Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
docs: generate api.md off documentation model (#4832)
Pavel Feldmana446792c1829
diff --git a/docs-src/api-body.md b/docs-src/api-body.mdindex 7b0740af19..eae73d15ee 100644--- a/docs-src/api-body.md+++ b/docs-src/api-body.md@@ -827,12 +827,12 @@ Emitted when a frame is navigated to a new url.Emitted when the JavaScript [`load`](https://developer.mozilla.org/en-US/docs/Web/Events/load) event is dispatched.## event: Page.pageerror-- type: <[Error]> The exception message+- type: <[Error]>Emitted when an uncaught exception happens within the page.## event: Page.popup-- type: <[Page]> Page corresponding to "popup" window+- type: <[Page]>Emitted when the page opens a new tab or window. This event is emitted in addition to the [`event:BrowserContext.page`](), but only for popups relevant to this page.@@ -879,7 +879,7 @@ Emitted when [response] status and headers are received for a request. For a sucis `request`, `response` and `requestfinished`.## event: Page.websocket-- type: <[WebSocket]> websocket+- type: <[WebSocket]>Emitted when <[WebSocket]> request is sent.@@ -1046,7 +1046,7 @@ This method checks an element matching [`param: selector`]() by performing the f1. Ensure that matched element is a checkbox or a radio input. If not, this method rejects. If the element is already checked, this method returns immediately.1. Wait for [actionability](./actionability.md) checks on the matched element, unless [`option: force`]() option is set. If the element is detached during the checks, the whole action is retried.1. Scroll the element into view if needed.-1. Use [page.mouse](#pagemouse) to click in the center of the element.+1. Use [`property: Page.mouse`]() to click in the center of the element.1. Wait for initiated navigations to either succeed or fail, unless [`option: noWaitAfter`]() option is set.1. Ensure that the element is now checked. If not, this method rejects.@@ -1069,7 +1069,7 @@ This method clicks an element matching [`param: selector`]() by performing the f1. Find an element match matching [`param: selector`](). If there is none, wait until a matching element is attached to the DOM.1. Wait for [actionability](./actionability.md) checks on the matched element, unless [`option: force`]() option is set. If the element is detached during the checks, the whole action is retried.1. Scroll the element into view if needed.-1. Use [page.mouse](#pagemouse) to click in the center of the element, or the specified [`option: position`]().+1. Use [`property: Page.mouse`]() to click in the center of the element, or the specified [`option: position`]().1. Wait for initiated navigations to either succeed or fail, unless [`option: noWaitAfter`]() option is set.When all steps combined have not finished during the specified [`option: timeout`](), this method rejects with a@@ -1134,7 +1134,7 @@ This method double clicks an element matching [`param: selector`]() by performin1. Find an element match matching [`param: selector`](). If there is none, wait until a matching element is attached to the DOM.1. Wait for [actionability](./actionability.md) checks on the matched element, unless [`option: force`]() option is set. If the element is detached during the checks, the whole action is retried.1. Scroll the element into view if needed.-1. Use [page.mouse](#pagemouse) to double click in the center of the element, or the specified [`option: position`]().+1. Use [`property: Page.mouse`]() to double click in the center of the element, or the specified [`option: position`]().1. Wait for initiated navigations to either succeed or fail, unless [`option: noWaitAfter`]() option is set. Note that if the first click of the `dblclick()` triggers a navigation event, this method will reject.When all steps combined have not finished during the specified [`option: timeout`](), this method rejects with a@@ -1608,7 +1608,7 @@ This method hovers over an element matching [`param: selector`]() by performing1. Find an element match matching [`param: selector`](). If there is none, wait until a matching element is attached to the DOM.1. Wait for [actionability](./actionability.md) checks on the matched element, unless [`option: force`]() option is set. If the element is detached during the checks, the whole action is retried.1. Scroll the element into view if needed.-1. Use [page.mouse](#pagemouse) to hover over the center of the element, or the specified [`option: position`]().+1. Use [`property: Page.mouse`]() to hover over the center of the element, or the specified [`option: position`]().1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.When all steps combined have not finished during the specified [`option: timeout`](), this method rejects with a@@ -2075,7 +2075,7 @@ This method taps an element matching [`param: selector`]() by performing the fol1. Find an element match matching [`param: selector`](). If there is none, wait until a matching element is attached to the DOM.1. Wait for [actionability](./actionability.md) checks on the matched element, unless [`option: force`]() option is set. If the element is detached during the checks, the whole action is retried.1. Scroll the element into view if needed.-1. Use [page.touchscreen](#pagetouchscreen#pagetouchscreen) to tap the center of the element, or the specified [`option: position`]().+1. Use [`property: Page.touchscreen`]() to tap the center of the element, or the specified [`option: position`]().1. Wait for initiated navigations to either succeed or fail, unless [`option: noWaitAfter`]() option is set.When all steps combined have not finished during the specified [`option: timeout`](), this method rejects with a@@ -2151,7 +2151,7 @@ This method unchecks an element matching [`param: selector`]() by performing the1. Ensure that matched element is a checkbox or a radio input. If not, this method rejects. If the element is already unchecked, this method returns immediately.1. Wait for [actionability](./actionability.md) checks on the matched element, unless [`option: force`]() option is set. If the element is detached during the checks, the whole action is retried.1. Scroll the element into view if needed.-1. Use [page.mouse](#pagemouse) to click in the center of the element.+1. Use [`property: Page.mouse`]() to click in the center of the element.1. Wait for initiated navigations to either succeed or fail, unless [`option: noWaitAfter`]() option is set.1. Ensure that the element is now unchecked. If not, this method rejects.@@ -2602,7 +2602,7 @@ This method checks an element matching [`param: selector`]() by performing the f1. Ensure that matched element is a checkbox or a radio input. If not, this method rejects. If the element is already checked, this method returns immediately.1. Wait for [actionability](./actionability.md) checks on the matched element, unless [`option: force`]() option is set. If the element is detached during the checks, the whole action is retried.1. Scroll the element into view if needed.-1. Use [page.mouse](#pagemouse) to click in the center of the element.+1. Use [`property: Page.mouse`]() to click in the center of the element.1. Wait for initiated navigations to either succeed or fail, unless [`option: noWaitAfter`]() option is set.1. Ensure that the element is now checked. If not, this method rejects.@@ -2626,7 +2626,7 @@ This method clicks an element matching [`param: selector`]() by performing the f1. Find an element match matching [`param: selector`](). If there is none, wait until a matching element is attached to the DOM.1. Wait for [actionability](./actionability.md) checks on the matched element, unless [`option: force`]() option is set. If the element is detached during the checks, the whole action is retried.1. Scroll the element into view if needed.-1. Use [page.mouse](#pagemouse) to click in the center of the element, or the specified [`option: position`]().+1. Use [`property: Page.mouse`]() to click in the center of the element, or the specified [`option: position`]().1. Wait for initiated navigations to either succeed or fail, unless [`option: noWaitAfter`]() option is set.When all steps combined have not finished during the specified [`option: timeout`](), this method rejects with a@@ -2661,7 +2661,7 @@ This method double clicks an element matching [`param: selector`]() by performin1. Find an element match matching [`param: selector`](). If there is none, wait until a matching element is attached to the DOM.1. Wait for [actionability](./actionability.md) checks on the matched element, unless [`option: force`]() option is set. If the element is detached during the checks, the whole action is retried.1. Scroll the element into view if needed.-1. Use [page.mouse](#pagemouse) to double click in the center of the element, or the specified [`option: position`]().+1. Use [`property: Page.mouse`]() to double click in the center of the element, or the specified [`option: position`]().1. Wait for initiated navigations to either succeed or fail, unless [`option: noWaitAfter`]() option is set. Note that if the first click of the `dblclick()` triggers a navigation event, this method will reject.When all steps combined have not finished during the specified [`option: timeout`](), this method rejects with a@@ -2916,7 +2916,7 @@ This method hovers over an element matching [`param: selector`]() by performing1. Find an element match matching [`param: selector`](). If there is none, wait until a matching element is attached to the DOM.1. Wait for [actionability](./actionability.md) checks on the matched element, unless [`option: force`]() option is set. If the element is detached during the checks, the whole action is retried.1. Scroll the element into view if needed.-1. Use [page.mouse](#pagemouse) to hover over the center of the element, or the specified [`option: position`]().+1. Use [`property: Page.mouse`]() to hover over the center of the element, or the specified [`option: position`]().1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.When all steps combined have not finished during the specified [`option: timeout`](), this method rejects with a@@ -3079,7 +3079,7 @@ This method taps an element matching [`param: selector`]() by performing the fol1. Find an element match matching [`param: selector`](). If there is none, wait until a matching element is attached to the DOM.1. Wait for [actionability](./actionability.md) checks on the matched element, unless [`option: force`]() option is set. If the element is detached during the checks, the whole action is retried.1. Scroll the element into view if needed.-1. Use [page.touchscreen](#pagetouchscreen#pagetouchscreen) to tap the center of the element, or the specified [`option: position`]().+1. Use [`property: Page.touchscreen`]() to tap the center of the element, or the specified [`option: position`]().1. Wait for initiated navigations to either succeed or fail, unless [`option: noWaitAfter`]() option is set.When all steps combined have not finished during the specified [`option: timeout`](), this method rejects with a@@ -3148,7 +3148,7 @@ This method checks an element matching [`param: selector`]() by performing the f1. Ensure that matched element is a checkbox or a radio input. If not, this method rejects. If the element is already unchecked, this method returns immediately.1. Wait for [actionability](./actionability.md) checks on the matched element, unless [`option: force`]() option is set. If the element is detached during the checks, the whole action is retried.1. Scroll the element into view if needed.-1. Use [page.mouse](#pagemouse) to click in the center of the element.+1. Use [`property: Page.mouse`]() to click in the center of the element.1. Wait for initiated navigations to either succeed or fail, unless [`option: noWaitAfter`]() option is set.1. Ensure that the element is now unchecked. If not, this method rejects.@@ -3460,7 +3460,7 @@ This method checks the element by performing the following steps:1. Ensure that element is a checkbox or a radio input. If not, this method rejects. If the element is already checked, this method returns immediately.1. Wait for [actionability](./actionability.md) checks on the element, unless [`option: force`]() option is set.1. Scroll the element into view if needed.-1. Use [page.mouse](#pagemouse) to click in the center of the element.+1. Use [`property: Page.mouse`]() to click in the center of the element.1. Wait for initiated navigations to either succeed or fail, unless [`option: noWaitAfter`]() option is set.1. Ensure that the element is now checked. If not, this method rejects.@@ -3480,7 +3480,7 @@ When all steps combined have not finished during the specified [`option: timeoutThis method clicks the element by performing the following steps:1. Wait for [actionability](./actionability.md) checks on the element, unless [`option: force`]() option is set.1. Scroll the element into view if needed.-1. Use [page.mouse](#pagemouse) to click in the center of the element, or the specified [`option: position`]().+1. Use [`property: Page.mouse`]() to click in the center of the element, or the specified [`option: position`]().1. Wait for initiated navigations to either succeed or fail, unless [`option: noWaitAfter`]() option is set.If the element is detached from the DOM at any moment during the action, this method rejects.@@ -3514,7 +3514,7 @@ Returns the content frame for element handles referencing iframe nodes, or `nullThis method double clicks the element by performing the following steps:1. Wait for [actionability](./actionability.md) checks on the element, unless [`option: force`]() option is set.1. Scroll the element into view if needed.-1. Use [page.mouse](#pagemouse) to double click in the center of the element, or the specified [`option: position`]().+1. Use [`property: Page.mouse`]() to double click in the center of the element, or the specified [`option: position`]().1. Wait for initiated navigations to either succeed or fail, unless [`option: noWaitAfter`]() option is set. Note that if the first click of the `dblclick()` triggers a navigation event, this method will reject.If the element is detached from the DOM at any moment during the action, this method rejects.@@ -3613,7 +3613,7 @@ Attribute name to get the value for.This method hovers over the element by performing the following steps:1. Wait for [actionability](./actionability.md) checks on the element, unless [`option: force`]() option is set.1. Scroll the element into view if needed.-1. Use [page.mouse](#pagemouse) to hover over the center of the element, or the specified [`option: position`]().+1. Use [`property: Page.mouse`]() to hover over the center of the element, or the specified [`option: position`]().1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.If the element is detached from the DOM at any moment during the action, this method rejects.@@ -3786,7 +3786,7 @@ are resolved relative to the the current working directory. For empty array, cleThis method taps the element by performing the following steps:1. Wait for [actionability](./actionability.md) checks on the element, unless [`option: force`]() option is set.1. Scroll the element into view if needed.-1. Use [page.touchscreen](#pagetouchscreen) to tap in the center of the element, or the specified [`option: position`]().+1. Use [`property: Page.touchscreen`]() to tap the center of the element, or the specified [`option: position`]().1. Wait for initiated navigations to either succeed or fail, unless [`option: noWaitAfter`]() option is set.If the element is detached from the DOM at any moment during the action, this method rejects.@@ -3853,7 +3853,7 @@ This method checks the element by performing the following steps:1. Ensure that element is a checkbox or a radio input. If not, this method rejects. If the element is already unchecked, this method returns immediately.1. Wait for [actionability](./actionability.md) checks on the element, unless [`option: force`]() option is set.1. Scroll the element into view if needed.-1. Use [page.mouse](#pagemouse) to click in the center of the element.+1. Use [`property: Page.mouse`]() to click in the center of the element.1. Wait for initiated navigations to either succeed or fail, unless [`option: noWaitAfter`]() option is set.1. Ensure that the element is now unchecked. If not, this method rejects.@@ -4399,7 +4399,7 @@ Name of the key to press or a character to generate, such as `ArrowLeft` or `a`.The Mouse class operates in main-frame CSS pixels relative to the top-left corner of the viewport.-Every `page` object has its own Mouse, accessible with [page.mouse](#pagemouse).+Every `page` object has its own Mouse, accessible with [`property: Page.mouse`]().```js// Using ‘page.mouse’ to trace a 100x100 square.@@ -4874,19 +4874,19 @@ The [WebSocket] class represents websocket connections in the page.Fired when the websocket closes.## event: WebSocket.framereceived-- type: <[Object]> web socket frame data+- type: <[Object]>- `payload` <[string]|[Buffer]> frame payloadFired when the websocket recieves a frame.## event: WebSocket.framesent-- type: <[Object]> web socket frame data+- type: <[Object]>- `payload` <[string]|[Buffer]> frame payloadFired when the websocket sends a frame.## event: WebSocket.socketerror-- type: <[String]> the error message+- type: <[String]>Fired when the websocket has an error.@@ -4972,7 +4972,7 @@ assistive technologies themselves. By default, Playwright tries to approximate t- `haspopup` <[string]> What kind of popup is currently being shown for a node, if applicable.- `invalid` <[string]> Whether and in what way this node's value is invalid, if applicable.- `orientation` <[string]> Whether the node is oriented horizontally or vertically, if applicable.- - `children` <[Array]<[Object]>> Child [AXNode]s of this node, if any, if applicable.+ - `children` <[Array]<[Object]>> Child nodes, if any, if applicable.Captures the current state of the accessibility tree. The returned object represents the root accessible node of thepage.diff --git a/docs-src/api-footer.md b/docs-src/api-footer.mdindex 287c9e9e28..cccd1dab1b 100644--- a/docs-src/api-footer.md+++ b/docs-src/api-footer.md@@ -155,63 +155,3 @@ const { chromium } = require('playwright');> **NOTE** It is not yet possible to test extension popups or content scripts.-[AXNode]: #accessibilitysnapshotoptions "AXNode"-[Accessibility]: #class-accessibility "Accessibility"-[Array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array "Array"-[Body]: #class-body "Body"-[BrowserServer]: #class-browserserver "BrowserServer"-[BrowserContext]: #class-browsercontext "BrowserContext"-[BrowserType]: #class-browsertype "BrowserType"-[Browser]: #class-browser "Browser"-[Buffer]: https://nodejs.org/api/buffer.html#buffer_class_buffer "Buffer"-[ChildProcess]: https://nodejs.org/api/child_process.html "ChildProcess"-[ChromiumBrowser]: #class-chromiumbrowser "ChromiumBrowser"-[ChromiumBrowserContext]: #class-chromiumbrowsercontext "ChromiumBrowserContext"-[ChromiumCoverage]: #class-chromiumcoverage "ChromiumCoverage"-[CDPSession]: #class-cdpsession "CDPSession"-[ConsoleMessage]: #class-consolemessage "ConsoleMessage"-[Dialog]: #class-dialog "Dialog"-[Download]: #class-download "Download"-[ElementHandle]: #class-elementhandle "ElementHandle"-[Element]: https://developer.mozilla.org/en-US/docs/Web/API/element "Element"-[Error]: https://nodejs.org/api/errors.html#errors_class_error "Error"-[EvaluationArgument]: #evaluationargument "Evaluation Argument"-[File]: #class-file "https://developer.mozilla.org/en-US/docs/Web/API/File"-[FileChooser]: #class-filechooser "FileChooser"-[FirefoxBrowser]: #class-firefoxbrowser "FirefoxBrowser"-[Frame]: #class-frame "Frame"-[JSHandle]: #class-jshandle "JSHandle"-[Keyboard]: #class-keyboard "Keyboard"-[Logger]: #class-logger "Logger"-[Map]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map "Map"-[Mouse]: #class-mouse "Mouse"-[Object]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object "Object"-[Page]: #class-page "Page"-[Playwright]: #class-playwright "Playwright"-[Promise]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise "Promise"-[RegExp]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp-[Request]: #class-request "Request"-[Response]: #class-response "Response"-[Route]: #class-route "Route"-[Selectors]: #class-selectors "Selectors"-[Serializable]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#Description "Serializable"-[TimeoutError]: #class-timeouterror "TimeoutError"-[Touchscreen]: #class-touchscreen "Touchscreen"-[UIEvent.detail]: https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/detail "UIEvent.detail"-[URL]: https://nodejs.org/api/url.html-[USKeyboardLayout]: ../src/usKeyboardLayout.ts "USKeyboardLayout"-[UnixTime]: https://en.wikipedia.org/wiki/Unix_time "Unix Time"-[Video]: #class-video "Video"-[WebKitBrowser]: #class-webkitbrowser "WebKitBrowser"-[WebSocket]: #class-websocket "WebSocket"-[Worker]: #class-worker "Worker"-[boolean]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type "Boolean"-[function]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function "Function"-[iterator]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols "Iterator"-[null]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null-[number]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type "Number"-[origin]: https://developer.mozilla.org/en-US/docs/Glossary/Origin "Origin"-[selector]: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors "selector"-[Readable]: https://nodejs.org/api/stream.html#stream_class_stream_readable "Readable"-[string]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type "String"-[xpath]: https://developer.mozilla.org/en-US/docs/Web/XPath "xpath"diff --git a/docs-src/api-links.md b/docs-src/api-links.mdnew file mode 100644index 0000000000..3a3cd3cf4b--- /dev/null+++ b/docs-src/api-links.md@@ -0,0 +1,25 @@+[Array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array "Array"+[Buffer]: https://nodejs.org/api/buffer.html#buffer_class_buffer "Buffer"+[ChildProcess]: https://nodejs.org/api/child_process.html "ChildProcess"+[Element]: https://developer.mozilla.org/en-US/docs/Web/API/element "Element"+[Error]: https://nodejs.org/api/errors.html#errors_class_error "Error"+[EvaluationArgument]: #evaluationargument "Evaluation Argument"+[Map]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map "Map"+[Object]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object "Object"+[Promise]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise "Promise"+[RegExp]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp "RegExp"+[Serializable]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#Description "Serializable"+[UIEvent.detail]: https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/detail "UIEvent.detail"+[URL]: https://nodejs.org/api/url.html "URL"+[USKeyboardLayout]: ../src/usKeyboardLayout.ts "USKeyboardLayout"+[UnixTime]: https://en.wikipedia.org/wiki/Unix_time "Unix Time"+[boolean]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type "Boolean"+[function]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function "Function"+[iterator]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols "Iterator"+[null]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null "null"+[number]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type "Number"+[origin]: https://developer.mozilla.org/en-US/docs/Glossary/Origin "Origin"+[selector]: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors "selector"+[Readable]: https://nodejs.org/api/stream.html#stream_class_stream_readable "Readable"+[string]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type "string"+[xpath]: https://developer.mozilla.org/en-US/docs/Web/XPath "xpath"diff --git a/docs-src/api-params.md b/docs-src/api-params.mdindex f980fb84ae..2085f50f40 100644--- a/docs-src/api-params.md+++ b/docs-src/api-params.md@@ -170,7 +170,7 @@ Whether or not to enable JavaScript in the context. Defaults to `true`.## context-option-timezoneid- `timezoneId` <[string]>-Changes the timezone of the context. See [ICU’s `metaZones.txt`](https://cs.chromium.org/chromium/src/third_party/icu/source/data/misc/metaZones.txt?rcl=faee8bc70570192d82d2978a71e2a615788597d1)+Changes the timezone of the context. See [ICU's metaZones.txt](https://cs.chromium.org/chromium/src/third_party/icu/source/data/misc/metaZones.txt?rcl=faee8bc70570192d82d2978a71e2a615788597d1)for a list of supported timezone IDs.## context-option-geolocationdiff --git a/docs/api.md b/docs/api.mdindex ccfeef1312..48c435e875 100644--- a/docs/api.md+++ b/docs/api.md@@ -132,6 +132,8 @@ Selectors can be used to install custom selector engines. See [Working with seleThis object can be used to launch or connect to WebKit, returning instances of [WebKitBrowser].+[Playwright]: #class-playwright "Playwright"+### class: Browser* extends: [EventEmitter](https://nodejs.org/api/events.html#events_class_eventemitter)@@ -246,7 +248,7 @@ Indicates that the browser is connected.- `localStorage` <[Array]<[Object]>>- `name` <[string]>- `value` <[string]>- - `timezoneId` <[string]> Changes the timezone of the context. See [ICU’s `metaZones.txt`](https://cs.chromium.org/chromium/src/third_party/icu/source/data/misc/metaZones.txt?rcl=faee8bc70570192d82d2978a71e2a615788597d1) for a list of supported timezone IDs.+ - `timezoneId` <[string]> Changes the timezone of the context. See [ICU's metaZones.txt](https://cs.chromium.org/chromium/src/third_party/icu/source/data/misc/metaZones.txt?rcl=faee8bc70570192d82d2978a71e2a615788597d1) for a list of supported timezone IDs.- `userAgent` <[string]> Specific user agent to use in this context.- `videoSize` <[Object]> **NOTE** Use `recordVideo` instead, it takes precedence over `videoSize`. Specifies dimensions of the automatically recorded video. Can only be used if `videosPath` is set. If not specified the size will be equal to `viewport`. If `viewport` is not configured explicitly the video size defaults to 1280x720. Actual picture of the page will be scaled down if necessary to fit specified size.- `width` <[number]> Video frame width.@@ -321,7 +323,7 @@ Creates a new browser context. It won't share cookies/cache with other browser c- `localStorage` <[Array]<[Object]>>- `name` <[string]>- `value` <[string]>- - `timezoneId` <[string]> Changes the timezone of the context. See [ICU’s `metaZones.txt`](https://cs.chromium.org/chromium/src/third_party/icu/source/data/misc/metaZones.txt?rcl=faee8bc70570192d82d2978a71e2a615788597d1) for a list of supported timezone IDs.+ - `timezoneId` <[string]> Changes the timezone of the context. See [ICU's metaZones.txt](https://cs.chromium.org/chromium/src/third_party/icu/source/data/misc/metaZones.txt?rcl=faee8bc70570192d82d2978a71e2a615788597d1) for a list of supported timezone IDs.- `userAgent` <[string]> Specific user agent to use in this context.- `videoSize` <[Object]> **NOTE** Use `recordVideo` instead, it takes precedence over `videoSize`. Specifies dimensions of the automatically recorded video. Can only be used if `videosPath` is set. If not specified the size will be equal to `viewport`. If `viewport` is not configured explicitly the video size defaults to 1280x720. Actual picture of the page will be scaled down if necessary to fit specified size.- `width` <[number]> Video frame width.@@ -341,6 +343,8 @@ This is a convenience API that should only be used for the single-page scenariosReturns the browser version.+[Browser]: #class-browser "Browser"+### class: BrowserContext* extends: [EventEmitter](https://nodejs.org/api/events.html#events_class_eventemitter)@@ -397,7 +401,7 @@ Emitted when Browser context gets closed. This might happen because of one of th#### browserContext.on('page')- type: <[Page]>-The event is emitted when a new Page is created in the BrowserContext. The page may still be loading. The event will also fire for popup pages. See also [page.on('popup')](#pageonpopup) to receive events about popups relevant to a specific page.+The event is emitted when a new Page is created in the BrowserContext. The page may still be loading. The event will also fire for popup pages. See also [`page.on('popup')`](#pageonpopup) to receive events about popups relevant to a specific page.The earliest moment that page is available is when it has navigated to the initial url. For example, when opening a popup with `window.open('http://example.com')`, this event will fire when the network request to "http://example.com" is done and its response has started loading in the popup.@@ -752,6 +756,8 @@ const context = await browser.newContext();await context.grantPermissions(['geolocation']);```+[BrowserContext]: #class-browsercontext "BrowserContext"+### class: Page* extends: [EventEmitter](https://nodejs.org/api/events.html#events_class_eventemitter)@@ -979,14 +985,14 @@ Emitted when a frame is navigated to a new url.Emitted when the JavaScript [`load`](https://developer.mozilla.org/en-US/docs/Web/Events/load) event is dispatched.#### page.on('pageerror')-- type: <[Error]> The exception message+- type: <[Error]>Emitted when an uncaught exception happens within the page.#### page.on('popup')-- type: <[Page]> Page corresponding to "popup" window+- type: <[Page]>-Emitted when the page opens a new tab or window. This event is emitted in addition to the [browserContext.on('page')](#browsercontextonpage), but only for popups relevant to this page.+Emitted when the page opens a new tab or window. This event is emitted in addition to the [`browserContext.on('page')`](#browsercontextonpage), but only for popups relevant to this page.The earliest moment that page is available is when it has navigated to the initial url. For example, when opening a popup with `window.open('http://example.com')`, this event will fire when the network request to "http://example.com" is done and its response has started loading in the popup.@@ -1010,7 +1016,7 @@ Emitted when a page issues a request. The [request] object is read-only. In ordeEmitted when a request fails, for example by timing out.-> **NOTE** HTTP Error responses, such as 404 or 503, are still successful responses from HTTP standpoint, so request will complete with [page.on('requestfinished')](#pageonrequestfinished) event and not with [page.on('requestfailed')](#pageonrequestfailed).+> **NOTE** HTTP Error responses, such as 404 or 503, are still successful responses from HTTP standpoint, so request will complete with [`page.on('requestfinished')`](#pageonrequestfinished) event and not with [`page.on('requestfailed')`](#pageonrequestfailed).#### page.on('requestfinished')- type: <[Request]>@@ -1023,7 +1029,7 @@ Emitted when a request finishes successfully after downloading the response bodyEmitted when [response] status and headers are received for a request. For a successful response, the sequence of events is `request`, `response` and `requestfinished`.#### page.on('websocket')-- type: <[WebSocket]> websocket+- type: <[WebSocket]>Emitted when <[WebSocket]> request is sent.@@ -1154,7 +1160,7 @@ This method checks an element matching `selector` by performing the following st1. Ensure that matched element is a checkbox or a radio input. If not, this method rejects. If the element is already checked, this method returns immediately.1. Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried.1. Scroll the element into view if needed.-1. Use [page.mouse](#pagemouse) to click in the center of the element.+1. Use [`page.mouse`](#pagemouse) to click in the center of the element.1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.1. Ensure that the element is now checked. If not, this method rejects.@@ -1181,7 +1187,7 @@ This method clicks an element matching `selector` by performing the following st1. Find an element match matching `selector`. If there is none, wait until a matching element is attached to the DOM.1. Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried.1. Scroll the element into view if needed.-1. Use [page.mouse](#pagemouse) to click in the center of the element, or the specified `position`.+1. Use [`page.mouse`](#pagemouse) to click in the center of the element, or the specified `position`.1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.When all steps combined have not finished during the specified `timeout`, this method rejects with a [TimeoutError]. Passing zero timeout disables this.@@ -1198,7 +1204,7 @@ If `runBeforeUnload` is `false`, does not run any unload handlers and waits forBy default, `page.close()` **does not** run `beforeunload` handlers.> **NOTE** if `runBeforeUnload` is passed as true, a `beforeunload` dialog might be summoned-> and should be handled manually via [page.on('dialog')](#pageondialog) event.+> and should be handled manually via [`page.on('dialog')`](#pageondialog) event.#### page.content()- returns: <[Promise]<[string]>>@@ -1233,7 +1239,7 @@ This method double clicks an element matching `selector` by performing the follo1. Find an element match matching `selector`. If there is none, wait until a matching element is attached to the DOM.1. Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried.1. Scroll the element into view if needed.-1. Use [page.mouse](#pagemouse) to double click in the center of the element, or the specified `position`.+1. Use [`page.mouse`](#pagemouse) to double click in the center of the element, or the specified `position`.1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set. Note that if the first click of the `dblclick()` triggers a navigation event, this method will reject.When all steps combined have not finished during the specified `timeout`, this method rejects with a [TimeoutError]. Passing zero timeout disables this.@@ -1614,7 +1620,7 @@ This method hovers over an element matching `selector` by performing the followi1. Find an element match matching `selector`. If there is none, wait until a matching element is attached to the DOM.1. Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried.1. Scroll the element into view if needed.-1. Use [page.mouse](#pagemouse) to hover over the center of the element, or the specified `position`.+1. Use [`page.mouse`](#pagemouse) to hover over the center of the element, or the specified `position`.1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.When all steps combined have not finished during the specified `timeout`, this method rejects with a [TimeoutError]. Passing zero timeout disables this.@@ -1943,7 +1949,7 @@ This method taps an element matching `selector` by performing the following step1. Find an element match matching `selector`. If there is none, wait until a matching element is attached to the DOM.1. Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried.1. Scroll the element into view if needed.-1. Use [page.touchscreen](#pagetouchscreen#pagetouchscreen) to tap the center of the element, or the specified `position`.+1. Use [`page.touchscreen`](#pagetouchscreen) to tap the center of the element, or the specified `position`.1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.When all steps combined have not finished during the specified `timeout`, this method rejects with a [TimeoutError]. Passing zero timeout disables this.@@ -2001,7 +2007,7 @@ This method unchecks an element matching `selector` by performing the following1. Ensure that matched element is a checkbox or a radio input. If not, this method rejects. If the element is already unchecked, this method returns immediately.1. Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried.1. Scroll the element into view if needed.-1. Use [page.mouse](#pagemouse) to click in the center of the element.+1. Use [`page.mouse`](#pagemouse) to click in the center of the element.1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.1. Ensure that the element is now unchecked. If not, this method rejects.@@ -2218,14 +2224,16 @@ This method returns all of the dedicated [WebWorkers](https://developer.mozilla.> **NOTE** This does not contain ServiceWorkers+[Page]: #class-page "Page"+### class: FrameAt every point of time, page exposes its current frame tree via the [`page.mainFrame()`](#pagemainframe) and [`frame.childFrames()`](#framechildframes) methods.[Frame] object's lifecycle is controlled by three events, dispatched on the page object:-* [page.on('frameattached')](#pageonframeattached) - fired when the frame gets attached to the page. A Frame can be attached to the page only once.-* [page.on('framenavigated')](#pageonframenavigated) - fired when the frame commits navigation to a different URL.-* [page.on('framedetached')](#pageonframedetached) - fired when the frame gets detached from the page. A Frame can be detached from the page only once.+* [`page.on('frameattached')`](#pageonframeattached) - fired when the frame gets attached to the page. A Frame can be attached to the page only once.+* [`page.on('framenavigated')`](#pageonframenavigated) - fired when the frame commits navigation to a different URL.+* [`page.on('framedetached')`](#pageonframedetached) - fired when the frame gets detached from the page. A Frame can be detached from the page only once.An example of dumping frame tree:@@ -2390,7 +2398,7 @@ This method checks an element matching `selector` by performing the following st1. Ensure that matched element is a checkbox or a radio input. If not, this method rejects. If the element is already checked, this method returns immediately.1. Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried.1. Scroll the element into view if needed.-1. Use [page.mouse](#pagemouse) to click in the center of the element.+1. Use [`page.mouse`](#pagemouse) to click in the center of the element.1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.1. Ensure that the element is now checked. If not, this method rejects.@@ -2418,7 +2426,7 @@ This method clicks an element matching `selector` by performing the following st1. Find an element match matching `selector`. If there is none, wait until a matching element is attached to the DOM.1. Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried.1. Scroll the element into view if needed.-1. Use [page.mouse](#pagemouse) to click in the center of the element, or the specified `position`.+1. Use [`page.mouse`](#pagemouse) to click in the center of the element, or the specified `position`.1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.When all steps combined have not finished during the specified `timeout`, this method rejects with a [TimeoutError]. Passing zero timeout disables this.@@ -2446,7 +2454,7 @@ This method double clicks an element matching `selector` by performing the follo1. Find an element match matching `selector`. If there is none, wait until a matching element is attached to the DOM.1. Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried.1. Scroll the element into view if needed.-1. Use [page.mouse](#pagemouse) to double click in the center of the element, or the specified `position`.+1. Use [`page.mouse`](#pagemouse) to double click in the center of the element, or the specified `position`.1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set. Note that if the first click of the `dblclick()` triggers a navigation event, this method will reject.When all steps combined have not finished during the specified `timeout`, this method rejects with a [TimeoutError]. Passing zero timeout disables this.@@ -2633,7 +2641,7 @@ This method hovers over an element matching `selector` by performing the followi1. Find an element match matching `selector`. If there is none, wait until a matching element is attached to the DOM.1. Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried.1. Scroll the element into view if needed.-1. Use [page.mouse](#pagemouse) to hover over the center of the element, or the specified `position`.+1. Use [`page.mouse`](#pagemouse) to hover over the center of the element, or the specified `position`.1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.When all steps combined have not finished during the specified `timeout`, this method rejects with a [TimeoutError]. Passing zero timeout disables this.@@ -2766,7 +2774,7 @@ This method taps an element matching `selector` by performing the following step1. Find an element match matching `selector`. If there is none, wait until a matching element is attached to the DOM.1. Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried.1. Scroll the element into view if needed.-1. Use [page.touchscreen](#pagetouchscreen#pagetouchscreen) to tap the center of the element, or the specified `position`.+1. Use [`page.touchscreen`](#pagetouchscreen) to tap the center of the element, or the specified `position`.1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.When all steps combined have not finished during the specified `timeout`, this method rejects with a [TimeoutError]. Passing zero timeout disables this.@@ -2817,7 +2825,7 @@ This method checks an element matching `selector` by performing the following st1. Ensure that matched element is a checkbox or a radio input. If not, this method rejects. If the element is already unchecked, this method returns immediately.1. Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried.1. Scroll the element into view if needed.-1. Use [page.mouse](#pagemouse) to click in the center of the element.+1. Use [`page.mouse`](#pagemouse) to click in the center of the element.1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.1. Ensure that the element is now unchecked. If not, this method rejects.@@ -2943,6 +2951,8 @@ Waits for the given `timeout` in milliseconds.Note that `frame.waitForTimeout()` should only be used for debugging. Tests using the timer in production are going to be flaky. Use signals such as network events, selectors becoming visible and others instead.+[Frame]: #class-frame "Frame"+### class: ElementHandle* extends: [JSHandle]@@ -3097,7 +3107,7 @@ This method checks the element by performing the following steps:1. Ensure that element is a checkbox or a radio input. If not, this method rejects. If the element is already checked, this method returns immediately.1. Wait for [actionability](./actionability.md) checks on the element, unless `force` option is set.1. Scroll the element into view if needed.-1. Use [page.mouse](#pagemouse) to click in the center of the element.+1. Use [`page.mouse`](#pagemouse) to click in the center of the element.1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.1. Ensure that the element is now checked. If not, this method rejects.@@ -3122,7 +3132,7 @@ When all steps combined have not finished during the specified `timeout`, this mThis method clicks the element by performing the following steps:1. Wait for [actionability](./actionability.md) checks on the element, unless `force` option is set.1. Scroll the element into view if needed.-1. Use [page.mouse](#pagemouse) to click in the center of the element, or the specified `position`.+1. Use [`page.mouse`](#pagemouse) to click in the center of the element, or the specified `position`.1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.If the element is detached from the DOM at any moment during the action, this method rejects.@@ -3150,7 +3160,7 @@ Returns the content frame for element handles referencing iframe nodes, or `nullThis method double clicks the element by performing the following steps:1. Wait for [actionability](./actionability.md) checks on the element, unless `force` option is set.1. Scroll the element into view if needed.-1. Use [page.mouse](#pagemouse) to double click in the center of the element, or the specified `position`.+1. Use [`page.mouse`](#pagemouse) to double click in the center of the element, or the specified `position`.1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set. Note that if the first click of the `dblclick()` triggers a navigation event, this method will reject.If the element is detached from the DOM at any moment during the action, this method rejects.@@ -3222,7 +3232,7 @@ Returns element attribute value.This method hovers over the element by performing the following steps:1. Wait for [actionability](./actionability.md) checks on the element, unless `force` option is set.1. Scroll the element into view if needed.-1. Use [page.mouse](#pagemouse) to hover over the center of the element, or the specified `position`.+1. Use [`page.mouse`](#pagemouse) to hover over the center of the element, or the specified `position`.1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.If the element is detached from the DOM at any moment during the action, this method rejects.@@ -3351,7 +3361,7 @@ Sets the value of the file input to these file paths or files. If some of the `fThis method taps the element by performing the following steps:1. Wait for [actionability](./actionability.md) checks on the element, unless `force` option is set.1. Scroll the element into view if needed.-1. Use [page.touchscreen](#pagetouchscreen) to tap in the center of the element, or the specified `position`.+1. Use [`page.touchscreen`](#pagetouchscreen) to tap the center of the element, or the specified `position`.1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.If the element is detached from the DOM at any moment during the action, this method rejects.@@ -3404,7 +3414,7 @@ This method checks the element by performing the following steps:1. Ensure that element is a checkbox or a radio input. If not, this method rejects. If the element is already unchecked, this method returns immediately.1. Wait for [actionability](./actionability.md) checks on the element, unless `force` option is set.1. Scroll the element into view if needed.-1. Use [page.mouse](#pagemouse) to click in the center of the element.+1. Use [`page.mouse`](#pagemouse) to click in the center of the element.1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.1. Ensure that the element is now unchecked. If not, this method rejects.@@ -3453,6 +3463,8 @@ const span = await div.waitForSelector('span', { state: 'attached' });> **NOTE** This method does not work across navigations, use [`page.waitForSelector(selector[, options])`](#pagewaitforselectorselector-options) instead.+[ElementHandle]: #class-elementhandle "ElementHandle"+### class: JSHandleJSHandle represents an in-page JavaScript object. JSHandles can be created with the [`page.evaluateHandle(pageFunction[, arg])`](#pageevaluatehandlepagefunction-arg) method.@@ -3545,9 +3557,11 @@ Returns a JSON representation of the object. If the object has a `toJSON` functi> **NOTE** The method will return an empty JSON object if the referenced object is not stringifiable. It will throw an error if the object has circular references.+[JSHandle]: #class-jshandle "JSHandle"+### class: ConsoleMessage-[ConsoleMessage] objects are dispatched by page via the [page.on('console')](#pageonconsole) event.+[ConsoleMessage] objects are dispatched by page via the [`page.on('console')`](#pageonconsole) event.<!-- GEN:toc -->- [consoleMessage.args()](#consolemessageargs)@@ -3573,9 +3587,11 @@ Returns a JSON representation of the object. If the object has a `toJSON` functiOne of the following values: `'log'`, `'debug'`, `'info'`, `'error'`, `'warning'`, `'dir'`, `'dirxml'`, `'table'`, `'trace'`, `'clear'`, `'startGroup'`, `'startGroupCollapsed'`, `'endGroup'`, `'assert'`, `'profile'`, `'profileEnd'`, `'count'`, `'timeEnd'`.+[ConsoleMessage]: #class-consolemessage "ConsoleMessage"+### class: Dialog-[Dialog] objects are dispatched by page via the [page.on('dialog')](#pageondialog) event.+[Dialog] objects are dispatched by page via the [`page.on('dialog')`](#pageondialog) event.An example of using `Dialog` class:@@ -3628,9 +3644,11 @@ A message displayed in the dialog.Returns dialog's type, can be one of `alert`, `beforeunload`, `confirm` or `prompt`.+[Dialog]: #class-dialog "Dialog"+### class: Download-[Download] objects are dispatched by page via the [page.on('download')](#pageondownload) event.+[Download] objects are dispatched by page via the [`page.on('download')`](#pageondownload) event.All the downloaded files belonging to the browser context are deleted when the browser context is closed. All downloaded files are deleted when the browser closes.@@ -3694,6 +3712,8 @@ Returns suggested filename for this download. It is typically computed by the brReturns downloaded url.+[Download]: #class-download "Download"+### class: VideoWhen browser context is created with the `videosPath` option, each page has a video object associated with it.@@ -3711,9 +3731,11 @@ console.log(await page.video().path());Returns the file system path this video will be recorded to. The video is guaranteed to be written to the filesystem upon closing the browser context.+[Video]: #class-video "Video"+### class: FileChooser-[FileChooser] objects are dispatched by the page in the [page.on('filechooser')](#pageonfilechooser) event.+[FileChooser] objects are dispatched by the page in the [`page.on('filechooser')`](#pageonfilechooser) event.```jspage.on('filechooser', async (fileChooser) => {@@ -3755,6 +3777,8 @@ Returns page this file chooser belongs to.Sets the value of the file input this chooser is associated with. If some of the `filePaths` are relative paths, then they are resolved relative to the the current working directory. For empty array, clears the selected files.+[FileChooser]: #class-filechooser "FileChooser"+### class: KeyboardKeyboard provides an api for managing a virtual keyboard. The high level api is [`keyboard.type(text[, options])`](#keyboardtypetext-options), which takes raw characters and generates proper keydown, keypress/input, and keyup events on your page.@@ -3890,11 +3914,13 @@ await page.keyboard.type('World', {delay: 100}); // Types slower, like a userDispatches a `keyup` event.+[Keyboard]: #class-keyboard "Keyboard"+### class: MouseThe Mouse class operates in main-frame CSS pixels relative to the top-left corner of the viewport.-Every `page` object has its own Mouse, accessible with [page.mouse](#pagemouse).+Every `page` object has its own Mouse, accessible with [`page.mouse`](#pagemouse).```js// Using ‘page.mouse’ to trace a 100x100 square.@@ -3961,6 +3987,8 @@ Dispatches a `mousemove` event.Dispatches a `mouseup` event.+[Mouse]: #class-mouse "Mouse"+### class: TouchscreenThe Touchscreen class operates in main-frame CSS pixels relative to the top-left corner of the viewport. Methods on the touchscreen can only be used in browser contexts that have been intialized with `hasTouch` set to true.@@ -3972,14 +4000,16 @@ The Touchscreen class operates in main-frame CSS pixels relative to the top-leftDispatches a `touchstart` and `touchend` event with a single touch at the position (`x`,`y`).+[Touchscreen]: #class-touchscreen "Touchscreen"+### class: RequestWhenever the page sends a request for a network resource the following sequence of events are emitted by [Page]:-* [page.on('request')](#pageonrequest) emitted when the request is issued by the page.-* [page.on('response')](#pageonresponse) emitted when/if the response status and headers are received for the request.-* [page.on('requestfinished')](#pageonrequestfinished) emitted when the response body is downloaded and the request is complete.+* [`page.on('request')`](#pageonrequest) emitted when the request is issued by the page.+* [`page.on('response')`](#pageonresponse) emitted when/if the response status and headers are received for the request.+* [`page.on('requestfinished')`](#pageonrequestfinished) emitted when the response body is downloaded and the request is complete.-If request fails at some point, then instead of `'requestfinished'` event (and possibly instead of 'response' event), the [page.on('requestfailed')](#pageonrequestfailed) event is emitted.+If request fails at some point, then instead of `'requestfinished'` event (and possibly instead of 'response' event), the [`page.on('requestfailed')`](#pageonrequestfailed) event is emitted.> **NOTE** HTTP Error responses, such as 404 or 503, are still successful responses from HTTP standpoint, so request will complete with `'requestfinished'` event.@@ -4122,6 +4152,8 @@ console.log(request.timing());URL of the request.+[Request]: #class-request "Request"+### class: Response[Response] class represents responses which are received by page.@@ -4197,6 +4229,8 @@ Returns the text representation of response body.Contains the URL of the response.+[Response]: #class-response "Response"+### class: SelectorsSelectors can be used to install custom selector engines. See [Working with selectors](#working-with-selectors) for more information.@@ -4251,6 +4285,8 @@ const { selectors, firefox } = require('playwright'); // Or 'chromium' or 'webk})();```+[Selectors]: #class-selectors "Selectors"+### class: RouteWhenever a network route is set up with [`page.route(url, handler)`](#pagerouteurl-handler) or [`browserContext.route(url, handler)`](#browsercontextrouteurl-handler), the `Route` object allows to handle the route.@@ -4338,6 +4374,8 @@ await page.route('**/xhr_endpoint', route => route.fulfill({ path: 'mock_data.jsA request to be routed.+[Route]: #class-route "Route"+### class: WebSocketThe [WebSocket] class represents websocket connections in the page.@@ -4357,19 +4395,19 @@ The [WebSocket] class represents websocket connections in the page.Fired when the websocket closes.#### webSocket.on('framereceived')-- type: <[Object]> web socket frame data+- type: <[Object]>- `payload` <[string]|[Buffer]> frame payloadFired when the websocket recieves a frame.#### webSocket.on('framesent')-- type: <[Object]> web socket frame data+- type: <[Object]>- `payload` <[string]|[Buffer]> frame payloadFired when the websocket sends a frame.#### webSocket.on('socketerror')-- type: <[String]> the error message+- type: <[String]>Fired when the websocket has an error.@@ -4394,11 +4432,15 @@ Returns the event data value.Waits for event to fire and passes its value into the predicate function. Returns when the predicate returns truthy value. Will throw an error if the webSocket is closed before the event is fired.+[WebSocket]: #class-websocket "WebSocket"+### class: TimeoutError* extends: [Error]TimeoutError is emitted whenever certain operations are terminated due to timeout, e.g. [`page.waitForSelector(selector[, options])`](#pagewaitforselectorselector-options) or [`browserType.launch([options])`](#browsertypelaunchoptions).+[TimeoutError]: #class-timeouterror "TimeoutError"+### class: AccessibilityThe Accessibility class provides methods for inspecting Chromium's accessibility tree. The accessibility tree is used by assistive technology such as [screen readers](https://en.wikipedia.org/wiki/Screen_reader) or [switches](https://en.wikipedia.org/wiki/Switch_access).@@ -4434,8 +4476,8 @@ Most of the accessibility tree gets filtered out when converting from Blink AX T- `readonly` <[boolean]> Whether the node is read only, if applicable.- `required` <[boolean]> Whether the node is required, if applicable.- `selected` <[boolean]> Whether the node is selected in its parent node, if applicable.- - `checked` <[boolean]|"mixed"> Whether the checkbox is checked, or "mixed", if applicable.- - `pressed` <[boolean]|"mixed"> Whether the toggle button is checked, or "mixed", if applicable.+ - `checked` <boolean|"mixed"> Whether the checkbox is checked, or "mixed", if applicable.+ - `pressed` <boolean|"mixed"> Whether the toggle button is checked, or "mixed", if applicable.- `level` <[number]> The level of a heading, if applicable.- `valuemin` <[number]> The minimum value in a node, if applicable.- `valuemax` <[number]> The maximum value in a node, if applicable.@@ -4443,7 +4485,7 @@ Most of the accessibility tree gets filtered out when converting from Blink AX T- `haspopup` <[string]> What kind of popup is currently being shown for a node, if applicable.- `invalid` <[string]> Whether and in what way this node's value is invalid, if applicable.- `orientation` <[string]> Whether the node is oriented horizontally or vertically, if applicable.- - `children` <[Array]<[Object]>> Child [AXNode]s of this node, if any, if applicable.+ - `children` <[Array]<[Object]>> Child nodes, if any, if applicable.Captures the current state of the accessibility tree. The returned object represents the root accessible node of the page.@@ -4474,6 +4516,8 @@ function findFocusedNode(node) {}```+[Accessibility]: #class-accessibility "Accessibility"+### class: WorkerThe Worker class represents a [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API). `worker` event is emitted on the page object to signal a worker creation. `close` event is emitted on the worker object when the worker is gone.@@ -4526,6 +4570,8 @@ If the function passed to the `worker.evaluateHandle` returns a [Promise], then#### worker.url()- returns: <[string]>+[Worker]: #class-worker "Worker"+### class: BrowserServer<!-- GEN:toc -->@@ -4562,6 +4608,8 @@ Browser websocket url.Browser websocket endpoint which can be used as an argument to [`browserType.connect(params)`](#browsertypeconnectparams) to establish connection to the browser.+[BrowserServer]: #class-browserserver "BrowserServer"+### class: BrowserTypeBrowserType provides methods to launch a specific browser instance or connect to an existing one. The following is a typical example of using Playwright to drive automation:@@ -4693,7 +4741,7 @@ const browser = await chromium.launch({ // Or 'firefox' or 'webkit'.- `height` <[number]> Video frame height.- `slowMo` <[number]> Slows down Playwright operations by the specified amount of milliseconds. Useful so that you can see what is going on. Defaults to 0.- `timeout` <[number]> Maximum time in milliseconds to wait for the browser instance to start. Defaults to `30000` (30 seconds). Pass `0` to disable timeout.- - `timezoneId` <[string]> Changes the timezone of the context. See [ICU’s `metaZones.txt`](https://cs.chromium.org/chromium/src/third_party/icu/source/data/misc/metaZones.txt?rcl=faee8bc70570192d82d2978a71e2a615788597d1) for a list of supported timezone IDs.+ - `timezoneId` <[string]> Changes the timezone of the context. See [ICU's metaZones.txt](https://cs.chromium.org/chromium/src/third_party/icu/source/data/misc/metaZones.txt?rcl=faee8bc70570192d82d2978a71e2a615788597d1) for a list of supported timezone IDs.- `userAgent` <[string]> Specific user agent to use in this context.- `videoSize` <[Object]> **NOTE** Use `recordVideo` instead, it takes precedence over `videoSize`. Specifies dimensions of the automatically recorded video. Can only be used if `videosPath` is set. If not specified the size will be equal to `viewport`. If `viewport` is not configured explicitly the video size defaults to 1280x720. Actual picture of the page will be scaled down if necessary to fit specified size.- `width` <[number]> Video frame width.@@ -4754,6 +4802,8 @@ const { chromium } = require('playwright'); // Or 'webkit' or 'firefox'.Returns browser name. For example: `'chromium'`, `'webkit'` or `'firefox'`.+[BrowserType]: #class-browsertype "BrowserType"+### class: LoggerPlaywright generates a lot of logs and they are accessible via the pluggable logger sink.@@ -4792,6 +4842,8 @@ Determines whether sink is interested in the logger with the given name and seve- `hints` <[Object]> optional formatting hints- `color` <[string]> Optional preferred logger color.+[Logger]: #class-logger "Logger"+### class: ChromiumBrowser* extends: [Browser]@@ -4839,6 +4891,8 @@ Only one trace can be active at a time per browser.Returns the buffer with trace data.+[ChromiumBrowser]: #class-chromiumbrowser "ChromiumBrowser"+### class: ChromiumBrowserContext* extends: [BrowserContext]@@ -4911,6 +4965,8 @@ Returns the newly created session.All existing service workers in the context.+[ChromiumBrowserContext]: #class-chromiumbrowsercontext "ChromiumBrowserContext"+### class: ChromiumCoverageCoverage gathers information about parts of JavaScript and CSS that were used by the page.@@ -4990,6 +5046,8 @@ Returns the array of coverage reports for all scripts> **NOTE** JavaScript Coverage doesn't include anonymous scripts by default. However, scripts with sourceURLs are reported.+[ChromiumCoverage]: #class-chromiumcoverage "ChromiumCoverage"+### class: CDPSession* extends: [EventEmitter](https://nodejs.org/api/events.html#events_class_eventemitter)@@ -5027,6 +5085,8 @@ Detaches the CDPSession from the target. Once detached, the CDPSession object wo- `params` <[Object]> Optional method parameters- returns: <[Promise]<[Object]>>+[CDPSession]: #class-cdpsession "CDPSession"+### class: FirefoxBrowser* extends: [Browser]@@ -5042,6 +5102,8 @@ Firefox browser instance does not expose Firefox-specific features.- [browser.version()](#browserversion)<!-- GEN:stop -->+[FirefoxBrowser]: #class-firefoxbrowser "FirefoxBrowser"+### class: WebKitBrowser* extends: [Browser]@@ -5057,6 +5119,34 @@ WebKit browser instance does not expose WebKit-specific features.- [browser.version()](#browserversion)<!-- GEN:stop -->+[WebKitBrowser]: #class-webkitbrowser "WebKitBrowser"++[Array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array "Array"+[Buffer]: https://nodejs.org/api/buffer.html#buffer_class_buffer "Buffer"+[ChildProcess]: https://nodejs.org/api/child_process.html "ChildProcess"+[Element]: https://developer.mozilla.org/en-US/docs/Web/API/element "Element"+[Error]: https://nodejs.org/api/errors.html#errors_class_error "Error"+[EvaluationArgument]: #evaluationargument "Evaluation Argument"+[Map]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map "Map"+[Object]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object "Object"+[Promise]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise "Promise"+[RegExp]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp "RegExp"+[Serializable]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#Description "Serializable"+[UIEvent.detail]: https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/detail "UIEvent.detail"+[URL]: https://nodejs.org/api/url.html "URL"+[USKeyboardLayout]: ../src/usKeyboardLayout.ts "USKeyboardLayout"+[UnixTime]: https://en.wikipedia.org/wiki/Unix_time "Unix Time"+[boolean]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type "Boolean"+[function]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function "Function"+[iterator]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols "Iterator"+[null]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null "null"+[number]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type "Number"+[origin]: https://developer.mozilla.org/en-US/docs/Glossary/Origin "Origin"+[selector]: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors "selector"+[Readable]: https://nodejs.org/api/stream.html#stream_class_stream_readable "Readable"+[string]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type "string"+[xpath]: https://developer.mozilla.org/en-US/docs/Web/XPath "xpath"+### EvaluationArgumentPlaywright evaluation methods like [page.evaluate(pageFunction[, arg])](#pageevaluatepagefunction-arg) take a single optional argument. This argument can be a mix of [Serializable] values and [JSHandle] or [ElementHandle] instances. Handles are automatically converted to the value they represent.@@ -5214,63 +5304,3 @@ const { chromium } = require('playwright');> **NOTE** It is not yet possible to test extension popups or content scripts.-[AXNode]: #accessibilitysnapshotoptions "AXNode"-[Accessibility]: #class-accessibility "Accessibility"-[Array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array "Array"-[Body]: #class-body "Body"-[BrowserServer]: #class-browserserver "BrowserServer"-[BrowserContext]: #class-browsercontext "BrowserContext"-[BrowserType]: #class-browsertype "BrowserType"-[Browser]: #class-browser "Browser"-[Buffer]: https://nodejs.org/api/buffer.html#buffer_class_buffer "Buffer"-[ChildProcess]: https://nodejs.org/api/child_process.html "ChildProcess"-[ChromiumBrowser]: #class-chromiumbrowser "ChromiumBrowser"-[ChromiumBrowserContext]: #class-chromiumbrowsercontext "ChromiumBrowserContext"-[ChromiumCoverage]: #class-chromiumcoverage "ChromiumCoverage"-[CDPSession]: #class-cdpsession "CDPSession"-[ConsoleMessage]: #class-consolemessage "ConsoleMessage"-[Dialog]: #class-dialog "Dialog"-[Download]: #class-download "Download"-[ElementHandle]: #class-elementhandle "ElementHandle"-[Element]: https://developer.mozilla.org/en-US/docs/Web/API/element "Element"-[Error]: https://nodejs.org/api/errors.html#errors_class_error "Error"-[EvaluationArgument]: #evaluationargument "Evaluation Argument"-[File]: #class-file "https://developer.mozilla.org/en-US/docs/Web/API/File"-[FileChooser]: #class-filechooser "FileChooser"-[FirefoxBrowser]: #class-firefoxbrowser "FirefoxBrowser"-[Frame]: #class-frame "Frame"-[JSHandle]: #class-jshandle "JSHandle"-[Keyboard]: #class-keyboard "Keyboard"-[Logger]: #class-logger "Logger"-[Map]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map "Map"-[Mouse]: #class-mouse "Mouse"-[Object]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object "Object"-[Page]: #class-page "Page"-[Playwright]: #class-playwright "Playwright"-[Promise]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise "Promise"-[RegExp]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp-[Request]: #class-request "Request"-[Response]: #class-response "Response"-[Route]: #class-route "Route"-[Selectors]: #class-selectors "Selectors"-[Serializable]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#Description "Serializable"-[TimeoutError]: #class-timeouterror "TimeoutError"-[Touchscreen]: #class-touchscreen "Touchscreen"-[UIEvent.detail]: https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/detail "UIEvent.detail"-[URL]: https://nodejs.org/api/url.html-[USKeyboardLayout]: ../src/usKeyboardLayout.ts "USKeyboardLayout"-[UnixTime]: https://en.wikipedia.org/wiki/Unix_time "Unix Time"-[Video]: #class-video "Video"-[WebKitBrowser]: #class-webkitbrowser "WebKitBrowser"-[WebSocket]: #class-websocket "WebSocket"-[Worker]: #class-worker "Worker"-[boolean]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type "Boolean"-[function]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function "Function"-[iterator]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols "Iterator"-[null]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null-[number]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type "Number"-[origin]: https://developer.mozilla.org/en-US/docs/Glossary/Origin "Origin"-[selector]: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors "selector"-[Readable]: https://nodejs.org/api/stream.html#stream_class_stream_readable "Readable"-[string]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type "String"-[xpath]: https://developer.mozilla.org/en-US/docs/Web/XPath "xpath"diff --git a/types/types.d.ts b/types/types.d.tsindex 5efd82e60e..290aa7bea1 100644--- a/types/types.d.ts+++ b/types/types.d.ts@@ -28,8 +28,12 @@ type ElementHandleWaitForSelectorOptionsNotHidden = ElementHandleWaitForSelector};/**- * Page provides methods to interact with a single tab in a Browser, or an extension background page in Chromium. One Browser instance might have multiple Page instances.+ * - extends: [EventEmitter](https://nodejs.org/api/events.html#events_class_eventemitter)+ *+ * Page provides methods to interact with a single tab in a [Browser], or an [extension background page](https://developer.chrome.com/extensions/background_pages) in Chromium. One [Browser] instance might have multiple [Page] instances.+ ** This example creates a page, navigates it to a URL, and then saves a screenshot:+ ** ```js* const { webkit } = require('playwright'); // Or 'chromium' or 'firefox'.*@@ -42,12 +46,17 @@ type ElementHandleWaitForSelectorOptionsNotHidden = ElementHandleWaitForSelector* await browser.close();* })();* ```- * The Page class emits various events (described below) which can be handled using any of Node's native `EventEmitter` methods, such as `on`, `once` or `removeListener`.+ *+ * The Page class emits various events (described below) which can be handled using any of Node's native [`EventEmitter`](https://nodejs.org/api/events.html#events_class_eventemitter) methods, such as `on`, `once` or `removeListener`.+ ** This example logs a message for a single page `load` event:+ ** ```js* page.once('load', () => console.log('Page loaded!'));* ```+ ** To unsubscribe from events use the `removeListener` method:+ ** ```js* function logRequest(interceptedRequest) {* console.log('A request was made:', interceptedRequest.url());@@ -56,32 +65,42 @@ type ElementHandleWaitForSelectorOptionsNotHidden = ElementHandleWaitForSelector* // Sometime later...* page.removeListener('request', logRequest);* ```+ **/export interface Page {/*** Returns the value of the `pageFunction` invocation.- * If the function passed to the `page.evaluate` returns a Promise, then `page.evaluate` would wait for the promise to resolve and return its value.- * If the function passed to the `page.evaluate` returns a non-Serializable value, then `page.evaluate` resolves to `undefined`. DevTools Protocol also supports transferring some additional values that are not serializable by `JSON`: `-0`, `NaN`, `Infinity`, `-Infinity`, and bigint literals.+ *+ * If the function passed to the `page.evaluate` returns a [Promise], then `page.evaluate` would wait for the promise to resolve and return its value.+ *+ * If the function passed to the `page.evaluate` returns a non-[Serializable] value, then `page.evaluate` resolves to `undefined`. DevTools Protocol also supports transferring some additional values that are not serializable by `JSON`: `-0`, `NaN`, `Infinity`, `-Infinity`, and bigint literals.+ ** Passing argument to `pageFunction`:+ ** ```js* const result = await page.evaluate(([x, y]) => {* return Promise.resolve(x * y);* }, [7, 8]);* console.log(result); // prints "56"* ```+ ** A string can also be passed in instead of a function:+ ** ```js* console.log(await page.evaluate('1 + 2')); // prints "3"* const x = 10;* console.log(await page.evaluate(`1 + ${x}`)); // prints "11"* ```- * ElementHandle instances can be passed as an argument to the `page.evaluate`:+ *+ * [ElementHandle] instances can be passed as an argument to the `page.evaluate`:+ ** ```js* const bodyHandle = await page.$('body');* const html = await page.evaluate(([body, suffix]) => body.innerHTML + suffix, [bodyHandle, 'hello']);* await bodyHandle.dispose();* ```- * Shortcut for main frame's `frame.evaluate(pageFunction[, arg])`.+ *+ * Shortcut for main frame's [`frame.evaluate(pageFunction[, arg])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#frameevaluatepagefunction-arg).* @param pageFunction Function to be evaluated in the page context* @param arg Optional argument to pass to `pageFunction`*/@@ -90,19 +109,26 @@ export interface Page {/*** Returns the value of the `pageFunction` invocation as in-page object (JSHandle).+ ** The only difference between `page.evaluate` and `page.evaluateHandle` is that `page.evaluateHandle` returns in-page object (JSHandle).- * If the function passed to the `page.evaluateHandle` returns a Promise, then `page.evaluateHandle` would wait for the promise to resolve and return its value.+ *+ * If the function passed to the `page.evaluateHandle` returns a [Promise], then `page.evaluateHandle` would wait for the promise to resolve and return its value.+ ** A string can also be passed in instead of a function:+ ** ```js* const aHandle = await page.evaluateHandle('document'); // Handle for the 'document'* ```- * JSHandle instances can be passed as an argument to the `page.evaluateHandle`:+ *+ * [JSHandle] instances can be passed as an argument to the `page.evaluateHandle`:+ ** ```js* const aHandle = await page.evaluateHandle(() => document.body);* const resultHandle = await page.evaluateHandle(body => body.innerHTML, aHandle);* console.log(await resultHandle.jsonValue());* await resultHandle.dispose();* ```+ ** @param pageFunction Function to be evaluated in the page context* @param arg Optional argument to pass to `pageFunction`*/@@ -111,31 +137,37 @@ export interface Page {/*** The method finds an element matching the specified selector within the page. If no elements match the selector, the return value resolves to `null`.- * Shortcut for main frame's `frame.$(selector)`.- * @param selector A selector to query for. See working with selectors for more details.+ *+ * Shortcut for main frame's [`frame.$(selector)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#frameselector).+ * @param selector A selector to query for. See [working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details.*/$<K extends keyof HTMLElementTagNameMap>(selector: K): Promise<ElementHandleForTag<K> | null>;$(selector: string): Promise<ElementHandle<SVGElement | HTMLElement> | null>;/*** The method finds all elements matching the specified selector within the page. If no elements match the selector, the return value resolves to `[]`.- * Shortcut for main frame's `frame.$$(selector)`.- * @param selector A selector to query for. See working with selectors for more details.+ *+ * Shortcut for main frame's [`frame.$$(selector)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#frameselector).+ * @param selector A selector to query for. See [working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details.*/$$<K extends keyof HTMLElementTagNameMap>(selector: K): Promise<ElementHandleForTag<K>[]>;$$(selector: string): Promise<ElementHandle<SVGElement | HTMLElement>[]>;/*** The method finds an element matching the specified selector within the page and passes it as a first argument to `pageFunction`. If no elements match the selector, the method throws an error. Returns the value of `pageFunction`.- * If `pageFunction` returns a Promise, then `page.$eval(selector, pageFunction[, arg])` would wait for the promise to resolve and return its value.+ *+ * If `pageFunction` returns a [Promise], then [`page.$eval(selector, pageFunction[, arg])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageevalselector-pagefunction-arg) would wait for the promise to resolve and return its value.+ ** Examples:+ ** ```js* const searchValue = await page.$eval('#search', el => el.value);* const preloadHref = await page.$eval('link[rel=preload]', el => el.href);* const html = await page.$eval('.main-container', (e, suffix) => e.outerHTML + suffix, 'hello');* ```- * Shortcut for main frame's `frame.$eval(selector, pageFunction[, arg])`.- * @param selector A selector to query for. See working with selectors for more details.+ *+ * Shortcut for main frame's [`frame.$eval(selector, pageFunction[, arg])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#frameevalselector-pagefunction-arg).+ * @param selector A selector to query for. See [working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details.* @param pageFunction Function to be evaluated in browser context* @param arg Optional argument to pass to `pageFunction`*/@@ -146,12 +178,16 @@ export interface Page {/*** The method finds all elements matching the specified selector within the page and passes an array of matched elements as a first argument to `pageFunction`. Returns the result of `pageFunction` invocation.- * If `pageFunction` returns a Promise, then `page.$$eval(selector, pageFunction[, arg])` would wait for the promise to resolve and return its value.+ *+ * If `pageFunction` returns a [Promise], then [`page.$$eval(selector, pageFunction[, arg])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageevalselector-pagefunction-arg) would wait for the promise to resolve and return its value.+ ** Examples:+ ** ```js* const divsCounts = await page.$$eval('div', (divs, min) => divs.length >= min, 10);* ```- * @param selector A selector to query for. See working with selectors for more details.+ *+ * @param selector A selector to query for. See [working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details.* @param pageFunction Function to be evaluated in browser context* @param arg Optional argument to pass to `pageFunction`*/@@ -162,7 +198,9 @@ export interface Page {/*** Returns when the `pageFunction` returns a truthy value. It resolves to a JSHandle of the truthy value.+ ** The `waitForFunction` can be used to observe viewport size change:+ ** ```js* const { webkit } = require('playwright'); // Or 'chromium' or 'firefox'.*@@ -175,12 +213,15 @@ export interface Page {* await browser.close();* })();* ```+ ** To pass an argument to the predicate of `page.waitForFunction` function:+ ** ```js* const selector = '.foo';* await page.waitForFunction(selector => !!document.querySelector(selector), selector);* ```- * Shortcut for main frame's `frame.waitForFunction(pageFunction[, arg, options])`.+ *+ * Shortcut for main frame's [`frame.waitForFunction(pageFunction[, arg, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#framewaitforfunctionpagefunction-arg-options).* @param pageFunction Function to be evaluated in browser context* @param arg Optional argument to pass to `pageFunction`* @param options@@ -190,8 +231,11 @@ export interface Page {/*** Returns when element specified by selector satisfies `state` option. Returns `null` if waiting for `hidden` or `detached`.+ ** Wait for the `selector` to satisfy `state` option (either appear/disappear from dom, or become visible/hidden). If at the moment of calling the method `selector` already satisfies the condition, the method will return immediately. If the selector doesn't satisfy the condition for the `timeout` milliseconds, the function will throw.+ ** This method works across navigations:+ ** ```js* const { chromium } = require('playwright'); // Or 'firefox' or 'webkit'.*@@ -208,7 +252,8 @@ export interface Page {* await browser.close();* })();* ```- * @param selector A selector to query for. See working with selectors for more details.+ *+ * @param selector A selector to query for. See [working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details.* @param options*/waitForSelector<K extends keyof HTMLElementTagNameMap>(selector: K, options?: PageWaitForSelectorOptionsNotHidden): Promise<ElementHandleForTag<K>>;@@ -217,12 +262,16 @@ export interface Page {waitForSelector(selector: string, options: PageWaitForSelectorOptions): Promise<null|ElementHandle<SVGElement | HTMLElement>>;/**- * The method adds a function called `name` on the `window` object of every frame in this page. When called, the function executes `playwrightBinding` and returns a Promise which resolves to the return value of `playwrightBinding`. If the `playwrightBinding` returns a Promise, it will be awaited.+ * The method adds a function called `name` on the `window` object of every frame in this page. When called, the function executes `playwrightBinding` and returns a [Promise] which resolves to the return value of `playwrightBinding`. If the `playwrightBinding` returns a [Promise], it will be awaited.+ ** The first argument of the `playwrightBinding` function contains information about the caller: `{ browserContext: BrowserContext, page: Page, frame: Frame }`.- * See `browserContext.exposeBinding(name, playwrightBinding[, options])` for the context-wide version.+ *+ * See [`browserContext.exposeBinding(name, playwrightBinding[, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextexposebindingname-playwrightbinding-options) for the context-wide version.** > **NOTE** Functions installed via `page.exposeBinding` survive navigations.+ ** An example of exposing page URL to all frames in a page:+ ** ```js* const { webkit } = require('playwright'); // Or 'chromium' or 'firefox'.*@@ -243,7 +292,9 @@ export interface Page {* await page.click('button');* })();* ```+ ** An example of passing an element handle:+ ** ```js* await page.exposeBinding('clicked', async (source, element) => {* console.log(await element.textContent());@@ -256,6 +307,7 @@ export interface Page {* <div>Or click me</div>* `);* ```+ ** @param name Name of the function on the window object.* @param playwrightBinding Callback function that will be called in the Playwright's context.* @param options@@ -269,8 +321,11 @@ export interface Page {/*** Emitted when JavaScript within the page calls one of console API methods, e.g. `console.log` or `console.dir`. Also emitted if the page throws an error or a warning.+ ** The arguments passed into `console.log` appear as arguments on the event handler.+ ** An example of handling `console` event:+ ** ```js* page.on('console', msg => {* for (let i = 0; i < msg.args().length; ++i)@@ -278,12 +333,15 @@ export interface Page {* });* page.evaluate(() => console.log('hello', 5, {foo: 'bar'}));* ```+ **/on(event: 'console', listener: (consoleMessage: ConsoleMessage) => void): this;/*** Emitted when the page crashes. Browser pages might crash if they try to allocate too much memory. When the page crashes, ongoing and subsequent operations will throw.+ ** The most common way to deal with crashes is to catch an exception:+ ** ```js* try {* // Crash might happen during a click.@@ -294,7 +352,9 @@ export interface Page {* // When the page crashes, exception message contains 'crash'.* }* ```+ ** However, when manually listening to events, it might be useful to avoid stalling when the page crashes. In this case, handling `crash` event helps:+ ** ```js* await new Promise((resolve, reject) => {* page.on('requestfinished', async request => {@@ -304,33 +364,36 @@ export interface Page {* page.on('crash', error => reject(error));* });* ```+ **/on(event: 'crash', listener: () => void): this;/**- * Emitted when a JavaScript dialog appears, such as `alert`, `prompt`, `confirm` or `beforeunload`. Playwright can respond to the dialog via `dialog.accept([promptText])` or `dialog.dismiss()` methods.+ * Emitted when a JavaScript dialog appears, such as `alert`, `prompt`, `confirm` or `beforeunload`. Playwright can respond to the dialog via [`dialog.accept([promptText])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#dialogacceptprompttext) or [`dialog.dismiss()`](https://github.com/microsoft/playwright/blob/master/docs/api.md#dialogdismiss) methods.*/on(event: 'dialog', listener: (dialog: Dialog) => void): this;/**- * Emitted when the JavaScript `DOMContentLoaded` event is dispatched.+ * Emitted when the JavaScript [`DOMContentLoaded`](https://developer.mozilla.org/en-US/docs/Web/Events/DOMContentLoaded) event is dispatched.*/on(event: 'domcontentloaded', listener: () => void): this;/**- * Emitted when attachment download started. User can access basic file operations on downloaded content via the passed Download instance.+ * Emitted when attachment download started. User can access basic file operations on downloaded content via the passed [Download] instance.** > **NOTE** Browser context **must** be created with the `acceptDownloads` set to `true` when user needs access to the downloaded content. If `acceptDownloads` is not set or set to `false`, download events are emitted, but the actual download is not performed and user has no access to the downloaded files.*/on(event: 'download', listener: (download: Download) => void): this;/**- * Emitted when a file chooser is supposed to appear, such as after clicking the `<input type=file>`. Playwright can respond to it via setting the input files using `fileChooser.setFiles(files[, options])` that can be uploaded after that.+ * Emitted when a file chooser is supposed to appear, such as after clicking the `<input type=file>`. Playwright can respond to it via setting the input files using [`fileChooser.setFiles(files[, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#filechoosersetfilesfiles-options) that can be uploaded after that.+ ** ```js* page.on('filechooser', async (fileChooser) => {* await fileChooser.setFiles('/tmp/myfile.pdf');* });* ```+ **/on(event: 'filechooser', listener: (fileChooser: FileChooser) => void): this;@@ -350,7 +413,7 @@ export interface Page {on(event: 'framenavigated', listener: (frame: Frame) => void): this;/**- * Emitted when the JavaScript `load` event is dispatched.+ * Emitted when the JavaScript [`load`](https://developer.mozilla.org/en-US/docs/Web/Events/load) event is dispatched.*/on(event: 'load', listener: () => void): this;@@ -360,8 +423,10 @@ export interface Page {on(event: 'pageerror', listener: (error: Error) => void): this;/**- * Emitted when the page opens a new tab or window. This event is emitted in addition to the `browserContext.on('page')`, but only for popups relevant to this page.+ * Emitted when the page opens a new tab or window. This event is emitted in addition to the [`browserContext.on('page')`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextonpage), but only for popups relevant to this page.+ ** The earliest moment that page is available is when it has navigated to the initial url. For example, when opening a popup with `window.open('http://example.com')`, this event will fire when the network request to "http://example.com" is done and its response has started loading in the popup.+ ** ```js* const [popup] = await Promise.all([* page.waitForEvent('popup'),@@ -370,19 +435,19 @@ export interface Page {* console.log(await popup.evaluate('location.href'));* ```*- * > **NOTE** Use `page.waitForLoadState([state, options])` to wait until the page gets to a particular state (you should not need it in most cases).+ * > **NOTE** Use [`page.waitForLoadState([state, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagewaitforloadstatestate-options) to wait until the page gets to a particular state (you should not need it in most cases).*/on(event: 'popup', listener: (page: Page) => void): this;/**- * Emitted when a page issues a request. The [request] object is read-only. In order to intercept and mutate requests, see `page.route(url, handler)` or `browserContext.route(url, handler)`.+ * Emitted when a page issues a request. The [request] object is read-only. In order to intercept and mutate requests, see [`page.route(url, handler)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagerouteurl-handler) or [`browserContext.route(url, handler)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextrouteurl-handler).*/on(event: 'request', listener: (request: Request) => void): this;/*** Emitted when a request fails, for example by timing out.*- * > **NOTE** HTTP Error responses, such as 404 or 503, are still successful responses from HTTP standpoint, so request will complete with `page.on('requestfinished')` event and not with `page.on('requestfailed')`.+ * > **NOTE** HTTP Error responses, such as 404 or 503, are still successful responses from HTTP standpoint, so request will complete with [`page.on('requestfinished')`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageonrequestfinished) event and not with [`page.on('requestfailed')`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageonrequestfailed).*/on(event: 'requestfailed', listener: (request: Request) => void): this;@@ -397,12 +462,12 @@ export interface Page {on(event: 'response', listener: (response: Response) => void): this;/**- * Emitted when <WebSocket> request is sent.+ * Emitted when <[WebSocket]> request is sent.*/on(event: 'websocket', listener: (webSocket: WebSocket) => void): this;/**- * Emitted when a dedicated WebWorker is spawned by the page.+ * Emitted when a dedicated [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) is spawned by the page.*/on(event: 'worker', listener: (worker: Worker) => void): this;@@ -413,8 +478,11 @@ export interface Page {/*** Emitted when JavaScript within the page calls one of console API methods, e.g. `console.log` or `console.dir`. Also emitted if the page throws an error or a warning.+ ** The arguments passed into `console.log` appear as arguments on the event handler.+ ** An example of handling `console` event:+ ** ```js* page.on('console', msg => {* for (let i = 0; i < msg.args().length; ++i)@@ -422,12 +490,15 @@ export interface Page {* });* page.evaluate(() => console.log('hello', 5, {foo: 'bar'}));* ```+ **/once(event: 'console', listener: (consoleMessage: ConsoleMessage) => void): this;/*** Emitted when the page crashes. Browser pages might crash if they try to allocate too much memory. When the page crashes, ongoing and subsequent operations will throw.+ ** The most common way to deal with crashes is to catch an exception:+ ** ```js* try {* // Crash might happen during a click.@@ -438,7 +509,9 @@ export interface Page {* // When the page crashes, exception message contains 'crash'.* }* ```+ ** However, when manually listening to events, it might be useful to avoid stalling when the page crashes. In this case, handling `crash` event helps:+ ** ```js* await new Promise((resolve, reject) => {* page.on('requestfinished', async request => {@@ -448,33 +521,36 @@ export interface Page {* page.on('crash', error => reject(error));* });* ```+ **/once(event: 'crash', listener: () => void): this;/**- * Emitted when a JavaScript dialog appears, such as `alert`, `prompt`, `confirm` or `beforeunload`. Playwright can respond to the dialog via `dialog.accept([promptText])` or `dialog.dismiss()` methods.+ * Emitted when a JavaScript dialog appears, such as `alert`, `prompt`, `confirm` or `beforeunload`. Playwright can respond to the dialog via [`dialog.accept([promptText])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#dialogacceptprompttext) or [`dialog.dismiss()`](https://github.com/microsoft/playwright/blob/master/docs/api.md#dialogdismiss) methods.*/once(event: 'dialog', listener: (dialog: Dialog) => void): this;/**- * Emitted when the JavaScript `DOMContentLoaded` event is dispatched.+ * Emitted when the JavaScript [`DOMContentLoaded`](https://developer.mozilla.org/en-US/docs/Web/Events/DOMContentLoaded) event is dispatched.*/once(event: 'domcontentloaded', listener: () => void): this;/**- * Emitted when attachment download started. User can access basic file operations on downloaded content via the passed Download instance.+ * Emitted when attachment download started. User can access basic file operations on downloaded content via the passed [Download] instance.** > **NOTE** Browser context **must** be created with the `acceptDownloads` set to `true` when user needs access to the downloaded content. If `acceptDownloads` is not set or set to `false`, download events are emitted, but the actual download is not performed and user has no access to the downloaded files.*/once(event: 'download', listener: (download: Download) => void): this;/**- * Emitted when a file chooser is supposed to appear, such as after clicking the `<input type=file>`. Playwright can respond to it via setting the input files using `fileChooser.setFiles(files[, options])` that can be uploaded after that.+ * Emitted when a file chooser is supposed to appear, such as after clicking the `<input type=file>`. Playwright can respond to it via setting the input files using [`fileChooser.setFiles(files[, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#filechoosersetfilesfiles-options) that can be uploaded after that.+ ** ```js* page.on('filechooser', async (fileChooser) => {* await fileChooser.setFiles('/tmp/myfile.pdf');* });* ```+ **/once(event: 'filechooser', listener: (fileChooser: FileChooser) => void): this;@@ -494,7 +570,7 @@ export interface Page {once(event: 'framenavigated', listener: (frame: Frame) => void): this;/**- * Emitted when the JavaScript `load` event is dispatched.+ * Emitted when the JavaScript [`load`](https://developer.mozilla.org/en-US/docs/Web/Events/load) event is dispatched.*/once(event: 'load', listener: () => void): this;@@ -504,8 +580,10 @@ export interface Page {once(event: 'pageerror', listener: (error: Error) => void): this;/**- * Emitted when the page opens a new tab or window. This event is emitted in addition to the `browserContext.on('page')`, but only for popups relevant to this page.+ * Emitted when the page opens a new tab or window. This event is emitted in addition to the [`browserContext.on('page')`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextonpage), but only for popups relevant to this page.+ ** The earliest moment that page is available is when it has navigated to the initial url. For example, when opening a popup with `window.open('http://example.com')`, this event will fire when the network request to "http://example.com" is done and its response has started loading in the popup.+ ** ```js* const [popup] = await Promise.all([* page.waitForEvent('popup'),@@ -514,19 +592,19 @@ export interface Page {* console.log(await popup.evaluate('location.href'));* ```*- * > **NOTE** Use `page.waitForLoadState([state, options])` to wait until the page gets to a particular state (you should not need it in most cases).+ * > **NOTE** Use [`page.waitForLoadState([state, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagewaitforloadstatestate-options) to wait until the page gets to a particular state (you should not need it in most cases).*/once(event: 'popup', listener: (page: Page) => void): this;/**- * Emitted when a page issues a request. The [request] object is read-only. In order to intercept and mutate requests, see `page.route(url, handler)` or `browserContext.route(url, handler)`.+ * Emitted when a page issues a request. The [request] object is read-only. In order to intercept and mutate requests, see [`page.route(url, handler)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagerouteurl-handler) or [`browserContext.route(url, handler)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextrouteurl-handler).*/once(event: 'request', listener: (request: Request) => void): this;/*** Emitted when a request fails, for example by timing out.*- * > **NOTE** HTTP Error responses, such as 404 or 503, are still successful responses from HTTP standpoint, so request will complete with `page.on('requestfinished')` event and not with `page.on('requestfailed')`.+ * > **NOTE** HTTP Error responses, such as 404 or 503, are still successful responses from HTTP standpoint, so request will complete with [`page.on('requestfinished')`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageonrequestfinished) event and not with [`page.on('requestfailed')`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageonrequestfailed).*/once(event: 'requestfailed', listener: (request: Request) => void): this;@@ -541,12 +619,12 @@ export interface Page {once(event: 'response', listener: (response: Response) => void): this;/**- * Emitted when <WebSocket> request is sent.+ * Emitted when <[WebSocket]> request is sent.*/once(event: 'websocket', listener: (webSocket: WebSocket) => void): this;/**- * Emitted when a dedicated WebWorker is spawned by the page.+ * Emitted when a dedicated [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) is spawned by the page.*/once(event: 'worker', listener: (worker: Worker) => void): this;@@ -557,8 +635,11 @@ export interface Page {/*** Emitted when JavaScript within the page calls one of console API methods, e.g. `console.log` or `console.dir`. Also emitted if the page throws an error or a warning.+ ** The arguments passed into `console.log` appear as arguments on the event handler.+ ** An example of handling `console` event:+ ** ```js* page.on('console', msg => {* for (let i = 0; i < msg.args().length; ++i)@@ -566,12 +647,15 @@ export interface Page {* });* page.evaluate(() => console.log('hello', 5, {foo: 'bar'}));* ```+ **/addListener(event: 'console', listener: (consoleMessage: ConsoleMessage) => void): this;/*** Emitted when the page crashes. Browser pages might crash if they try to allocate too much memory. When the page crashes, ongoing and subsequent operations will throw.+ ** The most common way to deal with crashes is to catch an exception:+ ** ```js* try {* // Crash might happen during a click.@@ -582,7 +666,9 @@ export interface Page {* // When the page crashes, exception message contains 'crash'.* }* ```+ ** However, when manually listening to events, it might be useful to avoid stalling when the page crashes. In this case, handling `crash` event helps:+ ** ```js* await new Promise((resolve, reject) => {* page.on('requestfinished', async request => {@@ -592,33 +678,36 @@ export interface Page {* page.on('crash', error => reject(error));* });* ```+ **/addListener(event: 'crash', listener: () => void): this;/**- * Emitted when a JavaScript dialog appears, such as `alert`, `prompt`, `confirm` or `beforeunload`. Playwright can respond to the dialog via `dialog.accept([promptText])` or `dialog.dismiss()` methods.+ * Emitted when a JavaScript dialog appears, such as `alert`, `prompt`, `confirm` or `beforeunload`. Playwright can respond to the dialog via [`dialog.accept([promptText])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#dialogacceptprompttext) or [`dialog.dismiss()`](https://github.com/microsoft/playwright/blob/master/docs/api.md#dialogdismiss) methods.*/addListener(event: 'dialog', listener: (dialog: Dialog) => void): this;/**- * Emitted when the JavaScript `DOMContentLoaded` event is dispatched.+ * Emitted when the JavaScript [`DOMContentLoaded`](https://developer.mozilla.org/en-US/docs/Web/Events/DOMContentLoaded) event is dispatched.*/addListener(event: 'domcontentloaded', listener: () => void): this;/**- * Emitted when attachment download started. User can access basic file operations on downloaded content via the passed Download instance.+ * Emitted when attachment download started. User can access basic file operations on downloaded content via the passed [Download] instance.** > **NOTE** Browser context **must** be created with the `acceptDownloads` set to `true` when user needs access to the downloaded content. If `acceptDownloads` is not set or set to `false`, download events are emitted, but the actual download is not performed and user has no access to the downloaded files.*/addListener(event: 'download', listener: (download: Download) => void): this;/**- * Emitted when a file chooser is supposed to appear, such as after clicking the `<input type=file>`. Playwright can respond to it via setting the input files using `fileChooser.setFiles(files[, options])` that can be uploaded after that.+ * Emitted when a file chooser is supposed to appear, such as after clicking the `<input type=file>`. Playwright can respond to it via setting the input files using [`fileChooser.setFiles(files[, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#filechoosersetfilesfiles-options) that can be uploaded after that.+ ** ```js* page.on('filechooser', async (fileChooser) => {* await fileChooser.setFiles('/tmp/myfile.pdf');* });* ```+ **/addListener(event: 'filechooser', listener: (fileChooser: FileChooser) => void): this;@@ -638,7 +727,7 @@ export interface Page {addListener(event: 'framenavigated', listener: (frame: Frame) => void): this;/**- * Emitted when the JavaScript `load` event is dispatched.+ * Emitted when the JavaScript [`load`](https://developer.mozilla.org/en-US/docs/Web/Events/load) event is dispatched.*/addListener(event: 'load', listener: () => void): this;@@ -648,8 +737,10 @@ export interface Page {addListener(event: 'pageerror', listener: (error: Error) => void): this;/**- * Emitted when the page opens a new tab or window. This event is emitted in addition to the `browserContext.on('page')`, but only for popups relevant to this page.+ * Emitted when the page opens a new tab or window. This event is emitted in addition to the [`browserContext.on('page')`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextonpage), but only for popups relevant to this page.+ ** The earliest moment that page is available is when it has navigated to the initial url. For example, when opening a popup with `window.open('http://example.com')`, this event will fire when the network request to "http://example.com" is done and its response has started loading in the popup.+ ** ```js* const [popup] = await Promise.all([* page.waitForEvent('popup'),@@ -658,19 +749,19 @@ export interface Page {* console.log(await popup.evaluate('location.href'));* ```*- * > **NOTE** Use `page.waitForLoadState([state, options])` to wait until the page gets to a particular state (you should not need it in most cases).+ * > **NOTE** Use [`page.waitForLoadState([state, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagewaitforloadstatestate-options) to wait until the page gets to a particular state (you should not need it in most cases).*/addListener(event: 'popup', listener: (page: Page) => void): this;/**- * Emitted when a page issues a request. The [request] object is read-only. In order to intercept and mutate requests, see `page.route(url, handler)` or `browserContext.route(url, handler)`.+ * Emitted when a page issues a request. The [request] object is read-only. In order to intercept and mutate requests, see [`page.route(url, handler)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagerouteurl-handler) or [`browserContext.route(url, handler)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextrouteurl-handler).*/addListener(event: 'request', listener: (request: Request) => void): this;/*** Emitted when a request fails, for example by timing out.*- * > **NOTE** HTTP Error responses, such as 404 or 503, are still successful responses from HTTP standpoint, so request will complete with `page.on('requestfinished')` event and not with `page.on('requestfailed')`.+ * > **NOTE** HTTP Error responses, such as 404 or 503, are still successful responses from HTTP standpoint, so request will complete with [`page.on('requestfinished')`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageonrequestfinished) event and not with [`page.on('requestfailed')`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageonrequestfailed).*/addListener(event: 'requestfailed', listener: (request: Request) => void): this;@@ -685,12 +776,12 @@ export interface Page {addListener(event: 'response', listener: (response: Response) => void): this;/**- * Emitted when <WebSocket> request is sent.+ * Emitted when <[WebSocket]> request is sent.*/addListener(event: 'websocket', listener: (webSocket: WebSocket) => void): this;/**- * Emitted when a dedicated WebWorker is spawned by the page.+ * Emitted when a dedicated [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) is spawned by the page.*/addListener(event: 'worker', listener: (worker: Worker) => void): this;@@ -701,8 +792,11 @@ export interface Page {/*** Emitted when JavaScript within the page calls one of console API methods, e.g. `console.log` or `console.dir`. Also emitted if the page throws an error or a warning.+ ** The arguments passed into `console.log` appear as arguments on the event handler.+ ** An example of handling `console` event:+ ** ```js* page.on('console', msg => {* for (let i = 0; i < msg.args().length; ++i)@@ -710,12 +804,15 @@ export interface Page {* });* page.evaluate(() => console.log('hello', 5, {foo: 'bar'}));* ```+ **/removeListener(event: 'console', listener: (consoleMessage: ConsoleMessage) => void): this;/*** Emitted when the page crashes. Browser pages might crash if they try to allocate too much memory. When the page crashes, ongoing and subsequent operations will throw.+ ** The most common way to deal with crashes is to catch an exception:+ ** ```js* try {* // Crash might happen during a click.@@ -726,7 +823,9 @@ export interface Page {* // When the page crashes, exception message contains 'crash'.* }* ```+ ** However, when manually listening to events, it might be useful to avoid stalling when the page crashes. In this case, handling `crash` event helps:+ ** ```js* await new Promise((resolve, reject) => {* page.on('requestfinished', async request => {@@ -736,33 +835,36 @@ export interface Page {* page.on('crash', error => reject(error));* });* ```+ **/removeListener(event: 'crash', listener: () => void): this;/**- * Emitted when a JavaScript dialog appears, such as `alert`, `prompt`, `confirm` or `beforeunload`. Playwright can respond to the dialog via `dialog.accept([promptText])` or `dialog.dismiss()` methods.+ * Emitted when a JavaScript dialog appears, such as `alert`, `prompt`, `confirm` or `beforeunload`. Playwright can respond to the dialog via [`dialog.accept([promptText])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#dialogacceptprompttext) or [`dialog.dismiss()`](https://github.com/microsoft/playwright/blob/master/docs/api.md#dialogdismiss) methods.*/removeListener(event: 'dialog', listener: (dialog: Dialog) => void): this;/**- * Emitted when the JavaScript `DOMContentLoaded` event is dispatched.+ * Emitted when the JavaScript [`DOMContentLoaded`](https://developer.mozilla.org/en-US/docs/Web/Events/DOMContentLoaded) event is dispatched.*/removeListener(event: 'domcontentloaded', listener: () => void): this;/**- * Emitted when attachment download started. User can access basic file operations on downloaded content via the passed Download instance.+ * Emitted when attachment download started. User can access basic file operations on downloaded content via the passed [Download] instance.** > **NOTE** Browser context **must** be created with the `acceptDownloads` set to `true` when user needs access to the downloaded content. If `acceptDownloads` is not set or set to `false`, download events are emitted, but the actual download is not performed and user has no access to the downloaded files.*/removeListener(event: 'download', listener: (download: Download) => void): this;/**- * Emitted when a file chooser is supposed to appear, such as after clicking the `<input type=file>`. Playwright can respond to it via setting the input files using `fileChooser.setFiles(files[, options])` that can be uploaded after that.+ * Emitted when a file chooser is supposed to appear, such as after clicking the `<input type=file>`. Playwright can respond to it via setting the input files using [`fileChooser.setFiles(files[, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#filechoosersetfilesfiles-options) that can be uploaded after that.+ ** ```js* page.on('filechooser', async (fileChooser) => {* await fileChooser.setFiles('/tmp/myfile.pdf');* });* ```+ **/removeListener(event: 'filechooser', listener: (fileChooser: FileChooser) => void): this;@@ -782,7 +884,7 @@ export interface Page {removeListener(event: 'framenavigated', listener: (frame: Frame) => void): this;/**- * Emitted when the JavaScript `load` event is dispatched.+ * Emitted when the JavaScript [`load`](https://developer.mozilla.org/en-US/docs/Web/Events/load) event is dispatched.*/removeListener(event: 'load', listener: () => void): this;@@ -792,8 +894,10 @@ export interface Page {removeListener(event: 'pageerror', listener: (error: Error) => void): this;/**- * Emitted when the page opens a new tab or window. This event is emitted in addition to the `browserContext.on('page')`, but only for popups relevant to this page.+ * Emitted when the page opens a new tab or window. This event is emitted in addition to the [`browserContext.on('page')`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextonpage), but only for popups relevant to this page.+ ** The earliest moment that page is available is when it has navigated to the initial url. For example, when opening a popup with `window.open('http://example.com')`, this event will fire when the network request to "http://example.com" is done and its response has started loading in the popup.+ ** ```js* const [popup] = await Promise.all([* page.waitForEvent('popup'),@@ -802,19 +906,19 @@ export interface Page {* console.log(await popup.evaluate('location.href'));* ```*- * > **NOTE** Use `page.waitForLoadState([state, options])` to wait until the page gets to a particular state (you should not need it in most cases).+ * > **NOTE** Use [`page.waitForLoadState([state, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagewaitforloadstatestate-options) to wait until the page gets to a particular state (you should not need it in most cases).*/removeListener(event: 'popup', listener: (page: Page) => void): this;/**- * Emitted when a page issues a request. The [request] object is read-only. In order to intercept and mutate requests, see `page.route(url, handler)` or `browserContext.route(url, handler)`.+ * Emitted when a page issues a request. The [request] object is read-only. In order to intercept and mutate requests, see [`page.route(url, handler)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagerouteurl-handler) or [`browserContext.route(url, handler)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextrouteurl-handler).*/removeListener(event: 'request', listener: (request: Request) => void): this;/*** Emitted when a request fails, for example by timing out.*- * > **NOTE** HTTP Error responses, such as 404 or 503, are still successful responses from HTTP standpoint, so request will complete with `page.on('requestfinished')` event and not with `page.on('requestfailed')`.+ * > **NOTE** HTTP Error responses, such as 404 or 503, are still successful responses from HTTP standpoint, so request will complete with [`page.on('requestfinished')`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageonrequestfinished) event and not with [`page.on('requestfailed')`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageonrequestfailed).*/removeListener(event: 'requestfailed', listener: (request: Request) => void): this;@@ -829,12 +933,12 @@ export interface Page {removeListener(event: 'response', listener: (response: Response) => void): this;/**- * Emitted when <WebSocket> request is sent.+ * Emitted when <[WebSocket]> request is sent.*/removeListener(event: 'websocket', listener: (webSocket: WebSocket) => void): this;/**- * Emitted when a dedicated WebWorker is spawned by the page.+ * Emitted when a dedicated [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) is spawned by the page.*/removeListener(event: 'worker', listener: (worker: Worker) => void): this;@@ -845,8 +949,11 @@ export interface Page {/*** Emitted when JavaScript within the page calls one of console API methods, e.g. `console.log` or `console.dir`. Also emitted if the page throws an error or a warning.+ ** The arguments passed into `console.log` appear as arguments on the event handler.+ ** An example of handling `console` event:+ ** ```js* page.on('console', msg => {* for (let i = 0; i < msg.args().length; ++i)@@ -854,12 +961,15 @@ export interface Page {* });* page.evaluate(() => console.log('hello', 5, {foo: 'bar'}));* ```+ **/off(event: 'console', listener: (consoleMessage: ConsoleMessage) => void): this;/*** Emitted when the page crashes. Browser pages might crash if they try to allocate too much memory. When the page crashes, ongoing and subsequent operations will throw.+ ** The most common way to deal with crashes is to catch an exception:+ ** ```js* try {* // Crash might happen during a click.@@ -870,7 +980,9 @@ export interface Page {* // When the page crashes, exception message contains 'crash'.* }* ```+ ** However, when manually listening to events, it might be useful to avoid stalling when the page crashes. In this case, handling `crash` event helps:+ ** ```js* await new Promise((resolve, reject) => {* page.on('requestfinished', async request => {@@ -880,33 +992,36 @@ export interface Page {* page.on('crash', error => reject(error));* });* ```+ **/off(event: 'crash', listener: () => void): this;/**- * Emitted when a JavaScript dialog appears, such as `alert`, `prompt`, `confirm` or `beforeunload`. Playwright can respond to the dialog via `dialog.accept([promptText])` or `dialog.dismiss()` methods.+ * Emitted when a JavaScript dialog appears, such as `alert`, `prompt`, `confirm` or `beforeunload`. Playwright can respond to the dialog via [`dialog.accept([promptText])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#dialogacceptprompttext) or [`dialog.dismiss()`](https://github.com/microsoft/playwright/blob/master/docs/api.md#dialogdismiss) methods.*/off(event: 'dialog', listener: (dialog: Dialog) => void): this;/**- * Emitted when the JavaScript `DOMContentLoaded` event is dispatched.+ * Emitted when the JavaScript [`DOMContentLoaded`](https://developer.mozilla.org/en-US/docs/Web/Events/DOMContentLoaded) event is dispatched.*/off(event: 'domcontentloaded', listener: () => void): this;/**- * Emitted when attachment download started. User can access basic file operations on downloaded content via the passed Download instance.+ * Emitted when attachment download started. User can access basic file operations on downloaded content via the passed [Download] instance.** > **NOTE** Browser context **must** be created with the `acceptDownloads` set to `true` when user needs access to the downloaded content. If `acceptDownloads` is not set or set to `false`, download events are emitted, but the actual download is not performed and user has no access to the downloaded files.*/off(event: 'download', listener: (download: Download) => void): this;/**- * Emitted when a file chooser is supposed to appear, such as after clicking the `<input type=file>`. Playwright can respond to it via setting the input files using `fileChooser.setFiles(files[, options])` that can be uploaded after that.+ * Emitted when a file chooser is supposed to appear, such as after clicking the `<input type=file>`. Playwright can respond to it via setting the input files using [`fileChooser.setFiles(files[, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#filechoosersetfilesfiles-options) that can be uploaded after that.+ ** ```js* page.on('filechooser', async (fileChooser) => {* await fileChooser.setFiles('/tmp/myfile.pdf');* });* ```+ **/off(event: 'filechooser', listener: (fileChooser: FileChooser) => void): this;@@ -926,7 +1041,7 @@ export interface Page {off(event: 'framenavigated', listener: (frame: Frame) => void): this;/**- * Emitted when the JavaScript `load` event is dispatched.+ * Emitted when the JavaScript [`load`](https://developer.mozilla.org/en-US/docs/Web/Events/load) event is dispatched.*/off(event: 'load', listener: () => void): this;@@ -936,8 +1051,10 @@ export interface Page {off(event: 'pageerror', listener: (error: Error) => void): this;/**- * Emitted when the page opens a new tab or window. This event is emitted in addition to the `browserContext.on('page')`, but only for popups relevant to this page.+ * Emitted when the page opens a new tab or window. This event is emitted in addition to the [`browserContext.on('page')`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextonpage), but only for popups relevant to this page.+ ** The earliest moment that page is available is when it has navigated to the initial url. For example, when opening a popup with `window.open('http://example.com')`, this event will fire when the network request to "http://example.com" is done and its response has started loading in the popup.+ ** ```js* const [popup] = await Promise.all([* page.waitForEvent('popup'),@@ -946,19 +1063,19 @@ export interface Page {* console.log(await popup.evaluate('location.href'));* ```*- * > **NOTE** Use `page.waitForLoadState([state, options])` to wait until the page gets to a particular state (you should not need it in most cases).+ * > **NOTE** Use [`page.waitForLoadState([state, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagewaitforloadstatestate-options) to wait until the page gets to a particular state (you should not need it in most cases).*/off(event: 'popup', listener: (page: Page) => void): this;/**- * Emitted when a page issues a request. The [request] object is read-only. In order to intercept and mutate requests, see `page.route(url, handler)` or `browserContext.route(url, handler)`.+ * Emitted when a page issues a request. The [request] object is read-only. In order to intercept and mutate requests, see [`page.route(url, handler)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagerouteurl-handler) or [`browserContext.route(url, handler)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextrouteurl-handler).*/off(event: 'request', listener: (request: Request) => void): this;/*** Emitted when a request fails, for example by timing out.*- * > **NOTE** HTTP Error responses, such as 404 or 503, are still successful responses from HTTP standpoint, so request will complete with `page.on('requestfinished')` event and not with `page.on('requestfailed')`.+ * > **NOTE** HTTP Error responses, such as 404 or 503, are still successful responses from HTTP standpoint, so request will complete with [`page.on('requestfinished')`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageonrequestfinished) event and not with [`page.on('requestfailed')`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageonrequestfailed).*/off(event: 'requestfailed', listener: (request: Request) => void): this;@@ -973,12 +1090,12 @@ export interface Page {off(event: 'response', listener: (response: Response) => void): this;/**- * Emitted when <WebSocket> request is sent.+ * Emitted when <[WebSocket]> request is sent.*/off(event: 'websocket', listener: (webSocket: WebSocket) => void): this;/**- * Emitted when a dedicated WebWorker is spawned by the page.+ * Emitted when a dedicated [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) is spawned by the page.*/off(event: 'worker', listener: (worker: Worker) => void): this;@@ -988,8 +1105,11 @@ export interface Page {* Adds a script which would be evaluated in one of the following scenarios:* - Whenever the page is navigated.* - Whenever the child frame is attached or navigated. In this case, the script is evaluated in the context of the newly attached frame.+ ** The script is evaluated after the document was created but before any of its scripts were run. This is useful to amend the JavaScript environment, e.g. to seed `Math.random`.+ ** An example of overriding `Math.random` before the page loads:+ ** ```js* // preload.js* Math.random = () => 42;@@ -999,67 +1119,69 @@ export interface Page {* await page.addInitScript(preloadFile);* ```*- * > **NOTE** The order of evaluation of multiple scripts installed via `browserContext.addInitScript(script[, arg])` and `page.addInitScript(script[, arg])` is not defined.+ * > **NOTE** The order of evaluation of multiple scripts installed via [`browserContext.addInitScript(script[, arg])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextaddinitscriptscript-arg) and [`page.addInitScript(script[, arg])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageaddinitscriptscript-arg) is not defined.* @param script Script to be evaluated in the page.* @param arg Optional argument to pass to `script` (only supported when passing a function).*/addInitScript(script: Function|string|{/**- * Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the current working directory.+ * Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the current working directory. Optional.*/path?: string;/**- * Raw script content.+ * Raw script content. Optional.*/content?: string;}, arg?: Serializable): Promise<void>;/*** Adds a `<script>` tag into the page with the desired url or content. Returns the added tag when the script's onload fires or when the script content was injected into frame.- * Shortcut for main frame's `frame.addScriptTag(params)`.+ *+ * Shortcut for main frame's [`frame.addScriptTag(params)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#frameaddscripttagparams).* @param params*/addScriptTag(params: {/**- * URL of a script to be added.+ * URL of a script to be added. Optional.*/url?: string;/**- * Path to the JavaScript file to be injected into frame. If `path` is a relative path, then it is resolved relative to the current working directory.+ * Path to the JavaScript file to be injected into frame. If `path` is a relative path, then it is resolved relative to the current working directory. Optional.*/path?: string;/**- * Raw JavaScript content to be injected into frame.+ * Raw JavaScript content to be injected into frame. Optional.*/content?: string;/**- * Script type. Use 'module' in order to load a Javascript ES6 module. See script for more details.+ * Script type. Use 'module' in order to load a Javascript ES6 module. See [script](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script) for more details. Optional.*/type?: string;}): Promise<ElementHandle>;/*** Adds a `<link rel="stylesheet">` tag into the page with the desired url or a `<style type="text/css">` tag with the content. Returns the added tag when the stylesheet's onload fires or when the CSS content was injected into frame.- * Shortcut for main frame's `frame.addStyleTag(params)`.+ *+ * Shortcut for main frame's [`frame.addStyleTag(params)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#frameaddstyletagparams).* @param params*/addStyleTag(params: {/**- * URL of the `<link>` tag.+ * URL of the `<link>` tag. Optional.*/url?: string;/**- * Path to the CSS file to be injected into frame. If `path` is a relative path, then it is resolved relative to the current working directory.+ * Path to the CSS file to be injected into frame. If `path` is a relative path, then it is resolved relative to the current working directory. Optional.*/path?: string;/**- * Raw CSS content to be injected into frame.+ * Raw CSS content to be injected into frame. Optional.*/content?: string;}): Promise<ElementHandle>;@@ -1071,21 +1193,23 @@ export interface Page {/*** This method checks an element matching `selector` by performing the following steps:- * - Find an element match matching `selector`. If there is none, wait until a matching element is attached to the DOM.- * - Ensure that matched element is a checkbox or a radio input. If not, this method rejects. If the element is already checked, this method returns immediately.- * - Wait for actionability checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried.- * - Scroll the element into view if needed.- * - Use page.mouse to click in the center of the element.- * - Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.- * - Ensure that the element is now checked. If not, this method rejects.- * When all steps combined have not finished during the specified `timeout`, this method rejects with a TimeoutError. Passing zero timeout disables this.- * Shortcut for main frame's `frame.check(selector[, options])`.- * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See working with selectors for more details.+ * 1. Find an element match matching `selector`. If there is none, wait until a matching element is attached to the DOM.+ * 1. Ensure that matched element is a checkbox or a radio input. If not, this method rejects. If the element is already checked, this method returns immediately.+ * 1. Wait for [actionability](https://github.com/microsoft/playwright/blob/master/docs/actionability.md) checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried.+ * 1. Scroll the element into view if needed.+ * 1. Use [`page.mouse`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagemouse) to click in the center of the element.+ * 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.+ * 1. Ensure that the element is now checked. If not, this method rejects.+ *+ * When all steps combined have not finished during the specified `timeout`, this method rejects with a [TimeoutError]. Passing zero timeout disables this.+ *+ * Shortcut for main frame's [`frame.check(selector[, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#framecheckselector-options).+ * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details.* @param options*/check(selector: string, options?: {/**- * Whether to bypass the actionability checks. Defaults to `false`.+ * Whether to bypass the [actionability](https://github.com/microsoft/playwright/blob/master/docs/actionability.md) checks. Defaults to `false`.*/force?: boolean;@@ -1095,31 +1219,33 @@ export interface Page {noWaitAfter?: boolean;/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}): Promise<void>;/*** This method clicks an element matching `selector` by performing the following steps:- * - Find an element match matching `selector`. If there is none, wait until a matching element is attached to the DOM.- * - Wait for actionability checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried.- * - Scroll the element into view if needed.- * - Use page.mouse to click in the center of the element, or the specified `position`.- * - Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.- * When all steps combined have not finished during the specified `timeout`, this method rejects with a TimeoutError. Passing zero timeout disables this.- * Shortcut for main frame's `frame.click(selector[, options])`.- * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See working with selectors for more details.+ * 1. Find an element match matching `selector`. If there is none, wait until a matching element is attached to the DOM.+ * 1. Wait for [actionability](https://github.com/microsoft/playwright/blob/master/docs/actionability.md) checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried.+ * 1. Scroll the element into view if needed.+ * 1. Use [`page.mouse`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagemouse) to click in the center of the element, or the specified `position`.+ * 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.+ *+ * When all steps combined have not finished during the specified `timeout`, this method rejects with a [TimeoutError]. Passing zero timeout disables this.+ *+ * Shortcut for main frame's [`frame.click(selector[, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#frameclickselector-options).+ * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details.* @param options*/click(selector: string, options?: {/*** Defaults to `left`.*/- button?: "left"|"middle"|"right";+ button?: "left"|"right"|"middle";/**- * defaults to 1. See UIEvent.detail.+ * defaults to 1. See [UIEvent.detail].*/clickCount?: number;@@ -1129,7 +1255,7 @@ export interface Page {delay?: number;/**- * Whether to bypass the actionability checks. Defaults to `false`.+ * Whether to bypass the [actionability](https://github.com/microsoft/playwright/blob/master/docs/actionability.md) checks. Defaults to `false`.*/force?: boolean;@@ -1153,23 +1279,23 @@ export interface Page {};/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}): Promise<void>;/*** If `runBeforeUnload` is `false`, does not run any unload handlers and waits for the page to be closed. If `runBeforeUnload` is `true` the method will run unload handlers, but will **not** wait for the page to close.+ ** By default, `page.close()` **does not** run `beforeunload` handlers.** > **NOTE** if `runBeforeUnload` is passed as true, a `beforeunload` dialog might be summoned- *- * > and should be handled manually via `page.on('dialog')` event.+ * > and should be handled manually via [`page.on('dialog')`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageondialog) event.* @param options*/close(options?: {/**- * Defaults to `false`. Whether to run the before unload page handlers.+ * Defaults to `false`. Whether to run the [before unload](https://developer.mozilla.org/en-US/docs/Web/Events/beforeunload) page handlers.*/runBeforeUnload?: boolean;}): Promise<void>;@@ -1185,29 +1311,31 @@ export interface Page {context(): BrowserContext;/**- * Browser-specific Coverage implementation, only available for Chromium atm. See ChromiumCoverage for more details.+ * Browser-specific Coverage implementation, only available for Chromium atm. See [ChromiumCoverage](https://github.com/microsoft/playwright/blob/master/docs/api.md#class-chromiumcoverage) for more details.*/coverage: null|ChromiumCoverage;/*** This method double clicks an element matching `selector` by performing the following steps:- * - Find an element match matching `selector`. If there is none, wait until a matching element is attached to the DOM.- * - Wait for actionability checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried.- * - Scroll the element into view if needed.- * - Use page.mouse to double click in the center of the element, or the specified `position`.- * - Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set. Note that if the first click of the `dblclick()` triggers a navigation event, this method will reject.- * When all steps combined have not finished during the specified `timeout`, this method rejects with a TimeoutError. Passing zero timeout disables this.+ * 1. Find an element match matching `selector`. If there is none, wait until a matching element is attached to the DOM.+ * 1. Wait for [actionability](https://github.com/microsoft/playwright/blob/master/docs/actionability.md) checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried.+ * 1. Scroll the element into view if needed.+ * 1. Use [`page.mouse`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagemouse) to double click in the center of the element, or the specified `position`.+ * 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set. Note that if the first click of the `dblclick()` triggers a navigation event, this method will reject.+ *+ * When all steps combined have not finished during the specified `timeout`, this method rejects with a [TimeoutError]. Passing zero timeout disables this.** > **NOTE** `page.dblclick()` dispatches two `click` events and a single `dblclick` event.- * Shortcut for main frame's `frame.dblclick(selector[, options])`.- * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See working with selectors for more details.+ *+ * Shortcut for main frame's [`frame.dblclick(selector[, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#framedblclickselector-options).+ * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details.* @param options*/dblclick(selector: string, options?: {/*** Defaults to `left`.*/- button?: "left"|"middle"|"right";+ button?: "left"|"right"|"middle";/*** Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0.@@ -1215,7 +1343,7 @@ export interface Page {delay?: number;/**- * Whether to bypass the actionability checks. Defaults to `false`.+ * Whether to bypass the [actionability](https://github.com/microsoft/playwright/blob/master/docs/actionability.md) checks. Defaults to `false`.*/force?: boolean;@@ -1239,44 +1367,51 @@ export interface Page {};/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}): Promise<void>;/**- * The snippet below dispatches the `click` event on the element. Regardless of the visibility state of the elment, `click` is dispatched. This is equivalend to calling element.click().+ * The snippet below dispatches the `click` event on the element. Regardless of the visibility state of the elment, `click` is dispatched. This is equivalend to calling [element.click()](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/click).+ ** ```js* await page.dispatchEvent('button#submit', 'click');* ```+ ** Under the hood, it creates an instance of an event based on the given `type`, initializes it with `eventInit` properties and dispatches it on the element. Events are `composed`, `cancelable` and bubble by default.+ ** Since `eventInit` is event-specific, please refer to the events documentation for the lists of initial properties:- * - DragEvent- * - FocusEvent- * - KeyboardEvent- * - MouseEvent- * - PointerEvent- * - TouchEvent- * - Event+ * - [DragEvent](https://developer.mozilla.org/en-US/docs/Web/API/DragEvent/DragEvent)+ * - [FocusEvent](https://developer.mozilla.org/en-US/docs/Web/API/FocusEvent/FocusEvent)+ * - [KeyboardEvent](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/KeyboardEvent)+ * - [MouseEvent](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/MouseEvent)+ * - [PointerEvent](https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/PointerEvent)+ * - [TouchEvent](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/TouchEvent)+ * - [Event](https://developer.mozilla.org/en-US/docs/Web/API/Event/Event)+ ** You can also specify `JSHandle` as the property value if you want live objects to be passed into the event:+ ** ```js* // Note you can only create DataTransfer in Chromium and Firefox* const dataTransfer = await page.evaluateHandle(() => new DataTransfer());* await page.dispatchEvent('#source', 'dragstart', { dataTransfer });* ```- * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See working with selectors for more details.+ *+ * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details.* @param type DOM event type: `"click"`, `"dragstart"`, etc.* @param eventInit Optional event-specific initialization properties.* @param options*/dispatchEvent(selector: string, type: string, eventInit?: EvaluationArgument, options?: {/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}): Promise<void>;/**+ ** ```js* await page.evaluate(() => matchMedia('screen').matches);* // → true@@ -1295,6 +1430,7 @@ export interface Page {* await page.evaluate(() => matchMedia('print').matches);* // → false* ```+ ** ```js* await page.emulateMedia({ colorScheme: 'dark' });* await page.evaluate(() => matchMedia('(prefers-color-scheme: dark)').matches);@@ -1304,27 +1440,32 @@ export interface Page {* await page.evaluate(() => matchMedia('(prefers-color-scheme: no-preference)').matches);* // → false* ```+ ** @param params*/emulateMedia(params: {/**- * Changes the CSS media type of the page. The only allowed values are `'screen'`, `'print'` and `null`. Passing `null` disables CSS media emulation. Omitting `media` or passing `undefined` does not change the emulated value.+ * Changes the CSS media type of the page. The only allowed values are `'screen'`, `'print'` and `null`. Passing `null` disables CSS media emulation. Omitting `media` or passing `undefined` does not change the emulated value. Optional.*/- media?: null|"print"|"screen";+ media?: null|"screen"|"print";/**- * Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. Passing `null` disables color scheme emulation. Omitting `colorScheme` or passing `undefined` does not change the emulated value.+ * Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. Passing `null` disables color scheme emulation. Omitting `colorScheme` or passing `undefined` does not change the emulated value. Optional.*/- colorScheme?: null|"dark"|"light"|"no-preference";+ colorScheme?: null|"light"|"dark"|"no-preference";}): Promise<void>;/**- * The method adds a function called `name` on the `window` object of every frame in the page. When called, the function executes `playwrightFunction` and returns a Promise which resolves to the return value of `playwrightFunction`.- * If the `playwrightFunction` returns a Promise, it will be awaited.- * See `browserContext.exposeFunction(name, playwrightFunction)` for context-wide exposed function.+ * The method adds a function called `name` on the `window` object of every frame in the page. When called, the function executes `playwrightFunction` and returns a [Promise] which resolves to the return value of `playwrightFunction`.+ *+ * If the `playwrightFunction` returns a [Promise], it will be awaited.+ *+ * See [`browserContext.exposeFunction(name, playwrightFunction)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextexposefunctionname-playwrightfunction) for context-wide exposed function.** > **NOTE** Functions installed via `page.exposeFunction` survive navigations.+ ** An example of adding an `md5` function to the page:+ ** ```js* const { webkit } = require('playwright'); // Or 'chromium' or 'firefox'.* const crypto = require('crypto');@@ -1345,7 +1486,9 @@ export interface Page {* await page.click('button');* })();* ```+ ** An example of adding a `window.readfile` function to the page:+ ** ```js* const { chromium } = require('playwright'); // Or 'firefox' or 'webkit'.* const fs = require('fs');@@ -1372,16 +1515,19 @@ export interface Page {* await browser.close();* })();* ```+ ** @param name Name of the function on the window object* @param playwrightFunction Callback function which will be called in Playwright's context.*/exposeFunction(name: string, playwrightFunction: Function): Promise<void>;/**- * This method waits for an element matching `selector`, waits for actionability checks, focuses the element, fills it and triggers an `input` event after filling. If the element matching `selector` is not an `<input>`, `<textarea>` or `[contenteditable]` element, this method throws an error. Note that you can pass an empty string to clear the input field.- * To send fine-grained keyboard events, use `page.type(selector, text[, options])`.- * Shortcut for main frame's `frame.fill(selector, value[, options])`- * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See working with selectors for more details.+ * This method waits for an element matching `selector`, waits for [actionability](https://github.com/microsoft/playwright/blob/master/docs/actionability.md) checks, focuses the element, fills it and triggers an `input` event after filling. If the element matching `selector` is not an `<input>`, `<textarea>` or `[contenteditable]` element, this method throws an error. Note that you can pass an empty string to clear the input field.+ *+ * To send fine-grained keyboard events, use [`page.type(selector, text[, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagetypeselector-text-options).+ *+ * Shortcut for main frame's [`frame.fill(selector, value[, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#framefillselector-value-options)+ * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details.* @param value Value to fill for the `<input>`, `<textarea>` or `[contenteditable]` element.* @param options*/@@ -1392,42 +1538,46 @@ export interface Page {noWaitAfter?: boolean;/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}): Promise<void>;/*** This method fetches an element with `selector` and focuses it. If there's no element matching `selector`, the method waits until a matching element appears in the DOM.- * Shortcut for main frame's `frame.focus(selector[, options])`.- * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See working with selectors for more details.+ *+ * Shortcut for main frame's [`frame.focus(selector[, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#framefocusselector-options).+ * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details.* @param options*/focus(selector: string, options?: {/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}): Promise<void>;/*** Returns frame matching the specified criteria. Either `name` or `url` must be specified.+ ** ```js* const frame = page.frame('frame-name');* ```+ ** ```js* const frame = page.frame({ url: /.*domain.*\/ });* ```+ ** @param frameSelector Frame name or other frame lookup options.*/frame(frameSelector: string|{/**- * Frame name specified in the `iframe`'s `name` attribute.+ * Frame name specified in the `iframe`'s `name` attribute. Optional.*/name?: string;/**- * A glob pattern, regex pattern or predicate receiving frame's `url` as a URL object.+ * A glob pattern, regex pattern or predicate receiving frame's `url` as a [URL] object. Optional.*/url?: string|RegExp|Function;}): null|Frame;@@ -1439,25 +1589,26 @@ export interface Page {/*** Returns element attribute value.- * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See working with selectors for more details.+ * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details.* @param name Attribute name to get the value for.* @param options*/getAttribute(selector: string, name: string, options?: {/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}): Promise<null|string>;/*** Returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of the last redirect. If can not go back, returns `null`.+ ** Navigate to the previous page in history.* @param options*/goBack(options?: {/**- * Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultNavigationTimeout(timeout)`, `browserContext.setDefaultTimeout(timeout)`, `page.setDefaultNavigationTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultNavigationTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaultnavigationtimeouttimeout), [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout), [`page.setDefaultNavigationTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaultnavigationtimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;@@ -1467,17 +1618,18 @@ export interface Page {* - `'load'` - consider operation to be finished when the `load` event is fired.* - `'networkidle'` - consider operation to be finished when there are no network connections for at least `500` ms.*/- waitUntil?: "domcontentloaded"|"load"|"networkidle";+ waitUntil?: "load"|"domcontentloaded"|"networkidle";}): Promise<null|Response>;/*** Returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of the last redirect. If can not go forward, returns `null`.+ ** Navigate to the next page in history.* @param options*/goForward(options?: {/**- * Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultNavigationTimeout(timeout)`, `browserContext.setDefaultTimeout(timeout)`, `page.setDefaultNavigationTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultNavigationTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaultnavigationtimeouttimeout), [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout), [`page.setDefaultNavigationTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaultnavigationtimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;@@ -1487,34 +1639,36 @@ export interface Page {* - `'load'` - consider operation to be finished when the `load` event is fired.* - `'networkidle'` - consider operation to be finished when there are no network connections for at least `500` ms.*/- waitUntil?: "domcontentloaded"|"load"|"networkidle";+ waitUntil?: "load"|"domcontentloaded"|"networkidle";}): Promise<null|Response>;/*** Returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of the last redirect.+ ** `page.goto` will throw an error if:* - there's an SSL error (e.g. in case of self-signed certificates).* - target URL is invalid.* - the `timeout` is exceeded during navigation.* - the remote server does not respond or is unreachable.* - the main resource failed to load.- * `page.goto` will not throw an error when any valid HTTP status code is 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 `response.status()`.+ *+ * `page.goto` will not throw an error when any valid HTTP status code is 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 [`response.status()`](https://github.com/microsoft/playwright/blob/master/docs/api.md#responsestatus).** > **NOTE** `page.goto` either throws an error or returns a main resource response. The only exceptions are navigation to `about:blank` or navigation to the same URL with a different hash, which would succeed and return `null`.+ * > **NOTE** Headless mode doesn't support navigation to a PDF document. See the [upstream issue](https://bugs.chromium.org/p/chromium/issues/detail?id=761295).*- * > **NOTE** Headless mode doesn't support navigation to a PDF document. See the upstream issue.- * Shortcut for main frame's `frame.goto(url[, options])`+ * Shortcut for main frame's [`frame.goto(url[, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#framegotourl-options)* @param url URL to navigate page to. The url should include scheme, e.g. `https://`.* @param options*/goto(url: string, options?: {/**- * Referer header value. If provided it will take preference over the referer header value set by `page.setExtraHTTPHeaders(headers)`.+ * Referer header value. If provided it will take preference over the referer header value set by [`page.setExtraHTTPHeaders(headers)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetextrahttpheadersheaders).*/referer?: string;/**- * Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultNavigationTimeout(timeout)`, `browserContext.setDefaultTimeout(timeout)`, `page.setDefaultNavigationTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultNavigationTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaultnavigationtimeouttimeout), [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout), [`page.setDefaultNavigationTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaultnavigationtimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;@@ -1524,24 +1678,26 @@ export interface Page {* - `'load'` - consider operation to be finished when the `load` event is fired.* - `'networkidle'` - consider operation to be finished when there are no network connections for at least `500` ms.*/- waitUntil?: "domcontentloaded"|"load"|"networkidle";+ waitUntil?: "load"|"domcontentloaded"|"networkidle";}): Promise<null|Response>;/*** This method hovers over an element matching `selector` by performing the following steps:- * - Find an element match matching `selector`. If there is none, wait until a matching element is attached to the DOM.- * - Wait for actionability checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried.- * - Scroll the element into view if needed.- * - Use page.mouse to hover over the center of the element, or the specified `position`.- * - Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.- * When all steps combined have not finished during the specified `timeout`, this method rejects with a TimeoutError. Passing zero timeout disables this.- * Shortcut for main frame's `frame.hover(selector[, options])`.- * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See working with selectors for more details.+ * 1. Find an element match matching `selector`. If there is none, wait until a matching element is attached to the DOM.+ * 1. Wait for [actionability](https://github.com/microsoft/playwright/blob/master/docs/actionability.md) checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried.+ * 1. Scroll the element into view if needed.+ * 1. Use [`page.mouse`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagemouse) to hover over the center of the element, or the specified `position`.+ * 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.+ *+ * When all steps combined have not finished during the specified `timeout`, this method rejects with a [TimeoutError]. Passing zero timeout disables this.+ *+ * Shortcut for main frame's [`frame.hover(selector[, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#framehoverselector-options).+ * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details.* @param options*/hover(selector: string, options?: {/**- * Whether to bypass the actionability checks. Defaults to `false`.+ * Whether to bypass the [actionability](https://github.com/microsoft/playwright/blob/master/docs/actionability.md) checks. Defaults to `false`.*/force?: boolean;@@ -1560,31 +1716,31 @@ export interface Page {};/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}): Promise<void>;/*** Returns `element.innerHTML`.- * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See working with selectors for more details.+ * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details.* @param options*/innerHTML(selector: string, options?: {/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}): Promise<string>;/*** Returns `element.innerText`.- * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See working with selectors for more details.+ * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details.* @param options*/innerText(selector: string, options?: {/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}): Promise<string>;@@ -1612,24 +1768,30 @@ export interface Page {* Returns the PDF buffer.** > **NOTE** Generating a pdf is currently only supported in Chromium headless.- * `page.pdf()` generates a pdf of the page with `print` css media. To generate a pdf with `screen` media, call `page.emulateMedia(params)` before calling `page.pdf()`:*- * > **NOTE** By default, `page.pdf()` generates a pdf with modified colors for printing. Use the `-webkit-print-color-adjust` property to force rendering of exact colors.+ * `page.pdf()` generates a pdf of the page with `print` css media. To generate a pdf with `screen` media, call [`page.emulateMedia(params)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageemulatemediaparams) before calling `page.pdf()`:+ *+ * > **NOTE** By default, `page.pdf()` generates a pdf with modified colors for printing. Use the [`-webkit-print-color-adjust`](https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-print-color-adjust) property to force rendering of exact colors.+ ** ```js* // Generates a PDF with 'screen' media type.* await page.emulateMedia({media: 'screen'});* await page.pdf({path: 'page.pdf'});* ```+ ** The `width`, `height`, and `margin` options accept values labeled with units. Unlabeled values are treated as pixels.+ ** A few examples:* - `page.pdf({width: 100})` - prints with width set to 100 pixels* - `page.pdf({width: '100px'})` - prints with width set to 100 pixels* - `page.pdf({width: '10cm'})` - prints with width set to 10 centimeters.+ ** All possible units are:* - `px` - pixel* - `in` - inch* - `cm` - centimeter* - `mm` - millimeter+ ** The `format` options are:* - `Letter`: 8.5in x 11in* - `Legal`: 8.5in x 14in@@ -1644,9 +1806,7 @@ export interface Page {* - `A6`: 4.13in x 5.83in** > **NOTE** `headerTemplate` and `footerTemplate` markup have the following limitations:- ** > 1. Script tags inside templates are not evaluated.- ** > 2. Page styles are not visible inside templates.* @param options*/@@ -1743,13 +1903,20 @@ export interface Page {}): Promise<Buffer>;/**- * Focuses the element, and then uses `keyboard.down(key)` and `keyboard.up(key)`.- * `key` can specify the intended keyboardEvent.key value or a single character to generate the text for. A superset of the `key` values can be found here. Examples of the keys are:+ * Focuses the element, and then uses [`keyboard.down(key)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#keyboarddownkey) and [`keyboard.up(key)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#keyboardupkey).+ *+ * `key` can specify the intended [keyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key) value or a single character to generate the text for. A superset of the `key` values can be found [here](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values). Examples of the keys are:+ ** `F1` - `F12`, `Digit0`- `Digit9`, `KeyA`- `KeyZ`, `Backquote`, `Minus`, `Equal`, `Backslash`, `Backspace`, `Tab`, `Delete`, `Escape`, `ArrowDown`, `End`, `Enter`, `Home`, `Insert`, `PageDown`, `PageUp`, `ArrowRight`, `ArrowUp`, etc.+ ** Following modification shortcuts are also supported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`.+ ** Holding down `Shift` will type the text that corresponds to the `key` in the upper case.+ ** If `key` is a single character, it is case-sensitive, so the values `a` and `A` will generate different respective texts.+ ** Shortcuts such as `key: "Control+o"` or `key: "Control+Shift+T"` are supported as well. When speficied with the modifier, modifier is pressed and being held while the subsequent key is being pressed.+ ** ```js* const page = await browser.newPage();* await page.goto('https://keycode.info');@@ -1761,7 +1928,8 @@ export interface Page {* await page.screenshot({ path: 'O.png' });* await browser.close();* ```- * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See working with selectors for more details.+ *+ * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details.* @param key Name of the key to press or a character to generate, such as `ArrowLeft` or `a`.* @param options*/@@ -1777,7 +1945,7 @@ export interface Page {noWaitAfter?: boolean;/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}): Promise<void>;@@ -1788,7 +1956,7 @@ export interface Page {*/reload(options?: {/**- * Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultNavigationTimeout(timeout)`, `browserContext.setDefaultTimeout(timeout)`, `page.setDefaultNavigationTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultNavigationTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaultnavigationtimeouttimeout), [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout), [`page.setDefaultNavigationTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaultnavigationtimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;@@ -1798,32 +1966,38 @@ export interface Page {* - `'load'` - consider operation to be finished when the `load` event is fired.* - `'networkidle'` - consider operation to be finished when there are no network connections for at least `500` ms.*/- waitUntil?: "domcontentloaded"|"load"|"networkidle";+ waitUntil?: "load"|"domcontentloaded"|"networkidle";}): Promise<null|Response>;/*** Routing provides the capability to modify network requests that are made by a page.+ ** Once routing is enabled, every request matching the url pattern will stall unless it's continued, fulfilled or aborted.** > **NOTE** The handler will only be called for the first url if the response is a redirect.+ ** An example of a naïve handler that aborts all image requests:+ ** ```js* const page = await browser.newPage();* await page.route('**\/*.{png,jpg,jpeg}', route => route.abort());* await page.goto('https://example.com');* await browser.close();* ```+ ** or the same snippet using a regex pattern instead:+ ** ```js* const page = await browser.newPage();* await page.route(/(\.png$)|(\.jpg$)/, route => route.abort());* await page.goto('https://example.com');* await browser.close();* ```- * Page routes take precedence over browser context routes (set up with `browserContext.route(url, handler)`) when request matches both handlers.+ *+ * Page routes take precedence over browser context routes (set up with [`browserContext.route(url, handler)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextrouteurl-handler)) when request matches both handlers.** > **NOTE** Enabling routing disables http cache.- * @param url A glob pattern, regex pattern or predicate receiving URL to match while routing.+ * @param url A glob pattern, regex pattern or predicate receiving [URL] to match while routing.* @param handler handler function to route the request.*/route(url: string|RegExp|((url: URL) => boolean), handler: ((route: Route, request: Request) => void)): Promise<void>;@@ -1881,19 +2055,21 @@ export interface Page {quality?: number;/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;/*** Specify screenshot type, defaults to `png`.*/- type?: "jpeg"|"png";+ type?: "png"|"jpeg";}): Promise<Buffer>;/*** Returns the array of option values that have been successfully selected.+ ** Triggers a `change` and `input` event once all the provided options have been selected. If there's no `<select>` element matching `selector`, the method throws an error.+ ** ```js* // single selection matching the value* page.selectOption('select#colors', 'blue');@@ -1905,39 +2081,40 @@ export interface Page {* page.selectOption('select#colors', ['red', 'green', 'blue']);** ```- * Shortcut for main frame's `frame.selectOption(selector, values[, options])`- * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See working with selectors for more details.+ *+ * Shortcut for main frame's [`frame.selectOption(selector, values[, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#frameselectoptionselector-values-options)+ * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details.* @param values Options to select. If the `<select>` has the `multiple` attribute, all matching options are selected, otherwise only the first option matching one of the passed options is selected. String values are equivalent to `{value:'string'}`. Option is considered matching if all specified properties match.* @param options*/selectOption(selector: string, values: null|string|ElementHandle|Array<string>|{/**- * Matches by `option.value`.+ * Matches by `option.value`. Optional.*/value?: string;/**- * Matches by `option.label`.+ * Matches by `option.label`. Optional.*/label?: string;/**- * Matches by the index.+ * Matches by the index. Optional.*/index?: number;}|Array<ElementHandle>|Array<{/**- * Matches by `option.value`.+ * Matches by `option.value`. Optional.*/value?: string;/**- * Matches by `option.label`.+ * Matches by `option.label`. Optional.*/label?: string;/**- * Matches by the index.+ * Matches by the index. Optional.*/index?: number;}>, options?: {@@ -1947,7 +2124,7 @@ export interface Page {noWaitAfter?: boolean;/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}): Promise<Array<string>>;@@ -1958,7 +2135,7 @@ export interface Page {*/setContent(html: string, options?: {/**- * Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultNavigationTimeout(timeout)`, `browserContext.setDefaultTimeout(timeout)`, `page.setDefaultNavigationTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultNavigationTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaultnavigationtimeouttimeout), [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout), [`page.setDefaultNavigationTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaultnavigationtimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;@@ -1968,19 +2145,19 @@ export interface Page {* - `'load'` - consider operation to be finished when the `load` event is fired.* - `'networkidle'` - consider operation to be finished when there are no network connections for at least `500` ms.*/- waitUntil?: "domcontentloaded"|"load"|"networkidle";+ waitUntil?: "load"|"domcontentloaded"|"networkidle";}): Promise<void>;/*** This setting will change the default maximum navigation time for the following methods and related shortcuts:- * - `page.goBack([options])`- * - `page.goForward([options])`- * - `page.goto(url[, options])`- * - `page.reload([options])`- * - `page.setContent(html[, options])`- * - `page.waitForNavigation([options])`- *- * > **NOTE** `page.setDefaultNavigationTimeout(timeout)` takes priority over `page.setDefaultTimeout(timeout)`, `browserContext.setDefaultTimeout(timeout)` and `browserContext.setDefaultNavigationTimeout(timeout)`.+ * - [`page.goBack([options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagegobackoptions)+ * - [`page.goForward([options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagegoforwardoptions)+ * - [`page.goto(url[, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagegotourl-options)+ * - [`page.reload([options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagereloadoptions)+ * - [`page.setContent(html[, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetcontenthtml-options)+ * - [`page.waitForNavigation([options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagewaitfornavigationoptions)+ *+ * > **NOTE** [`page.setDefaultNavigationTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaultnavigationtimeouttimeout) takes priority over [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout), [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) and [`browserContext.setDefaultNavigationTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaultnavigationtimeouttimeout).* @param timeout Maximum navigation time in milliseconds*/setDefaultNavigationTimeout(timeout: number): void;@@ -1988,7 +2165,7 @@ export interface Page {/*** This setting will change the default maximum time for all the methods accepting `timeout` option.*- * > **NOTE** `page.setDefaultNavigationTimeout(timeout)` takes priority over `page.setDefaultTimeout(timeout)`.+ * > **NOTE** [`page.setDefaultNavigationTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaultnavigationtimeouttimeout) takes priority over [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout).* @param timeout Maximum time in milliseconds*/setDefaultTimeout(timeout: number): void;@@ -2002,20 +2179,21 @@ export interface Page {setExtraHTTPHeaders(headers: { [key: string]: string; }): Promise<void>;/**- * This method expects `selector` to point to an input element.+ * This method expects `selector` to point to an [input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input).+ ** Sets the value of the file input to these file paths or files. If some of the `filePaths` are relative paths, then they are resolved relative to the the current working directory. For empty array, clears the selected files.- * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See working with selectors for more details.+ * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details.* @param files* @param options*/setInputFiles(selector: string, files: string|Array<string>|{/**- * File name **required**+ * [File] name **required***/name: string;/**- * File type **required**+ * [File] type **required***/mimeType: string;@@ -2025,12 +2203,12 @@ export interface Page {buffer: Buffer;}|Array<{/**- * File name **required**+ * [File] name **required***/name: string;/**- * File type **required**+ * [File] type **required***/mimeType: string;@@ -2045,14 +2223,16 @@ export interface Page {noWaitAfter?: boolean;/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}): Promise<void>;/**- * In the case of multiple pages in a single browser, each page can have its own viewport size. However, `browser.newContext([options])` allows to set viewport size (and more) for all pages in the context at once.+ * In the case of multiple pages in a single browser, each page can have its own viewport size. However, [`browser.newContext([options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsernewcontextoptions) allows to set viewport size (and more) for all pages in the context at once.+ ** `page.setViewportSize` will resize the page. A lot of websites don't expect phones to change size, so you should set the viewport size before navigating to the page.+ ** ```js* const page = await browser.newPage();* await page.setViewportSize({@@ -2061,6 +2241,7 @@ export interface Page {* });* await page.goto('https://example.com');* ```+ ** @param viewportSize*/setViewportSize(viewportSize: {@@ -2077,21 +2258,23 @@ export interface Page {/*** This method taps an element matching `selector` by performing the following steps:- * - Find an element match matching `selector`. If there is none, wait until a matching element is attached to the DOM.- * - Wait for actionability checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried.- * - Scroll the element into view if needed.- * - Use page.touchscreen to tap the center of the element, or the specified `position`.- * - Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.- * When all steps combined have not finished during the specified `timeout`, this method rejects with a TimeoutError. Passing zero timeout disables this.+ * 1. Find an element match matching `selector`. If there is none, wait until a matching element is attached to the DOM.+ * 1. Wait for [actionability](https://github.com/microsoft/playwright/blob/master/docs/actionability.md) checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried.+ * 1. Scroll the element into view if needed.+ * 1. Use [`page.touchscreen`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagetouchscreen) to tap the center of the element, or the specified `position`.+ * 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.+ *+ * When all steps combined have not finished during the specified `timeout`, this method rejects with a [TimeoutError]. Passing zero timeout disables this.** > **NOTE** `page.tap()` requires that the `hasTouch` option of the browser context be set to true.- * Shortcut for main frame's `frame.tap(selector[, options])`.- * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See working with selectors for more details.+ *+ * Shortcut for main frame's [`frame.tap(selector[, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#frametapselector-options).+ * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details.* @param options*/tap(selector: string, options?: {/**- * Whether to bypass the actionability checks. Defaults to `false`.+ * Whether to bypass the [actionability](https://github.com/microsoft/playwright/blob/master/docs/actionability.md) checks. Defaults to `false`.*/force?: boolean;@@ -2115,39 +2298,42 @@ export interface Page {};/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}): Promise<void>;/*** Returns `element.textContent`.- * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See working with selectors for more details.+ * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details.* @param options*/textContent(selector: string, options?: {/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}): Promise<null|string>;/**- * Returns the page's title. Shortcut for main frame's `frame.title()`.+ * Returns the page's title. Shortcut for main frame's [`frame.title()`](https://github.com/microsoft/playwright/blob/master/docs/api.md#frametitle).*/title(): Promise<string>;touchscreen: Touchscreen;/**- * Sends a `keydown`, `keypress`/`input`, and `keyup` event for each character in the text. `page.type` can be used to send fine-grained keyboard events. To fill values in form fields, use `page.fill(selector, value[, options])`.- * To press a special key, like `Control` or `ArrowDown`, use `keyboard.press(key[, options])`.+ * Sends a `keydown`, `keypress`/`input`, and `keyup` event for each character in the text. `page.type` can be used to send fine-grained keyboard events. To fill values in form fields, use [`page.fill(selector, value[, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagefillselector-value-options).+ *+ * To press a special key, like `Control` or `ArrowDown`, use [`keyboard.press(key[, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#keyboardpresskey-options).+ ** ```js* await page.type('#mytextarea', 'Hello'); // Types instantly* await page.type('#mytextarea', 'World', {delay: 100}); // Types slower, like a user* ```- * Shortcut for main frame's `frame.type(selector, text[, options])`.- * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See working with selectors for more details.+ *+ * Shortcut for main frame's [`frame.type(selector, text[, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#frametypeselector-text-options).+ * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details.* @param text A text to type into a focused element.* @param options*/@@ -2163,28 +2349,30 @@ export interface Page {noWaitAfter?: boolean;/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}): Promise<void>;/*** This method unchecks an element matching `selector` by performing the following steps:- * - Find an element match matching `selector`. If there is none, wait until a matching element is attached to the DOM.- * - Ensure that matched element is a checkbox or a radio input. If not, this method rejects. If the element is already unchecked, this method returns immediately.- * - Wait for actionability checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried.- * - Scroll the element into view if needed.- * - Use page.mouse to click in the center of the element.- * - Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.- * - Ensure that the element is now unchecked. If not, this method rejects.- * When all steps combined have not finished during the specified `timeout`, this method rejects with a TimeoutError. Passing zero timeout disables this.- * Shortcut for main frame's `frame.uncheck(selector[, options])`.- * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See working with selectors for more details.+ * 1. Find an element match matching `selector`. If there is none, wait until a matching element is attached to the DOM.+ * 1. Ensure that matched element is a checkbox or a radio input. If not, this method rejects. If the element is already unchecked, this method returns immediately.+ * 1. Wait for [actionability](https://github.com/microsoft/playwright/blob/master/docs/actionability.md) checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried.+ * 1. Scroll the element into view if needed.+ * 1. Use [`page.mouse`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagemouse) to click in the center of the element.+ * 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.+ * 1. Ensure that the element is now unchecked. If not, this method rejects.+ *+ * When all steps combined have not finished during the specified `timeout`, this method rejects with a [TimeoutError]. Passing zero timeout disables this.+ *+ * Shortcut for main frame's [`frame.uncheck(selector[, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#frameuncheckselector-options).+ * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details.* @param options*/uncheck(selector: string, options?: {/**- * Whether to bypass the actionability checks. Defaults to `false`.+ * Whether to bypass the [actionability](https://github.com/microsoft/playwright/blob/master/docs/actionability.md) checks. Defaults to `false`.*/force?: boolean;@@ -2194,20 +2382,20 @@ export interface Page {noWaitAfter?: boolean;/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}): Promise<void>;/**- * Removes a route created with `page.route(url, handler)`. When `handler` is not specified, removes all routes for the `url`.- * @param url A glob pattern, regex pattern or predicate receiving URL to match while routing.+ * Removes a route created with [`page.route(url, handler)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagerouteurl-handler). When `handler` is not specified, removes all routes for the `url`.+ * @param url A glob pattern, regex pattern or predicate receiving [URL] to match while routing.* @param handler Optional handler function to route the request.*/unroute(url: string|RegExp|((url: URL) => boolean), handler?: ((route: Route, request: Request) => void)): Promise<void>;/**- * Shortcut for main frame's `frame.url()`.+ * Shortcut for main frame's [`frame.url()`](https://github.com/microsoft/playwright/blob/master/docs/api.md#frameurl).*/url(): string;@@ -2235,8 +2423,11 @@ export interface Page {/*** Emitted when JavaScript within the page calls one of console API methods, e.g. `console.log` or `console.dir`. Also emitted if the page throws an error or a warning.+ ** The arguments passed into `console.log` appear as arguments on the event handler.+ ** An example of handling `console` event:+ ** ```js* page.on('console', msg => {* for (let i = 0; i < msg.args().length; ++i)@@ -2244,12 +2435,15 @@ export interface Page {* });* page.evaluate(() => console.log('hello', 5, {foo: 'bar'}));* ```+ **/waitForEvent(event: 'console', optionsOrPredicate?: { predicate?: (consoleMessage: ConsoleMessage) => boolean, timeout?: number } | ((consoleMessage: ConsoleMessage) => boolean)): Promise<ConsoleMessage>;/*** Emitted when the page crashes. Browser pages might crash if they try to allocate too much memory. When the page crashes, ongoing and subsequent operations will throw.+ ** The most common way to deal with crashes is to catch an exception:+ ** ```js* try {* // Crash might happen during a click.@@ -2260,7 +2454,9 @@ export interface Page {* // When the page crashes, exception message contains 'crash'.* }* ```+ ** However, when manually listening to events, it might be useful to avoid stalling when the page crashes. In this case, handling `crash` event helps:+ ** ```js* await new Promise((resolve, reject) => {* page.on('requestfinished', async request => {@@ -2270,33 +2466,36 @@ export interface Page {* page.on('crash', error => reject(error));* });* ```+ **/waitForEvent(event: 'crash', optionsOrPredicate?: { predicate?: () => boolean, timeout?: number } | (() => boolean)): Promise<void>;/**- * Emitted when a JavaScript dialog appears, such as `alert`, `prompt`, `confirm` or `beforeunload`. Playwright can respond to the dialog via `dialog.accept([promptText])` or `dialog.dismiss()` methods.+ * Emitted when a JavaScript dialog appears, such as `alert`, `prompt`, `confirm` or `beforeunload`. Playwright can respond to the dialog via [`dialog.accept([promptText])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#dialogacceptprompttext) or [`dialog.dismiss()`](https://github.com/microsoft/playwright/blob/master/docs/api.md#dialogdismiss) methods.*/waitForEvent(event: 'dialog', optionsOrPredicate?: { predicate?: (dialog: Dialog) => boolean, timeout?: number } | ((dialog: Dialog) => boolean)): Promise<Dialog>;/**- * Emitted when the JavaScript `DOMContentLoaded` event is dispatched.+ * Emitted when the JavaScript [`DOMContentLoaded`](https://developer.mozilla.org/en-US/docs/Web/Events/DOMContentLoaded) event is dispatched.*/waitForEvent(event: 'domcontentloaded', optionsOrPredicate?: { predicate?: () => boolean, timeout?: number } | (() => boolean)): Promise<void>;/**- * Emitted when attachment download started. User can access basic file operations on downloaded content via the passed Download instance.+ * Emitted when attachment download started. User can access basic file operations on downloaded content via the passed [Download] instance.** > **NOTE** Browser context **must** be created with the `acceptDownloads` set to `true` when user needs access to the downloaded content. If `acceptDownloads` is not set or set to `false`, download events are emitted, but the actual download is not performed and user has no access to the downloaded files.*/waitForEvent(event: 'download', optionsOrPredicate?: { predicate?: (download: Download) => boolean, timeout?: number } | ((download: Download) => boolean)): Promise<Download>;/**- * Emitted when a file chooser is supposed to appear, such as after clicking the `<input type=file>`. Playwright can respond to it via setting the input files using `fileChooser.setFiles(files[, options])` that can be uploaded after that.+ * Emitted when a file chooser is supposed to appear, such as after clicking the `<input type=file>`. Playwright can respond to it via setting the input files using [`fileChooser.setFiles(files[, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#filechoosersetfilesfiles-options) that can be uploaded after that.+ ** ```js* page.on('filechooser', async (fileChooser) => {* await fileChooser.setFiles('/tmp/myfile.pdf');* });* ```+ **/waitForEvent(event: 'filechooser', optionsOrPredicate?: { predicate?: (fileChooser: FileChooser) => boolean, timeout?: number } | ((fileChooser: FileChooser) => boolean)): Promise<FileChooser>;@@ -2316,7 +2515,7 @@ export interface Page {waitForEvent(event: 'framenavigated', optionsOrPredicate?: { predicate?: (frame: Frame) => boolean, timeout?: number } | ((frame: Frame) => boolean)): Promise<Frame>;/**- * Emitted when the JavaScript `load` event is dispatched.+ * Emitted when the JavaScript [`load`](https://developer.mozilla.org/en-US/docs/Web/Events/load) event is dispatched.*/waitForEvent(event: 'load', optionsOrPredicate?: { predicate?: () => boolean, timeout?: number } | (() => boolean)): Promise<void>;@@ -2326,8 +2525,10 @@ export interface Page {waitForEvent(event: 'pageerror', optionsOrPredicate?: { predicate?: (error: Error) => boolean, timeout?: number } | ((error: Error) => boolean)): Promise<Error>;/**- * Emitted when the page opens a new tab or window. This event is emitted in addition to the `browserContext.on('page')`, but only for popups relevant to this page.+ * Emitted when the page opens a new tab or window. This event is emitted in addition to the [`browserContext.on('page')`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextonpage), but only for popups relevant to this page.+ ** The earliest moment that page is available is when it has navigated to the initial url. For example, when opening a popup with `window.open('http://example.com')`, this event will fire when the network request to "http://example.com" is done and its response has started loading in the popup.+ ** ```js* const [popup] = await Promise.all([* page.waitForEvent('popup'),@@ -2336,19 +2537,19 @@ export interface Page {* console.log(await popup.evaluate('location.href'));* ```*- * > **NOTE** Use `page.waitForLoadState([state, options])` to wait until the page gets to a particular state (you should not need it in most cases).+ * > **NOTE** Use [`page.waitForLoadState([state, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagewaitforloadstatestate-options) to wait until the page gets to a particular state (you should not need it in most cases).*/waitForEvent(event: 'popup', optionsOrPredicate?: { predicate?: (page: Page) => boolean, timeout?: number } | ((page: Page) => boolean)): Promise<Page>;/**- * Emitted when a page issues a request. The [request] object is read-only. In order to intercept and mutate requests, see `page.route(url, handler)` or `browserContext.route(url, handler)`.+ * Emitted when a page issues a request. The [request] object is read-only. In order to intercept and mutate requests, see [`page.route(url, handler)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagerouteurl-handler) or [`browserContext.route(url, handler)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextrouteurl-handler).*/waitForEvent(event: 'request', optionsOrPredicate?: { predicate?: (request: Request) => boolean, timeout?: number } | ((request: Request) => boolean)): Promise<Request>;/*** Emitted when a request fails, for example by timing out.*- * > **NOTE** HTTP Error responses, such as 404 or 503, are still successful responses from HTTP standpoint, so request will complete with `page.on('requestfinished')` event and not with `page.on('requestfailed')`.+ * > **NOTE** HTTP Error responses, such as 404 or 503, are still successful responses from HTTP standpoint, so request will complete with [`page.on('requestfinished')`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageonrequestfinished) event and not with [`page.on('requestfailed')`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageonrequestfailed).*/waitForEvent(event: 'requestfailed', optionsOrPredicate?: { predicate?: (request: Request) => boolean, timeout?: number } | ((request: Request) => boolean)): Promise<Request>;@@ -2363,23 +2564,26 @@ export interface Page {waitForEvent(event: 'response', optionsOrPredicate?: { predicate?: (response: Response) => boolean, timeout?: number } | ((response: Response) => boolean)): Promise<Response>;/**- * Emitted when <WebSocket> request is sent.+ * Emitted when <[WebSocket]> request is sent.*/waitForEvent(event: 'websocket', optionsOrPredicate?: { predicate?: (webSocket: WebSocket) => boolean, timeout?: number } | ((webSocket: WebSocket) => boolean)): Promise<WebSocket>;/**- * Emitted when a dedicated WebWorker is spawned by the page.+ * Emitted when a dedicated [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) is spawned by the page.*/waitForEvent(event: 'worker', optionsOrPredicate?: { predicate?: (worker: Worker) => boolean, timeout?: number } | ((worker: Worker) => boolean)): Promise<Worker>;/*** Returns when the required load state has been reached.+ ** This resolves when the page reaches a required load state, `load` by default. The navigation must have been committed when this method is called. If current document has already reached the required state, resolves immediately.+ ** ```js* await page.click('button'); // Click triggers navigation.* await page.waitForLoadState(); // The promise resolves after 'load' event.* ```+ ** ```js* const [popup] = await Promise.all([* page.waitForEvent('popup'),@@ -2388,40 +2592,45 @@ export interface Page {* await popup.waitForLoadState('domcontentloaded'); // The promise resolves after 'domcontentloaded' event.* console.log(await popup.title()); // Popup is ready to use.* ```- * Shortcut for main frame's `frame.waitForLoadState([state, options])`.+ *+ * Shortcut for main frame's [`frame.waitForLoadState([state, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#framewaitforloadstatestate-options).* @param state Optional load state to wait for, defaults to `load`. If the state has been already reached while loading current document, the method resolves immediately. Can be one of: - `'load'` - wait for the `load` event to be fired.* - `'domcontentloaded'` - wait for the `DOMContentLoaded` event to be fired.* - `'networkidle'` - wait until there are no network connections for at least `500` ms.* @param options*/- waitForLoadState(state?: "domcontentloaded"|"load"|"networkidle", options?: {+ waitForLoadState(state?: "load"|"domcontentloaded"|"networkidle", options?: {/**- * Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultNavigationTimeout(timeout)`, `browserContext.setDefaultTimeout(timeout)`, `page.setDefaultNavigationTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultNavigationTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaultnavigationtimeouttimeout), [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout), [`page.setDefaultNavigationTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaultnavigationtimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}): Promise<void>;/*** Returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of the last redirect. In case of navigation to a different anchor or navigation due to History API usage, the navigation will resolve with `null`.+ ** This resolves when the page navigates to a new URL or reloads. It is useful for when you run code which will indirectly cause the page to navigate. e.g. The click target has an `onclick` handler that triggers navigation from a `setTimeout`. Consider this example:+ ** ```js* const [response] = await Promise.all([* page.waitForNavigation(), // The promise resolves after navigation has finished* page.click('a.delayed-navigation'), // Clicking the link will indirectly cause a navigation* ]);* ```- * **NOTE** Usage of the History API to change the URL is considered a navigation.- * Shortcut for main frame's `frame.waitForNavigation([options])`.+ *+ * **NOTE** Usage of the [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) to change the URL is considered a navigation.+ *+ * Shortcut for main frame's [`frame.waitForNavigation([options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#framewaitfornavigationoptions).* @param options*/waitForNavigation(options?: {/**- * Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultNavigationTimeout(timeout)`, `browserContext.setDefaultTimeout(timeout)`, `page.setDefaultNavigationTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultNavigationTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaultnavigationtimeouttimeout), [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout), [`page.setDefaultNavigationTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaultnavigationtimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;/**- * A glob pattern, regex pattern or predicate receiving URL to match while waiting for the navigation.+ * A glob pattern, regex pattern or predicate receiving [URL] to match while waiting for the navigation.*/url?: string|RegExp|Function;@@ -2431,72 +2640,83 @@ export interface Page {* - `'load'` - consider operation to be finished when the `load` event is fired.* - `'networkidle'` - consider operation to be finished when there are no network connections for at least `500` ms.*/- waitUntil?: "domcontentloaded"|"load"|"networkidle";+ waitUntil?: "load"|"domcontentloaded"|"networkidle";}): Promise<null|Response>;/*** Waits for the matching request and returns it.+ ** ```js* const firstRequest = await page.waitForRequest('http://example.com/resource');* const finalRequest = await page.waitForRequest(request => request.url() === 'http://example.com' && request.method() === 'GET');* return firstRequest.url();* ```+ ** ```js* await page.waitForRequest(request => request.url().searchParams.get('foo') === 'bar' && request.url().searchParams.get('foo2') === 'bar2');* ```- * @param urlOrPredicate Request URL string, regex or predicate receiving Request object.+ *+ * @param urlOrPredicate Request URL string, regex or predicate receiving [Request] object.* @param options*/waitForRequest(urlOrPredicate: string|RegExp|Function, options?: {/**- * Maximum wait time in milliseconds, defaults to 30 seconds, pass `0` to disable the timeout. The default value can be changed by using the `page.setDefaultTimeout(timeout)` method.+ * Maximum wait time in milliseconds, defaults to 30 seconds, pass `0` to disable the timeout. The default value can be changed by using the [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) method.*/timeout?: number;}): Promise<Request>;/*** Returns the matched response.+ ** ```js* const firstResponse = await page.waitForResponse('https://example.com/resource');* const finalResponse = await page.waitForResponse(response => response.url() === 'https://example.com' && response.status() === 200);* return finalResponse.ok();* ```- * @param urlOrPredicate Request URL string, regex or predicate receiving Response object.+ *+ * @param urlOrPredicate Request URL string, regex or predicate receiving [Response] object.* @param options*/waitForResponse(urlOrPredicate: string|RegExp|((response: Response) => boolean), options?: {/**- * Maximum wait time in milliseconds, defaults to 30 seconds, pass `0` to disable the timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum wait time in milliseconds, defaults to 30 seconds, pass `0` to disable the timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}): Promise<Response>;/*** Waits for the given `timeout` in milliseconds.+ ** Note that `page.waitForTimeout()` should only be used for debugging. Tests using the timer in production are going to be flaky. Use signals such as network events, selectors becoming visible and others instead.+ ** ```js* // wait for 1 second* await page.waitForTimeout(1000);* ```- * Shortcut for main frame's `frame.waitForTimeout(timeout)`.+ *+ * Shortcut for main frame's [`frame.waitForTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#framewaitfortimeouttimeout).* @param timeout A timeout to wait for*/waitForTimeout(timeout: number): Promise<void>;/**- * This method returns all of the dedicated WebWorkers associated with the page.+ * This method returns all of the dedicated [WebWorkers](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) associated with the page.** > **NOTE** This does not contain ServiceWorkers*/workers(): Array<Worker>;}/**- * At every point of time, page exposes its current frame tree via the `page.mainFrame()` and `frame.childFrames()` methods.- * Frame object's lifecycle is controlled by three events, dispatched on the page object:- * - `page.on('frameattached')` - fired when the frame gets attached to the page. A Frame can be attached to the page only once.- * - `page.on('framenavigated')` - fired when the frame commits navigation to a different URL.- * - `page.on('framedetached')` - fired when the frame gets detached from the page. A Frame can be detached from the page only once.+ * At every point of time, page exposes its current frame tree via the [`page.mainFrame()`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagemainframe) and [`frame.childFrames()`](https://github.com/microsoft/playwright/blob/master/docs/api.md#framechildframes) methods.+ *+ * [Frame] object's lifecycle is controlled by three events, dispatched on the page object:+ * - [`page.on('frameattached')`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageonframeattached) - fired when the frame gets attached to the page. A Frame can be attached to the page only once.+ * - [`page.on('framenavigated')`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageonframenavigated) - fired when the frame commits navigation to a different URL.+ * - [`page.on('framedetached')`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageonframedetached) - fired when the frame gets detached from the page. A Frame can be detached from the page only once.+ ** An example of dumping frame tree:+ ** ```js* const { firefox } = require('playwright'); // Or 'chromium' or 'webkit'.*@@ -2515,34 +2735,45 @@ export interface Page {* }* })();* ```+ ** An example of getting text from an iframe element:+ ** ```js* const frame = page.frames().find(frame => frame.name() === 'myframe');* const text = await frame.$eval('.selector', element => element.textContent);* console.log(text);* ```+ **/export interface Frame {/*** Returns the return value of `pageFunction`- * If the function passed to the `frame.evaluate` returns a Promise, then `frame.evaluate` would wait for the promise to resolve and return its value.- * If the function passed to the `frame.evaluate` returns a non-Serializable value, then `frame.evaluate` returns `undefined`. DevTools Protocol also supports transferring some additional values that are not serializable by `JSON`: `-0`, `NaN`, `Infinity`, `-Infinity`, and bigint literals.+ *+ * If the function passed to the `frame.evaluate` returns a [Promise], then `frame.evaluate` would wait for the promise to resolve and return its value.+ *+ * If the function passed to the `frame.evaluate` returns a non-[Serializable] value, then `frame.evaluate` returns `undefined`. DevTools Protocol also supports transferring some additional values that are not serializable by `JSON`: `-0`, `NaN`, `Infinity`, `-Infinity`, and bigint literals.+ ** ```js* const result = await frame.evaluate(([x, y]) => {* return Promise.resolve(x * y);* }, [7, 8]);* console.log(result); // prints "56"* ```+ ** A string can also be passed in instead of a function.+ ** ```js* console.log(await frame.evaluate('1 + 2')); // prints "3"* ```- * ElementHandle instances can be passed as an argument to the `frame.evaluate`:+ *+ * [ElementHandle] instances can be passed as an argument to the `frame.evaluate`:+ ** ```js* const bodyHandle = await frame.$('body');* const html = await frame.evaluate(([body, suffix]) => body.innerHTML + suffix, [bodyHandle, 'hello']);* await bodyHandle.dispose();* ```+ ** @param pageFunction Function to be evaluated in browser context* @param arg Optional argument to pass to `pageFunction`*/@@ -2551,23 +2782,31 @@ export interface Frame {/*** Returns the return value of `pageFunction` as in-page object (JSHandle).+ ** The only difference between `frame.evaluate` and `frame.evaluateHandle` is that `frame.evaluateHandle` returns in-page object (JSHandle).- * If the function, passed to the `frame.evaluateHandle`, returns a Promise, then `frame.evaluateHandle` would wait for the promise to resolve and return its value.+ *+ * If the function, passed to the `frame.evaluateHandle`, returns a [Promise], then `frame.evaluateHandle` would wait for the promise to resolve and return its value.+ ** ```js* const aWindowHandle = await frame.evaluateHandle(() => Promise.resolve(window));* aWindowHandle; // Handle for the window object.* ```+ ** A string can also be passed in instead of a function.+ ** ```js* const aHandle = await frame.evaluateHandle('document'); // Handle for the 'document'.* ```- * JSHandle instances can be passed as an argument to the `frame.evaluateHandle`:+ *+ * [JSHandle] instances can be passed as an argument to the `frame.evaluateHandle`:+ ** ```js* const aHandle = await frame.evaluateHandle(() => document.body);* const resultHandle = await frame.evaluateHandle(([body, suffix]) => body.innerHTML + suffix, [aHandle, 'hello']);* console.log(await resultHandle.jsonValue());* await resultHandle.dispose();* ```+ ** @param pageFunction Function to be evaluated in the page context* @param arg Optional argument to pass to `pageFunction`*/@@ -2576,31 +2815,38 @@ export interface Frame {/*** Returns the ElementHandle pointing to the frame element.- * The method finds an element matching the specified selector within the frame. See Working with selectors for more details. If no elements match the selector, returns `null`.- * @param selector A selector to query for. See working with selectors for more details.+ *+ * The method finds an element matching the specified selector within the frame. See [Working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details. If no elements match the selector, returns `null`.+ * @param selector A selector to query for. See [working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details.*/$<K extends keyof HTMLElementTagNameMap>(selector: K): Promise<ElementHandleForTag<K> | null>;$(selector: string): Promise<ElementHandle<SVGElement | HTMLElement> | null>;/*** Returns the ElementHandles pointing to the frame elements.- * The method finds all elements matching the specified selector within the frame. See Working with selectors for more details. If no elements match the selector, returns empty array.- * @param selector A selector to query for. See working with selectors for more details.+ *+ * The method finds all elements matching the specified selector within the frame. See [Working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details. If no elements match the selector, returns empty array.+ * @param selector A selector to query for. See [working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details.*/$$<K extends keyof HTMLElementTagNameMap>(selector: K): Promise<ElementHandleForTag<K>[]>;$$(selector: string): Promise<ElementHandle<SVGElement | HTMLElement>[]>;/*** Returns the return value of `pageFunction`- * The method finds an element matching the specified selector within the frame and passes it as a first argument to `pageFunction`. See Working with selectors for more details. If no elements match the selector, the method throws an error.- * If `pageFunction` returns a Promise, then `frame.$eval` would wait for the promise to resolve and return its value.+ *+ * The method finds an element matching the specified selector within the frame and passes it as a first argument to `pageFunction`. See [Working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details. If no elements match the selector, the method throws an error.+ *+ * If `pageFunction` returns a [Promise], then `frame.$eval` would wait for the promise to resolve and return its value.+ ** Examples:+ ** ```js* const searchValue = await frame.$eval('#search', el => el.value);* const preloadHref = await frame.$eval('link[rel=preload]', el => el.href);* const html = await frame.$eval('.main-container', (e, suffix) => e.outerHTML + suffix, 'hello');* ```- * @param selector A selector to query for. See working with selectors for more details.+ *+ * @param selector A selector to query for. See [working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details.* @param pageFunction Function to be evaluated in browser context* @param arg Optional argument to pass to `pageFunction`*/@@ -2611,13 +2857,18 @@ export interface Frame {/*** Returns the return value of `pageFunction`- * The method finds all elements matching the specified selector within the frame and passes an array of matched elements as a first argument to `pageFunction`. See Working with selectors for more details.- * If `pageFunction` returns a Promise, then `frame.$$eval` would wait for the promise to resolve and return its value.+ *+ * The method finds all elements matching the specified selector within the frame and passes an array of matched elements as a first argument to `pageFunction`. See [Working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details.+ *+ * If `pageFunction` returns a [Promise], then `frame.$$eval` would wait for the promise to resolve and return its value.+ ** Examples:+ ** ```js* const divsCounts = await frame.$$eval('div', (divs, min) => divs.length >= min, 10);* ```- * @param selector A selector to query for. See working with selectors for more details.+ *+ * @param selector A selector to query for. See [working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details.* @param pageFunction Function to be evaluated in browser context* @param arg Optional argument to pass to `pageFunction`*/@@ -2628,7 +2879,9 @@ export interface Frame {/*** Returns when the `pageFunction` returns a truthy value, returns that value.+ ** The `waitForFunction` can be used to observe viewport size change:+ ** ```js* const { firefox } = require('playwright'); // Or 'chromium' or 'webkit'.*@@ -2641,11 +2894,14 @@ export interface Frame {* await browser.close();* })();* ```+ ** To pass an argument to the predicate of `frame.waitForFunction` function:+ ** ```js* const selector = '.foo';* await frame.waitForFunction(selector => !!document.querySelector(selector), selector);* ```+ ** @param pageFunction Function to be evaluated in browser context* @param arg Optional argument to pass to `pageFunction`* @param options@@ -2655,8 +2911,11 @@ export interface Frame {/*** Returns when element specified by selector satisfies `state` option. Returns `null` if waiting for `hidden` or `detached`.+ ** Wait for the `selector` to satisfy `state` option (either appear/disappear from dom, or become visible/hidden). If at the moment of calling the method `selector` already satisfies the condition, the method will return immediately. If the selector doesn't satisfy the condition for the `timeout` milliseconds, the function will throw.+ ** This method works across navigations:+ ** ```js* const { webkit } = require('playwright'); // Or 'chromium' or 'firefox'.*@@ -2673,7 +2932,8 @@ export interface Frame {* await browser.close();* })();* ```- * @param selector A selector to query for. See working with selectors for more details.+ *+ * @param selector A selector to query for. See [working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details.* @param options*/waitForSelector<K extends keyof HTMLElementTagNameMap>(selector: K, options?: PageWaitForSelectorOptionsNotHidden): Promise<ElementHandleForTag<K>>;@@ -2682,69 +2942,72 @@ export interface Frame {waitForSelector(selector: string, options: PageWaitForSelectorOptions): Promise<null|ElementHandle<SVGElement | HTMLElement>>;/*** Returns the added tag when the script's onload fires or when the script content was injected into frame.+ ** Adds a `<script>` tag into the page with the desired url or content.* @param params*/addScriptTag(params: {/**- * URL of a script to be added.+ * URL of a script to be added. Optional.*/url?: string;/**- * Path to the JavaScript file to be injected into frame. If `path` is a relative path, then it is resolved relative to the current working directory.+ * Path to the JavaScript file to be injected into frame. If `path` is a relative path, then it is resolved relative to the current working directory. Optional.*/path?: string;/**- * Raw JavaScript content to be injected into frame.+ * Raw JavaScript content to be injected into frame. Optional.*/content?: string;/**- * Script type. Use 'module' in order to load a Javascript ES6 module. See script for more details.+ * Script type. Use 'module' in order to load a Javascript ES6 module. See [script](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script) for more details. Optional.*/type?: string;}): Promise<ElementHandle>;/*** Returns the added tag when the stylesheet's onload fires or when the CSS content was injected into frame.+ ** Adds a `<link rel="stylesheet">` tag into the page with the desired url or a `<style type="text/css">` tag with the content.* @param params*/addStyleTag(params: {/**- * URL of the `<link>` tag.+ * URL of the `<link>` tag. Optional.*/url?: string;/**- * Path to the CSS file to be injected into frame. If `path` is a relative path, then it is resolved relative to the current working directory.+ * Path to the CSS file to be injected into frame. If `path` is a relative path, then it is resolved relative to the current working directory. Optional.*/path?: string;/**- * Raw CSS content to be injected into frame.+ * Raw CSS content to be injected into frame. Optional.*/content?: string;}): Promise<ElementHandle>;/*** This method checks an element matching `selector` by performing the following steps:- * - Find an element match matching `selector`. If there is none, wait until a matching element is attached to the DOM.- * - Ensure that matched element is a checkbox or a radio input. If not, this method rejects. If the element is already checked, this method returns immediately.- * - Wait for actionability checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried.- * - Scroll the element into view if needed.- * - Use page.mouse to click in the center of the element.- * - Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.- * - Ensure that the element is now checked. If not, this method rejects.- * When all steps combined have not finished during the specified `timeout`, this method rejects with a TimeoutError. Passing zero timeout disables this.- * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See working with selectors for more details.+ * 1. Find an element match matching `selector`. If there is none, wait until a matching element is attached to the DOM.+ * 1. Ensure that matched element is a checkbox or a radio input. If not, this method rejects. If the element is already checked, this method returns immediately.+ * 1. Wait for [actionability](https://github.com/microsoft/playwright/blob/master/docs/actionability.md) checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried.+ * 1. Scroll the element into view if needed.+ * 1. Use [`page.mouse`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagemouse) to click in the center of the element.+ * 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.+ * 1. Ensure that the element is now checked. If not, this method rejects.+ *+ * When all steps combined have not finished during the specified `timeout`, this method rejects with a [TimeoutError]. Passing zero timeout disables this.+ * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details.* @param options*/check(selector: string, options?: {/**- * Whether to bypass the actionability checks. Defaults to `false`.+ * Whether to bypass the [actionability](https://github.com/microsoft/playwright/blob/master/docs/actionability.md) checks. Defaults to `false`.*/force?: boolean;@@ -2754,7 +3017,7 @@ export interface Frame {noWaitAfter?: boolean;/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}): Promise<void>;@@ -2763,23 +3026,24 @@ export interface Frame {/*** This method clicks an element matching `selector` by performing the following steps:- * - Find an element match matching `selector`. If there is none, wait until a matching element is attached to the DOM.- * - Wait for actionability checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried.- * - Scroll the element into view if needed.- * - Use page.mouse to click in the center of the element, or the specified `position`.- * - Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.- * When all steps combined have not finished during the specified `timeout`, this method rejects with a TimeoutError. Passing zero timeout disables this.- * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See working with selectors for more details.+ * 1. Find an element match matching `selector`. If there is none, wait until a matching element is attached to the DOM.+ * 1. Wait for [actionability](https://github.com/microsoft/playwright/blob/master/docs/actionability.md) checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried.+ * 1. Scroll the element into view if needed.+ * 1. Use [`page.mouse`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagemouse) to click in the center of the element, or the specified `position`.+ * 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.+ *+ * When all steps combined have not finished during the specified `timeout`, this method rejects with a [TimeoutError]. Passing zero timeout disables this.+ * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details.* @param options*/click(selector: string, options?: {/*** Defaults to `left`.*/- button?: "left"|"middle"|"right";+ button?: "left"|"right"|"middle";/**- * defaults to 1. See UIEvent.detail.+ * defaults to 1. See [UIEvent.detail].*/clickCount?: number;@@ -2789,7 +3053,7 @@ export interface Frame {delay?: number;/**- * Whether to bypass the actionability checks. Defaults to `false`.+ * Whether to bypass the [actionability](https://github.com/microsoft/playwright/blob/master/docs/actionability.md) checks. Defaults to `false`.*/force?: boolean;@@ -2813,7 +3077,7 @@ export interface Frame {};/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}): Promise<void>;@@ -2825,22 +3089,23 @@ export interface Frame {/*** This method double clicks an element matching `selector` by performing the following steps:- * - Find an element match matching `selector`. If there is none, wait until a matching element is attached to the DOM.- * - Wait for actionability checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried.- * - Scroll the element into view if needed.- * - Use page.mouse to double click in the center of the element, or the specified `position`.- * - Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set. Note that if the first click of the `dblclick()` triggers a navigation event, this method will reject.- * When all steps combined have not finished during the specified `timeout`, this method rejects with a TimeoutError. Passing zero timeout disables this.+ * 1. Find an element match matching `selector`. If there is none, wait until a matching element is attached to the DOM.+ * 1. Wait for [actionability](https://github.com/microsoft/playwright/blob/master/docs/actionability.md) checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried.+ * 1. Scroll the element into view if needed.+ * 1. Use [`page.mouse`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagemouse) to double click in the center of the element, or the specified `position`.+ * 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set. Note that if the first click of the `dblclick()` triggers a navigation event, this method will reject.+ *+ * When all steps combined have not finished during the specified `timeout`, this method rejects with a [TimeoutError]. Passing zero timeout disables this.** > **NOTE** `frame.dblclick()` dispatches two `click` events and a single `dblclick` event.- * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See working with selectors for more details.+ * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details.* @param options*/dblclick(selector: string, options?: {/*** Defaults to `left`.*/- button?: "left"|"middle"|"right";+ button?: "left"|"right"|"middle";/*** Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0.@@ -2848,7 +3113,7 @@ export interface Frame {delay?: number;/**- * Whether to bypass the actionability checks. Defaults to `false`.+ * Whether to bypass the [actionability](https://github.com/microsoft/playwright/blob/master/docs/actionability.md) checks. Defaults to `false`.*/force?: boolean;@@ -2872,47 +3137,54 @@ export interface Frame {};/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}): Promise<void>;/**- * The snippet below dispatches the `click` event on the element. Regardless of the visibility state of the elment, `click` is dispatched. This is equivalend to calling element.click().+ * The snippet below dispatches the `click` event on the element. Regardless of the visibility state of the elment, `click` is dispatched. This is equivalend to calling [element.click()](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/click).+ ** ```js* await frame.dispatchEvent('button#submit', 'click');* ```+ ** Under the hood, it creates an instance of an event based on the given `type`, initializes it with `eventInit` properties and dispatches it on the element. Events are `composed`, `cancelable` and bubble by default.+ ** Since `eventInit` is event-specific, please refer to the events documentation for the lists of initial properties:- * - DragEvent- * - FocusEvent- * - KeyboardEvent- * - MouseEvent- * - PointerEvent- * - TouchEvent- * - Event+ * - [DragEvent](https://developer.mozilla.org/en-US/docs/Web/API/DragEvent/DragEvent)+ * - [FocusEvent](https://developer.mozilla.org/en-US/docs/Web/API/FocusEvent/FocusEvent)+ * - [KeyboardEvent](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/KeyboardEvent)+ * - [MouseEvent](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/MouseEvent)+ * - [PointerEvent](https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/PointerEvent)+ * - [TouchEvent](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/TouchEvent)+ * - [Event](https://developer.mozilla.org/en-US/docs/Web/API/Event/Event)+ ** You can also specify `JSHandle` as the property value if you want live objects to be passed into the event:+ ** ```js* // Note you can only create DataTransfer in Chromium and Firefox* const dataTransfer = await frame.evaluateHandle(() => new DataTransfer());* await frame.dispatchEvent('#source', 'dragstart', { dataTransfer });* ```- * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See working with selectors for more details.+ *+ * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details.* @param type DOM event type: `"click"`, `"dragstart"`, etc.* @param eventInit Optional event-specific initialization properties.* @param options*/dispatchEvent(selector: string, type: string, eventInit?: EvaluationArgument, options?: {/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}): Promise<void>;/**- * This method waits for an element matching `selector`, waits for actionability checks, focuses the element, fills it and triggers an `input` event after filling. If the element matching `selector` is not an `<input>`, `<textarea>` or `[contenteditable]` element, this method throws an error. Note that you can pass an empty string to clear the input field.- * To send fine-grained keyboard events, use `frame.type(selector, text[, options])`.- * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See working with selectors for more details.+ * This method waits for an element matching `selector`, waits for [actionability](https://github.com/microsoft/playwright/blob/master/docs/actionability.md) checks, focuses the element, fills it and triggers an `input` event after filling. If the element matching `selector` is not an `<input>`, `<textarea>` or `[contenteditable]` element, this method throws an error. Note that you can pass an empty string to clear the input field.+ *+ * To send fine-grained keyboard events, use [`frame.type(selector, text[, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#frametypeselector-text-options).+ * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details.* @param value Value to fill for the `<input>`, `<textarea>` or `[contenteditable]` element.* @param options*/@@ -2923,72 +3195,77 @@ export interface Frame {noWaitAfter?: boolean;/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}): Promise<void>;/*** This method fetches an element with `selector` and focuses it. If there's no element matching `selector`, the method waits until a matching element appears in the DOM.- * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See working with selectors for more details.+ * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details.* @param options*/focus(selector: string, options?: {/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}): Promise<void>;/*** Returns the `frame` or `iframe` element handle which corresponds to this frame.- * This is an inverse of `elementHandle.contentFrame()`. Note that returned handle actually belongs to the parent frame.+ *+ * This is an inverse of [`elementHandle.contentFrame()`](https://github.com/microsoft/playwright/blob/master/docs/api.md#elementhandlecontentframe). Note that returned handle actually belongs to the parent frame.+ ** This method throws an error if the frame has been detached before `frameElement()` returns.+ ** ```js* const frameElement = await frame.frameElement();* const contentFrame = await frameElement.contentFrame();* console.log(frame === contentFrame); // -> true* ```+ **/frameElement(): Promise<ElementHandle>;/*** Returns element attribute value.- * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See working with selectors for more details.+ * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details.* @param name Attribute name to get the value for.* @param options*/getAttribute(selector: string, name: string, options?: {/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}): Promise<null|string>;/*** Returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of the last redirect.+ ** `frame.goto` will throw an error if:* - there's an SSL error (e.g. in case of self-signed certificates).* - target URL is invalid.* - the `timeout` is exceeded during navigation.* - the remote server does not respond or is unreachable.* - the main resource failed to load.- * `frame.goto` will not throw an error when any valid HTTP status code is 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 `response.status()`.*- * > **NOTE** `frame.goto` either throws an error or returns a main resource response. The only exceptions are navigation to `about:blank` or navigation to the same URL with a different hash, which would succeed and return `null`.+ * `frame.goto` will not throw an error when any valid HTTP status code is 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 [`response.status()`](https://github.com/microsoft/playwright/blob/master/docs/api.md#responsestatus).*- * > **NOTE** Headless mode doesn't support navigation to a PDF document. See the upstream issue.+ * > **NOTE** `frame.goto` either throws an error or returns a main resource response. The only exceptions are navigation to `about:blank` or navigation to the same URL with a different hash, which would succeed and return `null`.+ * > **NOTE** Headless mode doesn't support navigation to a PDF document. See the [upstream issue](https://bugs.chromium.org/p/chromium/issues/detail?id=761295).* @param url URL to navigate frame to. The url should include scheme, e.g. `https://`.* @param options*/goto(url: string, options?: {/**- * Referer header value. If provided it will take preference over the referer header value set by `page.setExtraHTTPHeaders(headers)`.+ * Referer header value. If provided it will take preference over the referer header value set by [`page.setExtraHTTPHeaders(headers)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetextrahttpheadersheaders).*/referer?: string;/**- * Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultNavigationTimeout(timeout)`, `browserContext.setDefaultTimeout(timeout)`, `page.setDefaultNavigationTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultNavigationTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaultnavigationtimeouttimeout), [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout), [`page.setDefaultNavigationTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaultnavigationtimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;@@ -2998,23 +3275,24 @@ export interface Frame {* - `'load'` - consider operation to be finished when the `load` event is fired.* - `'networkidle'` - consider operation to be finished when there are no network connections for at least `500` ms.*/- waitUntil?: "domcontentloaded"|"load"|"networkidle";+ waitUntil?: "load"|"domcontentloaded"|"networkidle";}): Promise<null|Response>;/*** This method hovers over an element matching `selector` by performing the following steps:- * - Find an element match matching `selector`. If there is none, wait until a matching element is attached to the DOM.- * - Wait for actionability checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried.- * - Scroll the element into view if needed.- * - Use page.mouse to hover over the center of the element, or the specified `position`.- * - Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.- * When all steps combined have not finished during the specified `timeout`, this method rejects with a TimeoutError. Passing zero timeout disables this.- * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See working with selectors for more details.+ * 1. Find an element match matching `selector`. If there is none, wait until a matching element is attached to the DOM.+ * 1. Wait for [actionability](https://github.com/microsoft/playwright/blob/master/docs/actionability.md) checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried.+ * 1. Scroll the element into view if needed.+ * 1. Use [`page.mouse`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagemouse) to hover over the center of the element, or the specified `position`.+ * 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.+ *+ * When all steps combined have not finished during the specified `timeout`, this method rejects with a [TimeoutError]. Passing zero timeout disables this.+ * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details.* @param options*/hover(selector: string, options?: {/**- * Whether to bypass the actionability checks. Defaults to `false`.+ * Whether to bypass the [actionability](https://github.com/microsoft/playwright/blob/master/docs/actionability.md) checks. Defaults to `false`.*/force?: boolean;@@ -3033,31 +3311,31 @@ export interface Frame {};/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}): Promise<void>;/*** Returns `element.innerHTML`.- * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See working with selectors for more details.+ * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details.* @param options*/innerHTML(selector: string, options?: {/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}): Promise<string>;/*** Returns `element.innerText`.- * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See working with selectors for more details.+ * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details.* @param options*/innerText(selector: string, options?: {/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}): Promise<string>;@@ -3069,6 +3347,7 @@ export interface Frame {/*** Returns frame's name attribute as specified in the tag.+ ** If the name is empty, returns the id attribute instead.** > **NOTE** This value is calculated once when the frame is created, and will not update if the attribute is changed later.@@ -3086,13 +3365,18 @@ export interface Frame {parentFrame(): null|Frame;/**- * `key` can specify the intended keyboardEvent.key value or a single character to generate the text for. A superset of the `key` values can be found here. Examples of the keys are:+ * `key` can specify the intended [keyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key) value or a single character to generate the text for. A superset of the `key` values can be found [here](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values). Examples of the keys are:+ ** `F1` - `F12`, `Digit0`- `Digit9`, `KeyA`- `KeyZ`, `Backquote`, `Minus`, `Equal`, `Backslash`, `Backspace`, `Tab`, `Delete`, `Escape`, `ArrowDown`, `End`, `Enter`, `Home`, `Insert`, `PageDown`, `PageUp`, `ArrowRight`, `ArrowUp`, etc.+ ** Following modification shortcuts are also supported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`.+ ** Holding down `Shift` will type the text that corresponds to the `key` in the upper case.+ ** If `key` is a single character, it is case-sensitive, so the values `a` and `A` will generate different respective texts.+ ** Shortcuts such as `key: "Control+o"` or `key: "Control+Shift+T"` are supported as well. When speficied with the modifier, modifier is pressed and being held while the subsequent key is being pressed.- * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See working with selectors for more details.+ * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details.* @param key Name of the key to press or a character to generate, such as `ArrowLeft` or `a`.* @param options*/@@ -3108,14 +3392,16 @@ export interface Frame {noWaitAfter?: boolean;/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}): Promise<void>;/*** Returns the array of option values that have been successfully selected.+ ** Triggers a `change` and `input` event once all the provided options have been selected. If there's no `<select>` element matching `selector`, the method throws an error.+ ** ```js* // single selection matching the value* frame.selectOption('select#colors', 'blue');@@ -3126,38 +3412,39 @@ export interface Frame {* // multiple selection* frame.selectOption('select#colors', 'red', 'green', 'blue');* ```- * @param selector A selector to query for. See working with selectors for more details.+ *+ * @param selector A selector to query for. See [working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details.* @param values Options to select. If the `<select>` has the `multiple` attribute, all matching options are selected, otherwise only the first option matching one of the passed options is selected. String values are equivalent to `{value:'string'}`. Option is considered matching if all specified properties match.* @param options*/selectOption(selector: string, values: null|string|ElementHandle|Array<string>|{/**- * Matches by `option.value`.+ * Matches by `option.value`. Optional.*/value?: string;/**- * Matches by `option.label`.+ * Matches by `option.label`. Optional.*/label?: string;/**- * Matches by the index.+ * Matches by the index. Optional.*/index?: number;}|Array<ElementHandle>|Array<{/**- * Matches by `option.value`.+ * Matches by `option.value`. Optional.*/value?: string;/**- * Matches by `option.label`.+ * Matches by `option.label`. Optional.*/label?: string;/**- * Matches by the index.+ * Matches by the index. Optional.*/index?: number;}>, options?: {@@ -3167,7 +3454,7 @@ export interface Frame {noWaitAfter?: boolean;/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}): Promise<Array<string>>;@@ -3178,7 +3465,7 @@ export interface Frame {*/setContent(html: string, options?: {/**- * Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultNavigationTimeout(timeout)`, `browserContext.setDefaultTimeout(timeout)`, `page.setDefaultNavigationTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultNavigationTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaultnavigationtimeouttimeout), [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout), [`page.setDefaultNavigationTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaultnavigationtimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;@@ -3188,24 +3475,25 @@ export interface Frame {* - `'load'` - consider operation to be finished when the `load` event is fired.* - `'networkidle'` - consider operation to be finished when there are no network connections for at least `500` ms.*/- waitUntil?: "domcontentloaded"|"load"|"networkidle";+ waitUntil?: "load"|"domcontentloaded"|"networkidle";}): Promise<void>;/**- * This method expects `selector` to point to an input element.+ * This method expects `selector` to point to an [input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input).+ ** Sets the value of the file input to these file paths or files. If some of the `filePaths` are relative paths, then they are resolved relative to the the current working directory. For empty array, clears the selected files.- * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See working with selectors for more details.+ * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details.* @param files* @param options*/setInputFiles(selector: string, files: string|Array<string>|{/**- * File name **required**+ * [File] name **required***/name: string;/**- * File type **required**+ * [File] type **required***/mimeType: string;@@ -3215,12 +3503,12 @@ export interface Frame {buffer: Buffer;}|Array<{/**- * File name **required**+ * [File] name **required***/name: string;/**- * File type **required**+ * [File] type **required***/mimeType: string;@@ -3235,27 +3523,28 @@ export interface Frame {noWaitAfter?: boolean;/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}): Promise<void>;/*** This method taps an element matching `selector` by performing the following steps:- * - Find an element match matching `selector`. If there is none, wait until a matching element is attached to the DOM.- * - Wait for actionability checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried.- * - Scroll the element into view if needed.- * - Use page.touchscreen to tap the center of the element, or the specified `position`.- * - Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.- * When all steps combined have not finished during the specified `timeout`, this method rejects with a TimeoutError. Passing zero timeout disables this.+ * 1. Find an element match matching `selector`. If there is none, wait until a matching element is attached to the DOM.+ * 1. Wait for [actionability](https://github.com/microsoft/playwright/blob/master/docs/actionability.md) checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried.+ * 1. Scroll the element into view if needed.+ * 1. Use [`page.touchscreen`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagetouchscreen) to tap the center of the element, or the specified `position`.+ * 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.+ *+ * When all steps combined have not finished during the specified `timeout`, this method rejects with a [TimeoutError]. Passing zero timeout disables this.** > **NOTE** `frame.tap()` requires that the `hasTouch` option of the browser context be set to true.- * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See working with selectors for more details.+ * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details.* @param options*/tap(selector: string, options?: {/**- * Whether to bypass the actionability checks. Defaults to `false`.+ * Whether to bypass the [actionability](https://github.com/microsoft/playwright/blob/master/docs/actionability.md) checks. Defaults to `false`.*/force?: boolean;@@ -3279,19 +3568,19 @@ export interface Frame {};/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}): Promise<void>;/*** Returns `element.textContent`.- * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See working with selectors for more details.+ * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details.* @param options*/textContent(selector: string, options?: {/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}): Promise<null|string>;@@ -3302,13 +3591,16 @@ export interface Frame {title(): Promise<string>;/**- * Sends a `keydown`, `keypress`/`input`, and `keyup` event for each character in the text. `frame.type` can be used to send fine-grained keyboard events. To fill values in form fields, use `frame.fill(selector, value[, options])`.- * To press a special key, like `Control` or `ArrowDown`, use `keyboard.press(key[, options])`.+ * Sends a `keydown`, `keypress`/`input`, and `keyup` event for each character in the text. `frame.type` can be used to send fine-grained keyboard events. To fill values in form fields, use [`frame.fill(selector, value[, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#framefillselector-value-options).+ *+ * To press a special key, like `Control` or `ArrowDown`, use [`keyboard.press(key[, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#keyboardpresskey-options).+ ** ```js* await frame.type('#mytextarea', 'Hello'); // Types instantly* await frame.type('#mytextarea', 'World', {delay: 100}); // Types slower, like a user* ```- * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See working with selectors for more details.+ *+ * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details.* @param text A text to type into a focused element.* @param options*/@@ -3324,27 +3616,28 @@ export interface Frame {noWaitAfter?: boolean;/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}): Promise<void>;/*** This method checks an element matching `selector` by performing the following steps:- * - Find an element match matching `selector`. If there is none, wait until a matching element is attached to the DOM.- * - Ensure that matched element is a checkbox or a radio input. If not, this method rejects. If the element is already unchecked, this method returns immediately.- * - Wait for actionability checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried.- * - Scroll the element into view if needed.- * - Use page.mouse to click in the center of the element.- * - Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.- * - Ensure that the element is now unchecked. If not, this method rejects.- * When all steps combined have not finished during the specified `timeout`, this method rejects with a TimeoutError. Passing zero timeout disables this.- * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See working with selectors for more details.+ * 1. Find an element match matching `selector`. If there is none, wait until a matching element is attached to the DOM.+ * 1. Ensure that matched element is a checkbox or a radio input. If not, this method rejects. If the element is already unchecked, this method returns immediately.+ * 1. Wait for [actionability](https://github.com/microsoft/playwright/blob/master/docs/actionability.md) checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried.+ * 1. Scroll the element into view if needed.+ * 1. Use [`page.mouse`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagemouse) to click in the center of the element.+ * 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.+ * 1. Ensure that the element is now unchecked. If not, this method rejects.+ *+ * When all steps combined have not finished during the specified `timeout`, this method rejects with a [TimeoutError]. Passing zero timeout disables this.+ * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details.* @param options*/uncheck(selector: string, options?: {/**- * Whether to bypass the actionability checks. Defaults to `false`.+ * Whether to bypass the [actionability](https://github.com/microsoft/playwright/blob/master/docs/actionability.md) checks. Defaults to `false`.*/force?: boolean;@@ -3354,7 +3647,7 @@ export interface Frame {noWaitAfter?: boolean;/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}): Promise<void>;@@ -3366,43 +3659,49 @@ export interface Frame {/*** Waits for the required load state to be reached.+ ** This returns when the frame reaches a required load state, `load` by default. The navigation must have been committed when this method is called. If current document has already reached the required state, resolves immediately.+ ** ```js* await frame.click('button'); // Click triggers navigation.* await frame.waitForLoadState(); // Waits for 'load' state by default.* ```+ ** @param state Optional load state to wait for, defaults to `load`. If the state has been already reached while loading current document, the method returns immediately. Can be one of: - `'load'` - wait for the `load` event to be fired.* - `'domcontentloaded'` - wait for the `DOMContentLoaded` event to be fired.* - `'networkidle'` - wait until there are no network connections for at least `500` ms.* @param options*/- waitForLoadState(state?: "domcontentloaded"|"load"|"networkidle", options?: {+ waitForLoadState(state?: "load"|"domcontentloaded"|"networkidle", options?: {/**- * Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultNavigationTimeout(timeout)`, `browserContext.setDefaultTimeout(timeout)`, `page.setDefaultNavigationTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultNavigationTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaultnavigationtimeouttimeout), [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout), [`page.setDefaultNavigationTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaultnavigationtimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}): Promise<void>;/*** Returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of the last redirect. In case of navigation to a different anchor or navigation due to History API usage, the navigation will resolve with `null`.+ ** This method waits for the frame to navigate to a new URL. It is useful for when you run code which will indirectly cause the frame to navigate. Consider this example:+ ** ```js* const [response] = await Promise.all([* frame.waitForNavigation(), // Wait for the navigation to finish* frame.click('a.my-link'), // Clicking the link will indirectly cause a navigation* ]);* ```- * **NOTE** Usage of the History API to change the URL is considered a navigation.+ *+ * **NOTE** Usage of the [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) to change the URL is considered a navigation.* @param options*/waitForNavigation(options?: {/**- * Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultNavigationTimeout(timeout)`, `browserContext.setDefaultTimeout(timeout)`, `page.setDefaultNavigationTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultNavigationTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaultnavigationtimeouttimeout), [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout), [`page.setDefaultNavigationTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaultnavigationtimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;/**- * URL string, URL regex pattern or predicate receiving URL to match while waiting for the navigation.+ * URL string, URL regex pattern or predicate receiving [URL] to match while waiting for the navigation.*/url?: string|RegExp|Function;@@ -3412,20 +3711,26 @@ export interface Frame {* - `'load'` - consider operation to be finished when the `load` event is fired.* - `'networkidle'` - consider operation to be finished when there are no network connections for at least `500` ms.*/- waitUntil?: "domcontentloaded"|"load"|"networkidle";+ waitUntil?: "load"|"domcontentloaded"|"networkidle";}): Promise<null|Response>;/*** Waits for the given `timeout` in milliseconds.+ ** Note that `frame.waitForTimeout()` should only be used for debugging. Tests using the timer in production are going to be flaky. Use signals such as network events, selectors becoming visible and others instead.* @param timeout A timeout to wait for*/waitForTimeout(timeout: number): Promise<void>;}/**+ * - extends: [EventEmitter](https://nodejs.org/api/events.html#events_class_eventemitter)+ ** BrowserContexts provide a way to operate multiple independent browser sessions.+ ** If a page opens another page, e.g. with a `window.open` call, the popup will belong to the parent page's browser context.+ ** Playwright allows creation of "incognito" browser contexts with `browser.newContext()` method. "Incognito" browser contexts don't write any browsing data to disk.+ ** ```js* // Create a new incognito browser context* const context = await browser.newContext();@@ -3435,13 +3740,18 @@ export interface Frame {* // Dispose context once it's no longer needed.* await context.close();* ```+ **/export interface BrowserContext {/**- * The method adds a function called `name` on the `window` object of every frame in every page in the context. When called, the function executes `playwrightBinding` and returns a Promise which resolves to the return value of `playwrightBinding`. If the `playwrightBinding` returns a Promise, it will be awaited.+ * The method adds a function called `name` on the `window` object of every frame in every page in the context. When called, the function executes `playwrightBinding` and returns a [Promise] which resolves to the return value of `playwrightBinding`. If the `playwrightBinding` returns a [Promise], it will be awaited.+ ** The first argument of the `playwrightBinding` function contains information about the caller: `{ browserContext: BrowserContext, page: Page, frame: Frame }`.- * See `page.exposeBinding(name, playwrightBinding[, options])` for page-only version.+ *+ * See [`page.exposeBinding(name, playwrightBinding[, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageexposebindingname-playwrightbinding-options) for page-only version.+ ** An example of exposing page URL to all frames in all pages in the context:+ ** ```js* const { webkit } = require('playwright'); // Or 'chromium' or 'firefox'.*@@ -3462,7 +3772,9 @@ export interface BrowserContext {* await page.click('button');* })();* ```+ ** An example of passing an element handle:+ ** ```js* await context.exposeBinding('clicked', async (source, element) => {* console.log(await element.textContent());@@ -3475,6 +3787,7 @@ export interface BrowserContext {* <div>Or click me</div>* `);* ```+ ** @param name Name of the function on the window object.* @param playwrightBinding Callback function that will be called in the Playwright's context.* @param options@@ -3485,13 +3798,15 @@ export interface BrowserContext {* Emitted when Browser context gets closed. This might happen because of one of the following:* - Browser context is closed.* - Browser application is closed or crashed.- * - The `browser.close()` method was called.+ * - The [`browser.close()`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browserclose) method was called.*/on(event: 'close', listener: () => void): this;/**- * The event is emitted when a new Page is created in the BrowserContext. The page may still be loading. The event will also fire for popup pages. See also `page.on('popup')` to receive events about popups relevant to a specific page.+ * The event is emitted when a new Page is created in the BrowserContext. The page may still be loading. The event will also fire for popup pages. See also [`page.on('popup')`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageonpopup) to receive events about popups relevant to a specific page.+ ** The earliest moment that page is available is when it has navigated to the initial url. For example, when opening a popup with `window.open('http://example.com')`, this event will fire when the network request to "http://example.com" is done and its response has started loading in the popup.+ ** ```js* const [page] = await Promise.all([* context.waitForEvent('page'),@@ -3500,7 +3815,7 @@ export interface BrowserContext {* console.log(await page.evaluate('location.href'));* ```*- * > **NOTE** Use `page.waitForLoadState([state, options])` to wait until the page gets to a particular state (you should not need it in most cases).+ * > **NOTE** Use [`page.waitForLoadState([state, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagewaitforloadstatestate-options) to wait until the page gets to a particular state (you should not need it in most cases).*/on(event: 'page', listener: (page: Page) => void): this;@@ -3508,13 +3823,15 @@ export interface BrowserContext {* Emitted when Browser context gets closed. This might happen because of one of the following:* - Browser context is closed.* - Browser application is closed or crashed.- * - The `browser.close()` method was called.+ * - The [`browser.close()`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browserclose) method was called.*/once(event: 'close', listener: () => void): this;/**- * The event is emitted when a new Page is created in the BrowserContext. The page may still be loading. The event will also fire for popup pages. See also `page.on('popup')` to receive events about popups relevant to a specific page.+ * The event is emitted when a new Page is created in the BrowserContext. The page may still be loading. The event will also fire for popup pages. See also [`page.on('popup')`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageonpopup) to receive events about popups relevant to a specific page.+ ** The earliest moment that page is available is when it has navigated to the initial url. For example, when opening a popup with `window.open('http://example.com')`, this event will fire when the network request to "http://example.com" is done and its response has started loading in the popup.+ ** ```js* const [page] = await Promise.all([* context.waitForEvent('page'),@@ -3523,7 +3840,7 @@ export interface BrowserContext {* console.log(await page.evaluate('location.href'));* ```*- * > **NOTE** Use `page.waitForLoadState([state, options])` to wait until the page gets to a particular state (you should not need it in most cases).+ * > **NOTE** Use [`page.waitForLoadState([state, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagewaitforloadstatestate-options) to wait until the page gets to a particular state (you should not need it in most cases).*/once(event: 'page', listener: (page: Page) => void): this;@@ -3531,13 +3848,15 @@ export interface BrowserContext {* Emitted when Browser context gets closed. This might happen because of one of the following:* - Browser context is closed.* - Browser application is closed or crashed.- * - The `browser.close()` method was called.+ * - The [`browser.close()`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browserclose) method was called.*/addListener(event: 'close', listener: () => void): this;/**- * The event is emitted when a new Page is created in the BrowserContext. The page may still be loading. The event will also fire for popup pages. See also `page.on('popup')` to receive events about popups relevant to a specific page.+ * The event is emitted when a new Page is created in the BrowserContext. The page may still be loading. The event will also fire for popup pages. See also [`page.on('popup')`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageonpopup) to receive events about popups relevant to a specific page.+ ** The earliest moment that page is available is when it has navigated to the initial url. For example, when opening a popup with `window.open('http://example.com')`, this event will fire when the network request to "http://example.com" is done and its response has started loading in the popup.+ ** ```js* const [page] = await Promise.all([* context.waitForEvent('page'),@@ -3546,7 +3865,7 @@ export interface BrowserContext {* console.log(await page.evaluate('location.href'));* ```*- * > **NOTE** Use `page.waitForLoadState([state, options])` to wait until the page gets to a particular state (you should not need it in most cases).+ * > **NOTE** Use [`page.waitForLoadState([state, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagewaitforloadstatestate-options) to wait until the page gets to a particular state (you should not need it in most cases).*/addListener(event: 'page', listener: (page: Page) => void): this;@@ -3554,13 +3873,15 @@ export interface BrowserContext {* Emitted when Browser context gets closed. This might happen because of one of the following:* - Browser context is closed.* - Browser application is closed or crashed.- * - The `browser.close()` method was called.+ * - The [`browser.close()`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browserclose) method was called.*/removeListener(event: 'close', listener: () => void): this;/**- * The event is emitted when a new Page is created in the BrowserContext. The page may still be loading. The event will also fire for popup pages. See also `page.on('popup')` to receive events about popups relevant to a specific page.+ * The event is emitted when a new Page is created in the BrowserContext. The page may still be loading. The event will also fire for popup pages. See also [`page.on('popup')`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageonpopup) to receive events about popups relevant to a specific page.+ ** The earliest moment that page is available is when it has navigated to the initial url. For example, when opening a popup with `window.open('http://example.com')`, this event will fire when the network request to "http://example.com" is done and its response has started loading in the popup.+ ** ```js* const [page] = await Promise.all([* context.waitForEvent('page'),@@ -3569,7 +3890,7 @@ export interface BrowserContext {* console.log(await page.evaluate('location.href'));* ```*- * > **NOTE** Use `page.waitForLoadState([state, options])` to wait until the page gets to a particular state (you should not need it in most cases).+ * > **NOTE** Use [`page.waitForLoadState([state, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagewaitforloadstatestate-options) to wait until the page gets to a particular state (you should not need it in most cases).*/removeListener(event: 'page', listener: (page: Page) => void): this;@@ -3577,13 +3898,15 @@ export interface BrowserContext {* Emitted when Browser context gets closed. This might happen because of one of the following:* - Browser context is closed.* - Browser application is closed or crashed.- * - The `browser.close()` method was called.+ * - The [`browser.close()`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browserclose) method was called.*/off(event: 'close', listener: () => void): this;/**- * The event is emitted when a new Page is created in the BrowserContext. The page may still be loading. The event will also fire for popup pages. See also `page.on('popup')` to receive events about popups relevant to a specific page.+ * The event is emitted when a new Page is created in the BrowserContext. The page may still be loading. The event will also fire for popup pages. See also [`page.on('popup')`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageonpopup) to receive events about popups relevant to a specific page.+ ** The earliest moment that page is available is when it has navigated to the initial url. For example, when opening a popup with `window.open('http://example.com')`, this event will fire when the network request to "http://example.com" is done and its response has started loading in the popup.+ ** ```js* const [page] = await Promise.all([* context.waitForEvent('page'),@@ -3592,15 +3915,17 @@ export interface BrowserContext {* console.log(await page.evaluate('location.href'));* ```*- * > **NOTE** Use `page.waitForLoadState([state, options])` to wait until the page gets to a particular state (you should not need it in most cases).+ * > **NOTE** Use [`page.waitForLoadState([state, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagewaitforloadstatestate-options) to wait until the page gets to a particular state (you should not need it in most cases).*/off(event: 'page', listener: (page: Page) => void): this;/**- * Adds cookies into this browser context. All pages within this context will have these cookies installed. Cookies can be obtained via `browserContext.cookies([urls])`.+ * Adds cookies into this browser context. All pages within this context will have these cookies installed. Cookies can be obtained via [`browserContext.cookies([urls])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextcookiesurls).+ ** ```js* await browserContext.addCookies([cookieObject1, cookieObject2]);* ```+ ** @param cookies*/addCookies(cookies: Array<{@@ -3615,7 +3940,7 @@ export interface BrowserContext {value: string;/**- * either url or domain / path are required.+ * either url or domain / path are required. Optional.*/url?: string;@@ -3630,7 +3955,7 @@ export interface BrowserContext {path?: string;/**- * Unix time in seconds.+ * Unix time in seconds. Optional.*/expires?: number;@@ -3647,19 +3972,23 @@ export interface BrowserContext {/*** Optional.*/- sameSite?: "Lax"|"None"|"Strict";+ sameSite?: "Strict"|"Lax"|"None";}>): Promise<void>;/*** Adds a script which would be evaluated in one of the following scenarios:* - Whenever a page is created in the browser context or is navigated.* - Whenever a child frame is attached or navigated in any page in the browser context. In this case, the script is evaluated in the context of the newly attached frame.+ ** The script is evaluated after the document was created but before any of its scripts were run. This is useful to amend the JavaScript environment, e.g. to seed `Math.random`.+ ** An example of overriding `Math.random` before the page loads:+ ** ```js* // preload.js* Math.random = () => 42;* ```+ ** ```js* // In your playwright script, assuming the preload.js file is in same directory.* await browserContext.addInitScript({@@ -3667,18 +3996,18 @@ export interface BrowserContext {* });* ```*- * > **NOTE** The order of evaluation of multiple scripts installed via `browserContext.addInitScript(script[, arg])` and `page.addInitScript(script[, arg])` is not defined.+ * > **NOTE** The order of evaluation of multiple scripts installed via [`browserContext.addInitScript(script[, arg])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextaddinitscriptscript-arg) and [`page.addInitScript(script[, arg])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageaddinitscriptscript-arg) is not defined.* @param script Script to be evaluated in all pages in the browser context.* @param arg Optional argument to pass to `script` (only supported when passing a function).*/addInitScript(script: Function|string|{/**- * Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the current working directory.+ * Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the current working directory. Optional.*/path?: string;/**- * Raw script content.+ * Raw script content. Optional.*/content?: string;}, arg?: Serializable): Promise<void>;@@ -3695,12 +4024,14 @@ export interface BrowserContext {/*** Clears all permission overrides for the browser context.+ ** ```js* const context = await browser.newContext();* await context.grantPermissions(['clipboard-read']);* // do stuff ..* context.clearPermissions();* ```+ **/clearPermissions(): Promise<void>;@@ -3718,10 +4049,14 @@ export interface BrowserContext {cookies(urls?: string|Array<string>): Promise<Array<Cookie>>;/**- * The method adds a function called `name` on the `window` object of every frame in every page in the context. When called, the function executes `playwrightFunction` and returns a Promise which resolves to the return value of `playwrightFunction`.- * If the `playwrightFunction` returns a Promise, it will be awaited.- * See `page.exposeFunction(name, playwrightFunction)` for page-only version.+ * The method adds a function called `name` on the `window` object of every frame in every page in the context. When called, the function executes `playwrightFunction` and returns a [Promise] which resolves to the return value of `playwrightFunction`.+ *+ * If the `playwrightFunction` returns a [Promise], it will be awaited.+ *+ * See [`page.exposeFunction(name, playwrightFunction)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageexposefunctionname-playwrightfunction) for page-only version.+ ** An example of adding an `md5` function to all pages in the context:+ ** ```js* const { webkit } = require('playwright'); // Or 'chromium' or 'firefox'.* const crypto = require('crypto');@@ -3743,6 +4078,7 @@ export interface BrowserContext {* await page.click('button');* })();* ```+ ** @param name Name of the function on the window object.* @param playwrightFunction Callback function that will be called in the Playwright's context.*/@@ -3770,7 +4106,7 @@ export interface BrowserContext {*/grantPermissions(permissions: Array<string>, options?: {/**- * The origin to grant permissions to, e.g. "https://example.com".+ * The [origin] to grant permissions to, e.g. "https://example.com".*/origin?: string;}): Promise<void>;@@ -3781,13 +4117,15 @@ export interface BrowserContext {newPage(): Promise<Page>;/**- * Returns all open pages in the context. Non visible pages, such as `"background_page"`, will not be listed here. You can find them using `chromiumBrowserContext.backgroundPages()`.+ * Returns all open pages in the context. Non visible pages, such as `"background_page"`, will not be listed here. You can find them using [`chromiumBrowserContext.backgroundPages()`](https://github.com/microsoft/playwright/blob/master/docs/api.md#chromiumbrowsercontextbackgroundpages).*/pages(): Array<Page>;/*** Routing provides the capability to modify network requests that are made by any page in the browser context. Once route is enabled, every request matching the url pattern will stall unless it's continued, fulfilled or aborted.+ ** An example of a naïve handler that aborts all image requests:+ ** ```js* const context = await browser.newContext();* await context.route('**\/*.{png,jpg,jpeg}', route => route.abort());@@ -3795,7 +4133,9 @@ export interface BrowserContext {* await page.goto('https://example.com');* await browser.close();* ```+ ** or the same snippet using a regex pattern instead:+ ** ```js* const context = await browser.newContext();* await context.route(/(\.png$)|(\.jpg$)/, route => route.abort());@@ -3803,24 +4143,25 @@ export interface BrowserContext {* await page.goto('https://example.com');* await browser.close();* ```- * Page routes (set up with `page.route(url, handler)`) take precedence over browser context routes when request matches both handlers.+ *+ * Page routes (set up with [`page.route(url, handler)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagerouteurl-handler)) take precedence over browser context routes when request matches both handlers.** > **NOTE** Enabling routing disables http cache.- * @param url A glob pattern, regex pattern or predicate receiving URL to match while routing.+ * @param url A glob pattern, regex pattern or predicate receiving [URL] to match while routing.* @param handler handler function to route the request.*/route(url: string|RegExp|((url: URL) => boolean), handler: ((route: Route, request: Request) => void)): Promise<void>;/*** This setting will change the default maximum navigation time for the following methods and related shortcuts:- * - `page.goBack([options])`- * - `page.goForward([options])`- * - `page.goto(url[, options])`- * - `page.reload([options])`- * - `page.setContent(html[, options])`- * - `page.waitForNavigation([options])`- *- * > **NOTE** `page.setDefaultNavigationTimeout(timeout)` and `page.setDefaultTimeout(timeout)` take priority over `browserContext.setDefaultNavigationTimeout(timeout)`.+ * - [`page.goBack([options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagegobackoptions)+ * - [`page.goForward([options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagegoforwardoptions)+ * - [`page.goto(url[, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagegotourl-options)+ * - [`page.reload([options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagereloadoptions)+ * - [`page.setContent(html[, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetcontenthtml-options)+ * - [`page.waitForNavigation([options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagewaitfornavigationoptions)+ *+ * > **NOTE** [`page.setDefaultNavigationTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaultnavigationtimeouttimeout) and [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) take priority over [`browserContext.setDefaultNavigationTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaultnavigationtimeouttimeout).* @param timeout Maximum navigation time in milliseconds*/setDefaultNavigationTimeout(timeout: number): void;@@ -3828,13 +4169,13 @@ export interface BrowserContext {/*** This setting will change the default maximum time for all the methods accepting `timeout` option.*- * > **NOTE** `page.setDefaultNavigationTimeout(timeout)`, `page.setDefaultTimeout(timeout)` and `browserContext.setDefaultNavigationTimeout(timeout)` take priority over `browserContext.setDefaultTimeout(timeout)`.+ * > **NOTE** [`page.setDefaultNavigationTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaultnavigationtimeouttimeout), [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) and [`browserContext.setDefaultNavigationTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaultnavigationtimeouttimeout) take priority over [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout).* @param timeout Maximum time in milliseconds*/setDefaultTimeout(timeout: number): void;/**- * The extra HTTP headers will be sent with every request initiated by any page in the context. These headers are merged with page-specific extra HTTP headers set with `page.setExtraHTTPHeaders(headers)`. If page overrides a particular header, page-specific header value will be used instead of the browser context header value.+ * The extra HTTP headers will be sent with every request initiated by any page in the context. These headers are merged with page-specific extra HTTP headers set with [`page.setExtraHTTPHeaders(headers)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetextrahttpheadersheaders). If page overrides a particular header, page-specific header value will be used instead of the browser context header value.** > **NOTE** `browserContext.setExtraHTTPHeaders` does not guarantee the order of headers in the outgoing requests.* @param headers An object containing additional HTTP headers to be sent with every request. All header values must be strings.@@ -3843,11 +4184,12 @@ export interface BrowserContext {/*** Sets the context's geolocation. Passing `null` or `undefined` emulates position unavailable.+ ** ```js* await browserContext.setGeolocation({latitude: 59.95, longitude: 30.31667});* ```*- * > **NOTE** Consider using `browserContext.grantPermissions(permissions[, options])` to grant permissions for the browser context pages to read its geolocation.+ * > **NOTE** Consider using [`browserContext.grantPermissions(permissions[, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextgrantpermissionspermissions-options) to grant permissions for the browser context pages to read its geolocation.* @param geolocation*/setGeolocation(geolocation: null|{@@ -3868,7 +4210,7 @@ export interface BrowserContext {}): Promise<void>;/**- * Provide credentials for HTTP authentication.+ * Provide credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication).** > **NOTE** Browsers may cache credentials after successful authentication. Passing different credentials or passing `null` to disable authentication will be unreliable. To remove or replace credentials, create a new browser context instead.* @param httpCredentials@@ -3896,7 +4238,7 @@ export interface BrowserContext {*/storageState(options?: {/**- * The file path to save the storage state to. If `path` is a relative path, then it is resolved relative to current working directory. If no path is provided, storage state is still returned, but won't be saved to the disk.+ * The file path to save the storage state to. If `path` is a relative path, then it is resolved relative to [current working directory](https://nodejs.org/api/process.html#process_process_cwd). If no path is provided, storage state is still returned, but won't be saved to the disk.*/path?: string;}): Promise<{@@ -3918,7 +4260,7 @@ export interface BrowserContext {secure: boolean;- sameSite: "Lax"|"None"|"Strict";+ sameSite: "Strict"|"Lax"|"None";}>;origins: Array<{@@ -3933,9 +4275,9 @@ export interface BrowserContext {}>;/**- * Removes a route created with `browserContext.route(url, handler)`. When `handler` is not specified, removes all routes for the `url`.- * @param url A glob pattern, regex pattern or predicate receiving URL used to register a routing with `browserContext.route(url, handler)`.- * @param handler Optional handler function used to register a routing with `browserContext.route(url, handler)`.+ * Removes a route created with [`browserContext.route(url, handler)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextrouteurl-handler). When `handler` is not specified, removes all routes for the `url`.+ * @param url A glob pattern, regex pattern or predicate receiving [URL] used to register a routing with [`browserContext.route(url, handler)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextrouteurl-handler).+ * @param handler Optional handler function used to register a routing with [`browserContext.route(url, handler)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextrouteurl-handler).*/unroute(url: string|RegExp|((url: URL) => boolean), handler?: ((route: Route, request: Request) => void)): Promise<void>;@@ -3943,13 +4285,15 @@ export interface BrowserContext {* Emitted when Browser context gets closed. This might happen because of one of the following:* - Browser context is closed.* - Browser application is closed or crashed.- * - The `browser.close()` method was called.+ * - The [`browser.close()`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browserclose) method was called.*/waitForEvent(event: 'close', optionsOrPredicate?: { predicate?: () => boolean, timeout?: number } | (() => boolean)): Promise<void>;/**- * The event is emitted when a new Page is created in the BrowserContext. The page may still be loading. The event will also fire for popup pages. See also `page.on('popup')` to receive events about popups relevant to a specific page.+ * The event is emitted when a new Page is created in the BrowserContext. The page may still be loading. The event will also fire for popup pages. See also [`page.on('popup')`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageonpopup) to receive events about popups relevant to a specific page.+ ** The earliest moment that page is available is when it has navigated to the initial url. For example, when opening a popup with `window.open('http://example.com')`, this event will fire when the network request to "http://example.com" is done and its response has started loading in the popup.+ ** ```js* const [page] = await Promise.all([* context.waitForEvent('page'),@@ -3958,13 +4302,14 @@ export interface BrowserContext {* console.log(await page.evaluate('location.href'));* ```*- * > **NOTE** Use `page.waitForLoadState([state, options])` to wait until the page gets to a particular state (you should not need it in most cases).+ * > **NOTE** Use [`page.waitForLoadState([state, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagewaitforloadstatestate-options) to wait until the page gets to a particular state (you should not need it in most cases).*/waitForEvent(event: 'page', optionsOrPredicate?: { predicate?: (page: Page) => boolean, timeout?: number } | ((page: Page) => boolean)): Promise<Page>;}/**- * The Worker class represents a WebWorker. `worker` event is emitted on the page object to signal a worker creation. `close` event is emitted on the worker object when the worker is gone.+ * The Worker class represents a [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API). `worker` event is emitted on the page object to signal a worker creation. `close` event is emitted on the worker object when the worker is gone.+ ** ```js* page.on('worker', worker => {* console.log('Worker created: ' + worker.url());@@ -3975,12 +4320,15 @@ export interface BrowserContext {* for (const worker of page.workers())* console.log(' ' + worker.url());* ```+ **/export interface Worker {/*** Returns the return value of `pageFunction`- * If the function passed to the `worker.evaluate` returns a Promise, then `worker.evaluate` would wait for the promise to resolve and return its value.- * If the function passed to the `worker.evaluate` returns a non-Serializable value, then `worker.evaluate` returns `undefined`. DevTools Protocol also supports transferring some additional values that are not serializable by `JSON`: `-0`, `NaN`, `Infinity`, `-Infinity`, and bigint literals.+ *+ * If the function passed to the `worker.evaluate` returns a [Promise], then `worker.evaluate` would wait for the promise to resolve and return its value.+ *+ * If the function passed to the `worker.evaluate` returns a non-[Serializable] value, then `worker.evaluate` returns `undefined`. DevTools Protocol also supports transferring some additional values that are not serializable by `JSON`: `-0`, `NaN`, `Infinity`, `-Infinity`, and bigint literals.* @param pageFunction Function to be evaluated in the worker context* @param arg Optional argument to pass to `pageFunction`*/@@ -3989,59 +4337,69 @@ export interface Worker {/*** Returns the return value of `pageFunction` as in-page object (JSHandle).+ ** The only difference between `worker.evaluate` and `worker.evaluateHandle` is that `worker.evaluateHandle` returns in-page object (JSHandle).- * If the function passed to the `worker.evaluateHandle` returns a Promise, then `worker.evaluateHandle` would wait for the promise to resolve and return its value.+ *+ * If the function passed to the `worker.evaluateHandle` returns a [Promise], then `worker.evaluateHandle` would wait for the promise to resolve and return its value.* @param pageFunction Function to be evaluated in the page context* @param arg Optional argument to pass to `pageFunction`*/evaluateHandle<R, Arg>(pageFunction: PageFunction<Arg, R>, arg: Arg): Promise<SmartHandle<R>>;evaluateHandle<R>(pageFunction: PageFunction<void, R>, arg?: any): Promise<SmartHandle<R>>;/**- * Emitted when this dedicated WebWorker is terminated.+ * Emitted when this dedicated [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) is terminated.*/on(event: 'close', listener: (worker: Worker) => void): this;/**- * Emitted when this dedicated WebWorker is terminated.+ * Emitted when this dedicated [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) is terminated.*/once(event: 'close', listener: (worker: Worker) => void): this;/**- * Emitted when this dedicated WebWorker is terminated.+ * Emitted when this dedicated [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) is terminated.*/addListener(event: 'close', listener: (worker: Worker) => void): this;/**- * Emitted when this dedicated WebWorker is terminated.+ * Emitted when this dedicated [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) is terminated.*/removeListener(event: 'close', listener: (worker: Worker) => void): this;/**- * Emitted when this dedicated WebWorker is terminated.+ * Emitted when this dedicated [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) is terminated.*/off(event: 'close', listener: (worker: Worker) => void): this;url(): string;}/**- * JSHandle represents an in-page JavaScript object. JSHandles can be created with the `page.evaluateHandle(pageFunction[, arg])` method.+ * JSHandle represents an in-page JavaScript object. JSHandles can be created with the [`page.evaluateHandle(pageFunction[, arg])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageevaluatehandlepagefunction-arg) method.+ ** ```js* const windowHandle = await page.evaluateHandle(() => window);* // ...* ```- * JSHandle prevents the referenced JavaScript object being garbage collected unless the handle is exposed with `jsHandle.dispose()`. JSHandles are auto-disposed when their origin frame gets navigated or the parent context gets destroyed.- * JSHandle instances can be used as an argument in `page.$eval(selector, pageFunction[, arg])`, `page.evaluate(pageFunction[, arg])` and `page.evaluateHandle(pageFunction[, arg])` methods.+ *+ * JSHandle prevents the referenced JavaScript object being garbage collected unless the handle is exposed with [`jsHandle.dispose()`](https://github.com/microsoft/playwright/blob/master/docs/api.md#jshandledispose). JSHandles are auto-disposed when their origin frame gets navigated or the parent context gets destroyed.+ *+ * JSHandle instances can be used as an argument in [`page.$eval(selector, pageFunction[, arg])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageevalselector-pagefunction-arg), [`page.evaluate(pageFunction[, arg])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageevaluatepagefunction-arg) and [`page.evaluateHandle(pageFunction[, arg])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageevaluatehandlepagefunction-arg) methods.*/export interface JSHandle<T = any> {/*** Returns the return value of `pageFunction`+ ** This method passes this handle as the first argument to `pageFunction`.- * If `pageFunction` returns a Promise, then `handle.evaluate` would wait for the promise to resolve and return its value.+ *+ * If `pageFunction` returns a [Promise], then `handle.evaluate` would wait for the promise to resolve and return its value.+ ** Examples:+ ** ```js* const tweetHandle = await page.$('.tweet .retweets');* expect(await tweetHandle.evaluate((node, suffix) => node.innerText, ' retweets')).toBe('10 retweets');* ```+ ** @param pageFunction Function to be evaluated in browser context* @param arg Optional argument to pass to `pageFunction`*/@@ -4050,10 +4408,14 @@ export interface JSHandle<T = any> {/*** Returns the return value of `pageFunction` as in-page object (JSHandle).+ ** This method passes this handle as the first argument to `pageFunction`.+ ** The only difference between `jsHandle.evaluate` and `jsHandle.evaluateHandle` is that `jsHandle.evaluateHandle` returns in-page object (JSHandle).- * If the function passed to the `jsHandle.evaluateHandle` returns a Promise, then `jsHandle.evaluateHandle` would wait for the promise to resolve and return its value.- * See `page.evaluateHandle(pageFunction[, arg])` for more details.+ *+ * If the function passed to the `jsHandle.evaluateHandle` returns a [Promise], then `jsHandle.evaluateHandle` would wait for the promise to resolve and return its value.+ *+ * See [`page.evaluateHandle(pageFunction[, arg])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageevaluatehandlepagefunction-arg) for more details.* @param pageFunction Function to be evaluated* @param arg Optional argument to pass to `pageFunction`*/@@ -4067,7 +4429,7 @@ export interface JSHandle<T = any> {*/jsonValue(): Promise<T>;/**- * Returns either `null` or the object handle itself, if the object handle is an instance of ElementHandle.+ * Returns either `null` or the object handle itself, if the object handle is an instance of [ElementHandle].*/asElement(): T extends Node ? ElementHandle<T> : null;/**@@ -4077,6 +4439,7 @@ export interface JSHandle<T = any> {/*** The method returns a map with **own property names** as keys and JSHandle instances for the property values.+ ** ```js* const handle = await page.evaluateHandle(() => ({window, document}));* const properties = await handle.getProperties();@@ -4084,6 +4447,7 @@ export interface JSHandle<T = any> {* const documentHandle = properties.get('document');* await handle.dispose();* ```+ **/getProperties(): Promise<Map<string, JSHandle>>;@@ -4094,7 +4458,10 @@ export interface JSHandle<T = any> {getProperty(propertyName: string): Promise<JSHandle>;}/**- * ElementHandle represents an in-page DOM element. ElementHandles can be created with the `page.$(selector)` method.+ * - extends: [JSHandle]+ *+ * ElementHandle represents an in-page DOM element. ElementHandles can be created with the [`page.$(selector)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageselector) method.+ ** ```js* const { chromium } = require('playwright'); // Or 'firefox' or 'webkit'.*@@ -4107,35 +4474,42 @@ export interface JSHandle<T = any> {* // ...* })();* ```- * ElementHandle prevents DOM element from garbage collection unless the handle is disposed with `jsHandle.dispose()`. ElementHandles are auto-disposed when their origin frame gets navigated.- * ElementHandle instances can be used as an argument in `page.$eval(selector, pageFunction[, arg])` and `page.evaluate(pageFunction[, arg])` methods.+ *+ * ElementHandle prevents DOM element from garbage collection unless the handle is disposed with [`jsHandle.dispose()`](https://github.com/microsoft/playwright/blob/master/docs/api.md#jshandledispose). ElementHandles are auto-disposed when their origin frame gets navigated.+ *+ * ElementHandle instances can be used as an argument in [`page.$eval(selector, pageFunction[, arg])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageevalselector-pagefunction-arg) and [`page.evaluate(pageFunction[, arg])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageevaluatepagefunction-arg) methods.*/export interface ElementHandle<T=Node> extends JSHandle<T> {/**- * The method finds an element matching the specified selector in the `ElementHandle`'s subtree. See Working with selectors for more details. If no elements match the selector, returns `null`.- * @param selector A selector to query for. See working with selectors for more details.+ * The method finds an element matching the specified selector in the `ElementHandle`'s subtree. See [Working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details. If no elements match the selector, returns `null`.+ * @param selector A selector to query for. See [working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details.*/$<K extends keyof HTMLElementTagNameMap>(selector: K): Promise<ElementHandleForTag<K> | null>;$(selector: string): Promise<ElementHandle<SVGElement | HTMLElement> | null>;/**- * The method finds all elements matching the specified selector in the `ElementHandle`s subtree. See Working with selectors for more details. If no elements match the selector, returns empty array.- * @param selector A selector to query for. See working with selectors for more details.+ * The method finds all elements matching the specified selector in the `ElementHandle`s subtree. See [Working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details. If no elements match the selector, returns empty array.+ * @param selector A selector to query for. See [working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details.*/$$<K extends keyof HTMLElementTagNameMap>(selector: K): Promise<ElementHandleForTag<K>[]>;$$(selector: string): Promise<ElementHandle<SVGElement | HTMLElement>[]>;/*** Returns the return value of `pageFunction`- * The method finds an element matching the specified selector in the `ElementHandle`s subtree and passes it as a first argument to `pageFunction`. See Working with selectors for more details. If no elements match the selector, the method throws an error.- * If `pageFunction` returns a Promise, then `frame.$eval` would wait for the promise to resolve and return its value.+ *+ * The method finds an element matching the specified selector in the `ElementHandle`s subtree and passes it as a first argument to `pageFunction`. See [Working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details. If no elements match the selector, the method throws an error.+ *+ * If `pageFunction` returns a [Promise], then `frame.$eval` would wait for the promise to resolve and return its value.+ ** Examples:+ ** ```js* const tweetHandle = await page.$('.tweet');* expect(await tweetHandle.$eval('.like', node => node.innerText)).toBe('100');* expect(await tweetHandle.$eval('.retweets', node => node.innerText)).toBe('10');* ```- * @param selector A selector to query for. See working with selectors for more details.+ *+ * @param selector A selector to query for. See [working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details.* @param pageFunction Function to be evaluated in browser context* @param arg Optional argument to pass to `pageFunction`*/@@ -4146,20 +4520,26 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {/*** Returns the return value of `pageFunction`- * The method finds all elements matching the specified selector in the `ElementHandle`'s subtree and passes an array of matched elements as a first argument to `pageFunction`. See Working with selectors for more details.- * If `pageFunction` returns a Promise, then `frame.$$eval` would wait for the promise to resolve and return its value.+ *+ * The method finds all elements matching the specified selector in the `ElementHandle`'s subtree and passes an array of matched elements as a first argument to `pageFunction`. See [Working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details.+ *+ * If `pageFunction` returns a [Promise], then `frame.$$eval` would wait for the promise to resolve and return its value.+ ** Examples:+ ** ```html* <div class="feed">* <div class="tweet">Hello!</div>* <div class="tweet">Hi!</div>* </div>* ```+ ** ```js* const feedHandle = await page.$('.feed');* expect(await feedHandle.$$eval('.tweet', nodes => nodes.map(n => n.innerText))).toEqual(['Hello!', 'Hi!']);* ```- * @param selector A selector to query for. See working with selectors for more details.+ *+ * @param selector A selector to query for. See [working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details.* @param pageFunction Function to be evaluated in browser context* @param arg Optional argument to pass to `pageFunction`*/@@ -4170,7 +4550,9 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {/*** Returns element specified by selector satisfies `state` option. Returns `null` if waiting for `hidden` or `detached`.+ ** Wait for the `selector` relative to the element handle to satisfy `state` option (either appear/disappear from dom, or become visible/hidden). If at the moment of calling the method `selector` already satisfies the condition, the method will return immediately. If the selector doesn't satisfy the condition for the `timeout` milliseconds, the function will throw.+ ** ```js* await page.setContent(`<div><span></span></div>`);* const div = await page.$('div');@@ -4178,8 +4560,8 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {* const span = await div.waitForSelector('span', { state: 'attached' });* ```*- * > **NOTE** This method does not work across navigations, use `page.waitForSelector(selector[, options])` instead.- * @param selector A selector to query for. See working with selectors for more details.+ * > **NOTE** This method does not work across navigations, use [`page.waitForSelector(selector[, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagewaitforselectorselector-options) instead.+ * @param selector A selector to query for. See [working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more details.* @param options*/waitForSelector<K extends keyof HTMLElementTagNameMap>(selector: K, options?: ElementHandleWaitForSelectorOptionsNotHidden): Promise<ElementHandleForTag<K>>;@@ -4188,13 +4570,18 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {waitForSelector(selector: string, options: ElementHandleWaitForSelectorOptions): Promise<null|ElementHandle<SVGElement | HTMLElement>>;/*** This method returns the bounding box of the element, or `null` if the element is not visible. The bounding box is calculated relative to the main frame viewport - which is usually the same as the browser window.- * Scrolling affects the returned bonding box, similarly to Element.getBoundingClientRect. That means `x` and/or `y` may be negative.- * Elements from child frames return the bounding box relative to the main frame, unlike the Element.getBoundingClientRect.+ *+ * Scrolling affects the returned bonding box, similarly to [Element.getBoundingClientRect](https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect). That means `x` and/or `y` may be negative.+ *+ * Elements from child frames return the bounding box relative to the main frame, unlike the [Element.getBoundingClientRect](https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect).+ ** Assuming the page is static, it is safe to use bounding box coordinates to perform input. For example, the following snippet should click the center of the element.+ ** ```js* const box = await elementHandle.boundingBox();* await page.mouse.click(box.x + box.width / 2, box.y + box.height / 2);* ```+ **/boundingBox(): Promise<null|{/**@@ -4220,19 +4607,21 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {/*** This method checks the element by performing the following steps:- * - Ensure that element is a checkbox or a radio input. If not, this method rejects. If the element is already checked, this method returns immediately.- * - Wait for actionability checks on the element, unless `force` option is set.- * - Scroll the element into view if needed.- * - Use page.mouse to click in the center of the element.- * - Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.- * - Ensure that the element is now checked. If not, this method rejects.+ * 1. Ensure that element is a checkbox or a radio input. If not, this method rejects. If the element is already checked, this method returns immediately.+ * 1. Wait for [actionability](https://github.com/microsoft/playwright/blob/master/docs/actionability.md) checks on the element, unless `force` option is set.+ * 1. Scroll the element into view if needed.+ * 1. Use [`page.mouse`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagemouse) to click in the center of the element.+ * 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.+ * 1. Ensure that the element is now checked. If not, this method rejects.+ ** If the element is detached from the DOM at any moment during the action, this method rejects.- * When all steps combined have not finished during the specified `timeout`, this method rejects with a TimeoutError. Passing zero timeout disables this.+ *+ * When all steps combined have not finished during the specified `timeout`, this method rejects with a [TimeoutError]. Passing zero timeout disables this.* @param options*/check(options?: {/**- * Whether to bypass the actionability checks. Defaults to `false`.+ * Whether to bypass the [actionability](https://github.com/microsoft/playwright/blob/master/docs/actionability.md) checks. Defaults to `false`.*/force?: boolean;@@ -4242,29 +4631,31 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {noWaitAfter?: boolean;/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}): Promise<void>;/*** This method clicks the element by performing the following steps:- * - Wait for actionability checks on the element, unless `force` option is set.- * - Scroll the element into view if needed.- * - Use page.mouse to click in the center of the element, or the specified `position`.- * - Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.+ * 1. Wait for [actionability](https://github.com/microsoft/playwright/blob/master/docs/actionability.md) checks on the element, unless `force` option is set.+ * 1. Scroll the element into view if needed.+ * 1. Use [`page.mouse`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagemouse) to click in the center of the element, or the specified `position`.+ * 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.+ ** If the element is detached from the DOM at any moment during the action, this method rejects.- * When all steps combined have not finished during the specified `timeout`, this method rejects with a TimeoutError. Passing zero timeout disables this.+ *+ * When all steps combined have not finished during the specified `timeout`, this method rejects with a [TimeoutError]. Passing zero timeout disables this.* @param options*/click(options?: {/*** Defaults to `left`.*/- button?: "left"|"middle"|"right";+ button?: "left"|"right"|"middle";/**- * defaults to 1. See UIEvent.detail.+ * defaults to 1. See [UIEvent.detail].*/clickCount?: number;@@ -4274,7 +4665,7 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {delay?: number;/**- * Whether to bypass the actionability checks. Defaults to `false`.+ * Whether to bypass the [actionability](https://github.com/microsoft/playwright/blob/master/docs/actionability.md) checks. Defaults to `false`.*/force?: boolean;@@ -4298,7 +4689,7 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {};/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}): Promise<void>;@@ -4310,12 +4701,14 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {/*** This method double clicks the element by performing the following steps:- * - Wait for actionability checks on the element, unless `force` option is set.- * - Scroll the element into view if needed.- * - Use page.mouse to double click in the center of the element, or the specified `position`.- * - Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set. Note that if the first click of the `dblclick()` triggers a navigation event, this method will reject.+ * 1. Wait for [actionability](https://github.com/microsoft/playwright/blob/master/docs/actionability.md) checks on the element, unless `force` option is set.+ * 1. Scroll the element into view if needed.+ * 1. Use [`page.mouse`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagemouse) to double click in the center of the element, or the specified `position`.+ * 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set. Note that if the first click of the `dblclick()` triggers a navigation event, this method will reject.+ ** If the element is detached from the DOM at any moment during the action, this method rejects.- * When all steps combined have not finished during the specified `timeout`, this method rejects with a TimeoutError. Passing zero timeout disables this.+ *+ * When all steps combined have not finished during the specified `timeout`, this method rejects with a [TimeoutError]. Passing zero timeout disables this.** > **NOTE** `elementHandle.dblclick()` dispatches two `click` events and a single `dblclick` event.* @param options@@ -4324,7 +4717,7 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {/*** Defaults to `left`.*/- button?: "left"|"middle"|"right";+ button?: "left"|"right"|"middle";/*** Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0.@@ -4332,7 +4725,7 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {delay?: number;/**- * Whether to bypass the actionability checks. Defaults to `false`.+ * Whether to bypass the [actionability](https://github.com/microsoft/playwright/blob/master/docs/actionability.md) checks. Defaults to `false`.*/force?: boolean;@@ -4356,38 +4749,44 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {};/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}): Promise<void>;/**- * The snippet below dispatches the `click` event on the element. Regardless of the visibility state of the elment, `click` is dispatched. This is equivalend to calling element.click().+ * The snippet below dispatches the `click` event on the element. Regardless of the visibility state of the elment, `click` is dispatched. This is equivalend to calling [element.click()](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/click).+ ** ```js* await elementHandle.dispatchEvent('click');* ```+ ** Under the hood, it creates an instance of an event based on the given `type`, initializes it with `eventInit` properties and dispatches it on the element. Events are `composed`, `cancelable` and bubble by default.+ ** Since `eventInit` is event-specific, please refer to the events documentation for the lists of initial properties:- * - DragEvent- * - FocusEvent- * - KeyboardEvent- * - MouseEvent- * - PointerEvent- * - TouchEvent- * - Event+ * - [DragEvent](https://developer.mozilla.org/en-US/docs/Web/API/DragEvent/DragEvent)+ * - [FocusEvent](https://developer.mozilla.org/en-US/docs/Web/API/FocusEvent/FocusEvent)+ * - [KeyboardEvent](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/KeyboardEvent)+ * - [MouseEvent](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/MouseEvent)+ * - [PointerEvent](https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/PointerEvent)+ * - [TouchEvent](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/TouchEvent)+ * - [Event](https://developer.mozilla.org/en-US/docs/Web/API/Event/Event)+ ** You can also specify `JSHandle` as the property value if you want live objects to be passed into the event:+ ** ```js* // Note you can only create DataTransfer in Chromium and Firefox* const dataTransfer = await page.evaluateHandle(() => new DataTransfer());* await elementHandle.dispatchEvent('dragstart', { dataTransfer });* ```+ ** @param type DOM event type: `"click"`, `"dragstart"`, etc.* @param eventInit Optional event-specific initialization properties.*/dispatchEvent(type: string, eventInit?: EvaluationArgument): Promise<void>;/**- * This method waits for actionability checks, focuses the element, fills it and triggers an `input` event after filling. If the element is not an `<input>`, `<textarea>` or `[contenteditable]` element, this method throws an error. Note that you can pass an empty string to clear the input field.+ * This method waits for [actionability](https://github.com/microsoft/playwright/blob/master/docs/actionability.md) checks, focuses the element, fills it and triggers an `input` event after filling. If the element is not an `<input>`, `<textarea>` or `[contenteditable]` element, this method throws an error. Note that you can pass an empty string to clear the input field.* @param value Value to set for the `<input>`, `<textarea>` or `[contenteditable]` element.* @param options*/@@ -4398,13 +4797,13 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {noWaitAfter?: boolean;/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}): Promise<void>;/**- * Calls focus on the element.+ * Calls [focus](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus) on the element.*/focus(): Promise<void>;@@ -4416,17 +4815,19 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {/*** This method hovers over the element by performing the following steps:- * - Wait for actionability checks on the element, unless `force` option is set.- * - Scroll the element into view if needed.- * - Use page.mouse to hover over the center of the element, or the specified `position`.- * - Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.+ * 1. Wait for [actionability](https://github.com/microsoft/playwright/blob/master/docs/actionability.md) checks on the element, unless `force` option is set.+ * 1. Scroll the element into view if needed.+ * 1. Use [`page.mouse`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagemouse) to hover over the center of the element, or the specified `position`.+ * 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.+ ** If the element is detached from the DOM at any moment during the action, this method rejects.- * When all steps combined have not finished during the specified `timeout`, this method rejects with a TimeoutError. Passing zero timeout disables this.+ *+ * When all steps combined have not finished during the specified `timeout`, this method rejects with a [TimeoutError]. Passing zero timeout disables this.* @param options*/hover(options?: {/**- * Whether to bypass the actionability checks. Defaults to `false`.+ * Whether to bypass the [actionability](https://github.com/microsoft/playwright/blob/master/docs/actionability.md) checks. Defaults to `false`.*/force?: boolean;@@ -4445,7 +4846,7 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {};/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}): Promise<void>;@@ -4466,12 +4867,18 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {ownerFrame(): Promise<null|Frame>;/**- * Focuses the element, and then uses `keyboard.down(key)` and `keyboard.up(key)`.- * `key` can specify the intended keyboardEvent.key value or a single character to generate the text for. A superset of the `key` values can be found here. Examples of the keys are:+ * Focuses the element, and then uses [`keyboard.down(key)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#keyboarddownkey) and [`keyboard.up(key)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#keyboardupkey).+ *+ * `key` can specify the intended [keyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key) value or a single character to generate the text for. A superset of the `key` values can be found [here](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values). Examples of the keys are:+ ** `F1` - `F12`, `Digit0`- `Digit9`, `KeyA`- `KeyZ`, `Backquote`, `Minus`, `Equal`, `Backslash`, `Backspace`, `Tab`, `Delete`, `Escape`, `ArrowDown`, `End`, `Enter`, `Home`, `Insert`, `PageDown`, `PageUp`, `ArrowRight`, `ArrowUp`, etc.+ ** Following modification shortcuts are also supported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`.+ ** Holding down `Shift` will type the text that corresponds to the `key` in the upper case.+ ** If `key` is a single character, it is case-sensitive, so the values `a` and `A` will generate different respective texts.+ ** Shortcuts such as `key: "Control+o"` or `key: "Control+Shift+T"` are supported as well. When speficied with the modifier, modifier is pressed and being held while the subsequent key is being pressed.* @param key Name of the key to press or a character to generate, such as `ArrowLeft` or `a`.* @param options@@ -4488,14 +4895,15 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {noWaitAfter?: boolean;/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}): Promise<void>;/*** Returns the buffer with the captured screenshot.- * This method waits for the actionability checks, then scrolls element into view before taking a screenshot. If the element is detached from DOM, the method throws an error.+ *+ * This method waits for the [actionability](https://github.com/microsoft/playwright/blob/master/docs/actionability.md) checks, then scrolls element into view before taking a screenshot. If the element is detached from DOM, the method throws an error.* @param options*/screenshot(options?: {@@ -4515,31 +4923,34 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {quality?: number;/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;/*** Specify screenshot type, defaults to `png`.*/- type?: "jpeg"|"png";+ type?: "png"|"jpeg";}): Promise<Buffer>;/**- * This method waits for actionability checks, then tries to scroll element into view, unless it is completely visible as defined by IntersectionObserver's ```ratio```.- * Throws when `elementHandle` does not point to an element connected to a Document or a ShadowRoot.+ * This method waits for [actionability](https://github.com/microsoft/playwright/blob/master/docs/actionability.md) checks, then tries to scroll element into view, unless it is completely visible as defined by [IntersectionObserver](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API)'s ```ratio```.+ *+ * Throws when `elementHandle` does not point to an element [connected](https://developer.mozilla.org/en-US/docs/Web/API/Node/isConnected) to a Document or a ShadowRoot.* @param options*/scrollIntoViewIfNeeded(options?: {/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}): Promise<void>;/*** Returns the array of option values that have been successfully selected.+ ** Triggers a `change` and `input` event once all the provided options have been selected. If element is not a `<select>` element, the method throws an error.+ ** ```js* // single selection matching the value* handle.selectOption('blue');@@ -4553,37 +4964,38 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {* // multiple selection for blue, red and second option* handle.selectOption({ value: 'blue' }, { index: 2 }, 'red');* ```+ ** @param values Options to select. If the `<select>` has the `multiple` attribute, all matching options are selected, otherwise only the first option matching one of the passed options is selected. String values are equivalent to `{value:'string'}`. Option is considered matching if all specified properties match.* @param options*/selectOption(values: null|string|ElementHandle|Array<string>|{/**- * Matches by `option.value`.+ * Matches by `option.value`. Optional.*/value?: string;/**- * Matches by `option.label`.+ * Matches by `option.label`. Optional.*/label?: string;/**- * Matches by the index.+ * Matches by the index. Optional.*/index?: number;}|Array<ElementHandle>|Array<{/**- * Matches by `option.value`.+ * Matches by `option.value`. Optional.*/value?: string;/**- * Matches by `option.label`.+ * Matches by `option.label`. Optional.*/label?: string;/**- * Matches by the index.+ * Matches by the index. Optional.*/index?: number;}>, options?: {@@ -4593,36 +5005,37 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {noWaitAfter?: boolean;/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}): Promise<Array<string>>;/**- * This method waits for actionability checks, then focuses the element and selects all its text content.+ * This method waits for [actionability](https://github.com/microsoft/playwright/blob/master/docs/actionability.md) checks, then focuses the element and selects all its text content.* @param options*/selectText(options?: {/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}): Promise<void>;/**- * This method expects `elementHandle` to point to an input element.+ * This method expects `elementHandle` to point to an [input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input).+ ** Sets the value of the file input to these file paths or files. If some of the `filePaths` are relative paths, then they are resolved relative to the the current working directory. For empty array, clears the selected files.* @param files* @param options*/setInputFiles(files: string|Array<string>|{/**- * File name **required**+ * [File] name **required***/name: string;/**- * File type **required**+ * [File] type **required***/mimeType: string;@@ -4632,12 +5045,12 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {buffer: Buffer;}|Array<{/**- * File name **required**+ * [File] name **required***/name: string;/**- * File type **required**+ * [File] type **required***/mimeType: string;@@ -4652,26 +5065,28 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {noWaitAfter?: boolean;/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}): Promise<void>;/*** This method taps the element by performing the following steps:- * - Wait for actionability checks on the element, unless `force` option is set.- * - Scroll the element into view if needed.- * - Use page.touchscreen to tap in the center of the element, or the specified `position`.- * - Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.+ * 1. Wait for [actionability](https://github.com/microsoft/playwright/blob/master/docs/actionability.md) checks on the element, unless `force` option is set.+ * 1. Scroll the element into view if needed.+ * 1. Use [`page.touchscreen`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagetouchscreen) to tap the center of the element, or the specified `position`.+ * 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.+ ** If the element is detached from the DOM at any moment during the action, this method rejects.- * When all steps combined have not finished during the specified `timeout`, this method rejects with a TimeoutError. Passing zero timeout disables this.+ *+ * When all steps combined have not finished during the specified `timeout`, this method rejects with a [TimeoutError]. Passing zero timeout disables this.** > **NOTE** `elementHandle.tap()` requires that the `hasTouch` option of the browser context be set to true.* @param options*/tap(options?: {/**- * Whether to bypass the actionability checks. Defaults to `false`.+ * Whether to bypass the [actionability](https://github.com/microsoft/playwright/blob/master/docs/actionability.md) checks. Defaults to `false`.*/force?: boolean;@@ -4695,7 +5110,7 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {};/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}): Promise<void>;@@ -4709,17 +5124,22 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {/*** Focuses the element, and then sends a `keydown`, `keypress`/`input`, and `keyup` event for each character in the text.- * To press a special key, like `Control` or `ArrowDown`, use `elementHandle.press(key[, options])`.+ *+ * To press a special key, like `Control` or `ArrowDown`, use [`elementHandle.press(key[, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#elementhandlepresskey-options).+ ** ```js* await elementHandle.type('Hello'); // Types instantly* await elementHandle.type('World', {delay: 100}); // Types slower, like a user* ```+ ** An example of typing into a text field and then submitting the form:+ ** ```js* const elementHandle = await page.$('input');* await elementHandle.type('some text');* await elementHandle.press('Enter');* ```+ ** @param text A text to type into a focused element.* @param options*/@@ -4735,26 +5155,28 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {noWaitAfter?: boolean;/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}): Promise<void>;/*** This method checks the element by performing the following steps:- * - Ensure that element is a checkbox or a radio input. If not, this method rejects. If the element is already unchecked, this method returns immediately.- * - Wait for actionability checks on the element, unless `force` option is set.- * - Scroll the element into view if needed.- * - Use page.mouse to click in the center of the element.- * - Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.- * - Ensure that the element is now unchecked. If not, this method rejects.+ * 1. Ensure that element is a checkbox or a radio input. If not, this method rejects. If the element is already unchecked, this method returns immediately.+ * 1. Wait for [actionability](https://github.com/microsoft/playwright/blob/master/docs/actionability.md) checks on the element, unless `force` option is set.+ * 1. Scroll the element into view if needed.+ * 1. Use [`page.mouse`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagemouse) to click in the center of the element.+ * 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.+ * 1. Ensure that the element is now unchecked. If not, this method rejects.+ ** If the element is detached from the DOM at any moment during the action, this method rejects.- * When all steps combined have not finished during the specified `timeout`, this method rejects with a TimeoutError. Passing zero timeout disables this.+ *+ * When all steps combined have not finished during the specified `timeout`, this method rejects with a [TimeoutError]. Passing zero timeout disables this.* @param options*/uncheck(options?: {/**- * Whether to bypass the actionability checks. Defaults to `false`.+ * Whether to bypass the [actionability](https://github.com/microsoft/playwright/blob/master/docs/actionability.md) checks. Defaults to `false`.*/force?: boolean;@@ -4764,32 +5186,35 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {noWaitAfter?: boolean;/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}): Promise<void>;/*** Returns the element satisfies the `state`.- * Depending on the `state` parameter, this method waits for one of the actionability checks to pass. This method throws when the element is detached while waiting, unless waiting for the `"hidden"` state.- * - `"visible"` Wait until the element is visible.- * - `"hidden"` Wait until the element is not visible or not attached. Note that waiting for hidden does not throw when the element detaches.- * - `"stable"` Wait until the element is both visible and stable.- * - `"enabled"` Wait until the element is enabled.- * - `"disabled"` Wait until the element is not enabled.+ *+ * Depending on the `state` parameter, this method waits for one of the [actionability](https://github.com/microsoft/playwright/blob/master/docs/actionability.md) checks to pass. This method throws when the element is detached while waiting, unless waiting for the `"hidden"` state.+ * - `"visible"` Wait until the element is [visible](https://github.com/microsoft/playwright/blob/master/docs/actionability.md#visible).+ * - `"hidden"` Wait until the element is [not visible](https://github.com/microsoft/playwright/blob/master/docs/actionability.md#visible) or [not attached](https://github.com/microsoft/playwright/blob/master/docs/actionability.md#attached). Note that waiting for hidden does not throw when the element detaches.+ * - `"stable"` Wait until the element is both [visible](https://github.com/microsoft/playwright/blob/master/docs/actionability.md#visible) and [stable](https://github.com/microsoft/playwright/blob/master/docs/actionability.md#stable).+ * - `"enabled"` Wait until the element is [enabled](https://github.com/microsoft/playwright/blob/master/docs/actionability.md#enabled).+ * - `"disabled"` Wait until the element is [not enabled](https://github.com/microsoft/playwright/blob/master/docs/actionability.md#enabled).+ ** If the element does not satisfy the condition for the `timeout` milliseconds, this method will throw.* @param state A state to wait for, see below for more details.* @param options*/- waitForElementState(state: "disabled"|"enabled"|"hidden"|"stable"|"visible", options?: {+ waitForElementState(state: "visible"|"hidden"|"stable"|"enabled"|"disabled", options?: {/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}): Promise<void>;}/*** BrowserType provides methods to launch a specific browser instance or connect to an existing one. The following is a typical example of using Playwright to drive automation:+ ** ```js* const { chromium } = require('playwright'); // Or 'firefox' or 'webkit'.*@@ -4801,6 +5226,7 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {* await browser.close();* })();* ```+ **/export interface BrowserType<Browser> {@@ -4817,7 +5243,9 @@ export interface BrowserType<Browser> {/*** Returns the browser instance.+ ** You can use `ignoreDefaultArgs` to filter out `--mute-audio` from default arguments:+ ** ```js* const browser = await chromium.launch({ // Or 'firefox' or 'webkit'.* ignoreDefaultArgs: ['--mute-audio']@@ -4826,22 +5254,20 @@ export interface BrowserType<Browser> {** > **Chromium-only** Playwright can also be used to control the Chrome browser, but it works best with the version of Chromium it is bundled with. There is no guarantee it will work with any other version. Use `executablePath` option with extreme caution.* >- *- * > If Google Chrome (rather than Chromium) is preferred, a Chrome Canary or Dev Channel build is suggested.+ * > If Google Chrome (rather than Chromium) is preferred, a [Chrome Canary](https://www.google.com/chrome/browser/canary.html) or [Dev Channel](https://www.chromium.org/getting-involved/dev-channel) build is suggested.* >- *- * > In `browserType.launch([options])` above, any mention of Chromium also applies to Chrome.+ * > In [`browserType.launch([options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsertypelaunchoptions) above, any mention of Chromium also applies to Chrome.* >- *- * > See `this article` for a description of the differences between Chromium and Chrome. `This article` describes some differences for Linux users.+ * > See [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkgr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.* @param options*/launch(options?: LaunchOptions): Promise<Browser>;/*** Returns the persistent browser context instance.+ ** Launches browser that uses persistent storage located at `userDataDir` and returns the only context. Closing this context will automatically close the browser.- * @param userDataDir Path to a User Data Directory, which stores browser session data like cookies and local storage. More details for Chromium and Firefox.+ * @param userDataDir Path to a User Data Directory, which stores browser session data like cookies and local storage. More details for [Chromium](https://chromium.googlesource.com/chromium/src/+/master/docs/user_data_dir.md) and [Firefox](https://developer.mozilla.org/en-US/docs/Mozilla/Command_Line_Options#User_Profile).* @param options*/launchPersistentContext(userDataDir: string, options?: {@@ -4851,7 +5277,7 @@ export interface BrowserType<Browser> {acceptDownloads?: boolean;/**- * Additional arguments to pass to the browser instance. The list of Chromium flags can be found here.+ * Additional arguments to pass to the browser instance. The list of Chromium flags can be found [here](http://peter.sh/experiments/chromium-command-line-switches/).*/args?: Array<string>;@@ -4866,9 +5292,9 @@ export interface BrowserType<Browser> {chromiumSandbox?: boolean;/**- * Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. See `page.emulateMedia(params)` for more details. Defaults to '`light`'.+ * Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. See [`page.emulateMedia(params)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageemulatemediaparams) for more details. Defaults to '`light`'.*/- colorScheme?: "dark"|"light"|"no-preference";+ colorScheme?: "light"|"dark"|"no-preference";/*** Specify device scale factor (can be thought of as dpr). Defaults to `1`.@@ -4938,12 +5364,12 @@ export interface BrowserType<Browser> {hasTouch?: boolean;/**- * Whether to run browser in headless mode. More details for Chromium and Firefox. Defaults to `true` unless the `devtools` option is `true`.+ * Whether to run browser in headless mode. More details for [Chromium](https://developers.google.com/web/updates/2017/04/headless-chrome) and [Firefox](https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Headless_mode). Defaults to `true` unless the `devtools` option is `true`.*/headless?: boolean;/**- * Credentials for HTTP authentication.+ * Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication).*/httpCredentials?: {username: string;@@ -4987,7 +5413,7 @@ export interface BrowserType<Browser> {offline?: boolean;/**- * A list of permissions to grant to all pages in this context. See `browserContext.grantPermissions(permissions[, options])` for more details.+ * A list of permissions to grant to all pages in this context. See [`browserContext.grantPermissions(permissions[, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextgrantpermissionspermissions-options) for more details.*/permissions?: Array<string>;@@ -5017,7 +5443,7 @@ export interface BrowserType<Browser> {};/**- * Enables HAR recording for all pages into `recordHar.path` file. If not specified, the HAR is not recorded. Make sure to await `browserContext.close()` for the HAR to be saved.+ * Enables [HAR](http://www.softwareishard.com/blog/har-12-spec) recording for all pages into `recordHar.path` file. If not specified, the HAR is not recorded. Make sure to await [`browserContext.close()`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextclose) for the HAR to be saved.*/recordHar?: {/**@@ -5032,7 +5458,7 @@ export interface BrowserType<Browser> {};/**- * Enables video recording for all pages into `recordVideo.dir` directory. If not specified videos are not recorded. Make sure to await `browserContext.close()` for videos to be saved.+ * Enables video recording for all pages into `recordVideo.dir` directory. If not specified videos are not recorded. Make sure to await [`browserContext.close()`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextclose) for videos to be saved.*/recordVideo?: {/**@@ -5067,7 +5493,7 @@ export interface BrowserType<Browser> {timeout?: number;/**- * Changes the timezone of the context. See ICU’s `metaZones.txt` for a list of supported timezone IDs.+ * Changes the timezone of the context. See [ICU's metaZones.txt](https://cs.chromium.org/chromium/src/third_party/icu/source/data/misc/metaZones.txt?rcl=faee8bc70570192d82d2978a71e2a615788597d1) for a list of supported timezone IDs.*/timezoneId?: string;@@ -5092,7 +5518,7 @@ export interface BrowserType<Browser> {};/**- * **NOTE** Use `recordVideo` instead, it takes precedence over `videosPath`. Enables video recording for all pages to `videosPath` directory. If not specified, videos are not recorded. Make sure to await `browserContext.close()` for videos to be saved.+ * **NOTE** Use `recordVideo` instead, it takes precedence over `videosPath`. Enables video recording for all pages to `videosPath` directory. If not specified, videos are not recorded. Make sure to await [`browserContext.close()`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextclose) for videos to be saved.*/videosPath?: string;@@ -5114,7 +5540,9 @@ export interface BrowserType<Browser> {/*** Returns the browser app instance.+ ** Launches browser server that client can connect to. An example of launching a browser executable and connecting to it later:+ ** ```js* const { chromium } = require('playwright'); // Or 'webkit' or 'firefox'.*@@ -5127,11 +5555,12 @@ export interface BrowserType<Browser> {* await browserServer.close();* })();* ```+ ** @param options*/launchServer(options?: {/**- * Additional arguments to pass to the browser instance. The list of Chromium flags can be found here.+ * Additional arguments to pass to the browser instance. The list of Chromium flags can be found [here](http://peter.sh/experiments/chromium-command-line-switches/).*/args?: Array<string>;@@ -5161,7 +5590,7 @@ export interface BrowserType<Browser> {executablePath?: string;/**- * Firefox user preferences. Learn more about the Firefox user preferences at `about:config`.+ * Firefox user preferences. Learn more about the Firefox user preferences at [`about:config`](https://support.mozilla.org/en-US/kb/about-config-editor-firefox).*/firefoxUserPrefs?: { [key: string]: string|number|boolean; };@@ -5181,7 +5610,7 @@ export interface BrowserType<Browser> {handleSIGTERM?: boolean;/**- * Whether to run browser in headless mode. More details for Chromium and Firefox. Defaults to `true` unless the `devtools` option is `true`.+ * Whether to run browser in headless mode. More details for [Chromium](https://developers.google.com/web/updates/2017/04/headless-chrome) and [Firefox](https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Headless_mode). Defaults to `true` unless the `devtools` option is `true`.*/headless?: boolean;@@ -5237,16 +5666,21 @@ export interface BrowserType<Browser> {name(): string;}/**- * Chromium-specific features including Tracing, service worker support, etc. You can use `chromiumBrowser.startTracing([page, options])` and `chromiumBrowser.stopTracing()` to create a trace file which can be opened in Chrome DevTools or timeline viewer.+ * - extends: [Browser]+ *+ * Chromium-specific features including Tracing, service worker support, etc. You can use [`chromiumBrowser.startTracing([page, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#chromiumbrowserstarttracingpage-options) and [`chromiumBrowser.stopTracing()`](https://github.com/microsoft/playwright/blob/master/docs/api.md#chromiumbrowserstoptracing) to create a trace file which can be opened in Chrome DevTools or [timeline viewer](https://chromedevtools.github.io/timeline-viewer/).+ ** ```js* await browser.startTracing(page, {path: 'trace.json'});* await page.goto('https://www.google.com');* await browser.stopTracing();* ```+ **/export interface ChromiumBrowser extends Browser {/*** Returns an array of all open browser contexts. In a newly created browser, this will return zero browser contexts.+ ** ```js* const browser = await pw.webkit.launch();* console.log(browser.contexts().length); // prints `0`@@ -5254,10 +5688,12 @@ export interface ChromiumBrowser extends Browser {* const context = await browser.newContext();* console.log(browser.contexts().length); // prints `1`* ```+ **/contexts(): Array<ChromiumBrowserContext>;/*** Creates a new browser context. It won't share cookies/cache with other browser contexts.+ ** ```js* (async () => {* const browser = await playwright.firefox.launch(); // Or 'chromium' or 'webkit'.@@ -5268,6 +5704,7 @@ export interface ChromiumBrowser extends Browser {* await page.goto('https://example.com');* })();* ```+ ** @param options*/newContext(options?: BrowserContextOptions): Promise<ChromiumBrowserContext>;@@ -5304,12 +5741,16 @@ export interface ChromiumBrowser extends Browser {stopTracing(): Promise<Buffer>;}/**+ * - extends: [EventEmitter](https://nodejs.org/api/events.html#events_class_eventemitter)+ ** The `CDPSession` instances are used to talk raw Chrome Devtools Protocol:* - protocol methods can be called with `session.send` method.* - protocol events can be subscribed to with `session.on` method.+ ** Useful links:- * - Documentation on DevTools Protocol can be found here: DevTools Protocol Viewer.+ * - Documentation on DevTools Protocol can be found here: [DevTools Protocol Viewer](https://chromedevtools.github.io/devtools-protocol/).* - Getting Started with DevTools Protocol: https://github.com/aslushnikov/getting-started-with-cdp/blob/master/README.md+ ** ```js* const client = await page.context().newCDPSession(page);* await client.send('Animation.enable');@@ -5320,6 +5761,7 @@ export interface ChromiumBrowser extends Browser {* playbackRate: response.playbackRate / 2* });* ```+ **/export interface CDPSession {on: <T extends keyof Protocol.Events | symbol>(event: T, listener: (payload: T extends symbol ? any : Protocol.Events[T extends keyof Protocol.Events ? T : never]) => void) => this;@@ -5352,16 +5794,21 @@ type DeviceDescriptor = {export namespace errors {/**- * TimeoutError is emitted whenever certain operations are terminated due to timeout, e.g. `page.waitForSelector(selector[, options])` or `browserType.launch([options])`.+ * - extends: [Error]+ *+ * TimeoutError is emitted whenever certain operations are terminated due to timeout, e.g. [`page.waitForSelector(selector[, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagewaitforselectorselector-options) or [`browserType.launch([options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsertypelaunchoptions).*/class TimeoutError extends Error {}}/**- * The Accessibility class provides methods for inspecting Chromium's accessibility tree. The accessibility tree is used by assistive technology such as screen readers or switches.+ * The Accessibility class provides methods for inspecting Chromium's accessibility tree. The accessibility tree is used by assistive technology such as [screen readers](https://en.wikipedia.org/wiki/Screen_reader) or [switches](https://en.wikipedia.org/wiki/Switch_access).+ ** Accessibility is a very platform-specific thing. On different platforms, there are different screen readers that might have wildly different output.+ ** Blink - Chromium's rendering engine - has a concept of "accessibility tree", which is then translated into different platform-specific APIs. Accessibility namespace gives users access to the Blink Accessibility Tree.+ ** Most of the accessibility tree gets filtered out when converting from Blink AX Tree to Platform-specific AX-Tree or by assistive technologies themselves. By default, Playwright tries to approximate this filtering, exposing only the "interesting" nodes of the tree.*/export interface Accessibility {@@ -5369,12 +5816,16 @@ export interface Accessibility {* Captures the current state of the accessibility tree. The returned object represents the root accessible node of the page.** > **NOTE** The Chromium accessibility tree contains nodes that go unused on most platforms and by most screen readers. Playwright will discard them as well for an easier to process tree, unless `interestingOnly` is set to `false`.+ ** An example of dumping the entire accessibility tree:+ ** ```js* const snapshot = await page.accessibility.snapshot();* console.log(snapshot);* ```+ ** An example of logging the focused node's name:+ ** ```js* const snapshot = await page.accessibility.snapshot();* const node = findFocusedNode(snapshot);@@ -5390,6 +5841,7 @@ export interface Accessibility {* return null;* }* ```+ ** @param options*/snapshot(options?: {@@ -5442,8 +5894,12 @@ export {};/**- * A Browser is created when Playwright connects to a browser instance, either through `browserType.launch([options])` or `browserType.connect(params)`.- * An example of using a Browser to create a Page:+ * - extends: [EventEmitter](https://nodejs.org/api/events.html#events_class_eventemitter)+ *+ * A Browser is created when Playwright connects to a browser instance, either through [`browserType.launch([options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsertypelaunchoptions) or [`browserType.connect(params)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsertypeconnectparams).+ *+ * An example of using a [Browser] to create a [Page]:+ ** ```js* const { firefox } = require('playwright'); // Or 'chromium' or 'webkit'.*@@ -5454,53 +5910,57 @@ export {};* await browser.close();* })();* ```- * See ChromiumBrowser, FirefoxBrowser and WebKitBrowser for browser-specific features. Note that `browserType.connect(params)` and `browserType.launch([options])` always return a specific browser instance, based on the browser being connected to or launched.+ *+ * See [ChromiumBrowser], [FirefoxBrowser] and [WebKitBrowser] for browser-specific features. Note that [`browserType.connect(params)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsertypeconnectparams) and [`browserType.launch([options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsertypelaunchoptions) always return a specific browser instance, based on the browser being connected to or launched.*/export interface Browser extends EventEmitter {/*** Emitted when Browser gets disconnected from the browser application. This might happen because of one of the following:* - Browser application is closed or crashed.- * - The `browser.close()` method was called.+ * - The [`browser.close()`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browserclose) method was called.*/on(event: 'disconnected', listener: () => void): this;/*** Emitted when Browser gets disconnected from the browser application. This might happen because of one of the following:* - Browser application is closed or crashed.- * - The `browser.close()` method was called.+ * - The [`browser.close()`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browserclose) method was called.*/once(event: 'disconnected', listener: () => void): this;/*** Emitted when Browser gets disconnected from the browser application. This might happen because of one of the following:* - Browser application is closed or crashed.- * - The `browser.close()` method was called.+ * - The [`browser.close()`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browserclose) method was called.*/addListener(event: 'disconnected', listener: () => void): this;/*** Emitted when Browser gets disconnected from the browser application. This might happen because of one of the following:* - Browser application is closed or crashed.- * - The `browser.close()` method was called.+ * - The [`browser.close()`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browserclose) method was called.*/removeListener(event: 'disconnected', listener: () => void): this;/*** Emitted when Browser gets disconnected from the browser application. This might happen because of one of the following:* - Browser application is closed or crashed.- * - The `browser.close()` method was called.+ * - The [`browser.close()`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browserclose) method was called.*/off(event: 'disconnected', listener: () => void): this;/**- * In case this browser is obtained using `browserType.launch([options])`, closes the browser and all of its pages (if any were opened).- * In case this browser is obtained using `browserType.connect(params)`, clears all created contexts belonging to this browser and disconnects from the browser server.- * The Browser object itself is considered to be disposed and cannot be used anymore.+ * In case this browser is obtained using [`browserType.launch([options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsertypelaunchoptions), closes the browser and all of its pages (if any were opened).+ *+ * In case this browser is obtained using [`browserType.connect(params)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsertypeconnectparams), clears all created contexts belonging to this browser and disconnects from the browser server.+ *+ * The [Browser] object itself is considered to be disposed and cannot be used anymore.*/close(): Promise<void>;/*** Returns an array of all open browser contexts. In a newly created browser, this will return zero browser contexts.+ ** ```js* const browser = await pw.webkit.launch();* console.log(browser.contexts().length); // prints `0`@@ -5508,6 +5968,7 @@ export interface Browser extends EventEmitter {* const context = await browser.newContext();* console.log(browser.contexts().length); // prints `1`* ```+ **/contexts(): Array<BrowserContext>;@@ -5518,6 +5979,7 @@ export interface Browser extends EventEmitter {/*** Creates a new browser context. It won't share cookies/cache with other browser contexts.+ ** ```js* (async () => {* const browser = await playwright.firefox.launch(); // Or 'chromium' or 'webkit'.@@ -5528,13 +5990,15 @@ export interface Browser extends EventEmitter {* await page.goto('https://example.com');* })();* ```+ ** @param options*/newContext(options?: BrowserContextOptions): Promise<BrowserContext>;/*** Creates a new page in a new browser context. Closing this page will close the context as well.- * This is a convenience API that should only be used for the single-page scenarios and short snippets. Production code and testing frameworks should explicitly create `browser.newContext([options])` followed by the `browserContext.newPage()` to control their exact life times.+ *+ * This is a convenience API that should only be used for the single-page scenarios and short snippets. Production code and testing frameworks should explicitly create [`browser.newContext([options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsernewcontextoptions) followed by the [`browserContext.newPage()`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextnewpage) to control their exact life times.* @param options*/newPage(options?: {@@ -5549,9 +6013,9 @@ export interface Browser extends EventEmitter {bypassCSP?: boolean;/**- * Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. See `page.emulateMedia(params)` for more details. Defaults to '`light`'.+ * Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. See [`page.emulateMedia(params)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageemulatemediaparams) for more details. Defaults to '`light`'.*/- colorScheme?: "dark"|"light"|"no-preference";+ colorScheme?: "light"|"dark"|"no-preference";/*** Specify device scale factor (can be thought of as dpr). Defaults to `1`.@@ -5586,7 +6050,7 @@ export interface Browser extends EventEmitter {hasTouch?: boolean;/**- * Credentials for HTTP authentication.+ * Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication).*/httpCredentials?: {username: string;@@ -5625,7 +6089,7 @@ export interface Browser extends EventEmitter {offline?: boolean;/**- * A list of permissions to grant to all pages in this context. See `browserContext.grantPermissions(permissions[, options])` for more details.+ * A list of permissions to grant to all pages in this context. See [`browserContext.grantPermissions(permissions[, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextgrantpermissionspermissions-options) for more details.*/permissions?: Array<string>;@@ -5655,7 +6119,7 @@ export interface Browser extends EventEmitter {};/**- * Enables HAR recording for all pages into `recordHar.path` file. If not specified, the HAR is not recorded. Make sure to await `browserContext.close()` for the HAR to be saved.+ * Enables [HAR](http://www.softwareishard.com/blog/har-12-spec) recording for all pages into `recordHar.path` file. If not specified, the HAR is not recorded. Make sure to await [`browserContext.close()`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextclose) for the HAR to be saved.*/recordHar?: {/**@@ -5670,7 +6134,7 @@ export interface Browser extends EventEmitter {};/**- * Enables video recording for all pages into `recordVideo.dir` directory. If not specified videos are not recorded. Make sure to await `browserContext.close()` for videos to be saved.+ * Enables video recording for all pages into `recordVideo.dir` directory. If not specified videos are not recorded. Make sure to await [`browserContext.close()`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextclose) for videos to be saved.*/recordVideo?: {/**@@ -5695,7 +6159,7 @@ export interface Browser extends EventEmitter {};/**- * Populates context with given storage state. This method can be used to initialize context with logged-in information obtained via `browserContext.storageState([options])`. Either a path to the file with saved storage, or an object with the following fields:+ * Populates context with given storage state. This method can be used to initialize context with logged-in information obtained via [`browserContext.storageState([options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextstoragestateoptions). Either a path to the file with saved storage, or an object with the following fields:*/storageState?: string|{/**@@ -5745,7 +6209,7 @@ export interface Browser extends EventEmitter {/*** Optional sameSite flag*/- sameSite?: "Lax"|"None"|"Strict";+ sameSite?: "Strict"|"Lax"|"None";}>;/**@@ -5763,7 +6227,7 @@ export interface Browser extends EventEmitter {};/**- * Changes the timezone of the context. See ICU’s `metaZones.txt` for a list of supported timezone IDs.+ * Changes the timezone of the context. See [ICU's metaZones.txt](https://cs.chromium.org/chromium/src/third_party/icu/source/data/misc/metaZones.txt?rcl=faee8bc70570192d82d2978a71e2a615788597d1) for a list of supported timezone IDs.*/timezoneId?: string;@@ -5788,7 +6252,7 @@ export interface Browser extends EventEmitter {};/**- * **NOTE** Use `recordVideo` instead, it takes precedence over `videosPath`. Enables video recording for all pages to `videosPath` directory. If not specified, videos are not recorded. Make sure to await `browserContext.close()` for videos to be saved.+ * **NOTE** Use `recordVideo` instead, it takes precedence over `videosPath`. Enables video recording for all pages to `videosPath` directory. If not specified, videos are not recorded. Make sure to await [`browserContext.close()`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextclose) for videos to be saved.*/videosPath?: string;@@ -5815,7 +6279,7 @@ export interface Browser extends EventEmitter {}/**- * ConsoleMessage objects are dispatched by page via the `page.on('console')` event.+ * [ConsoleMessage] objects are dispatched by page via the [`page.on('console')`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageonconsole) event.*/export interface ConsoleMessage {args(): Array<JSHandle>;@@ -5846,8 +6310,10 @@ export interface ConsoleMessage {}/**- * Dialog objects are dispatched by page via the `page.on('dialog')` event.+ * [Dialog] objects are dispatched by page via the [`page.on('dialog')`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageondialog) event.+ ** An example of using `Dialog` class:+ ** ```js* const { chromium } = require('playwright'); // Or 'firefox' or 'webkit'.*@@ -5862,6 +6328,7 @@ export interface ConsoleMessage {* page.evaluate(() => alert('1'));* })();* ```+ **/export interface Dialog {/**@@ -5892,9 +6359,12 @@ export interface Dialog {}/**- * Download objects are dispatched by page via the `page.on('download')` event.+ * [Download] objects are dispatched by page via the [`page.on('download')`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageondownload) event.+ ** All the downloaded files belonging to the browser context are deleted when the browser context is closed. All downloaded files are deleted when the browser closes.+ ** Download event is emitted once the download starts. Download path becomes available once download completes:+ ** ```js* const [ download ] = await Promise.all([* page.waitForEvent('download'), // wait for download to start@@ -5935,7 +6405,7 @@ export interface Download {saveAs(path: string): Promise<void>;/**- * Returns suggested filename for this download. It is typically computed by the browser from the `Content-Disposition` response header or the `download` attribute. See the spec on whatwg. Different browsers can use different logic for computing it.+ * Returns suggested filename for this download. It is typically computed by the browser from the [`Content-Disposition`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition) response header or the `download` attribute. See the spec on [whatwg](https://html.spec.whatwg.org/#downloading-resources). Different browsers can use different logic for computing it.*/suggestedFilename(): string;@@ -5947,9 +6417,11 @@ export interface Download {/*** When browser context is created with the `videosPath` option, each page has a video object associated with it.+ ** ```js* console.log(await page.video().path());* ```+ **/export interface Video {/**@@ -5959,12 +6431,14 @@ export interface Video {}/**- * FileChooser objects are dispatched by the page in the `page.on('filechooser')` event.+ * [FileChooser] objects are dispatched by the page in the [`page.on('filechooser')`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageonfilechooser) event.+ ** ```js* page.on('filechooser', async (fileChooser) => {* await fileChooser.setFiles('/tmp/myfile.pdf');* });* ```+ **/export interface FileChooser {/**@@ -5989,12 +6463,12 @@ export interface FileChooser {*/setFiles(files: string|Array<string>|{/**- * File name **required**+ * [File] name **required***/name: string;/**- * File type **required**+ * [File] type **required***/mimeType: string;@@ -6004,12 +6478,12 @@ export interface FileChooser {buffer: Buffer;}|Array<{/**- * File name **required**+ * [File] name **required***/name: string;/**- * File type **required**+ * [File] type **required***/mimeType: string;@@ -6024,16 +6498,19 @@ export interface FileChooser {noWaitAfter?: boolean;/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}): Promise<void>;}/**- * Keyboard provides an api for managing a virtual keyboard. The high level api is `keyboard.type(text[, options])`, which takes raw characters and generates proper keydown, keypress/input, and keyup events on your page.- * For finer control, you can use `keyboard.down(key)`, `keyboard.up(key)`, and `keyboard.insertText(text)` to manually fire events as if they were generated from a real keyboard.+ * Keyboard provides an api for managing a virtual keyboard. The high level api is [`keyboard.type(text[, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#keyboardtypetext-options), which takes raw characters and generates proper keydown, keypress/input, and keyup events on your page.+ *+ * For finer control, you can use [`keyboard.down(key)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#keyboarddownkey), [`keyboard.up(key)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#keyboardupkey), and [`keyboard.insertText(text)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#keyboardinserttexttext) to manually fire events as if they were generated from a real keyboard.+ ** An example of holding down `Shift` in order to select and delete some text:+ ** ```js* await page.keyboard.type('Hello World!');* await page.keyboard.press('ArrowLeft');@@ -6046,30 +6523,42 @@ export interface FileChooser {* await page.keyboard.press('Backspace');* // Result text will end up saying 'Hello!'* ```+ ** An example of pressing uppercase `A`+ ** ```js* await page.keyboard.press('Shift+KeyA');* // or* await page.keyboard.press('Shift+A');* ```+ ** An example to trigger select-all with the keyboard+ ** ```js* // on Windows and Linux* await page.keyboard.press('Control+A');* // on macOS* await page.keyboard.press('Meta+A');* ```+ **/export interface Keyboard {/*** Dispatches a `keydown` event.- * `key` can specify the intended keyboardEvent.key value or a single character to generate the text for. A superset of the `key` values can be found here. Examples of the keys are:+ *+ * `key` can specify the intended [keyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key) value or a single character to generate the text for. A superset of the `key` values can be found [here](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values). Examples of the keys are:+ ** `F1` - `F12`, `Digit0`- `Digit9`, `KeyA`- `KeyZ`, `Backquote`, `Minus`, `Equal`, `Backslash`, `Backspace`, `Tab`, `Delete`, `Escape`, `ArrowDown`, `End`, `Enter`, `Home`, `Insert`, `PageDown`, `PageUp`, `ArrowRight`, `ArrowUp`, etc.+ ** Following modification shortcuts are also supported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`.+ ** Holding down `Shift` will type the text that corresponds to the `key` in the upper case.+ ** If `key` is a single character, it is case-sensitive, so the values `a` and `A` will generate different respective texts.- * If `key` is a modifier key, `Shift`, `Meta`, `Control`, or `Alt`, subsequent key presses will be sent with that modifier active. To release the modifier key, use `keyboard.up(key)`.- * After the key is pressed once, subsequent calls to `keyboard.down(key)` will have repeat set to true. To release the key, use `keyboard.up(key)`.+ *+ * If `key` is a modifier key, `Shift`, `Meta`, `Control`, or `Alt`, subsequent key presses will be sent with that modifier active. To release the modifier key, use [`keyboard.up(key)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#keyboardupkey).+ *+ * After the key is pressed once, subsequent calls to [`keyboard.down(key)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#keyboarddownkey) will have [repeat](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/repeat) set to true. To release the key, use [`keyboard.up(key)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#keyboardupkey).** > **NOTE** Modifier keys DO influence `keyboard.down`. Holding down `Shift` will type the text in upper case.* @param key Name of the key to press or a character to generate, such as `ArrowLeft` or `a`.@@ -6078,6 +6567,7 @@ export interface Keyboard {/*** Dispatches only `input` event, does not emit the `keydown`, `keyup` or `keypress` events.+ ** ```js* page.keyboard.insertText('嗨');* ```@@ -6088,12 +6578,18 @@ export interface Keyboard {insertText(text: string): Promise<void>;/**- * `key` can specify the intended keyboardEvent.key value or a single character to generate the text for. A superset of the `key` values can be found here. Examples of the keys are:+ * `key` can specify the intended [keyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key) value or a single character to generate the text for. A superset of the `key` values can be found [here](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values). Examples of the keys are:+ ** `F1` - `F12`, `Digit0`- `Digit9`, `KeyA`- `KeyZ`, `Backquote`, `Minus`, `Equal`, `Backslash`, `Backspace`, `Tab`, `Delete`, `Escape`, `ArrowDown`, `End`, `Enter`, `Home`, `Insert`, `PageDown`, `PageUp`, `ArrowRight`, `ArrowUp`, etc.+ ** Following modification shortcuts are also supported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`.+ ** Holding down `Shift` will type the text that corresponds to the `key` in the upper case.+ ** If `key` is a single character, it is case-sensitive, so the values `a` and `A` will generate different respective texts.+ ** Shortcuts such as `key: "Control+o"` or `key: "Control+Shift+T"` are supported as well. When speficied with the modifier, modifier is pressed and being held while the subsequent key is being pressed.+ ** ```js* const page = await browser.newPage();* await page.goto('https://keycode.info');@@ -6105,7 +6601,8 @@ export interface Keyboard {* await page.screenshot({ path: 'O.png' });* await browser.close();* ```- * Shortcut for `keyboard.down(key)` and `keyboard.up(key)`.+ *+ * Shortcut for [`keyboard.down(key)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#keyboarddownkey) and [`keyboard.up(key)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#keyboardupkey).* @param key Name of the key to press or a character to generate, such as `ArrowLeft` or `a`.* @param options*/@@ -6118,7 +6615,9 @@ export interface Keyboard {/*** Sends a `keydown`, `keypress`/`input`, and `keyup` event for each character in the text.- * To press a special key, like `Control` or `ArrowDown`, use `keyboard.press(key[, options])`.+ *+ * To press a special key, like `Control` or `ArrowDown`, use [`keyboard.press(key[, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#keyboardpresskey-options).+ ** ```js* await page.keyboard.type('Hello'); // Types instantly* await page.keyboard.type('World', {delay: 100}); // Types slower, like a user@@ -6144,7 +6643,9 @@ export interface Keyboard {/*** The Mouse class operates in main-frame CSS pixels relative to the top-left corner of the viewport.- * Every `page` object has its own Mouse, accessible with page.mouse.+ *+ * Every `page` object has its own Mouse, accessible with [`page.mouse`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagemouse).+ ** ```js* // Using ‘page.mouse’ to trace a 100x100 square.* await page.mouse.move(0, 0);@@ -6155,10 +6656,11 @@ export interface Keyboard {* await page.mouse.move(0, 0);* await page.mouse.up();* ```+ **/export interface Mouse {/**- * Shortcut for `mouse.move(x, y[, options])`, `mouse.down([options])`, `mouse.up([options])`.+ * Shortcut for [`mouse.move(x, y[, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#mousemovex-y-options), [`mouse.down([options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#mousedownoptions), [`mouse.up([options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#mouseupoptions).* @param x* @param y* @param options@@ -6167,10 +6669,10 @@ export interface Mouse {/*** Defaults to `left`.*/- button?: "left"|"middle"|"right";+ button?: "left"|"right"|"middle";/**- * defaults to 1. See UIEvent.detail.+ * defaults to 1. See [UIEvent.detail].*/clickCount?: number;@@ -6181,7 +6683,7 @@ export interface Mouse {}): Promise<void>;/**- * Shortcut for `mouse.move(x, y[, options])`, `mouse.down([options])`, `mouse.up([options])`, `mouse.down([options])` and `mouse.up([options])`.+ * Shortcut for [`mouse.move(x, y[, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#mousemovex-y-options), [`mouse.down([options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#mousedownoptions), [`mouse.up([options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#mouseupoptions), [`mouse.down([options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#mousedownoptions) and [`mouse.up([options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#mouseupoptions).* @param x* @param y* @param options@@ -6190,7 +6692,7 @@ export interface Mouse {/*** Defaults to `left`.*/- button?: "left"|"middle"|"right";+ button?: "left"|"right"|"middle";/*** Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0.@@ -6206,10 +6708,10 @@ export interface Mouse {/*** Defaults to `left`.*/- button?: "left"|"middle"|"right";+ button?: "left"|"right"|"middle";/**- * defaults to 1. See UIEvent.detail.+ * defaults to 1. See [UIEvent.detail].*/clickCount?: number;}): Promise<void>;@@ -6235,10 +6737,10 @@ export interface Mouse {/*** Defaults to `left`.*/- button?: "left"|"middle"|"right";+ button?: "left"|"right"|"middle";/**- * defaults to 1. See UIEvent.detail.+ * defaults to 1. See [UIEvent.detail].*/clickCount?: number;}): Promise<void>;@@ -6257,24 +6759,29 @@ export interface Touchscreen {}/**- * Whenever the page sends a request for a network resource the following sequence of events are emitted by Page:- * - `page.on('request')` emitted when the request is issued by the page.- * - `page.on('response')` emitted when/if the response status and headers are received for the request.- * - `page.on('requestfinished')` emitted when the response body is downloaded and the request is complete.- * If request fails at some point, then instead of `'requestfinished'` event (and possibly instead of 'response' event), the `page.on('requestfailed')` event is emitted.+ * Whenever the page sends a request for a network resource the following sequence of events are emitted by [Page]:+ * - [`page.on('request')`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageonrequest) emitted when the request is issued by the page.+ * - [`page.on('response')`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageonresponse) emitted when/if the response status and headers are received for the request.+ * - [`page.on('requestfinished')`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageonrequestfinished) emitted when the response body is downloaded and the request is complete.+ *+ * If request fails at some point, then instead of `'requestfinished'` event (and possibly instead of 'response' event), the [`page.on('requestfailed')`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageonrequestfailed) event is emitted.** > **NOTE** HTTP Error responses, such as 404 or 503, are still successful responses from HTTP standpoint, so request will complete with `'requestfinished'` event.+ ** If request gets a 'redirect' response, the request is successfully finished with the 'requestfinished' event, and a new request is issued to a redirected url.*/export interface Request {/*** The method returns `null` unless this request has failed, as reported by `requestfailed` event.+ ** Example of logging of all the failed requests:+ ** ```js* page.on('requestfailed', request => {* console.log(request.url() + ' ' + request.failure().errorText);* });* ```+ **/failure(): null|{/**@@ -6284,7 +6791,7 @@ export interface Request {};/**- * Returns the Frame that initiated this request.+ * Returns the [Frame] that initiated this request.*/frame(): Frame;@@ -6315,32 +6822,42 @@ export interface Request {/*** Returns parsed request's body for `form-urlencoded` and JSON as a fallback if any.+ ** When the response is `application/x-www-form-urlencoded` then a key/value object of the values will be returned. Otherwise it will be parsed as JSON.*/postDataJSON(): null|Object;/*** Request that was redirected by the server to this one, if any.- * When the server responds with a redirect, Playwright creates a new Request object. The two requests are connected by `redirectedFrom()` and `redirectedTo()` methods. When multiple server redirects has happened, it is possible to construct the whole redirect chain by repeatedly calling `redirectedFrom()`.+ *+ * When the server responds with a redirect, Playwright creates a new [Request] object. The two requests are connected by `redirectedFrom()` and `redirectedTo()` methods. When multiple server redirects has happened, it is possible to construct the whole redirect chain by repeatedly calling `redirectedFrom()`.+ ** For example, if the website `http://example.com` redirects to `https://example.com`:+ ** ```js* const response = await page.goto('http://example.com');* console.log(response.request().redirectedFrom().url()); // 'http://example.com'* ```+ ** If the website `https://google.com` has no redirects:+ ** ```js* const response = await page.goto('https://google.com');* console.log(response.request().redirectedFrom()); // null* ```+ **/redirectedFrom(): null|Request;/*** New request issued by the browser if the server responded with redirect.- * This method is the opposite of `request.redirectedFrom()`:+ *+ * This method is the opposite of [`request.redirectedFrom()`](https://github.com/microsoft/playwright/blob/master/docs/api.md#requestredirectedfrom):+ ** ```js* console.log(request.redirectedFrom().redirectedTo() === request); // true* ```+ **/redirectedTo(): null|Request;@@ -6350,12 +6867,13 @@ export interface Request {resourceType(): string;/**- * Returns the matching Response object, or `null` if the response was not received due to error.+ * Returns the matching [Response] object, or `null` if the response was not received due to error.*/response(): Promise<null|Response>;/**- * Returns resource timing information for given request. Most of the timing values become available upon the response, `responseEnd` becomes available when request finishes. Find more information at Resource Timing API.+ * Returns resource timing information for given request. Most of the timing values become available upon the response, `responseEnd` becomes available when request finishes. Find more information at [Resource Timing API](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming).+ ** ```js* const [request] = await Promise.all([* page.waitForEvent('requestfinished'),@@ -6363,6 +6881,7 @@ export interface Request {* ]);* console.log(request.timing());* ```+ **/timing(): {/**@@ -6418,7 +6937,7 @@ export interface Request {}/**- * Response class represents responses which are received by page.+ * [Response] class represents responses which are received by page.*/export interface Response {/**@@ -6432,7 +6951,7 @@ export interface Response {finished(): Promise<null|Error>;/**- * Returns the Frame that initiated this response.+ * Returns the [Frame] that initiated this response.*/frame(): Frame;@@ -6443,6 +6962,7 @@ export interface Response {/*** Returns the JSON representation of response body.+ ** This method will throw if the response body is not parsable via `JSON.parse`.*/json(): Promise<Serializable>;@@ -6453,7 +6973,7 @@ export interface Response {ok(): boolean;/**- * Returns the matching Request object.+ * Returns the matching [Request] object.*/request(): Request;@@ -6479,11 +6999,12 @@ export interface Response {}/**- * Selectors can be used to install custom selector engines. See Working with selectors for more information.+ * Selectors can be used to install custom selector engines. See [Working with selectors](https://github.com/microsoft/playwright/blob/master/docs/api.md#working-with-selectors) for more information.*/export interface Selectors {/*** An example of registering selector engine that queries elements based on a tag name:+ ** ```js* const { selectors, firefox } = require('playwright'); // Or 'chromium' or 'webkit'.*@@ -6518,18 +7039,19 @@ export interface Selectors {* await browser.close();* })();* ```+ ** @param name Name that is used in selectors as a prefix, e.g. `{name: 'foo'}` enables `foo=myselectorbody` selectors. May only contain `[a-zA-Z0-9_]` characters.* @param script Script that evaluates to a selector engine instance.* @param options*/register(name: string, script: Function|string|{/**- * Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the current working directory.+ * Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the current working directory. Optional.*/path?: string;/**- * Raw script content.+ * Raw script content. Optional.*/content?: string;}, options?: {@@ -6541,7 +7063,7 @@ export interface Selectors {}/**- * Whenever a network route is set up with `page.route(url, handler)` or `browserContext.route(url, handler)`, the `Route` object allows to handle the route.+ * Whenever a network route is set up with [`page.route(url, handler)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagerouteurl-handler) or [`browserContext.route(url, handler)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextrouteurl-handler), the `Route` object allows to handle the route.*/export interface Route {/**@@ -6565,6 +7087,7 @@ export interface Route {/*** Continues route's request with optional overrides.+ ** ```js* await page.route('**\/*', (route, request) => {* // Override headers@@ -6576,6 +7099,7 @@ export interface Route {* route.continue({headers});* });* ```+ ** @param overrides Optional request overrides, can override following properties:*/continue(overrides?: {@@ -6602,7 +7126,9 @@ export interface Route {/*** Fulfills route's request with given response.+ ** An example of fulfilling all requests with 404 responses:+ ** ```js* await page.route('**\/*', route => {* route.fulfill({@@ -6612,10 +7138,13 @@ export interface Route {* });* });* ```+ ** An example of serving static file:+ ** ```js* await page.route('**\/xhr_endpoint', route => route.fulfill({ path: 'mock_data.json' }));* ```+ ** @param response Response that will fulfill this route's request.*/fulfill(response: {@@ -6652,7 +7181,7 @@ export interface Route {}/**- * The WebSocket class represents websocket connections in the page.+ * The [WebSocket] class represents websocket connections in the page.*/export interface WebSocket {/**@@ -6910,13 +7439,15 @@ export interface BrowserServer {/*** Browser websocket url.- * Browser websocket endpoint which can be used as an argument to `browserType.connect(params)` to establish connection to the browser.+ *+ * Browser websocket endpoint which can be used as an argument to [`browserType.connect(params)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsertypeconnectparams) to establish connection to the browser.*/wsEndpoint(): string;}/*** Playwright generates a lot of logs and they are accessible via the pluggable logger sink.+ ** ```js* const { chromium } = require('playwright'); // Or 'firefox' or 'webkit'.*@@ -6930,6 +7461,7 @@ export interface BrowserServer {* ...* })();* ```+ **/export interface Logger {/**@@ -6937,7 +7469,7 @@ export interface Logger {* @param name logger name* @param severity*/- isEnabled(name: string, severity: "error"|"info"|"verbose"|"warning"): boolean;+ isEnabled(name: string, severity: "verbose"|"info"|"warning"|"error"): boolean;/*** @param name logger name@@ -6946,7 +7478,7 @@ export interface Logger {* @param args message arguments* @param hints optional formatting hints*/- log(name: string, severity: "error"|"info"|"verbose"|"warning", message: string|Error, args: Array<Object>, hints: {+ log(name: string, severity: "verbose"|"info"|"warning"|"error", message: string|Error, args: Array<Object>, hints: {/*** Optional preferred logger color.*/@@ -6955,10 +7487,14 @@ export interface Logger {}/**+ * - extends: [BrowserContext]+ ** Chromium-specific features including background pages, service worker support, etc.+ ** ```js* const backgroundPage = await context.waitForEvent('backgroundpage');* ```+ **/export interface ChromiumBrowserContext extends BrowserContext {/**@@ -6977,13 +7513,15 @@ export interface ChromiumBrowserContext extends BrowserContext {* Emitted when Browser context gets closed. This might happen because of one of the following:* - Browser context is closed.* - Browser application is closed or crashed.- * - The `browser.close()` method was called.+ * - The [`browser.close()`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browserclose) method was called.*/on(event: 'close', listener: () => void): this;/**- * The event is emitted when a new Page is created in the BrowserContext. The page may still be loading. The event will also fire for popup pages. See also `page.on('popup')` to receive events about popups relevant to a specific page.+ * The event is emitted when a new Page is created in the BrowserContext. The page may still be loading. The event will also fire for popup pages. See also [`page.on('popup')`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageonpopup) to receive events about popups relevant to a specific page.+ ** The earliest moment that page is available is when it has navigated to the initial url. For example, when opening a popup with `window.open('http://example.com')`, this event will fire when the network request to "http://example.com" is done and its response has started loading in the popup.+ ** ```js* const [page] = await Promise.all([* context.waitForEvent('page'),@@ -6992,7 +7530,7 @@ export interface ChromiumBrowserContext extends BrowserContext {* console.log(await page.evaluate('location.href'));* ```*- * > **NOTE** Use `page.waitForLoadState([state, options])` to wait until the page gets to a particular state (you should not need it in most cases).+ * > **NOTE** Use [`page.waitForLoadState([state, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagewaitforloadstatestate-options) to wait until the page gets to a particular state (you should not need it in most cases).*/on(event: 'page', listener: (page: Page) => void): this;@@ -7012,13 +7550,15 @@ export interface ChromiumBrowserContext extends BrowserContext {* Emitted when Browser context gets closed. This might happen because of one of the following:* - Browser context is closed.* - Browser application is closed or crashed.- * - The `browser.close()` method was called.+ * - The [`browser.close()`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browserclose) method was called.*/once(event: 'close', listener: () => void): this;/**- * The event is emitted when a new Page is created in the BrowserContext. The page may still be loading. The event will also fire for popup pages. See also `page.on('popup')` to receive events about popups relevant to a specific page.+ * The event is emitted when a new Page is created in the BrowserContext. The page may still be loading. The event will also fire for popup pages. See also [`page.on('popup')`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageonpopup) to receive events about popups relevant to a specific page.+ ** The earliest moment that page is available is when it has navigated to the initial url. For example, when opening a popup with `window.open('http://example.com')`, this event will fire when the network request to "http://example.com" is done and its response has started loading in the popup.+ ** ```js* const [page] = await Promise.all([* context.waitForEvent('page'),@@ -7027,7 +7567,7 @@ export interface ChromiumBrowserContext extends BrowserContext {* console.log(await page.evaluate('location.href'));* ```*- * > **NOTE** Use `page.waitForLoadState([state, options])` to wait until the page gets to a particular state (you should not need it in most cases).+ * > **NOTE** Use [`page.waitForLoadState([state, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagewaitforloadstatestate-options) to wait until the page gets to a particular state (you should not need it in most cases).*/once(event: 'page', listener: (page: Page) => void): this;@@ -7047,13 +7587,15 @@ export interface ChromiumBrowserContext extends BrowserContext {* Emitted when Browser context gets closed. This might happen because of one of the following:* - Browser context is closed.* - Browser application is closed or crashed.- * - The `browser.close()` method was called.+ * - The [`browser.close()`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browserclose) method was called.*/addListener(event: 'close', listener: () => void): this;/**- * The event is emitted when a new Page is created in the BrowserContext. The page may still be loading. The event will also fire for popup pages. See also `page.on('popup')` to receive events about popups relevant to a specific page.+ * The event is emitted when a new Page is created in the BrowserContext. The page may still be loading. The event will also fire for popup pages. See also [`page.on('popup')`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageonpopup) to receive events about popups relevant to a specific page.+ ** The earliest moment that page is available is when it has navigated to the initial url. For example, when opening a popup with `window.open('http://example.com')`, this event will fire when the network request to "http://example.com" is done and its response has started loading in the popup.+ ** ```js* const [page] = await Promise.all([* context.waitForEvent('page'),@@ -7062,7 +7604,7 @@ export interface ChromiumBrowserContext extends BrowserContext {* console.log(await page.evaluate('location.href'));* ```*- * > **NOTE** Use `page.waitForLoadState([state, options])` to wait until the page gets to a particular state (you should not need it in most cases).+ * > **NOTE** Use [`page.waitForLoadState([state, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagewaitforloadstatestate-options) to wait until the page gets to a particular state (you should not need it in most cases).*/addListener(event: 'page', listener: (page: Page) => void): this;@@ -7082,13 +7624,15 @@ export interface ChromiumBrowserContext extends BrowserContext {* Emitted when Browser context gets closed. This might happen because of one of the following:* - Browser context is closed.* - Browser application is closed or crashed.- * - The `browser.close()` method was called.+ * - The [`browser.close()`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browserclose) method was called.*/removeListener(event: 'close', listener: () => void): this;/**- * The event is emitted when a new Page is created in the BrowserContext. The page may still be loading. The event will also fire for popup pages. See also `page.on('popup')` to receive events about popups relevant to a specific page.+ * The event is emitted when a new Page is created in the BrowserContext. The page may still be loading. The event will also fire for popup pages. See also [`page.on('popup')`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageonpopup) to receive events about popups relevant to a specific page.+ ** The earliest moment that page is available is when it has navigated to the initial url. For example, when opening a popup with `window.open('http://example.com')`, this event will fire when the network request to "http://example.com" is done and its response has started loading in the popup.+ ** ```js* const [page] = await Promise.all([* context.waitForEvent('page'),@@ -7097,7 +7641,7 @@ export interface ChromiumBrowserContext extends BrowserContext {* console.log(await page.evaluate('location.href'));* ```*- * > **NOTE** Use `page.waitForLoadState([state, options])` to wait until the page gets to a particular state (you should not need it in most cases).+ * > **NOTE** Use [`page.waitForLoadState([state, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagewaitforloadstatestate-options) to wait until the page gets to a particular state (you should not need it in most cases).*/removeListener(event: 'page', listener: (page: Page) => void): this;@@ -7117,13 +7661,15 @@ export interface ChromiumBrowserContext extends BrowserContext {* Emitted when Browser context gets closed. This might happen because of one of the following:* - Browser context is closed.* - Browser application is closed or crashed.- * - The `browser.close()` method was called.+ * - The [`browser.close()`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browserclose) method was called.*/off(event: 'close', listener: () => void): this;/**- * The event is emitted when a new Page is created in the BrowserContext. The page may still be loading. The event will also fire for popup pages. See also `page.on('popup')` to receive events about popups relevant to a specific page.+ * The event is emitted when a new Page is created in the BrowserContext. The page may still be loading. The event will also fire for popup pages. See also [`page.on('popup')`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageonpopup) to receive events about popups relevant to a specific page.+ ** The earliest moment that page is available is when it has navigated to the initial url. For example, when opening a popup with `window.open('http://example.com')`, this event will fire when the network request to "http://example.com" is done and its response has started loading in the popup.+ ** ```js* const [page] = await Promise.all([* context.waitForEvent('page'),@@ -7132,7 +7678,7 @@ export interface ChromiumBrowserContext extends BrowserContext {* console.log(await page.evaluate('location.href'));* ```*- * > **NOTE** Use `page.waitForLoadState([state, options])` to wait until the page gets to a particular state (you should not need it in most cases).+ * > **NOTE** Use [`page.waitForLoadState([state, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagewaitforloadstatestate-options) to wait until the page gets to a particular state (you should not need it in most cases).*/off(event: 'page', listener: (page: Page) => void): this;@@ -7168,13 +7714,15 @@ export interface ChromiumBrowserContext extends BrowserContext {* Emitted when Browser context gets closed. This might happen because of one of the following:* - Browser context is closed.* - Browser application is closed or crashed.- * - The `browser.close()` method was called.+ * - The [`browser.close()`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browserclose) method was called.*/waitForEvent(event: 'close', optionsOrPredicate?: { predicate?: () => boolean, timeout?: number } | (() => boolean)): Promise<void>;/**- * The event is emitted when a new Page is created in the BrowserContext. The page may still be loading. The event will also fire for popup pages. See also `page.on('popup')` to receive events about popups relevant to a specific page.+ * The event is emitted when a new Page is created in the BrowserContext. The page may still be loading. The event will also fire for popup pages. See also [`page.on('popup')`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageonpopup) to receive events about popups relevant to a specific page.+ ** The earliest moment that page is available is when it has navigated to the initial url. For example, when opening a popup with `window.open('http://example.com')`, this event will fire when the network request to "http://example.com" is done and its response has started loading in the popup.+ ** ```js* const [page] = await Promise.all([* context.waitForEvent('page'),@@ -7183,7 +7731,7 @@ export interface ChromiumBrowserContext extends BrowserContext {* console.log(await page.evaluate('location.href'));* ```*- * > **NOTE** Use `page.waitForLoadState([state, options])` to wait until the page gets to a particular state (you should not need it in most cases).+ * > **NOTE** Use [`page.waitForLoadState([state, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagewaitforloadstatestate-options) to wait until the page gets to a particular state (you should not need it in most cases).*/waitForEvent(event: 'page', optionsOrPredicate?: { predicate?: (page: Page) => boolean, timeout?: number } | ((page: Page) => boolean)): Promise<Page>;@@ -7191,7 +7739,9 @@ export interface ChromiumBrowserContext extends BrowserContext {/*** Coverage gathers information about parts of JavaScript and CSS that were used by the page.+ ** An example of using JavaScript coverage to produce Istambul report for page load:+ ** ```js* const { chromium } = require('playwright');* const v8toIstanbul = require('v8-to-istanbul');@@ -7211,6 +7761,7 @@ export interface ChromiumBrowserContext extends BrowserContext {* await browser.close();* })();* ```+ **/export interface ChromiumCoverage {/**@@ -7315,6 +7866,8 @@ export interface ChromiumCoverage {}/**+ * - extends: [Browser]+ ** Firefox browser instance does not expose Firefox-specific features.*/export interface FirefoxBrowser extends Browser {@@ -7322,6 +7875,8 @@ export interface FirefoxBrowser extends Browser {}/**+ * - extends: [Browser]+ ** WebKit browser instance does not expose WebKit-specific features.*/export interface WebKitBrowser extends Browser {@@ -7340,9 +7895,9 @@ export interface BrowserContextOptions {bypassCSP?: boolean;/**- * Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. See `page.emulateMedia(params)` for more details. Defaults to '`light`'.+ * Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. See [`page.emulateMedia(params)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pageemulatemediaparams) for more details. Defaults to '`light`'.*/- colorScheme?: "dark"|"light"|"no-preference";+ colorScheme?: "light"|"dark"|"no-preference";/*** Specify device scale factor (can be thought of as dpr). Defaults to `1`.@@ -7362,7 +7917,7 @@ export interface BrowserContextOptions {hasTouch?: boolean;/**- * Credentials for HTTP authentication.+ * Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication).*/httpCredentials?: HTTPCredentials;@@ -7397,7 +7952,7 @@ export interface BrowserContextOptions {offline?: boolean;/**- * A list of permissions to grant to all pages in this context. See `browserContext.grantPermissions(permissions[, options])` for more details.+ * A list of permissions to grant to all pages in this context. See [`browserContext.grantPermissions(permissions[, options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextgrantpermissionspermissions-options) for more details.*/permissions?: Array<string>;@@ -7427,7 +7982,7 @@ export interface BrowserContextOptions {};/**- * Enables HAR recording for all pages into `recordHar.path` file. If not specified, the HAR is not recorded. Make sure to await `browserContext.close()` for the HAR to be saved.+ * Enables [HAR](http://www.softwareishard.com/blog/har-12-spec) recording for all pages into `recordHar.path` file. If not specified, the HAR is not recorded. Make sure to await [`browserContext.close()`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextclose) for the HAR to be saved.*/recordHar?: {/**@@ -7442,7 +7997,7 @@ export interface BrowserContextOptions {};/**- * Enables video recording for all pages into `recordVideo.dir` directory. If not specified videos are not recorded. Make sure to await `browserContext.close()` for videos to be saved.+ * Enables video recording for all pages into `recordVideo.dir` directory. If not specified videos are not recorded. Make sure to await [`browserContext.close()`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextclose) for videos to be saved.*/recordVideo?: {/**@@ -7467,7 +8022,7 @@ export interface BrowserContextOptions {};/**- * Populates context with given storage state. This method can be used to initialize context with logged-in information obtained via `browserContext.storageState([options])`. Either a path to the file with saved storage, or an object with the following fields:+ * Populates context with given storage state. This method can be used to initialize context with logged-in information obtained via [`browserContext.storageState([options])`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextstoragestateoptions). Either a path to the file with saved storage, or an object with the following fields:*/storageState?: string|{/**@@ -7517,7 +8072,7 @@ export interface BrowserContextOptions {/*** Optional sameSite flag*/- sameSite?: "Lax"|"None"|"Strict";+ sameSite?: "Strict"|"Lax"|"None";}>;/**@@ -7535,7 +8090,7 @@ export interface BrowserContextOptions {};/**- * Changes the timezone of the context. See ICU’s `metaZones.txt` for a list of supported timezone IDs.+ * Changes the timezone of the context. See [ICU's metaZones.txt](https://cs.chromium.org/chromium/src/third_party/icu/source/data/misc/metaZones.txt?rcl=faee8bc70570192d82d2978a71e2a615788597d1) for a list of supported timezone IDs.*/timezoneId?: string;@@ -7560,7 +8115,7 @@ export interface BrowserContextOptions {};/**- * **NOTE** Use `recordVideo` instead, it takes precedence over `videosPath`. Enables video recording for all pages to `videosPath` directory. If not specified, videos are not recorded. Make sure to await `browserContext.close()` for videos to be saved.+ * **NOTE** Use `recordVideo` instead, it takes precedence over `videosPath`. Enables video recording for all pages to `videosPath` directory. If not specified, videos are not recorded. Make sure to await [`browserContext.close()`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextclose) for videos to be saved.*/videosPath?: string;@@ -7607,7 +8162,7 @@ export interface Geolocation {export interface LaunchOptions {/**- * Additional arguments to pass to the browser instance. The list of Chromium flags can be found here.+ * Additional arguments to pass to the browser instance. The list of Chromium flags can be found [here](http://peter.sh/experiments/chromium-command-line-switches/).*/args?: Array<string>;@@ -7637,7 +8192,7 @@ export interface LaunchOptions {executablePath?: string;/**- * Firefox user preferences. Learn more about the Firefox user preferences at `about:config`.+ * Firefox user preferences. Learn more about the Firefox user preferences at [`about:config`](https://support.mozilla.org/en-US/kb/about-config-editor-firefox).*/firefoxUserPrefs?: { [key: string]: string|number|boolean; };@@ -7657,7 +8212,7 @@ export interface LaunchOptions {handleSIGTERM?: boolean;/**- * Whether to run browser in headless mode. More details for Chromium and Firefox. Defaults to `true` unless the `devtools` option is `true`.+ * Whether to run browser in headless mode. More details for [Chromium](https://developers.google.com/web/updates/2017/04/headless-chrome) and [Firefox](https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Headless_mode). Defaults to `true` unless the `devtools` option is `true`.*/headless?: boolean;@@ -7719,7 +8274,7 @@ export interface ConnectOptions {slowMo?: number;/**- * Logger sink for Playwright logging.+ * Logger sink for Playwright logging. Optional.*/logger?: Logger;@@ -7737,10 +8292,10 @@ interface ElementHandleWaitForSelectorOptions {* - `'visible'` - wait for element to have non-empty bounding box and no `visibility:hidden`. Note that element without any content or with `display:none` has an empty bounding box and is not considered visible.* - `'hidden'` - wait for element to be either detached from DOM, or have an empty bounding box or `visibility:hidden`. This is opposite to the `'visible'` option.*/- state?: "attached"|"detached"|"hidden"|"visible";+ state?: "attached"|"detached"|"visible"|"hidden";/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}@@ -7763,7 +8318,7 @@ export interface Cookie {secure: boolean;- sameSite: "Lax"|"None"|"Strict";+ sameSite: "Strict"|"Lax"|"None";}interface PageWaitForSelectorOptions {@@ -7774,10 +8329,10 @@ interface PageWaitForSelectorOptions {* - `'visible'` - wait for element to have non-empty bounding box and no `visibility:hidden`. Note that element without any content or with `display:none` has an empty bounding box and is not considered visible.* - `'hidden'` - wait for element to be either detached from DOM, or have an empty bounding box or `visibility:hidden`. This is opposite to the `'visible'` option.*/- state?: "attached"|"detached"|"hidden"|"visible";+ state?: "attached"|"detached"|"visible"|"hidden";/**- * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the `browserContext.setDefaultTimeout(timeout)` or `page.setDefaultTimeout(timeout)` methods.+ * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#pagesetdefaulttimeouttimeout) methods.*/timeout?: number;}@@ -7789,7 +8344,7 @@ interface PageWaitForFunctionOptions {polling?: number|"raf";/**- * 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 `browserContext.setDefaultTimeout(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 [`browserContext.setDefaultTimeout(timeout)`](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsercontextsetdefaulttimeouttimeout).*/timeout?: number;}diff --git a/utils/doclint/check_public_api/MDBuilder.js b/utils/doclint/check_public_api/MDBuilder.jsindex 78bc2d370b..37cf5ca930 100644--- a/utils/doclint/check_public_api/MDBuilder.js+++ b/utils/doclint/check_public_api/MDBuilder.js@@ -16,7 +16,7 @@// @ts-check-const { parseArgument } = require('../../parse_md');+const { parseArgument, renderMd, clone } = require('../../parse_md');const Documentation = require('./Documentation');/** @typedef {import('./Documentation').MarkdownNode} MarkdownNode */@@ -24,8 +24,9 @@ const Documentation = require('./Documentation');class MDOutline {/*** @param {MarkdownNode[]} api+ * @param {string=} links*/- constructor(api) {+ constructor(api, links = '') {this.classesArray = /** @type {Documentation.Class[]} */ [];this.classes = /** @type {Map<string, Documentation.Class>} */ new Map();for (const clazz of api) {@@ -33,10 +34,20 @@ class MDOutline {this.classesArray.push(c);this.classes.set(c.name, c);}- this.signatures = this._generateComments();+ const linksMap = new Map();+ for (const link of links.replace(/\r\n/g, '\n').split('\n')) {+ if (!link)+ continue;+ const match = link.match(/\[([^\]]+)\]: ([^"]+) "([^"]+)"/);+ linksMap.set(new RegExp('\\[' + match[1] + '\\]', 'g'), { href: match[2], label: match[3] });+ }+ this.signatures = this._generateComments(linksMap);}- _generateComments() {+ /**+ * @param {Map<string, { href: string, label: string}>} linksMap+ */+ _generateComments(linksMap) {/*** @type {Map<string, string>}*/@@ -70,7 +81,9 @@ class MDOutline {}for (const clazz of this.classesArray)- clazz.visit(item => item.comment = renderComments(item.spec, signatures));+ clazz.visit(item => patchSignatures(item.spec, signatures));+ for (const clazz of this.classesArray)+ clazz.visit(item => item.comment = renderCommentsForSourceCode(item.spec, linksMap));return signatures;}}@@ -99,75 +112,79 @@ function parseClass(node) {* @returns {MarkdownNode[]}*/function extractComments(item) {- return (item.children || []).filter(c => c.type !== 'gen' && !c.type.startsWith('h'));+ return (item.children || []).filter(c => !c.type.startsWith('h') && (c.type !== 'li' || c.liType !== 'default'));+}++/**+ * @param {MarkdownNode[]} spec+ * @param {Map<string, { href: string, label: string}>} linksMap+ */+function renderCommentsForSourceCode(spec, linksMap) {+ const comments = (spec || []).filter(n => n.type !== 'gen' && !n.type.startsWith('h') && (n.type !== 'li' || n.liType !== 'default')).map(c => clone(c));+ const visit = node => {+ if (node.text) {+ for (const [regex, { href, label }] of linksMap)+ node.text = node.text.replace(regex, `[${label}](${href})`);+ // Those with in `` can have nested [], hence twice twice.+ node.text = node.text.replace(/\[`([^`]+)`\]\(#([^\)]+)\)/g, '[`$1`](https://github.com/microsoft/playwright/blob/master/docs/api.md#$2)');+ node.text = node.text.replace(/\[([^\]]+)\]\(#([^\)]+)\)/g, '[$1](https://github.com/microsoft/playwright/blob/master/docs/api.md#$2)');+ node.text = node.text.replace(/\[`([^`]+)`\]\(\.\/([^\)]+)\)/g, '[`$1`](https://github.com/microsoft/playwright/blob/master/docs/$2)');+ node.text = node.text.replace(/\[([^\]]+)\]\(\.\/([^\)]+)\)/g, '[$1](https://github.com/microsoft/playwright/blob/master/docs/$2)');+ }+ if (node.liType === 'bullet')+ node.liType = 'default';+ for (const child of node.children || [])+ visit(child);+ };+ for (const node of comments)+ visit(node);+ return renderMd(comments, 10000);++ // [`frame.waitForFunction(pageFunction[, arg, options])`](#framewaitforfunctionpagefunction-arg-options)}/*** @param {MarkdownNode[]} spec* @param {Map<string, string>} [signatures]*/-function renderComments(spec, signatures) {- const result = [];+function patchSignatures(spec, signatures) {for (const node of spec || []) {- if (node.type === 'text') {- const text = patchSignatures(node.text, signatures);-- // Render comments as text.- if (text.startsWith('> ')) {- result.push('');- result.push(text);- } else {- result.push(text);- }- }-- if (node.type === 'code') {- result.push('```' + node.codeLang);- for (const line of node.lines)- result.push(line);- result.push('```');- }-- if (node.type === 'gen') {- // Skip- }-- if (node.type === 'li' && node.liType !== 'default') {- if (node.text.startsWith('extends:'))- continue;- const visit = (node, indent) => {- result.push(`${indent}- ${patchSignatures(node.text, signatures)}`);- for (const child of node.children || [])- visit(child, indent + ' ');- };- visit(node, '');+ if (node.type === 'text')+ node.text = patchSignaturesInText(node.text, signatures);+ if (node.type === 'li') {+ node.text = patchSignaturesInText(node.text, signatures);+ patchSignatures(node.children, signatures);}}- return result.join('\n');+}++/**+ * @param {string} text+ * @returns {string}+ */+function createLink(text) {+ const anchor = text.toLowerCase().split(',').map(c => c.replace(/[^a-z]/g, '')).join('-');+ return `[\`${text}\`](#${anchor})`;}/*** @param {string} comment* @param {Map<string, string>} signatures*/-function patchSignatures(comment, signatures) {+function patchSignaturesInText(comment, signatures) {if (!signatures)return comment;comment = comment.replace(/\[`(event|method|property):\s(JS|CDP|[A-Z])([^.]+)\.([^`]+)`\]\(\)/g, (match, type, clazzPrefix, clazz, name) => {const className = `${clazzPrefix.toLowerCase()}${clazz}`;if (type === 'event')- return `\`${className}.on('${name}')\``;+ return createLink(`${className}.on('${name}')`);if (type === 'method') {const signature = signatures.get(`${clazzPrefix}${clazz}.${name}`) || '';- return `\`${className}.${name}(${signature})\``;+ return createLink(`${className}.${name}(${signature})`);}- return `\`${className}.${name}\``;+ return createLink(`${className}.${name}`);});- comment = comment.replace(/\[`(?:param|option):\s([^`]+)`\]\(\)/g, '`$1`');- comment = comment.replace(/\[([^\]]+)\]\([^\)]*\)/g, '$1');- for (const link of outgoingLinks)- comment = comment.replace(new RegExp('\\[' + link + '\\]', 'g'), link);- return comment;+ return comment.replace(/\[`(?:param|option):\s([^`]+)`\]\(\)/g, '`$1`');}/**@@ -221,7 +238,7 @@ function parseProperty(spec) {const text = param.text;const name = text.substring(0, text.indexOf('<')).replace(/\`/g, '').trim();const comments = extractComments(spec);- return Documentation.Member.createProperty(name, parseType(param), comments, guessRequired(renderComments(comments)));+ return Documentation.Member.createProperty(name, parseType(param), comments, guessRequired(renderCommentsForSourceCode(comments, new Map())));}/**@@ -233,8 +250,8 @@ function parseType(spec) {let typeName = type.replace(/[\[\]\\]/g, '');const literals = typeName.match(/("[^"]+"(\|"[^"]+")*)/);if (literals) {- const sorted = literals[1].split('|').sort((a, b) => a.localeCompare(b)).join('|');- typeName = typeName.substring(0, literals.index) + sorted + typeName.substring(literals.index + literals[0].length);+ const assorted = literals[1];+ typeName = typeName.substring(0, literals.index) + assorted + typeName.substring(literals.index + literals[0].length);}const properties = [];const hasNonEnumProperties = typeName.split('|').some(part => {@@ -245,8 +262,7 @@ function parseType(spec) {if (hasNonEnumProperties && spec) {for (const child of spec.children || []) {const { name, text } = parseArgument(child.text);- const patchedText = text.replace(/\. Optional\.$/, '.');- const comments = /** @type {MarkdownNode[]} */ ([{ type: 'text', text: patchedText }]);+ const comments = /** @type {MarkdownNode[]} */ ([{ type: 'text', text }]);properties.push(Documentation.Member.createProperty(name, parseType(child), comments, guessRequired(text)));}}@@ -278,11 +294,11 @@ function guessRequired(comment) {module.exports =/*** @param {any} api- * @param {boolean} copyDocsFromSuperClasses+ * @param {boolean=} copyDocsFromSuperClasses*/- function(api, copyDocsFromSuperClasses) {+ function(api, copyDocsFromSuperClasses = false, links = '') {const errors = [];- const outline = new MDOutline(api);+ const outline = new MDOutline(api, links);const documentation = new Documentation(outline.classesArray);if (copyDocsFromSuperClasses) {@@ -308,5 +324,3 @@ module.exports =}return { documentation, errors, outline };};--const outgoingLinks = ['AXNode', 'Accessibility', 'Array', 'Body', 'BrowserServer', 'BrowserContext', 'BrowserType', 'Browser', 'Buffer', 'ChildProcess', 'ChromiumBrowser', 'ChromiumBrowserContext', 'ChromiumCoverage', 'CDPSession', 'ConsoleMessage', 'Dialog', 'Download', 'ElementHandle', 'Element', 'Error', 'EvaluationArgument', 'File', 'FileChooser', 'FirefoxBrowser', 'Frame', 'JSHandle', 'Keyboard', 'Logger', 'Map', 'Mouse', 'Object', 'Page', 'Playwright', 'Promise', 'RegExp', 'Request', 'Response', 'Route', 'Selectors', 'Serializable', 'TimeoutError', 'Touchscreen', 'UIEvent.detail', 'URL', 'USKeyboardLayout', 'UnixTime', 'Video', 'WebKitBrowser', 'WebSocket', 'Worker', 'boolean', 'function', 'iterator', 'null', 'number', 'origin', 'selector', 'Readable', 'string', 'xpath'];\ No newline at end of filediff --git a/utils/doclint/check_public_api/index.js b/utils/doclint/check_public_api/index.jsindex 6b71bf73d1..bdcff2f3d2 100644--- a/utils/doclint/check_public_api/index.js+++ b/utils/doclint/check_public_api/index.js@@ -24,7 +24,7 @@ const EXCLUDE_PROPERTIES = new Set([]);/**- * @return {!Promise<!Array<!Message>>}+ * @return {!Array<!Message>}*/module.exports = function lint(api, jsSources) {const mdResult = mdBuilder(api, true);diff --git a/utils/doclint/cli.js b/utils/doclint/cli.jsindex f426c9fabb..f6f52f1c77 100755--- a/utils/doclint/cli.js+++ b/utils/doclint/cli.js@@ -15,16 +15,21 @@* limitations under the License.*/+//@ts-check+const playwright = require('../../');const fs = require('fs');const path = require('path');const Source = require('./Source');const Message = require('./Message');-const { parseMd, renderMd, parseArgument, applyTemplates } = require('./../parse_md');+const { parseMd, renderMd, applyTemplates, clone } = require('./../parse_md');const { spawnSync } = require('child_process');const preprocessor = require('./preprocessor');const mdBuilder = require('./check_public_api/MDBuilder');+/** @typedef {import('./check_public_api/Documentation').MarkdownNode} MarkdownNode */+/** @typedef {import('./check_public_api/Documentation').Type} Type */+const PROJECT_DIR = path.join(__dirname, '..', '..');const VERSION = require(path.join(PROJECT_DIR, 'package.json')).version;@@ -51,110 +56,72 @@ async function run() {const messages = [];let changedFiles = false;+ const header = fs.readFileSync(path.join(PROJECT_DIR, 'docs-src', 'api-header.md')).toString();+ const body = fs.readFileSync(path.join(PROJECT_DIR, 'docs-src', 'api-body.md')).toString();+ const footer = fs.readFileSync(path.join(PROJECT_DIR, 'docs-src', 'api-footer.md')).toString();+ const links = fs.readFileSync(path.join(PROJECT_DIR, 'docs-src', 'api-links.md')).toString();+ const params = fs.readFileSync(path.join(PROJECT_DIR, 'docs-src', 'api-params.md')).toString();+ const apiSpec = applyTemplates(parseMd(body), parseMd(params));+// Produce api.md{const comment = '<!-- THIS FILE IS NOW GENERATED -->';- const header = fs.readFileSync(path.join(PROJECT_DIR, 'docs-src', 'api-header.md')).toString();- const body = fs.readFileSync(path.join(PROJECT_DIR, 'docs-src', 'api-body.md')).toString();- const footer = fs.readFileSync(path.join(PROJECT_DIR, 'docs-src', 'api-footer.md')).toString();- const params = fs.readFileSync(path.join(PROJECT_DIR, 'docs-src', 'api-params.md')).toString();-- // Generate signatures{- const nodes = applyTemplates(parseMd(body), parseMd(params));- const { outline } = mdBuilder(nodes);+ const { outline } = mdBuilder(apiSpec, false);const signatures = outline.signatures;- for (const clazz of nodes) {- clazz.type = 'h3';- for (const member of clazz.children) {- if (member.type !== 'h2')- continue;- member.type = 'h4';-- let match = member.text.match(/(event|method|property|async method|): (JS|CDP|[A-Z])([^.]+)\.(.*)/);- if (!match)- continue;-- if (match[1] === 'event') {- member.text = `${match[2].toLowerCase() + match[3]}.on('${match[4]}')`;- continue;+ const result = [];+ for (const clazz of outline.classesArray) {+ // Iterate over classes, create header node.+ const classNode = { type: 'h3', text: `class: ${clazz.name}` };+ const match = clazz.name.match(/(JS|CDP|[A-Z])(.*)/);+ const varName = match[1].toLocaleLowerCase() + match[2];+ result.push(classNode);+ // Append link shortcut to resolve text like [Browser]+ result.push({+ type: 'text',+ text: `[${clazz.name}]: #class-${clazz.name.toLowerCase()} "${clazz.name}"`+ });+ // Append class comments+ classNode.children = (clazz.spec || []).map(c => clone(c));++ for (const member of clazz.membersArray) {+ // Iterate members+ const memberNode = { type: 'h4', children: [] };+ if (member.kind === 'event') {+ memberNode.text = `${varName}.on('${member.name}')`;+ } else if (member.kind === 'property') {+ memberNode.text = `${varName}.${member.name}`;+ } else if (member.kind === 'method') {+ // Patch method signatures+ const signature = signatures.get(clazz.name + '.' + member.name);+ memberNode.text = `${varName}.${member.name}(${signature})`;+ for (const arg of member.argsArray) {+ if (arg.type)+ memberNode.children.push(renderProperty(`\`${arg.name}\``, arg.type, arg.spec));+ }}- if (match[1] === 'method' || match[1] === 'async method') {- const args = [];- const argChildren = [];- const returnContainer = [];- const nonArgChildren = [];- const optionsContainer = [];- for (const item of member.children) {- if (item.type === 'li' && item.liType === 'default') {- const { type } = parseArgument(item.text);- if (match[1] === 'method')- item.text = `returns: <${type}>`;- else- item.text = `returns: <[Promise]<${type}>>`;- returnContainer.push(item);- continue;- }- if (item.type !== 'h3') {- nonArgChildren.push(item);- continue;- }- if (item.text.startsWith('param:')) {- const param = item.children[0];- if (item.children[1])- param.text += ' ' + item.children[1].text;- if (item.children.length > 2)- param.children = item.children.slice(2);- args.push(parseArgument(param.text));- argChildren.push(param);- }- if (item.text.startsWith('option:')) {- let optionsNode = optionsContainer[0];- if (!optionsNode) {- optionsNode = {- type: 'li',- text: '`options` <[Object]>',- liType: 'default',- children: [],- };- optionsContainer.push(optionsNode);- args.push(parseArgument(optionsNode.text));- }- const param = item.children[0];- if (item.children[1])- param.text += ' ' + item.children[1].text;- if (item.children.length > 2)- param.children = item.children.slice(2);- optionsNode.children.push(param);- }+ // Append type+ if (member.type && member.type.name !== 'void') {+ let name;+ switch (member.kind) {+ case 'event': name = 'type:'; break;+ case 'property': name = 'type:'; break;+ case 'method': name = 'returns:'; break;}- if (match[1] === 'async method' && !returnContainer[0]) {- returnContainer.push({- type: 'li',- text: 'returns: <[Promise]>',- liType: 'default'- });- }- if (optionsContainer[0])- optionsContainer[0].children.sort((o1, o2) => o1.text.localeCompare(o2.text));- member.children = [...argChildren, ...optionsContainer, ...returnContainer, ...nonArgChildren];- const signatureKey = match[2] + match[3] + '.' + match[4];- const methodName = match[2].toLowerCase() + match[3] + '.' + match[4];- const signature = signatures.get(signatureKey);- member.text = `${methodName}(${signature})`;+ memberNode.children.push(renderProperty(name, member.type));}- if (match[1] === 'property') {- member.text = `${match[2].toLowerCase() + match[3]}.${match[4]}`;- continue;- }+ // Append member doc+ memberNode.children.push(...(member.spec || []).map(c => clone(c)));+ classNode.children.push(memberNode);}}- api.setText([comment, header, renderMd(nodes, 10000), footer].join('\n'));-- // Generate links- preprocessor.generateLinks(api, signatures, messages);+ result.push({+ type: 'text',+ text: links+ });+ api.setText([comment, header, renderMd(result, 10000), footer].join('\n'));}}@@ -172,13 +139,10 @@ async function run() {for (const source of mdSources.filter(source => source.hasUpdatedText()))messages.push(Message.warning(`WARN: updated ${source.projectPath()}`));- const body = fs.readFileSync(path.join(PROJECT_DIR, 'docs-src', 'api-body.md')).toString();- const params = fs.readFileSync(path.join(PROJECT_DIR, 'docs-src', 'api-params.md')).toString();- const api = applyTemplates(parseMd(body), parseMd(params));const checkPublicAPI = require('./check_public_api');const jsSources = await Source.readdir(path.join(PROJECT_DIR, 'src', 'client'), '', []);- messages.push(...checkPublicAPI(api, jsSources));+ messages.push(...checkPublicAPI(apiSpec, jsSources));for (const source of mdSources) {if (!source.hasUpdatedText())@@ -235,3 +199,39 @@ function getRepositoryFiles() {const files = out.stdout.toString().trim().split('\n').filter(f => !f.startsWith('docs-src'));return files.map(file => path.join(PROJECT_DIR, file));}++/**+ * @param {string} name+ * @param {Type} type+ * @param {MarkdownNode[]} [spec]+ */+function renderProperty(name, type, spec) {+ let comment = '';+ if (spec && spec.length)+ comment = spec[0].text;+ let children;+ if (type.properties && type.properties.length)+ children = type.properties.map(p => renderProperty(`\`${p.name}\``, p.type, p.spec))+ else if (spec && spec.length > 1)+ children = spec.slice(1).map(s => clone(s));++ const result = {+ type: 'li',+ liType: 'default',+ text: `${name} <${renderType(type.name)}>${comment ? ' ' + comment : ''}`,+ children+ };+ return result;+}++/**+ * @param {string} type+ */+function renderType(type) {+ if (type.includes('"'))+ return type.replace(/,/g, '|').replace(/Array/, "[Array]").replace(/null/, "[null]").replace(/number/, "[number]");+ const result = type.replace(/([\w]+)/g, '[$1]');+ if (result === '[Promise]<[void]>')+ return '[Promise]';+ return result.replace(/[(]/g, '\\(').replace(/[)]/g, '\\)');+}diff --git a/utils/doclint/preprocessor/index.js b/utils/doclint/preprocessor/index.jsindex 9f5b4b8872..ea9d127038 100644--- a/utils/doclint/preprocessor/index.js+++ b/utils/doclint/preprocessor/index.js@@ -180,49 +180,6 @@ function autocorrectInvalidLinks(projectRoot, sources, allowedFilePaths) {}}-function generateLinks(source, signatures, messages) {- const sourceEdits = new SourceEdits(source);- let offset = 0;-- const lines = source.text().split('\n');- lines.forEach((line, lineNumber) => {- const linkRegex = /\[([^\]]+)\]\(\)/gm;- let match;- while (match = linkRegex.exec(line)) {- const [, name] = match;- const linkOffset = offset + lineNumber + match.index;- const hrefOffset = offset + lineNumber + match.index + 3 + name.length;- let replacement;- const memberMatch = name.match(/`(event|method|property):\s(JS|CDP|[A-Z])([^.]+)\.(.*)`/m);- const paramMatch = name.match(/`(?:param|option):\s(.*)`/m);- if (!memberMatch && !paramMatch) {- messages.push(Message.error(`Bad link: ${source.filePath()}:${lineNumber + 1}: ${name}`));- return;- }- if (memberMatch && memberMatch[1] === 'event') {- replacement = `${memberMatch[2].toLowerCase() + memberMatch[3]}.on('${memberMatch[4]}')`;- sourceEdits.edit(linkOffset + 1, hrefOffset - 2, replacement);- } else if (memberMatch && memberMatch[1] === 'method') {- const key = memberMatch[2] + memberMatch[3] + '.' + memberMatch[4];- const method = memberMatch[2].toLowerCase() + memberMatch[3] + '.' + memberMatch[4];- let signature = signatures.get(key);- if (signature === undefined) {- messages.push(Message.error(`Bad method link: ${source.filePath()}:${lineNumber + 1}: ${key}`));- signature = '(\u2026)';- }- replacement = method + '(' + signature + ')';- sourceEdits.edit(linkOffset + 2, hrefOffset - 3, replacement);- } else if (paramMatch) {- sourceEdits.edit(linkOffset, hrefOffset + 1, '`' + paramMatch[1] + '`');- }- if (replacement)- sourceEdits.edit(hrefOffset, hrefOffset, '#' + replacement.toLowerCase().replace(/[^a-z]/gm, ''));- }- offset += line.length;- });- sourceEdits.commit(messages);-}-class SourceEdits {constructor(source) {this._source = source;@@ -328,4 +285,4 @@ function generateTableOfContentsForSuperclass(text, name) {return text;}-module.exports = {autocorrectInvalidLinks, runCommands, generateLinks};+module.exports = {autocorrectInvalidLinks, runCommands};diff --git a/utils/parse_md.js b/utils/parse_md.jsindex 6e221e67f9..0a1cae7698 100644--- a/utils/parse_md.js+++ b/utils/parse_md.js@@ -158,7 +158,7 @@ function innerRenderMdNode(node, lastNode, result, maxColumns = 120) {const depth = node.type.substring(1);result.push(`${'#'.repeat(depth)} ${node.text}`);let lastNode = node;- for (const child of node.children) {+ for (const child of node.children || []) {innerRenderMdNode(child, lastNode, result, maxColumns);lastNode = child;}@@ -255,9 +255,8 @@ function applyTemplates(body, params) {throw new Error('Bad template: ' + key);node.children.push(...template.children.map(c => clone(c)));}- for (const child of node.children || []) {+ for (const child of node.children || [])visit(child, node);- }if (node.children)node.children = node.children.filter(child => !child.text || !child.text.includes('-inline- = %%'));};