What Is WebDriver BiDi? Bidirectional Browser Automation
Scrapeless Scraping Browser provides managed browser infrastructure for automation clients whose protocol and event requirements have been verified against the service.
TL;DR
- WebDriver BiDi is a bidirectional browser-automation protocol. It uses a WebSocket connection so clients can send asynchronous commands and browsers can emit subscribed events in real time.
- BiDi extends the WebDriver family. It retains session and capability concepts while adding modules, commands, events, subscriptions, browsing contexts, realms, and user contexts.
- BiDi addresses classic WebDriver’s event gap. Console entries, network activity, context changes, and other signals can flow from browser to client without continuous polling.
- BiDi is not simply a renamed CDP. It aims for cross-browser standardization, while CDP is a Chrome-specific protocol with a broader established Chrome debugging surface.
- Support is feature-by-feature. The specification remains a W3C Working Draft, and browser plus client implementations can cover different modules and commands at any given time.
WebDriver BiDi Adds a Live Event Channel to Browser Control
Classic WebDriver is built around discrete client requests and remote responses. That model handles navigation, input, elements, windows, cookies, screenshots, and scripts well, but the modern browser is event-driven. Network requests begin and finish, logs appear, browsing contexts open or close, dialogs show, downloads start, and scripts run independently of the next client command. WebDriver BiDi creates a persistent bidirectional connection so the client can subscribe to those changes and receive them as they occur.
W3C WebDriver BiDi specification defines WebDriver BiDi as a mechanism for remote control of user agents and explains that bidirectional communication better matches the evented nature of the browser DOM. The document is on the W3C Recommendation track but remains a Working Draft. Production designs should therefore treat the latest specification and current implementations as moving surfaces and verify every required module.
Commands, Results, Errors, and Events Share One WebSocket
A BiDi message identifies a method such as a module command and carries parameters. Commands have client-controlled identifiers so results or errors can be matched even when several operations run concurrently and finish out of order. Events carry a method name and data but are not responses to a specific command. The client subscribes to event names, optionally scoped to browsing or user contexts, and can unsubscribe when the signal is no longer needed.
MDN WebDriver BiDi reference describes BiDi as a WebSocket-based, event-driven variant of WebDriver and provides reference pages for modules, commands, and events. The persistent connection changes client architecture: message dispatch, subscription lifetime, ordering, buffering, and cleanup become explicit concerns. A client must not assume that event arrival order alone proves the application’s final business state.
- Module. A namespace groups related commands and events, such as session, browser, browsing context, network, script, log, storage, or input.
- Command. An asynchronous client request carries an identifier, method, and parameters and later receives a matched result or error.
- Event. A browser-originated notification reports subscribed activity without being tied to a new client request.
- Subscription. The client selects the event names and optional context scopes it wants the remote end to emit.
- Context and realm. Browsing contexts represent tabs or frames, while script realms represent execution environments within those contexts.
BiDi Can Start Through a WebDriver Session or a BiDi-Only Path
A client can request the WebSocket URL capability while creating a WebDriver session. A supporting remote end returns a connection URL and marks the session as BiDi-enabled. The specification also allows implementations to expose BiDi-only sessions through an out-of-band connection URL. Once connected, the client can manage subscriptions and issue module commands. The actual startup path depends on the browser, driver, client library, and remote service.
official Puppeteer WebDriver BiDi support guide explains how Puppeteer uses WebDriver BiDi for Chrome and Firefox and notes that unsupported features raise an explicit error. This is a practical example of progressive implementation: a client can expose a useful BiDi path while retaining CDP for Chrome features that BiDi does not yet cover in that stack. Architecture should permit capability checks or scoped fallbacks without presenting partial support as full protocol parity.
WebDriver Classic, WebDriver BiDi, and CDP Serve Different Goals
The protocols overlap, but their transport, event model, standardization scope, and implementation maturity differ.
| Protocol | Best understood as |
|---|---|
| WebDriver classic | A standards-based cross-browser HTTP command-and-response protocol for common browser automation operations. |
| WebDriver BiDi | A standards-track cross-browser WebSocket protocol for asynchronous commands, subscriptions, and browser events. |
| Chrome DevTools Protocol | A Chrome-specific inspection, debugging, profiling, and automation protocol with deep domain coverage. |
| Classic plus BiDi | A transitional and practical combination in which established commands coexist with event-driven BiDi features. |
| BiDi client library | A higher-level API that maps protocol modules and event streams into the project’s language and lifecycle model. |
| Remote browser service | An infrastructure layer whose advertised endpoint must be checked against the protocol modules the client needs. |
Where Bidirectional Events Change the Automation Design
BiDi is valuable when browser-originated activity is part of the result or synchronization model rather than incidental debugging data.
Console and log observation
A client can subscribe to log events and associate browser messages with the browsing context and automation step that produced them.
Network-aware automation
Network modules can expose request and response activity for observation, interception, authentication, or synchronization where implemented.
Context lifecycle tracking
Events can report tabs, windows, and frames as browsing contexts are created, navigated, or destroyed.
Script execution and realms
BiDi can evaluate or call functions in defined script realms and return values or remote references with clearer execution scope.
The Specification and Implementations Are Still Evolving
A W3C Working Draft can change, and implementations commonly land one module or command at a time. Browser support, driver support, client bindings, and remote services can move on different schedules. A public compatibility claim therefore needs a date and a feature list in internal engineering notes, even though an evergreen wiki should avoid brittle version tables. Test the exact subscription, command, parameter, and result shape that the application depends on.
MDN reference for WebDriver BiDi modules lists BiDi modules and their command and event namespaces. The list is useful for discovery but is not proof that every browser implements every entry. Consult implementation results, browser release information, and the client library’s support table, then run a conformance-focused smoke test in the production environment.
A WebDriver BiDi Adoption Checklist
Adopt BiDi by required capability rather than by protocol label. The test should prove transport, command, event, context, and cleanup behavior end to end.
- Name required modules. List the exact session, browser, browsingContext, network, script, log, storage, input, or other commands and events the workflow needs.
- Confirm the startup path. Verify whether the client requests webSocketUrl through a classic session, connects to a BiDi-only endpoint, or lets a framework manage the negotiation.
- Test subscriptions. Subscribe and unsubscribe to the intended events, scope them to relevant contexts, and confirm that unrelated sessions do not leak events into the handler.
- Handle concurrency. Match results to command identifiers, allow out-of-order completion, and define how message dispatch behaves when events arrive during long-running commands.
- Model context lifetime. Track tabs, frames, user contexts, and script realms explicitly so events and remote references are not applied after their context is destroyed.
- Bound event volume. Select only necessary event types, filter early, define buffering and backpressure, and avoid retaining payloads that contain unrelated personal or secret data.
- Preserve a supported path. Keep classic WebDriver or CDP adapters for load-bearing features missing from the selected browser and client, with tests that make the boundary visible.
- Revalidate upgrades. Run the protocol smoke test when the browser, driver, client library, remote service, or specification implementation changes.
WebDriver BiDi and Managed Browser Infrastructure
A managed browser service can host the remote end while a client application runs elsewhere, but the endpoint protocol and supported modules must be verified explicitly. Scrapeless Scraping Browser provides remote browser infrastructure for supported automation clients; it should not be described as a BiDi endpoint unless the current documentation and a live compatibility test confirm that path.
Use the service documentation to identify the supported client and connection model, then test every required event and command before adoption. Review the current Scrapeless Scraping Browser product overview, Scrapeless Scraping Browser getting-started documentation, and Scrapeless pricing before choosing an operating model.
Conclusion: BiDi Brings Browser Events Into a Standards Path
WebDriver BiDi adds a persistent, bidirectional, event-driven connection to the WebDriver family. Modules organize commands and events, subscriptions control what the browser emits, and asynchronous command identifiers allow several operations to be in flight. The model is a better match for console, network, context, and script activity than classic polling alone.
Adopt it carefully. The specification remains a Working Draft, support is feature-by-feature, and CDP or classic WebDriver may still carry required operations. A small compatibility suite should define the real contract between browser, driver, client, and remote service.
Ready to Test a Remote Automation Protocol?
Create a Scrapeless account and verify the supported client connection and event requirements on a bounded browser workflow before scaling it.
Start Free →FAQ
What does BiDi mean in WebDriver BiDi?
BiDi means bidirectional. The client can send asynchronous commands to the browser, and the browser can send subscribed events back over the same WebSocket connection. This differs from the primarily client-initiated HTTP command-response model of classic WebDriver.
Is WebDriver BiDi finished?
No. WebDriver BiDi remains a W3C Working Draft on the Recommendation track. Browsers and client libraries implement useful portions, but support varies by module, command, event, version, and connection path. Verify the exact feature set required by the workflow.
Does WebDriver BiDi replace classic WebDriver?
Not immediately. Classic WebDriver remains widely implemented for common browser operations, and clients can combine classic sessions with BiDi event features. Replacement depends on complete support for the commands and environments a project needs.
Is WebDriver BiDi the same as Chrome DevTools Protocol?
No. CDP is a Chrome-specific protocol for debugging, inspection, profiling, and automation. WebDriver BiDi is designed as a cross-browser standard. They overlap in network, script, log, and context capabilities but differ in scope, names, semantics, and maturity.
Which tools support WebDriver BiDi?
Support exists in modern browser-automation ecosystems, including Selenium and Puppeteer, but it is feature-specific. Consult the current browser and client documentation and run the required commands and subscriptions against the exact browser environment rather than relying on a general support badge.