Skip to content

Commit

Permalink
feat!: default to WebDriver BiDi for Firefox (#12732)
Browse files Browse the repository at this point in the history
Co-authored-by: Nikolay Vitkov <34244704+Lightning00Blade@users.noreply.github.com>
Co-authored-by: Nikolay Vitkov <nvitkov@chromium.org>
  • Loading branch information
3 people committed Aug 1, 2024
1 parent 3aacc1c commit 6422dc2
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
8 changes: 7 additions & 1 deletion docs/api/puppeteer.browserconnectoptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,13 @@ Whether to ignore HTTPS errors during navigation.

</td><td>

'cdp'
Determined at run time:

- Launching Chrome - 'cdp'.

- Launching Firefox - 'webDriverBiDi'.

- Connecting to a browser - 'cdp'.

</td></tr>
<tr><td>
Expand Down
9 changes: 8 additions & 1 deletion packages/puppeteer-core/src/common/ConnectOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,14 @@ export interface BrowserConnectOptions {
_isPageTarget?: IsPageTargetCallback;

/**
* @defaultValue 'cdp'
* @defaultValue Determined at run time:
*
* - Launching Chrome - 'cdp'.
*
* - Launching Firefox - 'webDriverBiDi'.
*
* - Connecting to a browser - 'cdp'.
*
* @public
*/
protocol?: ProtocolType;
Expand Down
8 changes: 7 additions & 1 deletion packages/puppeteer-core/src/node/ProductLauncher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,15 @@ export abstract class ProductLauncher {
timeout = 30000,
waitForInitialPage = true,
protocolTimeout,
protocol,
} = options;

let {protocol} = options;

// Default to 'webDriverBiDi' for Firefox.
if (this.#product === 'firefox' && protocol === undefined) {
protocol = 'webDriverBiDi';
}

const launchArgs = await this.computeLaunchArguments(options);

if (!existsSync(launchArgs.executablePath)) {
Expand Down

0 comments on commit 6422dc2

Please sign in to comment.