← Glossary

What Is the Chrome DevTools Protocol (CDP)?

The Chrome DevTools Protocol is the message-based interface through which Chrome DevTools, Puppeteer and similar tools inspect and control a Chromium-based browser, organised into domains of commands and events exchanged over a debugging connection.

Updated:

The Chrome DevTools Protocol, usually shortened to CDP, is the interface that lets external software instrument, inspect and control a running Chromium-based browser. It is the same channel that the DevTools panel uses when a developer sets a breakpoint or records a performance trace, exposed so that other programs can do the same. A client connects to a debugging endpoint the browser opens, sends JSON commands such as navigate to this URL or evaluate this expression, and receives JSON responses and a stream of events describing what the browser is doing. Browser automation libraries, test runners, scrapers and profiling tools can use this channel, although other automation protocols also exist. Unlike a website's public API, which describes a service, CDP describes the inner workings of one specific browser engine, and it changes as that engine changes.

Targets, Sessions and Protocol Domains

A browser is not one thing to debug but many. Targets include pages, workers and certain separately managed frames. A target is not the same thing as a JavaScript execution context: a page can contain several contexts, and not every cross-origin iframe becomes a separate target. CDP exposes these through the Target domain: a client can list targets, attach to one and receive a session identifier that scopes subsequent messages. Several sessions can be active at once over a single connection, so a tool can watch a page and its workers simultaneously.

Within a session, functionality is grouped into protocol domains that mirror DevTools panels. The Page domain handles navigation and lifecycle events, Network observes requests and Fetch supports request interception, DOM reads and manipulates the document tree, Runtime evaluates JavaScript and inspects objects, Debugger sets breakpoints, Performance and Profiler collect measurements, and Emulation overrides characteristics such as viewport size, geolocation or the user agent string. Each domain is a namespace; a method is written as domain and name, such as Network.enable, and domains such as Network require an enable command before emitting their regular events. The published protocol viewer lists three versions: the tip-of-tree definition that tracks Chromium development, a stable 1.3 subset, and a V8-specific subset used by Node.js. The 1.3 version is a historical snapshot, not the complete API of a current browser. Tools should match the protocol to the browser build they support; tip-of-tree methods may be renamed or removed between releases.

Commands, Events and Typical Debugging Workflows

The protocol has two message directions. Commands flow from client to browser. Each carries an identifier, a method and optional parameters, and the browser replies with a result or an error bearing the same identifier, which lets a client match replies to requests even when many are in flight. Events flow from browser to client without being requested. Once Network is enabled, the browser emits an event when a request starts, when response headers arrive and when the body finishes loading. A client that wants to record all traffic subscribes to those events and never has to poll.

A typical automation flow illustrates the pattern. The client creates a target, attaches a session, enables Page and Network, sends a navigate command, waits for the load event, evaluates a script in the Runtime domain to read values from the page, and captures a screenshot. Puppeteer's documentation describes its low-level CDP session object in exactly these terms: protocol methods are called with a send function and protocol events are subscribed to with an event listener, while the library's higher-level page API hides the details for common cases. DevTools remote debugging follows the same mechanics in reverse: the DevTools front end is itself a protocol client, which is why a developer can open DevTools against a browser running on another machine or in a container.

CDP Compared With WebDriver, BiDi and Extensions

Several technologies overlap with CDP, and each occupies a different position.

TechnologyScopeBrowsersStability
Chrome DevTools ProtocolDeep engine instrumentation, events and commandsChromium-based browsersHistorical stable snapshot plus changing tip-of-tree
WebDriver classicCommand and response automation over HTTPCross-browser standardW3C Recommendation
WebDriver BiDiBidirectional commands and events over WebSocketDesigned as cross-browser standardW3C Working Draft
Browser extensionsBrowser and page APIs within the extension permission modelPer-browser extension platformsVersioned manifest APIs

WebDriver classic is the long-standing standard for driving browsers, but its request-and-response shape cannot stream events. WebDriver BiDi, a W3C draft, adds a bidirectional WebSocket channel and provides a cross-browser route for automation without replacing every DevTools instrumentation use; Selenium's documentation calls its own CDP support temporary and notes that CDP was not designed for testing or for a stable API. Mozilla has removed its experimental CDP implementation from Firefox in favour of BiDi, and Puppeteer can drive Firefox through BiDi while still using CDP for Chrome. Extensions are different again: an extension can modify pages and observe some network activity, but through sandboxed, permission-gated APIs rather than raw engine access.

Practical Uses Beyond Testing

Automated testing is one application, but the same protocol supports performance auditing tools that collect traces, accessibility checkers that walk the accessibility tree, crawlers that need a real rendering engine, and tools that export HAR files of network activity. Emulation methods let a single desktop browser pretend to have a phone-sized viewport, a slow connection or a particular time zone for layout and localisation checks, with the caveat that emulation changes what the page is told, not the underlying hardware or operating system.

Limits and Security Considerations

CDP is engine-specific. It is available in Chrome, Edge, Opera, Brave and other Chromium derivatives but not in Safari, and no longer in Firefox. Method coverage and behaviour vary by version, so tools often pin supported browser builds and test protocol compatibility when upgrading. Automation that relies on CDP can also leave observable traces in the page environment, which bot detection systems look for; the protocol was built for debugging, not for being indistinguishable from a person.

The debugging endpoint deserves care. An unrestricted browser debugging connection can expose sensitive pages, cookies and script execution capabilities. Its exact reach depends on the endpoint and target, but ordinary website permissions should not be treated as protection against a debugging client. Keep access limited to trusted processes or authenticated, controlled infrastructure. A private network address alone does not provide authentication. Separate user data directories avoid accidental profile sharing; operating-system, container and network access controls are still needed to stop one job connecting to another's endpoint. Chrome's changes to remote debugging switches in version 136 also reinforce the separation between development sessions and a user's everyday profile.

Frequently asked questions

Is CDP supported by every browser?

No. It is native to Chromium-based browsers such as Chrome, Edge, Opera and Brave. Safari does not implement it, and Mozilla removed Firefox's experimental CDP support in favour of WebDriver BiDi, which is the cross-browser direction for automation.

How do commands differ from events?

Commands are requests the client sends, each with an identifier, and the browser replies with a matching result or error. Events are notifications the browser pushes on its own, such as a network response arriving, once the relevant domain has been enabled.

Why should debugging endpoints be protected?

A browser-level debugging connection can expose sensitive pages, cookies and script execution capabilities. Restrict it to trusted clients and isolate test profiles. Binding to a private address alone does not authenticate clients or prevent other users of that network connecting.

What is a protocol domain?

A domain is a named group of related commands and events, such as Network, DOM, Runtime or Emulation. Methods are addressed by domain and name. Some domains require an enable command before their regular events are delivered.

Which CDP version should a tool rely on?

Match the protocol to the browser build being automated, and test compatibility when upgrading. The stable 1.3 definition is a historical snapshot, not a complete guide to modern Chrome. Tip-of-tree definitions track ongoing Chromium development and can change.