Simulating Network Throttling - Desktop Web and Mobile Web
Explore how to simulate various network conditions on desktop and mobile web using Puppeteer automation. Understand how to measure page load times under different throttling presets and emulate devices like iPhone X to optimize web performance across network speeds.
In the previous lesson we discussed network throttling and its importance. Now let’s learn to simulate it via automation.
Example 1 - simulate network throttling for educative.io on desktop web
In this example, we will simulate the educative.io website launch under different network conditions.
Let’s look at the below code and explanation.
Code output
Here, in the output, we can see the throughput, latency, and overall page load time for different network presets.
time taken to load url https://www.educative.io/ with network throttle conf 'Regular4G': '{"offline":false,"downloadThroughput":524288,"uploadThroughput":393216,"latency":20}'=> 5532 ms
time taken to load url https://www.educative.io/ with network throttle conf 'WiFi': '{"offline":false,"downloadThroughput":3932160,"uploadThroughput":1966080,"latency":2}'=> 6289 ms
time taken to load url https://www.educative.io/ with network throttle conf 'Good3G': '{"offline":false,"downloadThroughput":196608,"uploadThroughput":96000,"latency":40}'=> 7267 ms
time taken to load url https://www.educative.io/ with network throttle conf 'Regular3G': '{"offline":false,"downloadThroughput" ...