October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

How to Emulate Network Conditions in Puppeteer

A practical guide to Puppeteer network profiles, offline mode, version changes, limitations, and troubleshooting.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use Puppeteer’s page.emulateNetworkConditions() to test a page with a predefined or custom network profile, and use page.setOfflineMode(true) when you need to simulate a disconnected browser. Apply the setting before the navigation or interaction you want to test.

Emulate a slower connection with a preset

The current Puppeteer API exposes the PredefinedNetworkConditions collection. This example uses its Slow 3G profile before loading the page:

As an Amazon Associate I earn from qualifying purchases.

import puppeteer, {PredefinedNetworkConditions} from 'puppeteer';

const browser = await puppeteer.launch();
try {
  const page = await browser.newPage();
  await page.emulateNetworkConditions(
    PredefinedNetworkConditions['Slow 3G'],
  );
  await page.goto('https://example.com');

  // Interact with and inspect the page under the emulated conditions.
} finally {
  await browser.close();
}

The profile name is a preset label; it is not itself a promise of a particular measured speed. The Page.emulateNetworkConditions() API reference documents the method and supported arguments. Check the API reference for the Puppeteer version installed in your project, since API details can change.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use the setting before the event under test

Set the profile before page.goto() when testing initial page loading, as in the example. For a later interaction, set it before performing that interaction so the relevant request occurs under the intended conditions.

Choose between network throttling and offline mode

What you want to simulate Use What it controls
A constrained but connected network page.emulateNetworkConditions(profile) Emulated download, upload, and latency parameters.
A disconnected browser page.setOfflineMode(true) Offline state.

These are separate controls. Setting offline mode does not change download, upload, or latency parameters already set through network-condition emulation. The Page.setOfflineMode() reference describes this behavior.

await page.emulateNetworkConditions(
  PredefinedNetworkConditions['Slow 3G'],
);
await page.setOfflineMode(true); // Offline state; does not reset the profile's parameters.

Passing null to emulateNetworkConditions() disables network-condition emulation. It is not documented as a substitute for calling setOfflineMode(false); use the control that matches the state you intend to test.

Use a custom network profile

The method accepts a NetworkConditions value as well as a predefined profile. A custom profile is useful when a preset does not match your test, but the exact fields and units should come from the API/type reference for your installed Puppeteer release. Do not copy field names or numeric values from examples meant for a different version without verifying them.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
// Replace this with a NetworkConditions value matching your installed version's type reference.
await page.emulateNetworkConditions(customConditions);

The method reference links the relevant API; consult the matching version’s NetworkConditions definition before constructing customConditions.

Know what the emulation does not cover

Puppeteer documents that network-condition emulation does not affect WebSockets or WebRTC PeerConnections. If your application uses either transport, this method alone does not reproduce constrained-network behavior for that traffic. See the note in the official method reference.

The API is documented on Puppeteer’s Page class. Do not assume identical behavior across every browser or protocol combination; verify the support documented for your installed Puppeteer version and browser setup.

Version and browser setup

Puppeteer v22.0.0 removed the older networkConditions name in favor of PredefinedNetworkConditions, according to its changelog. If older snippets fail because that name is unavailable, check the release and API documentation matching your installed package.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For installation context, Puppeteer’s installation guide says installing puppeteer downloads a compatible Chrome for Testing build and chrome-headless-shell by default. puppeteer-core does not download Chrome and is intended for setups where you manage the browser or connect remotely.

Troubleshooting

  • PredefinedNetworkConditions is undefined or cannot be imported: check the installed Puppeteer version and its API reference. Older code may use a historical name removed in v22.0.0; update the code to match the installed release.
  • The page seems to load normally: confirm the emulation call completed before navigation or the request being tested, and confirm you are testing traffic covered by this API. WebSockets and WebRTC PeerConnections are not affected.
  • The page is offline but the saved network parameters remain: this is expected. Offline mode does not modify those parameters; treat connectivity state and network conditions as separate settings.
  • A custom profile is rejected or behaves unexpectedly: verify its shape and units against the NetworkConditions type for the exact installed release rather than guessing from a different version’s example.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If your goal is to capture a rendered page rather than exercise Puppeteer’s network emulation in a test, ScreenshotNeo is a website screenshot API and MCP server. This one-call cURL request saves a WebP screenshot; see the ScreenshotNeo API documentation for request options.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp
  • Cookie banners are accepted and removed before capture; known newsletter popups and chat widgets are removed too, and each step can be turned off.
  • Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed; response headers identify the page verdict and billing status.
  • An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents and MCP clients.
  • The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots.

Sign up for ScreenshotNeo free: 1,000 screenshots a month, no card required.

Frequently Asked Questions

Does page.emulateNetworkConditions(null) put the browser online?

The API reference says null disables network-condition emulation; it does not document that call as equivalent to page.setOfflineMode(false).

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Can Puppeteer network emulation throttle WebSockets?

No. Puppeteer documents that this emulation does not affect WebSockets or WebRTC PeerConnections.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.