What is the Chrome DevTools Protocol (CDP) in web scraping?

The Chrome DevTools Protocol (CDP) is a set of APIs that exposes a running Chromium browser over a WebSocket connection, letting external tools open tabs, evaluate JavaScript, intercept network requests, and capture screenshots programmatically. Libraries like Playwright and Puppeteer use CDP under the hood to automate browsers for scraping. When you call page.goto() or page.screenshot(), those calls translate to CDP commands sent over a WebSocket to the browser process.

Factor Playwright / Puppeteer Direct CDP
Abstraction level High-level API Raw protocol commands
Setup Library install WebSocket client only
Use case Standard scraping automation Custom tooling, session attachment
Debugging Built-in error handling Full low-level visibility
Learning curve Low High

Use CDP directly when you need to attach your own tooling to a browser session that is already running, intercept and modify requests at the protocol level, or connect Playwright to a remote browser managed by a third-party service. For most scraping tasks, Playwright or a scraping API is faster to work with. Direct CDP access becomes relevant for custom session takeover, low-level traffic inspection, or hybrid setups where one service manages the browser and another controls it.

Firecrawl Browser Sandbox exposes a live WebSocket CDP endpoint for every session, so you can attach your own Playwright instance to a fully managed remote browser without installing or maintaining local Chromium infrastructure.