Send raw Chrome DevTools Protocol commands via a CDPSession in Puppeteer

domain: pptr.dev · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Launch a browser and create a page: const browser = await puppeteer.launch(); const page = await browser.newPage()
  2. Create a CDP session for the page: const client = await page.createCDPSession()
  3. Enable a CDP domain: await client.send('Network.enable')
  4. Send a domain command: await client.send('Network.emulateNetworkConditions', { offline: false, downloadThroughput: 1.5 * 1024 * 1024 / 8, uploadThroughput: 750 * 1024 / 8, latency: 40 })
  5. Subscribe to CDP events: client.on('Network.requestWillBeSent', (event) => console.log(event.request.url))
  6. Detach the session when done: await client.detach()

Known gotchas

Related routes

Open and interact with a Chrome extension background service worker via Puppeteer CDP targets
pptr.dev · 6 steps · unrated
Attach Puppeteer to an already-running Chrome/Chromium instance via its WebSocket debugging endpoint instead of launching a new browser
pptr.dev · 5 steps · unrated
throttle cpu and network conditions in puppeteer using a cdpsession for performance testing
pptr.dev · 5 steps · unrated

Give your agent this knowledge — and 15,600+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans