Implementation:Puppeteer Puppeteer Cdp PredefinedNetworkConditions
| Property | Value |
|---|---|
| sources | packages/puppeteer-core/src/cdp/PredefinedNetworkConditions.ts
|
| domains | CDP, Network Throttling, Emulation |
| last_updated | 2026-02-12 00:00 GMT |
Overview
Description
The PredefinedNetworkConditions module exports a frozen object containing pre-defined network throttling profiles for use with page.emulateNetworkConditions(). These profiles simulate various mobile network speeds and are aligned with Chrome DevTools' built-in throttling presets.
The available profiles are:
- Slow 3G -- ~500 Kbps download, ~500 Kbps upload, 2000ms latency (400ms RTT x 5 multiplier).
- Fast 3G -- ~1.6 Mbps download, ~750 Kbps upload, 562.5ms latency (150ms RTT x 3.75 multiplier).
- Slow 4G -- Alias for Fast 3G, aligned with Lighthouse and DevTools conventions.
- Fast 4G -- ~9 Mbps download, ~1.5 Mbps upload, 165ms latency (60ms RTT x 2.75 multiplier).
Each profile specifies download (bytes/sec), upload (bytes/sec), and latency (ms) values, computed with appropriate conversion factors and throughput multipliers (0.8 for Slow 3G, 0.9 for others) to simulate realistic conditions.
Usage
Users import PredefinedNetworkConditions directly from Puppeteer and pass a profile to page.emulateNetworkConditions() to simulate network speed during testing.
Code Reference
Source Location
packages/puppeteer-core/src/cdp/PredefinedNetworkConditions.ts (71 lines)
Signature
export const PredefinedNetworkConditions: Readonly<{
'Slow 3G': NetworkConditions;
'Fast 3G': NetworkConditions;
'Slow 4G': NetworkConditions;
'Fast 4G': NetworkConditions;
}>;
Import
import { PredefinedNetworkConditions } from 'puppeteer';
// or
import { PredefinedNetworkConditions } from '../cdp/PredefinedNetworkConditions.js';
I/O Contract
NetworkConditions shape
| Property | Type | Description |
|---|---|---|
| download | number |
Maximum download throughput in bytes per second |
| upload | number |
Maximum upload throughput in bytes per second |
| latency | number |
Additional latency in milliseconds |
Predefined values
| Profile | Download (bytes/s) | Upload (bytes/s) | Latency (ms) |
|---|---|---|---|
| Slow 3G | 50,000 | 50,000 | 2,000 |
| Fast 3G | 180,000 | 84,375 | 562.5 |
| Slow 4G | 180,000 | 84,375 | 562.5 |
| Fast 4G | 1,012,500 | 168,750 | 165 |
Usage Examples
import puppeteer from 'puppeteer';
import { PredefinedNetworkConditions } from 'puppeteer';
const browser = await puppeteer.launch();
const page = await browser.newPage();
// Emulate Slow 3G network
await page.emulateNetworkConditions(PredefinedNetworkConditions['Slow 3G']);
await page.goto('https://www.example.com');
// Switch to Fast 3G
await page.emulateNetworkConditions(PredefinedNetworkConditions['Fast 3G']);
await page.goto('https://www.example.com');
// Emulate Slow 4G (alias for Fast 3G)
await page.emulateNetworkConditions(PredefinedNetworkConditions['Slow 4G']);
await page.goto('https://www.example.com');
// Emulate Fast 4G
await page.emulateNetworkConditions(PredefinedNetworkConditions['Fast 4G']);
await page.goto('https://www.example.com');
// Disable network throttling
await page.emulateNetworkConditions(null);
await browser.close();