Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(webdriver): support Network interception #12279

Merged
merged 1 commit into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
38 changes: 20 additions & 18 deletions docs/webdriver-bidi.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ Firefox integration is nearing feature parity with its previous CDP-based approa

To gauge the capabilities of WebDriver BiDi, we utilized the comprehensive [Puppeteer test suite](https://puppeteer.github.io/ispuppeteerwebdriverbidiready/)

- For Firefox, there are currently under [60](https://puppeteer.github.io/ispuppeteerwebdriverbidiready/firefox-delta.json) failing tests compared to the CDP implementation, while over [82](https://puppeteer.github.io/ispuppeteerwebdriverbidiready/firefox-delta.json) new tests successfully utilize WebDriver BiDi, demonstrating its growing potential.
- For Chrome, around 68% of tests pass with WebDriver BiDi, indicating room for improvement compared to the CDP-based approach.
- For Firefox, there are currently under [30](https://puppeteer.github.io/ispuppeteerwebdriverbidiready/firefox-delta.json) failing tests compared to the CDP implementation, while over [140](https://puppeteer.github.io/ispuppeteerwebdriverbidiready/firefox-delta.json) new tests successfully utilize WebDriver BiDi, demonstrating its growing potential.
- For Chrome, around 85% of tests pass with WebDriver BiDi, indicating room for improvement compared to the CDP-based approach.

## Get started

Expand All @@ -41,17 +41,28 @@ This is an exciting step towards a more unified and efficient cross-browser auto

## Puppeteer features supported over WebDriver BiDi

- Browser and page automation
- Browser automation

- Puppeteer.launch
- Browser.close
- Frame.goto() (except `referer` and `referrerPolicy`)
- Browser.userAgent()

- Page automation

- Page.bringToFront
- Page.goBack()
- Page.goForward()
- Page.goto (except `referer` and `referrerPolicy`)
- Frame.goto() (except `referer` and `referrerPolicy`)
- Page.reload (except for `ignoreCache` parameter)
- Page.setViewport (`width`, `height`, `deviceScaleFactor` only)
- Puppeteer.launch
- Page.cookies()
- Page.setCookie()
- Page.deleteCookie()
- Page.workers()
- PageEvent.WorkerCreated
- PageEvent.WorkerDestroyed
- Page.setExtraHTTPHeaders()

- [Script evaluation](https://pptr.dev/guides/evaluate-javascript):

Expand Down Expand Up @@ -100,13 +111,9 @@ This is an exciting step towards a more unified and efficient cross-browser auto
- BrowserContext.clearPermissionOverrides()
- BrowserContext.overridePermissions()

## Puppeteer features not yet supported over WebDriver BiDi

- [Request interception](https://pptr.dev/guides/request-interception)

- HTTPRequest.abort()
- HTTPRequest.abort() (no custom error support)
- HTTPRequest.abortErrorReason()
- HTTPRequest.client()
- HTTPRequest.continue()
- HTTPRequest.continueRequestOverrides()
- HTTPRequest.failure()
Expand All @@ -117,6 +124,8 @@ This is an exciting step towards a more unified and efficient cross-browser auto
- HTTPRequest.responseForRequest()
- Page.setRequestInterception()

## Puppeteer features not yet supported over WebDriver BiDi

- Various emulations (most are supported with Chrome)

- Page.emulate() (supported only in Chrome)
Expand All @@ -134,14 +143,14 @@ This is an exciting step towards a more unified and efficient cross-browser auto
- CDP-specific features

- Page.createCDPSession() (supported only in Chrome)
- HTTPRequest.client() (supported only in Chrome)

- Tracing (supported only in Chrome)
- Coverage (supported only in Chrome)
- Accessibility (supported only in Chrome)

- Other methods:

- Browser.userAgent()
- Frame.isOOPFrame()
- Frame.waitForDevicePrompt()
- HTTPResponse.buffer()
Expand All @@ -152,8 +161,6 @@ This is an exciting step towards a more unified and efficient cross-browser auto
- Input.dragOver()
- Input.drop()
- Page.authenticate()
- Page.cookies()
- Page.deleteCookie()
- Page.emulateNetworkConditions()
- Page.isDragInterceptionEnabled()
- Page.isJavaScriptEnabled() (supported only in Chrome)
Expand All @@ -162,15 +169,10 @@ This is an exciting step towards a more unified and efficient cross-browser auto
- Page.queryObjects() (supported only in Chrome)
- Page.screencast() (supported only in Chrome)
- Page.setBypassServiceWorker()
- Page.setCookie()
- Page.setDragInterception()
- Page.setExtraHTTPHeaders()
- Page.setOfflineMode()
- Page.setUserAgent()
- Page.waitForDevicePrompt()
- Page.waitForFileChooser()
- Page.workers()
- PageEvent.popup
- PageEvent.WorkerCreated
- PageEvent.WorkerDestroyed
- Target.opener()
2 changes: 2 additions & 0 deletions packages/puppeteer-core/src/bidi/Page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ import {rewriteNavigationError} from './util.js';
import type {BidiWebWorker} from './WebWorker.js';

/**
* Implements Page using WebDriver BiDi.
OrKoN marked this conversation as resolved.
Show resolved Hide resolved
*
* @internal
*/
export class BidiPage extends Page {
Expand Down
20 changes: 6 additions & 14 deletions test/TestExpectations.json
Original file line number Diff line number Diff line change
Expand Up @@ -2733,6 +2733,12 @@
"expectations": ["TIMEOUT"],
"comment": "When navigating to page with authentication the command response (error) never comes without interception"
},
{
"testIdPattern": "[network.spec] network Page.setExtraHTTPHeaders should throw for non-string header values",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["firefox", "webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[network.spec] network Page.setExtraHTTPHeaders should work",
"platforms": ["darwin", "linux", "win32"],
Expand Down Expand Up @@ -3980,20 +3986,6 @@
"expectations": ["SKIP"],
"comment": "TODO: add a comment explaining why this expectation is required (include links to issues)"
},
{
"testIdPattern": "[waittask.spec] waittask specs Frame.waitForSelector should survive cross-process navigation",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["chrome", "webDriverBiDi"],
"expectations": ["SKIP"],
"comment": "TODO: add a comment explaining why this expectation is required (include links to issues)"
},
{
"testIdPattern": "[waittask.spec] waittask specs Frame.waitForSelector should survive cross-process navigation",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["firefox", "webDriverBiDi"],
"expectations": ["SKIP"],
"comment": "TODO: add a comment explaining why this expectation is required (include links to issues)"
},
{
"testIdPattern": "[waittask.spec] waittask specs Frame.waitForSelector should survive cross-process navigation",
"platforms": ["darwin", "linux", "win32"],
Expand Down