diff --git a/docs/api/index.md b/docs/api/index.md index 31d987e869b..a306b990cae 100644 --- a/docs/api/index.md +++ b/docs/api/index.md @@ -198,6 +198,7 @@ sidebar_label: API | [Predicate](./puppeteer.predicate.md) | | | [Product](./puppeteer.product.md) | Supported products. | | [ProtocolLifeCycleEvent](./puppeteer.protocollifecycleevent.md) | | +| [ProtocolType](./puppeteer.protocoltype.md) | | | [PuppeteerLifeCycleEvent](./puppeteer.puppeteerlifecycleevent.md) | | | [PuppeteerNodeLaunchOptions](./puppeteer.puppeteernodelaunchoptions.md) | Utility type exposed to enable users to define options that can be passed to puppeteer.launch without having to list the set of all types. | | [Quad](./puppeteer.quad.md) | | diff --git a/docs/api/puppeteer.browserconnectoptions.md b/docs/api/puppeteer.browserconnectoptions.md index c4a4bcb4536..1b80d4471a0 100644 --- a/docs/api/puppeteer.browserconnectoptions.md +++ b/docs/api/puppeteer.browserconnectoptions.md @@ -18,6 +18,7 @@ export interface BrowserConnectOptions | ----------------- | --------------------- | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------- | --------------------------- | | defaultViewport | optional | [Viewport](./puppeteer.viewport.md) \| null | Sets the viewport for each page. | '{width: 800, height: 600}' | | ignoreHTTPSErrors | optional | boolean | Whether to ignore HTTPS errors during navigation. | false | +| protocol | optional | [ProtocolType](./puppeteer.protocoltype.md) | | 'cdp' | | protocolTimeout | optional | number | Timeout setting for individual protocol (CDP) calls. | 180_000 | | slowMo | optional | number | Slows down Puppeteer operations by the specified amount of milliseconds to aid debugging. | | | targetFilter | optional | [TargetFilterCallback](./puppeteer.targetfiltercallback.md) | Callback to decide if Puppeteer should connect to a given target or not. | | diff --git a/docs/api/puppeteer.page.emulate.md b/docs/api/puppeteer.page.emulate.md index 436e9106c58..bba9c9b927d 100644 --- a/docs/api/puppeteer.page.emulate.md +++ b/docs/api/puppeteer.page.emulate.md @@ -28,6 +28,8 @@ Promise<void> ## Remarks +This method is a shortcut for calling two methods: [Page.setUserAgent()](./puppeteer.page.setuseragent.md) and [Page.setViewport()](./puppeteer.page.setviewport.md). + This method will resize the page. A lot of websites don't expect phones to change size, so you should emulate before navigating to the page. ## Example diff --git a/docs/api/puppeteer.page.type.md b/docs/api/puppeteer.page.type.md index bf6e563bd6d..27ec0b14fd7 100644 --- a/docs/api/puppeteer.page.type.md +++ b/docs/api/puppeteer.page.type.md @@ -32,8 +32,6 @@ class Page { Promise<void> -## Remarks - ## Example ```ts diff --git a/docs/api/puppeteer.protocoltype.md b/docs/api/puppeteer.protocoltype.md new file mode 100644 index 00000000000..4c88786b724 --- /dev/null +++ b/docs/api/puppeteer.protocoltype.md @@ -0,0 +1,11 @@ +--- +sidebar_label: ProtocolType +--- + +# ProtocolType type + +#### Signature: + +```typescript +export type ProtocolType = 'cdp' | 'webDriverBiDi'; +``` diff --git a/docs/faq.md b/docs/faq.md index d4d48ac7896..d68f59621ec 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -27,6 +27,16 @@ support to browsers such as Safari. This effort includes exploration of a standard for executing cross-browser commands (instead of relying on the non-standard DevTools Protocol used by Chrome). +Update 2023-11-17: Puppeteer has experimental support for the new +[WebDriverBiDi](https://w3c.github.io/webdriver-bidi/) protocol that can be used +to automate Firefox. The WebDriver BiDi implementation in Firefox will replace +the current CDP implementation in Firefox in the future. See +https://pptr.dev/webdriver-bidi for more details. + +## Q: Does Puppeteer support WebDriver BiDi? + +Puppeteer has experimental support for WebDriver BiDi. See https://pptr.dev/webdriver-bidi. + ## Q: What are Puppeteer’s goals and principles? The goals of the project are: diff --git a/docs/webdriver-bidi.md b/docs/webdriver-bidi.md new file mode 100644 index 00000000000..533fea46670 --- /dev/null +++ b/docs/webdriver-bidi.md @@ -0,0 +1,189 @@ +# Experimental WebDriver BiDi Support + +[WebDriver BiDi](https://w3c.github.io/webdriver-bidi/) is a new cross-browser +automation protocol that adds browser-driven events to WebDriver. Here are the +resources if you want to learn more about WebDriver BiDi: + +- [WebDriver BiDi - The future of cross-browser automation](https://developer.chrome.com/articles/webdriver-bidi/) +- [WebDriver BiDi: 2023 status update](https://developer.chrome.com/blog/webdriver-bidi-2023/) + +## Automate with Chrome and Firefox + +Firefox support has almost reaching feature parity with the previous CDP-based +implementation. To see which features are fully supported with WebDriver BiDi we +used the [Puppeteer test suite](https://puppeteer.github.io/ispuppeteerwebdriverbidiready/). Currently, +we still have fewer than +[60](https://puppeteer.github.io/ispuppeteerwebdriverbidiready/firefox-delta.json) +tests that are failing with Firefox and WebDriver BiDi compared to the previous +CDP implementation in Firefox but we also have more than +[82](https://puppeteer.github.io/ispuppeteerwebdriverbidiready/firefox-delta.json) +new tests that work with WebDriver BiDi and that didn't work with CDP. + +For Chrome, around 68% of the tests are currently passing with WebDriver BiDi so +the CDP-based implementation remains more powerful. Some of the Puppeteer +functionality is relying on CDP even with WebDriver BiDi enabled. Therefore, the +test pass rate is currently higher than that one of Firefox. + +Example of launching Firefox with WebDriver BiDi: + +```ts +import puppeteer from 'puppeteer'; + +const browser = await puppeteer.launch({ + product: 'firefox', + protocol: 'webDriverBiDi', +}); +const page = await browser.newPage(); +... +await browser.close(); +``` + +Example of launching Chrome with WebDriver BiDi: + +```ts +import puppeteer from 'puppeteer'; + +const browser = await puppeteer.launch({ + product: 'chrome', + protocol: 'webDriverBiDi', +}); +const page = await browser.newPage(); +... +await browser.close(); +``` + +## Puppeteer features supported over WebDriver BiDi + +- Browser and page automation + + - Browser.close + - Frame.goto() (except `referer` and `referrerPolicy`) + - Page.bringToFront + - Page.goto (except `referer` and `referrerPolicy`) + - Page.reload (except for `ignoreCache` parameter) + - Page.setViewport (`width`, `height`, `deviceScaleFactor` only) + - Puppeteer.launch + +- [Script evaluation](https://pptr.dev/guides/evaluate-javascript): + + - JSHandle.evaluate + - JSHandle.evaluateHandle + - Page.evaluate + - Page.exposeFunction + +- [Selectors](https://pptr.dev/guides/query-selectors) and [locators](https://pptr.dev/guides/locators) except for ARIA: + + - Page.$ (ARIA selectors supported in Chrome) + - Page.$$ (ARIA selectors supported in Chrome) + - Page.$$eval (ARIA selectors supported in Chrome) + - Page.$eval (ARIA selectors supported in Chrome) + - Page.waitForSelector (ARIA selectors supported in Chrome) + +- Input + + - ElementHandle.click + - Keyboard.down + - Keyboard.press + - Keyboard.sendCharacter + - Keyboard.type + - Keyboard.up + - Mouse events (except for dedicated drag'n'drop API methods) + - Page.tap + - TouchScreen.\* + +- JavaScript dialog interception + + - page.on('dialog') + - Dialog.\* + +- Screenshots (not all parameters are supported) + + - Page.screenshot (supported parameters `clip`, `encoding`, `fullPage`) + +- PDF generation (not all parameters are supported) + + - Page.pdf (only `format`, `height`, `landscape`, `margin`, `pageRanges`, `printBackground`, `scale`, `width` are supported) + - Page.createPDFStream (only `format`, `height`, `landscape`, `margin`, `pageRanges`, `printBackground`, `scale`, `width` are supported) + +## Puppeteer features not yet supported over WebDriver BiDi + +- [Request interception](https://pptr.dev/guides/request-interception) + + - HTTPRequest.abort() + - HTTPRequest.abortErrorReason() + - HTTPRequest.client() + - HTTPRequest.continue() + - HTTPRequest.continueRequestOverrides() + - HTTPRequest.failure() + - HTTPRequest.finalizeInterceptions() + - HTTPRequest.interceptResolutionState() + - HTTPRequest.isInterceptResolutionHandled() + - HTTPRequest.respond() + - HTTPRequest.responseForRequest() + - Page.setRequestInterception() + +- Permissions + + - BrowserContext.clearPermissionOverrides() + - BrowserContext.overridePermissions() + +- Various emulations (most are supported with Chrome) + + - Page.emulate() (supported only in Chrome) + - Page.emulateCPUThrottling() (supported only in Chrome) + - Page.emulateIdleState() (supported only in Chrome) + - Page.emulateMediaFeatures() (supported only in Chrome) + - Page.emulateMediaType() (supported only in Chrome) + - Page.emulateTimezone() (supported only in Chrome) + - Page.emulateVisionDeficiency() (supported only in Chrome) + - Page.setBypassCSP() (supported only in Chrome) + - Page.setCacheEnabled() (supported only in Chrome) + - Page.setGeolocation() (supported only in Chrome) + - Page.setJavaScriptEnabled() (supported only in Chrome) + +- CDP-specific features + + - Page.createCDPSession() (supported only in Chrome) + +- Tracing (supported only in Chrome) +- Coverage (supported only in Chrome) +- Accessibility (supported only in Chrome) + +- Other methods: + + - Browser.userAgent() + - ElementHandle.uploadFile() + - Frame.isOOPFrame() + - Frame.waitForDevicePrompt() + - HTTPResponse.buffer() + - HTTPResponse.fromServiceWorker() + - HTTPResponse.securityDetails() + - Input.drag() + - Input.dragAndDrop() + - Input.dragOver() + - Input.drop() + - Page.authenticate() + - Page.cookies() + - Page.deleteCookie() + - Page.emulateNetworkConditions() + - Page.goBack() + - Page.goForward() + - Page.isDragInterceptionEnabled() + - Page.isJavaScriptEnabled() (supported only in Chrome) + - Page.isServiceWorkerBypassed() + - Page.metrics() + - 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() diff --git a/packages/puppeteer-core/src/api/Browser.ts b/packages/puppeteer-core/src/api/Browser.ts index 39ce0e54d59..ddc3aba8722 100644 --- a/packages/puppeteer-core/src/api/Browser.ts +++ b/packages/puppeteer-core/src/api/Browser.ts @@ -401,10 +401,6 @@ export abstract class Browser extends EventEmitter { * {@link Page | Pages} can override the user agent with * {@link Page.setUserAgent}. * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported */ abstract userAgent(): Promise; diff --git a/packages/puppeteer-core/src/api/BrowserContext.ts b/packages/puppeteer-core/src/api/BrowserContext.ts index eab98a4a700..02be7be7802 100644 --- a/packages/puppeteer-core/src/api/BrowserContext.ts +++ b/packages/puppeteer-core/src/api/BrowserContext.ts @@ -164,11 +164,6 @@ export abstract class BrowserContext extends EventEmitter * "https://example.com". * @param permissions - An array of permissions to grant. All permissions that * are not listed here will be automatically denied. - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported */ abstract overridePermissions( origin: string, @@ -188,11 +183,6 @@ export abstract class BrowserContext extends EventEmitter * // do stuff .. * context.clearPermissionOverrides(); * ``` - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported */ abstract clearPermissionOverrides(): Promise; diff --git a/packages/puppeteer-core/src/api/ElementHandle.ts b/packages/puppeteer-core/src/api/ElementHandle.ts index c2d7afe40c1..12aca3e67ae 100644 --- a/packages/puppeteer-core/src/api/ElementHandle.ts +++ b/packages/puppeteer-core/src/api/ElementHandle.ts @@ -962,11 +962,6 @@ export abstract class ElementHandle< * {@link https://nodejs.org/api/process.html#process_process_cwd | current working directory}. * For locals script connecting to remote chrome environments, paths must be * absolute. - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported */ abstract uploadFile( this: ElementHandle, diff --git a/packages/puppeteer-core/src/api/Frame.ts b/packages/puppeteer-core/src/api/Frame.ts index 2420f066bc3..394d1915d00 100644 --- a/packages/puppeteer-core/src/api/Frame.ts +++ b/packages/puppeteer-core/src/api/Frame.ts @@ -311,11 +311,6 @@ export abstract class Frame extends EventEmitter { /** * Is `true` if the frame is an out-of-process (OOP) frame. Otherwise, * `false`. - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported */ abstract isOOPFrame(): boolean; @@ -352,14 +347,6 @@ export abstract class Frame extends EventEmitter { * returned by the remote server, including 404 "Not Found" and 500 "Internal * Server Error". The status code for such responses can be retrieved by * calling {@link HTTPResponse.status}. - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Partial support - * - * - `referer` not supported - * - `referrerPolicy` not supported */ abstract goto( url: string, @@ -1209,11 +1196,6 @@ export abstract class Frame extends EventEmitter { * ); * ``` * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported - * * @internal */ abstract waitForDevicePrompt( diff --git a/packages/puppeteer-core/src/api/HTTPRequest.ts b/packages/puppeteer-core/src/api/HTTPRequest.ts index 2ab50ccd9c0..fc6a3591489 100644 --- a/packages/puppeteer-core/src/api/HTTPRequest.ts +++ b/packages/puppeteer-core/src/api/HTTPRequest.ts @@ -130,11 +130,6 @@ export abstract class HTTPRequest { * Warning! Using this client can break Puppeteer. Use with caution. * * @experimental - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported */ abstract get client(): CDPSession; @@ -152,32 +147,17 @@ export abstract class HTTPRequest { * The `ContinueRequestOverrides` that will be used * if the interception is allowed to continue (ie, `abort()` and * `respond()` aren't called). - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported */ abstract continueRequestOverrides(): ContinueRequestOverrides; /** * The `ResponseForRequest` that gets used if the * interception is allowed to respond (ie, `abort()` is not called). - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported */ abstract responseForRequest(): Partial | null; /** * The most recent reason for aborting the request - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported */ abstract abortErrorReason(): Protocol.Network.ErrorReason | null; @@ -191,22 +171,12 @@ export abstract class HTTPRequest { * * InterceptResolutionAction is one of: `abort`, `respond`, `continue`, * `disabled`, `none`, or `already-handled`. - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported */ abstract interceptResolutionState(): InterceptResolutionState; /** * Is `true` if the intercept resolution has already been handled, * `false` otherwise. - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported */ abstract isInterceptResolutionHandled(): boolean; @@ -223,11 +193,6 @@ export abstract class HTTPRequest { /** * Awaits pending interception handlers and then decides how to fulfill * the request interception. - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported */ abstract finalizeInterceptions(): Promise; @@ -323,24 +288,12 @@ export abstract class HTTPRequest { * return an object with `errorText` containing a human-readable error * message, e.g. `net::ERR_FAILED`. It is not guaranteed that there will be * failure text if the request fails. - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported */ abstract failure(): {errorText: string} | null; /** * Continues request with optional request overrides. * - * @remarks - * - * To use this, request - * interception should be enabled with {@link Page.setRequestInterception}. - * - * Exception is immediately thrown if the request interception is not enabled. - * * @example * * ```ts @@ -356,14 +309,15 @@ export abstract class HTTPRequest { * ``` * * @param overrides - optional overrides to apply to the request. - * @param priority - If provided, intercept is resolved using - * cooperative handling rules. Otherwise, intercept is resolved - * immediately. + * @param priority - If provided, intercept is resolved using cooperative + * handling rules. Otherwise, intercept is resolved immediately. * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported + * @remarks * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported + * To use this, request interception should be enabled with + * {@link Page.setRequestInterception}. + * + * Exception is immediately thrown if the request interception is not enabled. */ abstract continue( overrides?: ContinueRequestOverrides, @@ -373,13 +327,6 @@ export abstract class HTTPRequest { /** * Fulfills a request with the given response. * - * @remarks - * - * To use this, request - * interception should be enabled with {@link Page.setRequestInterception}. - * - * Exception is immediately thrown if the request interception is not enabled. - * * @example * An example of fulfilling all requests with 404 responses: * @@ -402,10 +349,12 @@ export abstract class HTTPRequest { * cooperative handling rules. Otherwise, intercept is resolved * immediately. * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported + * @remarks * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported + * To use this, request + * interception should be enabled with {@link Page.setRequestInterception}. + * + * Exception is immediately thrown if the request interception is not enabled. */ abstract respond( response: Partial, @@ -415,20 +364,16 @@ export abstract class HTTPRequest { /** * Aborts a request. * - * @remarks - * To use this, request interception should be enabled with - * {@link Page.setRequestInterception}. If it is not enabled, this method will - * throw an exception immediately. - * * @param errorCode - optional error code to provide. * @param priority - If provided, intercept is resolved using * cooperative handling rules. Otherwise, intercept is resolved * immediately. * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported + * @remarks * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported + * To use this, request interception should be enabled with + * {@link Page.setRequestInterception}. If it is not enabled, this method will + * throw an exception immediately. */ abstract abort(errorCode?: ErrorCode, priority?: number): Promise; } diff --git a/packages/puppeteer-core/src/api/HTTPResponse.ts b/packages/puppeteer-core/src/api/HTTPResponse.ts index c78d53ac555..e82bc261476 100644 --- a/packages/puppeteer-core/src/api/HTTPResponse.ts +++ b/packages/puppeteer-core/src/api/HTTPResponse.ts @@ -81,11 +81,6 @@ export abstract class HTTPResponse { /** * {@link SecurityDetails} if the response was received over the * secure connection, or `null` otherwise. - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported */ abstract securityDetails(): SecurityDetails | null; @@ -96,11 +91,6 @@ export abstract class HTTPResponse { /** * Promise which resolves to a buffer with response body. - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported */ abstract buffer(): Promise; @@ -138,11 +128,6 @@ export abstract class HTTPResponse { /** * True if the response was served by a service worker. - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported */ abstract fromServiceWorker(): boolean; diff --git a/packages/puppeteer-core/src/api/Input.ts b/packages/puppeteer-core/src/api/Input.ts index d7a9f634517..ab462afbb1b 100644 --- a/packages/puppeteer-core/src/api/Input.ts +++ b/packages/puppeteer-core/src/api/Input.ts @@ -435,11 +435,6 @@ export abstract class Mouse { * Dispatches a `drag` event. * @param start - starting point for drag * @param target - point to drag to - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported */ abstract drag(start: Point, target: Point): Promise; @@ -447,11 +442,6 @@ export abstract class Mouse { * Dispatches a `dragenter` event. * @param target - point for emitting `dragenter` event * @param data - drag data containing items and operations mask - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported */ abstract dragEnter( target: Point, @@ -462,11 +452,6 @@ export abstract class Mouse { * Dispatches a `dragover` event. * @param target - point for emitting `dragover` event * @param data - drag data containing items and operations mask - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported */ abstract dragOver( target: Point, @@ -477,11 +462,6 @@ export abstract class Mouse { * Performs a dragenter, dragover, and drop in sequence. * @param target - point to drop on * @param data - drag data containing items and operations mask - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported */ abstract drop(target: Point, data: Protocol.Input.DragData): Promise; @@ -492,11 +472,6 @@ export abstract class Mouse { * @param options - An object of options. Accepts delay which, * if specified, is the time to wait between `dragover` and `drop` in milliseconds. * Defaults to 0. - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported */ abstract dragAndDrop( start: Point, diff --git a/packages/puppeteer-core/src/api/Page.ts b/packages/puppeteer-core/src/api/Page.ts index 8684bae7a9b..f685c6dab62 100644 --- a/packages/puppeteer-core/src/api/Page.ts +++ b/packages/puppeteer-core/src/api/Page.ts @@ -420,11 +420,6 @@ export const enum PageEvent { * page.evaluate(() => window.open('https://example.com')), * ]); * ``` - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported */ Popup = 'popup', /** @@ -468,22 +463,12 @@ export const enum PageEvent { * Emitted when a dedicated * {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API | WebWorker} * is spawned by the page. - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported */ WorkerCreated = 'workercreated', /** * Emitted when a dedicated * {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API | WebWorker} * is destroyed by the page. - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported */ WorkerDestroyed = 'workerdestroyed', } @@ -624,11 +609,6 @@ export abstract class Page extends EventEmitter { /** * `true` if the service worker are being bypassed, `false` otherwise. - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported */ abstract isServiceWorkerBypassed(): boolean; @@ -638,23 +618,11 @@ export abstract class Page extends EventEmitter { * @deprecated We no longer support intercepting drag payloads. Use the new * drag APIs found on {@link ElementHandle} to drag (or just use the * {@link Page.mouse}). - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported */ abstract isDragInterceptionEnabled(): boolean; /** * `true` if the page has JavaScript enabled, `false` otherwise. - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi+}: Supported */ abstract isJavaScriptEnabled(): boolean; @@ -740,11 +708,6 @@ export abstract class Page extends EventEmitter { * ]); * await fileChooser.accept(['/tmp/myfile.pdf']); * ``` - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported */ abstract waitForFileChooser( options?: WaitTimeoutOptions @@ -762,13 +725,6 @@ export abstract class Page extends EventEmitter { * ```ts * await page.setGeolocation({latitude: 59.95, longitude: 30.31667}); * ``` - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi+}: Supported */ abstract setGeolocation(options: GeolocationOptions): Promise; @@ -797,13 +753,6 @@ export abstract class Page extends EventEmitter { /** * Creates a Chrome Devtools Protocol session attached to the page. - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi+}: Supported */ abstract createCDPSession(): Promise; @@ -844,11 +793,6 @@ export abstract class Page extends EventEmitter { * * @remarks * This does not contain ServiceWorkers - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported */ abstract workers(): WebWorker[]; @@ -887,11 +831,6 @@ export abstract class Page extends EventEmitter { * ``` * * @param value - Whether to enable request interception. - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported */ abstract setRequestInterception(value: boolean): Promise; @@ -899,11 +838,6 @@ export abstract class Page extends EventEmitter { * Toggles ignoring of service worker for each request. * * @param bypass - Whether to bypass service worker and load from network. - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported */ abstract setBypassServiceWorker(bypass: boolean): Promise; @@ -913,11 +847,6 @@ export abstract class Page extends EventEmitter { * @deprecated We no longer support intercepting drag payloads. Use the new * drag APIs found on {@link ElementHandle} to drag (or just use the * {@link Page.mouse}). - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported */ abstract setDragInterception(enabled: boolean): Promise; @@ -927,11 +856,6 @@ export abstract class Page extends EventEmitter { * It does not change the parameters used in {@link Page.emulateNetworkConditions} * * @param enabled - When `true`, enables offline mode for the page. - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported */ abstract setOfflineMode(enabled: boolean): Promise; @@ -961,11 +885,6 @@ export abstract class Page extends EventEmitter { * * @param networkConditions - Passing `null` disables network condition * emulation. - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported */ abstract emulateNetworkConditions( networkConditions: NetworkConditions | null @@ -1049,15 +968,6 @@ export abstract class Page extends EventEmitter { * @param selector - A `selector` to query page for * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | selector} * to query page for. - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Partial support - * - * - ARIA selector not supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi+}: Supported */ async $( selector: Selector @@ -1068,18 +978,12 @@ export abstract class Page extends EventEmitter { /** * The method runs `document.querySelectorAll` within the page. If no elements * match the selector, the return value resolves to `[]`. - * @remarks - * Shortcut for {@link Frame.$$ | Page.mainFrame().$$(selector) }. + * * @param selector - A `selector` to query page for * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported + * @remarks * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Partial support - * - * - ARIA selector not supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi+}: Supported + * Shortcut for {@link Frame.$$ | Page.mainFrame().$$(selector) }. */ async $$( selector: Selector @@ -1180,13 +1084,6 @@ export abstract class Page extends EventEmitter { * @param prototypeHandle - a handle to the object prototype. * @returns Promise which resolves to a handle to an array of objects with * this prototype. - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi+}: Supported */ abstract queryObjects( prototypeHandle: JSHandle @@ -1253,15 +1150,6 @@ export abstract class Page extends EventEmitter { * @returns The result of calling `pageFunction`. If it returns an element it * is wrapped in an {@link ElementHandle}, else the raw value itself is * returned. - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Partial support - * - * - ARIA selector not supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi+}: Supported */ async $eval< Selector extends string, @@ -1340,15 +1228,6 @@ export abstract class Page extends EventEmitter { * @returns The result of calling `pageFunction`. If it returns an element it * is wrapped in an {@link ElementHandle}, else the raw value itself is * returned. - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Partial support - * - * - ARIA selector not supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi+}: Supported */ async $$eval< Selector extends string, @@ -1383,20 +1262,9 @@ export abstract class Page extends EventEmitter { /** * If no URLs are specified, this method returns cookies for the current page * URL. If URLs are specified, only cookies for those URLs are returned. - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported */ abstract cookies(...urls: string[]): Promise; - /** - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported - */ abstract deleteCookie( ...cookies: Protocol.Network.DeleteCookiesRequest[] ): Promise; @@ -1407,11 +1275,6 @@ export abstract class Page extends EventEmitter { * ```ts * await page.setCookie(cookieObject1, cookieObject2); * ``` - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported */ abstract setCookie(...cookies: Protocol.Network.CookieParam[]): Promise; @@ -1540,11 +1403,6 @@ export abstract class Page extends EventEmitter { * * @remarks * To disable authentication, pass `null`. - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported */ abstract authenticate(credentials: Credentials): Promise; @@ -1567,11 +1425,6 @@ export abstract class Page extends EventEmitter { * * @param headers - An object containing additional HTTP headers to be sent * with every request. All header values must be strings. - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported */ abstract setExtraHTTPHeaders(headers: Record): Promise; @@ -1580,11 +1433,6 @@ export abstract class Page extends EventEmitter { * @param userAgentData - Specific user agent client hint data to use in this * page * @returns Promise which resolves when the user agent is set. - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported */ abstract setUserAgent( userAgent: string, @@ -1626,18 +1474,15 @@ export abstract class Page extends EventEmitter { * @remarks * All timestamps are in monotonic time: monotonically increasing time * in seconds since an arbitrary point in the past. - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported */ abstract metrics(): Promise; /** * The page's URL. - * @remarks Shortcut for - * {@link Frame.url | page.mainFrame().url()}. + * + * @remarks + * + * Shortcut for {@link Frame.url | page.mainFrame().url()}. */ url(): string { return this.mainFrame().url(); @@ -1655,7 +1500,9 @@ export abstract class Page extends EventEmitter { * * @param html - HTML markup to assign to the page. * @param options - Parameters that has some properties. + * * @remarks + * * The parameter `options` might have the following options. * * - `timeout` : Maximum time in milliseconds for resources to load, defaults @@ -1684,6 +1531,7 @@ export abstract class Page extends EventEmitter { * Navigates the page to the given `url`. * * @remarks + * * Navigation to `about:blank` or navigation to the same URL with a different * hash will succeed and return `null`. * @@ -1744,6 +1592,7 @@ export abstract class Page extends EventEmitter { * ``` * * @remarks + * * Usage of the * {@link https://developer.mozilla.org/en-US/docs/Web/API/History_API | History API} * to change the URL is considered a navigation. @@ -1934,11 +1783,6 @@ export abstract class Page extends EventEmitter { * more than 0 network connections for at least `500` ms.
* - `networkidle2` : consider navigation to be finished when there are no * more than 2 network connections for at least `500` ms. - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported */ abstract goBack(options?: WaitForOptions): Promise; @@ -1967,11 +1811,6 @@ export abstract class Page extends EventEmitter { * more than 0 network connections for at least `500` ms.
* - `networkidle2` : consider navigation to be finished when there are no * more than 2 network connections for at least `500` ms. - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported */ abstract goForward(options?: WaitForOptions): Promise; @@ -1990,7 +1829,6 @@ export abstract class Page extends EventEmitter { * This method is a shortcut for calling two methods: * {@link Page.setUserAgent} and {@link Page.setViewport}. * - * @remarks * This method will resize the page. A lot of websites don't expect phones to * change size, so you should emulate before navigating to the page. * @@ -2009,11 +1847,6 @@ export abstract class Page extends EventEmitter { * await browser.close(); * })(); * ``` - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported */ async emulate(device: Device): Promise { await Promise.all([ @@ -2027,13 +1860,6 @@ export abstract class Page extends EventEmitter { * @remarks * NOTE: changing this value won't affect scripts that have already been run. * It will take full effect on the next navigation. - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi+}: Supported */ abstract setJavaScriptEnabled(enabled: boolean): Promise; @@ -2044,13 +1870,6 @@ export abstract class Page extends EventEmitter { * NOTE: CSP bypassing happens at the moment of CSP initialization rather than * evaluation. Usually, this means that `page.setBypassCSP` should be called * before navigating to the domain. - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi+}: Supported */ abstract setBypassCSP(enabled: boolean): Promise; @@ -2078,26 +1897,12 @@ export abstract class Page extends EventEmitter { * await page.evaluate(() => matchMedia('print').matches); * // → false * ``` - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi+}: Supported */ abstract emulateMediaType(type?: string): Promise; /** * Enables CPU throttling to emulate slow CPUs. * @param factor - slowdown factor (1 is no throttle, 2 is 2x slowdown, etc). - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi+}: Supported */ abstract emulateCPUThrottling(factor: number | null): Promise; @@ -2161,13 +1966,6 @@ export abstract class Page extends EventEmitter { * await page.evaluate(() => matchMedia('(color-gamut: rec2020)').matches); * // → false * ``` - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi+}: Supported */ abstract emulateMediaFeatures(features?: MediaFeature[]): Promise; @@ -2176,13 +1974,6 @@ export abstract class Page extends EventEmitter { * {@link https://source.chromium.org/chromium/chromium/deps/icu.git/+/faee8bc70570192d82d2978a71e2a615788597d1:source/data/misc/metaZones.txt | ICU’s metaZones.txt} * for a list of supported timezone IDs. Passing * `null` disables timezone emulation. - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi+}: Supported */ abstract emulateTimezone(timezoneId?: string): Promise; @@ -2204,13 +1995,6 @@ export abstract class Page extends EventEmitter { * ``` * * @param overrides - Mock idle state. If not set, clears idle overrides - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi+}: Supported */ abstract emulateIdleState(overrides?: { isUserActive: boolean; @@ -2244,13 +2028,6 @@ export abstract class Page extends EventEmitter { * ``` * * @param type - the type of deficiency to simulate, or `'none'` to reset. - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi+}: Supported */ abstract emulateVisionDeficiency( type?: Protocol.Emulation.SetEmulatedVisionDeficiencyRequest['type'] @@ -2279,15 +2056,6 @@ export abstract class Page extends EventEmitter { * @remarks * NOTE: in certain cases, setting viewport will reload the page in order to * set the isMobile or hasTouch properties. - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Partial support - * - * #TODO: List unsupported? - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi+}: Supported */ abstract setViewport(viewport: Viewport): Promise; @@ -2416,13 +2184,6 @@ export abstract class Page extends EventEmitter { * default, caching is enabled. * @param enabled - sets the `enabled` state of cache * @defaultValue `true` - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi+}: Supported */ abstract setCacheEnabled(enabled?: boolean): Promise; @@ -2445,13 +2206,6 @@ export abstract class Page extends EventEmitter { /** * Captures a screencast of this {@link Page | page}. * - * @remarks - * - * All recordings will be {@link https://www.webmproject.org/ | WebM} format using - * the {@link https://www.webmproject.org/vp9/ | VP9} video codec. The FPS is 30. - * - * You must have {@link https://ffmpeg.org/ | ffmpeg} installed on your system. - * * @example * Recording a {@link Page | page}: * @@ -2482,12 +2236,12 @@ export abstract class Page extends EventEmitter { * * @experimental * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported + * @remarks * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported + * All recordings will be {@link https://www.webmproject.org/ | WebM} format using + * the {@link https://www.webmproject.org/vp9/ | VP9} video codec. The FPS is 30. * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi+}: Supported + * You must have {@link https://ffmpeg.org/ | ffmpeg} installed on your system. */ async screencast( options: Readonly = {} @@ -2629,15 +2383,6 @@ export abstract class Page extends EventEmitter { * Captures a screenshot of this {@link Page | page}. * * @param options - Configures screenshot behavior. - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Partial support - * - * #TODO: List unsupported? - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi+}: Supported */ async screenshot( options: Readonly & {encoding: 'base64'} @@ -2789,6 +2534,9 @@ export abstract class Page extends EventEmitter { /** * Generates a PDF of the page with the `print` CSS media type. + * + * @param options - options for generating the PDF. + * * @remarks * * To generate a PDF with the `screen` media type, call @@ -2799,17 +2547,6 @@ export abstract class Page extends EventEmitter { * Use the * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-print-color-adjust | `-webkit-print-color-adjust`} * property to force rendering of exact colors. - * - * @param options - options for generating the PDF. - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Partial support - * - * #TODO: List unsupported? - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi+}: Supported */ abstract createPDFStream(options?: PDFOptions): Promise; @@ -2822,6 +2559,7 @@ export abstract class Page extends EventEmitter { * The page's title * * @remarks + * * Shortcut for {@link Frame.title | page.mainFrame().title()}. */ async title(): Promise { @@ -2846,7 +2584,10 @@ export abstract class Page extends EventEmitter { * needed, and then uses {@link Page | Page.mouse} to click in the center of the * element. If there's no element matching `selector`, the method throws an * error. - * @remarks Bear in mind that if `click()` triggers a navigation event and + * + * @remarks + * + * Bear in mind that if `click()` triggers a navigation event and * there's a separate `page.waitForNavigation()` promise to be resolved, you * may end up with a race condition that yields unexpected results. The * correct pattern for click and wait for navigation is the following: @@ -2880,7 +2621,9 @@ export abstract class Page extends EventEmitter { * @returns Promise which resolves when the element matching selector is * successfully focused. The promise will be rejected if there is no element * matching selector. + * * @remarks + * * Shortcut for {@link Frame.focus | page.mainFrame().focus(selector)}. */ focus(selector: string): Promise { @@ -2899,7 +2642,9 @@ export abstract class Page extends EventEmitter { * @returns Promise which resolves when the element matching `selector` is * successfully hovered. Promise gets rejected if there's no element matching * `selector`. + * * @remarks + * * Shortcut for {@link Page.hover | page.mainFrame().hover(selector)}. */ hover(selector: string): Promise { @@ -2927,6 +2672,7 @@ export abstract class Page extends EventEmitter { * @returns * * @remarks + * * Shortcut for {@link Frame.select | page.mainFrame().select()} */ select(selector: string, ...values: string[]): Promise { @@ -2942,13 +2688,10 @@ export abstract class Page extends EventEmitter { * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | Selector} * to search for element to tap. If there are multiple elements satisfying the * selector, the first will be tapped. + * * @remarks + * * Shortcut for {@link Frame.tap | page.mainFrame().tap(selector)}. - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported */ tap(selector: string): Promise { return this.mainFrame().tap(selector); @@ -2976,7 +2719,6 @@ export abstract class Page extends EventEmitter { * @param options - have property `delay` which is the Time to wait between * key presses in milliseconds. Defaults to `0`. * @returns - * @remarks */ type( selector: string, @@ -2992,6 +2734,7 @@ export abstract class Page extends EventEmitter { * Causes your script to wait for the given number of milliseconds. * * @remarks + * * It's generally recommended to not wait for a number of seconds, but instead * use {@link Frame.waitForSelector}, {@link Frame.waitForXPath} or * {@link Frame.waitForFunction} to wait for exactly the conditions you want. @@ -3046,6 +2789,7 @@ export abstract class Page extends EventEmitter { * @returns Promise which resolves when element specified by selector string * is added to DOM. Resolves to `null` if waiting for hidden: `true` and * selector is not found in DOM. + * * @remarks * The optional Parameter in Arguments `options` are: * @@ -3060,13 +2804,6 @@ export abstract class Page extends EventEmitter { * - `timeout`: maximum time to wait for in milliseconds. Defaults to `30000` * (30 seconds). Pass `0` to disable timeout. The default value can be changed * by using the {@link Page.setDefaultTimeout} method. - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Partial support - * - * - ARIA selector not supported */ async waitForSelector( selector: Selector, @@ -3223,11 +2960,6 @@ export abstract class Page extends EventEmitter { * await devicePrompt.waitForDevice(({name}) => name.includes('My Device')) * ); * ``` - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported */ abstract waitForDevicePrompt( options?: WaitTimeoutOptions diff --git a/packages/puppeteer-core/src/api/Target.ts b/packages/puppeteer-core/src/api/Target.ts index 8d9807b84af..3be4a0a9d1e 100644 --- a/packages/puppeteer-core/src/api/Target.ts +++ b/packages/puppeteer-core/src/api/Target.ts @@ -70,11 +70,6 @@ export abstract class Target { /** * Creates a Chrome Devtools Protocol session attached to the target. - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported */ abstract createCDPSession(): Promise; @@ -99,11 +94,6 @@ export abstract class Target { /** * Get the target that opened this target. Top-level targets return `null`. - * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported */ abstract opener(): Target | undefined; } diff --git a/packages/puppeteer-core/src/cdp/Accessibility.ts b/packages/puppeteer-core/src/cdp/Accessibility.ts index e688a3341d4..bd7382a15f0 100644 --- a/packages/puppeteer-core/src/cdp/Accessibility.ts +++ b/packages/puppeteer-core/src/cdp/Accessibility.ts @@ -128,13 +128,6 @@ export interface SnapshotOptions { * By default, Puppeteer tries to approximate this filtering, exposing only * the "interesting" nodes of the tree. * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi+}: Supported - * * @public */ export class Accessibility { diff --git a/packages/puppeteer-core/src/cdp/Coverage.ts b/packages/puppeteer-core/src/cdp/Coverage.ts index b08878226f8..4c115970edb 100644 --- a/packages/puppeteer-core/src/cdp/Coverage.ts +++ b/packages/puppeteer-core/src/cdp/Coverage.ts @@ -123,13 +123,6 @@ export interface CSSCoverageOptions { * console.log(`Bytes used: ${(usedBytes / totalBytes) * 100}%`); * ``` * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi+}: Supported - * * @public */ export class Coverage { diff --git a/packages/puppeteer-core/src/cdp/Tracing.ts b/packages/puppeteer-core/src/cdp/Tracing.ts index 9b3f198d3a2..c700fe29afd 100644 --- a/packages/puppeteer-core/src/cdp/Tracing.ts +++ b/packages/puppeteer-core/src/cdp/Tracing.ts @@ -45,13 +45,6 @@ export interface TracingOptions { * await page.tracing.stop(); * ``` * - * @privateRemarks BiDi - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | CDP}: Supported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi}: Unsupported - * - * {@link PROTOCOL_GET_STARTED_LINK_TEMPLATE | BiDi+}: Supported - * * @public */ export class Tracing { diff --git a/packages/puppeteer-core/src/common/ConnectOptions.ts b/packages/puppeteer-core/src/common/ConnectOptions.ts index 83c5873919a..71b6e032583 100644 --- a/packages/puppeteer-core/src/common/ConnectOptions.ts +++ b/packages/puppeteer-core/src/common/ConnectOptions.ts @@ -23,7 +23,7 @@ import type {ConnectionTransport} from './ConnectionTransport.js'; import type {Viewport} from './Viewport.js'; /** - * @internal + * @public */ export type ProtocolType = 'cdp' | 'webDriverBiDi'; @@ -57,9 +57,10 @@ export interface BrowserConnectOptions { * @internal */ _isPageTarget?: IsPageTargetCallback; + /** * @defaultValue 'cdp' - * @internal + * @public */ protocol?: ProtocolType; /** diff --git a/packages/puppeteer-core/src/node/ProductLauncher.ts b/packages/puppeteer-core/src/node/ProductLauncher.ts index 355e1c69469..0dee43989e1 100644 --- a/packages/puppeteer-core/src/node/ProductLauncher.ts +++ b/packages/puppeteer-core/src/node/ProductLauncher.ts @@ -95,8 +95,8 @@ export abstract class ProductLauncher { slowMo = 0, timeout = 30000, waitForInitialPage = true, - protocol, protocolTimeout, + protocol, } = options; const launchArgs = await this.computeLaunchArguments(options); diff --git a/website/sidebars.js b/website/sidebars.js index b76cf61d7b6..5aed3faed0f 100644 --- a/website/sidebars.js +++ b/website/sidebars.js @@ -39,6 +39,7 @@ module.exports = { }, ], }, + 'webdriver-bidi', 'chromium-support', 'troubleshooting', 'contributing', diff --git a/website/versioned_docs/version-21.5.2/faq.md b/website/versioned_docs/version-21.5.2/faq.md index 1f7fa8bfc01..bd7f154cb1c 100644 --- a/website/versioned_docs/version-21.5.2/faq.md +++ b/website/versioned_docs/version-21.5.2/faq.md @@ -32,7 +32,8 @@ non-standard DevTools Protocol used by Chrome). The goals of the project are: - Provide a slim, canonical library that highlights the capabilities of the - [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). + [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/) and + [WebDriver BiDi](https://w3c.github.io/webdriver-bidi/). - Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer. - Grow the adoption of headless/automated browser testing.