-
-
Notifications
You must be signed in to change notification settings - Fork 66
WebDriver BiDi
WebDriver BiDi is a W3C standard for browser automation. This doc explains what it is, where it came from, and why it matters.
Browser automation started with Selenium in 2004. It injected JavaScript into pages to simulate user actions β clever, but limited by browser security.
WebDriver emerged as a cleaner approach: a separate process (the "driver") that controls the browser through a native API. Each browser vendor ships their own driver (chromedriver, geckodriver, etc.).
In 2018, WebDriver became a W3C standard. The protocol uses HTTP + JSON: send a POST request to click a button, get a JSON response. Simple, but strictly request-response: the client drives every interaction, and the browser can never push events unprompted.
Chrome DevTools Protocol (CDP) changed the game. It uses WebSockets instead of HTTP, enabling:
- Bidirectional communication β the browser can push events to the client
- Real-time updates β console logs, network requests, DOM changes as they happen
- Low-level control β things WebDriver couldn't do (network interception, coverage, etc.)
Puppeteer (2017) and Playwright (2020) were built on CDP. They're fast, powerful, and developer-friendly.
But CDP is Chrome-specific and internal. It changes without warning. Other browsers had to reverse-engineer or partially implement it. Not ideal for a standard.
The W3C asked: what if we combined the best of both worlds?
- Bidirectional like CDP (WebSockets + JSON)
- Standardized like WebDriver (W3C spec, browser vendor buy-in)
- Cross-browser by design (Chrome, Firefox, Safari, Edge)
That's WebDriver BiDi.
βββββββββββββββ βββββββββββββββ
β Client βββββWebSocketβββββββΊβ Browser β
β (Vibium) β (JSON msgs) β β
βββββββββββββββ βββββββββββββββ
Bidirectional communication over WebSocket. Messages are JSON:
{"id": 1, "method": "browsingContext.navigate", "params": {"url": "https://example.com"}}The browser responds:
{"id": 1, "result": {"navigation": "123", "url": "https://example.com"}}And the browser can push events without being asked:
{"method": "log.entryAdded", "params": {"level": "error", "text": "Uncaught TypeError..."}}WebDriver BiDi is shipping today:
| Browser | Status |
|---|---|
| Chrome/Chromium | Supported via chromedriver |
| Firefox | Native support (no separate driver) |
| Safari | In development |
| Edge | Supported (Chromium-based) |
Puppeteer added BiDi support in 2023. Selenium is integrating it. The ecosystem is converging.
Building on WebDriver BiDi means:
-
Standards-based. We're building on a W3C standard, not proprietary protocols controlled by large corporations. CDP is controlled by Google. Playwright is controlled by Microsoft. WebDriver BiDi is governed by the W3C with input from all major browser vendors.
-
Future-proof. As browsers improve their BiDi support
-
Cross-browser potential. Same API, multiple browsers (as support matures).
-
Real-time events. Console logs, network activity, DOM changes β pushed to agents as they happen.
The protocol handles the hard parts.
- WebDriver BiDi Spec β the official W3C specification
- Firefox Remote Protocols β Firefox's BiDi implementation
- Firefox Developer Experience β Mozilla's BiDi blog updates
- Puppeteer BiDi β Puppeteer's BiDi integration
- Selenium BiDi β Selenium's BiDi documentation