Skip to content
jshacks.dev
Debugging

Throttle the network to test slow connections

Test a page on a slow connection with Chrome DevTools network throttling, or script the same limit in Puppeteer with a predefined condition.

1 min read
Summarize in AI

A page that is quick on office Wi-Fi may be unusable on a phone. In the Network panel, open the throttling dropdown, which says No throttling, and choose Slow 4G, Fast 4G or Offline. Reload, and the waterfall shows how long each request takes. See the Network throttling docs.

To make a repeatable check, script it with Puppeteer:

slow.mjsJavaScript
import puppeteer, { PredefinedNetworkConditions } from "puppeteer";

const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.emulateNetworkConditions(PredefinedNetworkConditions["Slow 3G"]);
await page.goto("https://example.test/");
console.log("Loaded under Slow 3G:", await page.title());
await browser.close();
Text
Loaded under Slow 3G: Example Domain

PredefinedNetworkConditions ships with Puppeteer and holds the download speed, upload speed and latency of each profile, as listed in the Puppeteer API reference.

Throttling slows the network only. The CPU is separate: use the Performance panel's CPU throttling to mimic a slower device as well, and test with the cache disabled for a cold visit.

Also inTesting
Share

More snippets

Debugging

Group related logs with console.group

Indent related console output under a label with console.group and console.groupEnd, so interleaved logs from one request stay readable in Node.js 24.

1 min read
Debugging

Inspect an object with console.dir

Show nested objects beyond the default depth of two with console.dir and the depth option, instead of the [Object] placeholders console.log prints.

1 min read

Get new posts by email

We send one email when a new post is published. No spam.

Unsubscribe in one click. No spam, ever.