automation protocols and drivers · lesson 1 of 7 · sources checked 2026-11-20
three protocols
This lesson compares the message models of CDP, WebDriver classic, and WebDriver BiDi, and shows how to track the status of each protocol.
status of this lesson: from a public sourcepurpose
A tool that controls a browser speaks to it through one protocol. The protocol sets which messages can go in each direction, and which browsers the tool can control. A driver that uses the wrong protocol for a browser fails after an update, or it cannot get the events that the task must have.
objectives
- Describe the message model of CDP, WebDriver classic, and WebDriver BiDi.
- Name the status of each protocol and the date of that status.
- Select a protocol for a browser and a task.
- Explain why a page probe set must follow the changes of each protocol.
new terms
- driver
- Software that controls an unmodified browser through a protocol.
- CDP
- Chrome DevTools Protocol, a JSON message protocol that controls and examines a Chromium browser.
- WebDriver classic
- The W3C request-and-response protocol for browser automation.
- WebDriver BiDi
- The W3C bidirectional browser automation protocol with events.
- WebSocket
- A protocol that starts with an HTTP upgrade and then carries frames in two directions on one connection.
- protocol residue
- A trace in the page that an automation protocol leaves.
- probe set
- A set of page checks, each with a positive control and a negative control.
- browser build
- A browser binary that a tool ships or patches.
how it works
Three protocols control a browser. Each has a different message model:
| protocol | who writes it | message model |
|---|---|---|
| CDP | Google, for the DevTools of Chrome | Commands and events, grouped in domains |
| WebDriver classic | W3C | One HTTP request for each command, one HTTP response for each request |
| WebDriver BiDi | W3C | Commands and events in both directions, over one WebSocket connection |
cdp
claim of a company A Google article states that tools "automate Chromium-based browsers using the Chrome DevTools Protocol". It also states that the protocol "needs to change with DevTools requirements" Google, source 1.
The protocol definition files put the commands and the events of one area into one domain. For example, the file of the domain Emulation starts with "This domain emulates different environments for the page". It lists commands such as setCPUThrottlingRate, and events such as virtualTimeBudgetExpired Chrome DevTools, source 2.
Thus a CDP client sends a command and gets its result. The browser can also send an event with no request from the client.
webdriver classic
WebDriver classic is a W3C protocol of HTTP requests. Level 1 is a W3C Recommendation of 05 June 2018. It states that the remote ends "must provide an HTTP compliant wire protocol where the endpoints map to different commands". Each HTTP request is a single command, and each command produces a single HTTP response W3C, source 3.
The remote end is the side that runs the commands: the driver and its browser. The local end is the client. Thus the remote end speaks only when the client asks. For example, a client that waits for a page change must send a new request each time. Level 2 is a W3C Working Draft of 09 November 2026 W3C, source 4.
The standard also gives a page one direct trace of the protocol. The property navigator.webdriver gives "a standard way for co-operating user agents to inform the document that it is controlled by WebDriver" MDN, source 5.
MDN states that in Chrome, it is true with the --enable-automation flag, the --headless flag, or the --remote-debugging-port flag with port 0. In Firefox, it is true with the --marionette flag MDN, source 5.
webdriver bidi
WebDriver BiDi is a W3C Working Draft of 13 November 2026. The W3C document gives these rules W3C, source 6:
- The WebSocket protocol carries the messages.
- A command is "an asynchronous operation, requested by the local end and run on the remote end". It gives a result or an error.
- An event is "a notification, sent by the remote end to the local end".
Thus BiDi has events, as CDP has. It is also on the W3C track, as WebDriver classic is.
the status changes over time
Four makers state how their own tools use the protocols:
- claim of a company Selenium: "Starting with Selenium 4.29.0, CDP support for Firefox has been fully removed" Selenium project, source 7.
- claim of a company Google, for Puppeteer: "Puppeteer, from version 23, offers stable support for Firefox through WebDriver BiDi" Google, source 1.
- claim of a company Puppeteer: a Firefox launch has WebDriver BiDi on by default. A Chrome launch still uses CDP by default, "since not all CDP features are supported by WebDriver BiDi yet" Puppeteer project, source 8.
- claim of a company Playwright: it "doesn't work with the branded version of Firefox since it relies on patches". The same is true for Safari Microsoft, source 9.
Thus the protocol of one tool on one browser can change with one release. A protocol choice is correct only on the date of its check.
select and track a protocol
A selection starts from two questions: which browser, and which messages the task must have. For example, a task on Firefox that waits for page events gets BiDi. A task on Chromium that must have one command of a domain with no BiDi equal gets CDP.
A check of the status records the status line and its date for each document, at each read. It also records the default protocol of each tool on each browser. For example, one row can say: Puppeteer, Firefox, BiDi by default, read on the date of the check.
A site can see this choice too. Each protocol leaves its own protocol residue in the page. Thus a defender keeps a probe set for each protocol, and runs it again after each change of status.
read the messages of a driver
A protocol message log can show which messages a driver sent, and in which order. For example, a BiDi local end can record each event that it gets, with the time of the event. In my model, the log comes from the client side of the connection, because the client sees each message that it sends and gets.
Such a log is also the first check when a protocol changes. Two logs of one task, before and after an update, show the commands that changed.
the two sides
| automation side | detection side |
|---|---|
| BiDi is the W3C path for many browsers. CDP stays a Chromium protocol. Some automation libraries use their own patches for Firefox and WebKit. | Each protocol has its own known traces. A page probe set must follow the changes of each protocol over time. |
design decisions
| option | gain | cost | when it is correct |
|---|---|---|---|
| CDP | All commands and events of the Chromium domains | Chromium only. The protocol changes when DevTools changes. | A Chromium task that must have a domain command with no BiDi equal |
| WebDriver classic | A W3C Recommendation, with drivers for many browsers | No events. The client must ask again for each change. | A test of one request and one result at a time |
| WebDriver BiDi | Events in both directions, on a W3C track | A Working Draft. Some CDP features have no BiDi equal yet. | A task on Firefox, or a task on many browsers that must have events |
| The own browser build of an automation library | One API for Chromium, Firefox, and WebKit | It does not work with the branded browser. | A task where the branded browser is not necessary |
diagram
message flow of cdp, webdriver classic, and webdriver bidi, side by side
failure modes
| problem | cause | correction |
|---|---|---|
| A Firefox script stops after an update of Selenium. | Selenium 4.29.0 removed CDP for Firefox. | Move the script to WebDriver BiDi. |
| A WebDriver classic client misses a short page change. | The remote end sends nothing with no request. | Use a protocol with events, or ask again at a fixed interval. |
| An automation library does not start the branded Firefox. | The library relies on its own patches. | Use the browser build of the library in your own lab, or a BiDi driver. |
| A Puppeteer script works on Chrome, and one command fails on Firefox. | Firefox uses BiDi by default, and not all CDP features have a BiDi equal. | Find each command of the script in the BiDi document. Record the protocol of each browser. |
| A probe set misses a new trace after a browser update. | The status or the default protocol of a tool changed. | Record the status and its date at each read. Run the probe set again with its controls. |
check questions
Describe the message model of CDP, WebDriver classic, and WebDriver BiDi.
sample answer
CDP groups commands and events in domains. The client sends a command and gets its result, and the browser can send an event with no request. WebDriver classic uses one HTTP request for each command and one HTTP response for each request. Thus the remote end speaks only when the client asks. WebDriver BiDi sends commands and events in both directions over one WebSocket connection.
Name the W3C status of WebDriver Level 1, WebDriver Level 2, and WebDriver BiDi, with the date of each status.
sample answer
WebDriver Level 1 is a W3C Recommendation of 05 June 2018. WebDriver Level 2 is a W3C Working Draft of 09 November 2026. WebDriver BiDi is a W3C Working Draft of 13 November 2026. Each status is correct only on the date of the read.
A test on Firefox must get each event of the page. Selenium is at a version after 4.29.0. Which protocol do you select?
- CDP
- WebDriver BiDi
- WebDriver classic
answer
b. WebDriver BiDi
Selenium removed CDP for Firefox in 4.29.0. WebDriver classic has no events. WebDriver BiDi has events and works with Firefox.
A Chromium task must have a domain command that WebDriver BiDi does not have yet. Which protocol do you select?
- CDP
- WebDriver classic
- WebDriver BiDi
answer
a. CDP
Not all CDP features have a BiDi equal yet. CDP gives all commands of the Chromium domains.
Explain why a page probe set must follow the changes of each protocol over time.
sample answer
Each protocol leaves its own traces in the page. The default protocol of a tool on one browser can change with one release, and the status of each document changes too. Thus a probe set that was correct before an update can miss a new trace. A defender runs the probe set again with its controls after each change of status.
exercise
exercise Do this task on paper, with the synthetic tasks below. Do not send a request to a site.
- Read task A: a test on Firefox that must get each console message of the page.
- Read task B: a test on Chromium that must have a domain command with no BiDi equal.
- Read task C: a test on many browsers that sends one command and reads one result at a time.
- Write the protocol that you select for each task.
- Write one reason for each selection.
- Write the date of the status check that each selection depends on.
sample answer
This sample answer uses the three synthetic tasks.
Task A gets WebDriver BiDi, because the task must have events on Firefox. Task B gets CDP, because the command exists only in a Chromium domain. Task C gets WebDriver classic, because one request and one response for each command is sufficient. Each selection depends on the status line and the date of the documents at your read. A new release of a tool or a new draft can change the selection.
sources
- Firefox support in Puppeteer with WebDriver BiDi, Google, article, read 2026-11-20
- Emulation domain definition, Chrome DevTools, source code, read 2026-11-20
- WebDriver, W3C, standard, read 2026-11-20
- WebDriver Level 2, W3C, draft, read 2026-11-20
- Navigator: webdriver property, MDN, documentation, read 2026-11-20
- WebDriver BiDi, W3C, draft, read 2026-11-20
- Removing CDP support for Firefox, Selenium project, article, read 2026-11-20
- Puppeteer and WebDriver BiDi, Puppeteer project, documentation, read 2026-11-20
- Browsers, Microsoft, documentation, read 2026-11-20
- My model of the selection of a protocol for a browser and a task, 2026-11 (not public).