Drive headless Chrome directly via the Chrome DevTools Protocol (CDP) without a high-level browser automation library

domain: chromedevtools.github.io · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Launch Chrome with remote debugging enabled: `google-chrome --headless --remote-debugging-port=9222 --disable-gpu`. The browser exposes a WebSocket endpoint at `http://localhost:9222/json`.
  2. Fetch the list of available targets from `http://localhost:9222/json/list` to get the WebSocket debugger URL for a specific tab, then open a WebSocket connection to that URL.
  3. Send CDP commands as JSON objects with the shape `{ id: <number>, method: 'Domain.method', params: { ... } }` and read responses that match by `id`.
  4. Enable necessary domains before using them — for example send `{ method: 'Page.enable' }` before listening for `Page.loadEventFired`, and `{ method: 'Network.enable' }` before intercepting network events.
  5. Use the `Runtime.evaluate` command to run JavaScript in the page context and retrieve the result, and `Page.captureScreenshot` to take a screenshot without any library abstraction.

Known gotchas

Related routes

Generate a PDF of a URL using only the headless Chrome/Chromium command-line binary, with no automation library
developer.chrome.com · 5 steps · unrated
enable and configure headless chrome downloads in puppeteer using cdp page.setdownloadbehavior
pptr.dev · 5 steps · unrated
Collect runtime performance metrics from headless Chrome using raw CDP Performance and Tracing domains
chromedevtools.github.io · 5 steps · unrated

Give your agent this knowledge — and 15,500+ 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