Principle:Puppeteer Puppeteer Cross Browser Configuration
| Knowledge Sources | |
|---|---|
| Domains | Browser_Automation, Cross_Browser_Testing |
| Last Updated | 2026-02-11 23:00 GMT |
Overview
A configuration pattern that enables automation scripts to run across different browser engines (Chrome, Firefox) and communication protocols (CDP, WebDriver BiDi) through a unified launch interface.
Description
Cross Browser Configuration addresses the need to run the same automation code against different browsers. Puppeteer supports:
- Chrome with Chrome DevTools Protocol (CDP) - the original and most mature backend
- Chrome with WebDriver BiDi - the emerging standard protocol
- Firefox with WebDriver BiDi - cross-browser support via the standard protocol
The configuration is expressed through the LaunchOptions interface, which includes:
- browser: Which browser to launch ('chrome' or 'firefox')
- protocol: Which communication protocol to use ('cdp' or 'webDriverBiDi')
- Browser-specific options (extraPrefsFirefox for Firefox preferences)
Protocol selection rules:
- Chrome defaults to CDP
- Firefox defaults to WebDriver BiDi
- Firefox + CDP is not supported (throws error)
Usage
Use cross-browser configuration when you need to verify that automation scripts work across multiple browsers, or when targeting Firefox specifically. The WebDriver BiDi protocol is the W3C standard direction and provides cross-browser compatibility.
Theoretical Basis
# Browser-protocol dispatch matrix
CDP WebDriver BiDi
Chrome ✅ Default ✅ Supported
Firefox ❌ Error ✅ Default
# Launch dispatch
launch(options) →
browser = options.browser ?? 'chrome'
launcher = browser === 'chrome' ? ChromeLauncher : FirefoxLauncher
protocol = options.protocol ?? launcher.defaultProtocol
validate(browser, protocol) // Firefox + CDP → error
launcher.launch(options)