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
chore: generate types, api.json off md rather than html (#4825)
Pavel Feldman15cdfd1cc126
diff --git a/docs-src/api-body.md b/docs-src/api-body.mdindex 88dd6561e6..3b5be7a366 100644--- a/docs-src/api-body.md+++ b/docs-src/api-body.md@@ -132,7 +132,7 @@ Emitted when Browser context gets closed. This might happen because of one of th* The [`method: Browser.close`]() method was called.## event: BrowserContext.page-- <[Page]>+- type: <[Page]>The event is emitted when a new Page is created in the BrowserContext. The page may still be loading. The event willalso fire for popup pages. See also [`event: Page.popup`]() to receive events about popups relevant to a specific page.@@ -165,13 +165,13 @@ await browserContext.addCookies([cookieObject1, cookieObject2]);- `cookies` <[Array]<[Object]>>- `name` <[string]> **required**- `value` <[string]> **required**- - `url` <[string]> either url or domain / path are required- - `domain` <[string]> either url or domain / path are required- - `path` <[string]> either url or domain / path are required- - `expires` <[number]> Unix time in seconds.- - `httpOnly` <[boolean]>- - `secure` <[boolean]>- - `sameSite` <"Strict"|"Lax"|"None">+ - `url` <[string]> either url or domain / path are required. Optional.+ - `domain` <[string]> either url or domain / path are required Optional.+ - `path` <[string]> either url or domain / path are required Optional.+ - `expires` <[number]> Unix time in seconds. Optional.+ - `httpOnly` <[boolean]> Optional.+ - `secure` <[boolean]> Optional.+ - `sameSite` <"Strict"|"Lax"|"None"> Optional.## async method: BrowserContext.addInitScript@@ -201,8 +201,8 @@ await browserContext.addInitScript({### param: BrowserContext.addInitScript.script- `script` <[function]|[string]|[Object]>- - `path` <[string]> Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the current working directory.- - `content` <[string]> Raw script content.+ - `path` <[string]> Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the current working directory. Optional.+ - `content` <[string]> Raw script content. Optional.Script to be evaluated in all pages in the browser context.@@ -372,24 +372,24 @@ specified.### param: BrowserContext.grantPermissions.permissions- `permissions` <[Array]<[string]>>- - `'geolocation'`- - `'midi'`- - `'midi-sysex'` (system-exclusive midi)- - `'notifications'`- - `'push'`- - `'camera'`- - `'microphone'`- - `'background-sync'`- - `'ambient-light-sensor'`- - `'accelerometer'`- - `'gyroscope'`- - `'magnetometer'`- - `'accessibility-events'`- - `'clipboard-read'`- - `'clipboard-write'`- - `'payment-handler'`A permission or an array of permissions to grant. Permissions can be one of the following values:+ * `'geolocation'`+ * `'midi'`+ * `'midi-sysex'` (system-exclusive midi)+ * `'notifications'`+ * `'push'`+ * `'camera'`+ * `'microphone'`+ * `'background-sync'`+ * `'ambient-light-sensor'`+ * `'accelerometer'`+ * `'gyroscope'`+ * `'magnetometer'`+ * `'accessibility-events'`+ * `'clipboard-read'`+ * `'clipboard-write'`+ * `'payment-handler'`### option: BrowserContext.grantPermissions.origin- `origin` <[string]>@@ -643,7 +643,7 @@ page.removeListener('request', logRequest);Emitted when the page closes.## event: Page.console-- <[ConsoleMessage]>+- type: <[ConsoleMessage]>Emitted when JavaScript within the page calls one of console API methods, e.g. `console.log` or `console.dir`. Alsoemitted if the page throws an error or a warning.@@ -692,7 +692,7 @@ await new Promise((resolve, reject) => {```## event: Page.dialog-- <[Dialog]>+- type: <[Dialog]>Emitted when a JavaScript dialog appears, such as `alert`, `prompt`, `confirm` or `beforeunload`. Playwright can respondto the dialog via [`method: Dialog.accept`]() or [`method: Dialog.dismiss`]() methods.@@ -703,7 +703,7 @@ Emitted when the JavaScript [`DOMContentLoaded`](https://developer.mozilla.org/eevent is dispatched.## event: Page.download-- <[Download]>+- type: <[Download]>Emitted when attachment download started. User can access basic file operations on downloaded content via the passed[Download] instance.@@ -713,7 +713,7 @@ downloaded content. If `acceptDownloads` is not set or set to `false`, downloaddownload is not performed and user has no access to the downloaded files.## event: Page.filechooser-- <[FileChooser]>+- type: <[FileChooser]>Emitted when a file chooser is supposed to appear, such as after clicking the `<input type=file>`. Playwright canrespond to it via setting the input files using [`method: FileChooser.setFiles`]() that can be uploaded after that.@@ -725,17 +725,17 @@ page.on('filechooser', async (fileChooser) => {```## event: Page.frameattached-- <[Frame]>+- type: <[Frame]>Emitted when a frame is attached.## event: Page.framedetached-- <[Frame]>+- type: <[Frame]>Emitted when a frame is detached.## event: Page.framenavigated-- <[Frame]>+- type: <[Frame]>Emitted when a frame is navigated to a new url.@@ -744,12 +744,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-- <[Error]> The exception message+- type: <[Error]> The exception messageEmitted when an uncaught exception happens within the page.## event: Page.popup-- <[Page]> Page corresponding to "popup" window+- type: <[Page]> Page corresponding to "popup" windowEmitted 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.@@ -770,13 +770,13 @@ console.log(await popup.evaluate('location.href'));need it in most cases).## event: Page.request-- <[Request]>+- type: <[Request]>Emitted when a page issues a request. The [request] object is read-only. In order to intercept and mutate requests, see[`method: Page.route`]() or [`method: BrowserContext.route`]().## event: Page.requestfailed-- <[Request]>+- type: <[Request]>Emitted when a request fails, for example by timing out.@@ -784,24 +784,24 @@ Emitted when a request fails, for example by timing out.will complete with [`event: Page.requestfinished`]() event and not with [`event: Page.requestfailed`]().## event: Page.requestfinished-- <[Request]>+- type: <[Request]>Emitted when a request finishes successfully after downloading the response body. For a successful response, thesequence of events is `request`, `response` and `requestfinished`.## event: Page.response-- <[Response]>+- type: <[Response]>Emitted when [response] status and headers are received for a request. For a successful response, the sequence of eventsis `request`, `response` and `requestfinished`.## event: Page.websocket-- <[WebSocket]> websocket+- type: <[WebSocket]> websocketEmitted when <[WebSocket]> request is sent.## event: Page.worker-- <[Worker]>+- type: <[Worker]>Emitted when a dedicated [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) is spawned by thepage.@@ -885,8 +885,8 @@ Function to be evaluated in browser contextOptional argument to pass to [`param: pageFunction`]()-## namespace: Page.accessibility-- returns: <[Accessibility]>+## property: Page.accessibility+- type: <[Accessibility]>## async method: Page.addInitScript@@ -913,8 +913,8 @@ await page.addInitScript(preloadFile);### param: Page.addInitScript.script- `script` <[function]|[string]|[Object]>- - `path` <[string]> Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the current working directory.- - `content` <[string]> Raw script content.+ - `path` <[string]> Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the current working directory. Optional.+ - `content` <[string]> Raw script content. Optional.Script to be evaluated in the page.@@ -933,10 +933,10 @@ Shortcut for main frame's [`method: Frame.addScriptTag`]().### param: Page.addScriptTag.params- `params` <[Object]>- - `url` <[string]> URL of a script to be added.- - `path` <[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.- - `content` <[string]> Raw JavaScript content to be injected into frame.- - `type` <[string]> 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.+ - `url` <[string]> URL of a script to be added. Optional.+ - `path` <[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. Optional.+ - `content` <[string]> Raw JavaScript content to be injected into frame. Optional.+ - `type` <[string]> 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.## async method: Page.addStyleTag- returns: <[ElementHandle]>@@ -948,9 +948,9 @@ Shortcut for main frame's [`method: Frame.addStyleTag`]().### param: Page.addStyleTag.params- `params` <[Object]>- - `url` <[string]> URL of the `<link>` tag.- - `path` <[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.- - `content` <[string]> Raw CSS content to be injected into frame.+ - `url` <[string]> URL of the `<link>` tag. Optional.+ - `path` <[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. Optional.+ - `content` <[string]> Raw CSS content to be injected into frame. Optional.## async method: Page.bringToFront@@ -1039,8 +1039,8 @@ Gets the full HTML contents of the page, including the doctype.Get the browser context that the page belongs to.-## namespace: Page.coverage-- returns: <[null]|[ChromiumCoverage]>+## property: Page.coverage+- type: <[null]|[ChromiumCoverage]>Browser-specific Coverage implementation, only available for Chromium atm. See[ChromiumCoverage](#class-chromiumcoverage) for more details.@@ -1155,13 +1155,13 @@ await page.evaluate(() => matchMedia('(prefers-color-scheme: no-preference)').ma### param: Page.emulateMedia.params- `params` <[Object]>- - `media` <[null]|"screen"|"print"> 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.- - `colorScheme` <[null]|"light"|"dark"|"no-preference"> 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.+ - `media` <[null]|"screen"|"print"> 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.+ - `colorScheme` <[null]|"light"|"dark"|"no-preference"> 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.## async method: Page.evaluate- returns: <[Serializable]>-Returns the value of the [`param: pageFunction`]() invacation.+Returns the value of the [`param: pageFunction`]() invocation.If the function passed to the `page.evaluate` returns a [Promise], then `page.evaluate` would wait for the promise toresolve and return its value.@@ -1210,7 +1210,7 @@ Optional argument to pass to [`param: pageFunction`]()## async method: Page.evaluateHandle- returns: <[JSHandle]>-Returns the value of the [`param: pageFunction`]() invacation as in-page object (JSHandle).+Returns the value of the [`param: pageFunction`]() invocation as in-page object (JSHandle).The only difference between `page.evaluate` and `page.evaluateHandle` is that `page.evaluateHandle` returns in-pageobject (JSHandle).@@ -1432,8 +1432,8 @@ const frame = page.frame({ url: /.*domain.*/ });### param: Page.frame.frameSelector- `frameSelector` <[string]|[Object]>- - `name` <[string]> frame name specified in the `iframe`'s `name` attribute- - `url` <[string]|[RegExp]|[Function]> A glob pattern, regex pattern or predicate receiving frame's `url` as a [URL] object.+ - `name` <[string]> Frame name specified in the `iframe`'s `name` attribute. Optional.+ - `url` <[string]|[RegExp]|[Function]> A glob pattern, regex pattern or predicate receiving frame's `url` as a [URL] object. Optional.Frame name or other frame lookup options.@@ -1566,16 +1566,16 @@ Returns `element.innerText`.Indicates that the page has been closed.-## namespace: Page.keyboard-- returns: <[Keyboard]>+## property: Page.keyboard+- type: <[Keyboard]>## method: Page.mainFrame- returns: <[Frame]>The page's main frame. Page is guaranteed to have a main frame which persists during navigations.-## namespace: Page.mouse-- returns: <[Mouse]>+## property: Page.mouse+- type: <[Mouse]>## async method: Page.opener- returns: <[null]|[Page]>@@ -1651,14 +1651,14 @@ Display header and footer. Defaults to `false`.### option: Page.pdf.headerTemplate- `headerTemplate` <[string]>- - `'date'` formatted print date- - `'title'` document title- - `'url'` document location- - `'pageNumber'` current page number- - `'totalPages'` total pages in the documentHTML template for the print header. Should be valid HTML markup with following classes used to inject printing valuesinto them:+ * `'date'` formatted print date+ * `'title'` document title+ * `'url'` document location+ * `'pageNumber'` current page number+ * `'totalPages'` total pages in the document### option: Page.pdf.footerTemplate- `footerTemplate` <[string]>@@ -1722,7 +1722,7 @@ generate the text for. A superset of the [`param: key`]() values can be found`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 suported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`.+Following modification shortcuts are also supported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`.Holding down `Shift` will type the text that corresponds to the [`param: key`]() in the upper case.@@ -1885,9 +1885,9 @@ Shortcut for main frame's [`method: Frame.selectOption`]()### param: Page.selectOption.values- `values` <[null]|[string]|[ElementHandle]|[Array]<[string]>|[Object]|[Array]<[ElementHandle]>|[Array]<[Object]>>- - `value` <[string]> Matches by `option.value`.- - `label` <[string]> Matches by `option.label`.- - `index` <[number]> Matches by the index.+ - `value` <[string]> Matches by `option.value`. Optional.+ - `label` <[string]> Matches by `option.label`. Optional.+ - `index` <[number]> Matches by the index. Optional.Options to select. If the `<select>` has the `multiple` attribute, all matching options are selected, otherwise only thefirst option matching one of the passed options is selected. String values are equivalent to `{value:'string'}`. Option@@ -2028,8 +2028,8 @@ Returns `element.textContent`.Returns the page's title. Shortcut for main frame's [`method: Frame.title`]().-## namespace: Page.touchscreen-- returns: <[Touchscreen]>+## property: Page.touchscreen+- type: <[Touchscreen]>## async method: Page.type@@ -2208,12 +2208,12 @@ Shortcut for main frame's [`method: Frame.waitForLoadState`]().### param: Page.waitForLoadState.state- `state` <"load"|"domcontentloaded"|"networkidle">- - `'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.-Load state to wait for, defaults to `load`. If the state has been already reached while loading current document, the-method resolves immediately. Optional.+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.### option: Page.waitForLoadState.timeout = %%-navigation-timeout-%%@@ -2366,9 +2366,9 @@ At every point of time, page exposes its current frame tree via the [`method: PaFrame.childFrames`]() methods.[Frame] object's lifecycle is controlled by three events, dispatched on the page object:-- [`event: Page.frameattached`]() - fired when the frame gets attached to the page. A Frame can be attached to the page only once.-- [`event: Page.framenavigated`]() - fired when the frame commits navigation to a different URL.-- [`event: Page.framedetached`]() - fired when the frame gets detached from the page. A Frame can be detached from the page only once.+* [`event: Page.frameattached`]() - fired when the frame gets attached to the page. A Frame can be attached to the page only once.+* [`event: Page.framenavigated`]() - fired when the frame commits navigation to a different URL.+* [`event: Page.framedetached`]() - 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:@@ -2493,10 +2493,10 @@ Adds a `<script>` tag into the page with the desired url or content.### param: Frame.addScriptTag.params- `params` <[Object]>- - `url` <[string]> URL of a script to be added.- - `path` <[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.- - `content` <[string]> Raw JavaScript content to be injected into frame.- - `type` <[string]> 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.+ - `url` <[string]> URL of a script to be added. Optional.+ - `path` <[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. Optional.+ - `content` <[string]> Raw JavaScript content to be injected into frame. Optional.+ - `type` <[string]> 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.## async method: Frame.addStyleTag- returns: <[ElementHandle]>@@ -2508,9 +2508,9 @@ content.### param: Frame.addStyleTag.params- `params` <[Object]>- - `url` <[string]> URL of the `<link>` tag.- - `path` <[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.- - `content` <[string]> Raw CSS content to be injected into frame.+ - `url` <[string]> URL of the `<link>` tag. Optional.+ - `path` <[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. Optional.+ - `content` <[string]> Raw CSS content to be injected into frame. Optional.## async method: Frame.check@@ -2902,7 +2902,7 @@ generate the text for. A superset of the [`param: key`]() values can be found`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 suported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`.+Following modification shortcuts are also supported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`.Holding down `Shift` will type the text that corresponds to the [`param: key`]() in the upper case.@@ -2951,9 +2951,9 @@ frame.selectOption('select#colors', 'red', 'green', 'blue');### param: Frame.selectOption.values- `values` <[null]|[string]|[ElementHandle]|[Array]<[string]>|[Object]|[Array]<[ElementHandle]>|[Array]<[Object]>>- - `value` <[string]> Matches by `option.value`.- - `label` <[string]> Matches by `option.label`.- - `index` <[number]> Matches by the index.+ - `value` <[string]> Matches by `option.value`. Optional.+ - `label` <[string]> Matches by `option.label`. Optional.+ - `index` <[number]> Matches by the index. Optional.Options to select. If the `<select>` has the `multiple` attribute, all matching options are selected, otherwise only thefirst option matching one of the passed options is selected. String values are equivalent to `{value:'string'}`. Option@@ -3145,12 +3145,12 @@ await frame.waitForLoadState(); // Waits for 'load' state by default.### param: Frame.waitForLoadState.state- `state` <"load"|"domcontentloaded"|"networkidle">- - `'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.-Load state to wait for, defaults to `load`. If the state has been already reached while loading current document, the-method returns immediately. Optional.+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.### option: Frame.waitForLoadState.timeout = %%-navigation-timeout-%%@@ -3350,8 +3350,8 @@ Optional argument to pass to [`param: pageFunction`]()- returns: <[null]|[Object]>- `x` <[number]> the x coordinate of the element in pixels.- `y` <[number]> the y coordinate of the element in pixels.- - width <[number]> the width of the element in pixels.- - height <[number]> the height of the element in pixels.+ - `width` <[number]> the width of the element in pixels.+ - `height` <[number]> the height of the element in pixels.This method returns the bounding box of the element, or `null` if the element is not visible. The bounding box iscalculated relative to the main frame viewport - which is usually the same as the browser window.@@ -3573,7 +3573,7 @@ generate the text for. A superset of the [`param: key`]() values can be found`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 suported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`.+Following modification shortcuts are also supported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`.Holding down `Shift` will type the text that corresponds to the [`param: key`]() in the upper case.@@ -3636,7 +3636,7 @@ This method waits for [actionability](./actionability.md) checks, then tries tocompletely 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+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.### option: ElementHandle.scrollIntoViewIfNeeded.timeout = %%-input-timeout-%%@@ -3665,9 +3665,9 @@ handle.selectOption({ value: 'blue' }, { index: 2 }, 'red');### param: ElementHandle.selectOption.values- `values` <[null]|[string]|[ElementHandle]|[Array]<[string]>|[Object]|[Array]<[ElementHandle]>|[Array]<[Object]>>- - `value` <[string]> Matches by `option.value`.- - `label` <[string]> Matches by `option.label`.- - `index` <[number]> Matches by the index.+ - `value` <[string]> Matches by `option.value`. Optional.+ - `label` <[string]> Matches by `option.label`. Optional.+ - `index` <[number]> Matches by the index. Optional.Options to select. If the `<select>` has the `multiple` attribute, all matching options are selected, otherwise only thefirst option matching one of the passed options is selected. String values are equivalent to `{value:'string'}`. Option@@ -3939,9 +3939,7 @@ property to get## async method: JSHandle.jsonValue- returns: <[Serializable]>-Returns a JSON representation of the object. If the object has a-[`toJSON`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#toJSON()_behavior)-function, it **will not be called**.+Returns a JSON representation of the object. If the object has a `toJSON` function, it **will not be called**.> **NOTE** The method will return an empty JSON object if the referenced object is not stringifiable. It will throw anerror if the object has circular references.@@ -3958,7 +3956,7 @@ error if the object has circular references.## method: ConsoleMessage.location- returns: <[Object]>- - `url` <[string]> URL of the resource if available, otherwise empty string.+ - `url` <[string]> URL of the resource.- `lineNumber` <[number]> 0-based line number in the resource.- `columnNumber` <[number]> 0-based column number in the resource.@@ -4202,7 +4200,7 @@ generate the text for. A superset of the [`param: key`]() values can be found`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 suported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`.+Following modification shortcuts are also supported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`.Holding down `Shift` will type the text that corresponds to the [`param: key`]() in the upper case.@@ -4248,7 +4246,7 @@ generate the text for. A superset of the [`param: key`]() values can be found`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 suported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`.+Following modification shortcuts are also supported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`.Holding down `Shift` will type the text that corresponds to the [`param: key`]() in the upper case.@@ -4414,9 +4412,9 @@ Dispatches a `touchstart` and `touchend` event with a single touch at the positi# class: RequestWhenever the page sends a request for a network resource the following sequence of events are emitted by [Page]:-- [`event: Page.request`]() emitted when the request is issued by the page.-- [`event: Page.response`]() emitted when/if the response status and headers are received for the request.-- [`event: Page.requestfinished`]() emitted when the response body is downloaded and the request is complete.+* [`event: Page.request`]() emitted when the request is issued by the page.+* [`event: Page.response`]() emitted when/if the response status and headers are received for the request.+* [`event: Page.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 [`event: Page.requestfailed`]() event is emitted.@@ -4676,8 +4674,8 @@ contain `[a-zA-Z0-9_]` characters.### param: Selectors.register.script- `script` <[function]|[string]|[Object]>- - `path` <[string]> Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the current working directory.- - `content` <[string]> Raw script content.+ - `path` <[string]> Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the current working directory. Optional.+ - `content` <[string]> Raw script content. Optional.Script that evaluates to a selector engine instance.@@ -4702,22 +4700,22 @@ Aborts the route's request.### param: Route.abort.errorCode- `errorCode` <[string]>- - `'aborted'` - An operation was aborted (due to user action)- - `'accessdenied'` - Permission to access a resource, other than the network, was denied- - `'addressunreachable'` - The IP address is unreachable. This usually means that there is no route to the specified host or network.- - `'blockedbyclient'` - The client chose to block the request.- - `'blockedbyresponse'` - The request failed because the response was delivered along with requirements which are not met ('X-Frame-Options' and 'Content-Security-Policy' ancestor checks, for instance).- - `'connectionaborted'` - A connection timed out as a result of not receiving an ACK for data sent.- - `'connectionclosed'` - A connection was closed (corresponding to a TCP FIN).- - `'connectionfailed'` - A connection attempt failed.- - `'connectionrefused'` - A connection attempt was refused.- - `'connectionreset'` - A connection was reset (corresponding to a TCP RST).- - `'internetdisconnected'` - The Internet connection has been lost.- - `'namenotresolved'` - The host name could not be resolved.- - `'timedout'` - An operation timed out.- - `'failed'` - A generic failure occurred.Optional error code. Defaults to `failed`, could be one of the following:+ * `'aborted'` - An operation was aborted (due to user action)+ * `'accessdenied'` - Permission to access a resource, other than the network, was denied+ * `'addressunreachable'` - The IP address is unreachable. This usually means that there is no route to the specified host or network.+ * `'blockedbyclient'` - The client chose to block the request.+ * `'blockedbyresponse'` - The request failed because the response was delivered along with requirements which are not met ('X-Frame-Options' and 'Content-Security-Policy' ancestor checks, for instance).+ * `'connectionaborted'` - A connection timed out as a result of not receiving an ACK for data sent.+ * `'connectionclosed'` - A connection was closed (corresponding to a TCP FIN).+ * `'connectionfailed'` - A connection attempt failed.+ * `'connectionrefused'` - A connection attempt was refused.+ * `'connectionreset'` - A connection was reset (corresponding to a TCP RST).+ * `'internetdisconnected'` - The Internet connection has been lost.+ * `'namenotresolved'` - The host name could not be resolved.+ * `'timedout'` - An operation timed out.+ * `'failed'` - A generic failure occurred.## async method: Route.continue@@ -4793,19 +4791,19 @@ The [WebSocket] class represents websocket connections in the page.Fired when the websocket closes.## event: WebSocket.framereceived-- <[Object]> web socket frame data+- type: <[Object]> web socket frame data- `payload` <[string]|[Buffer]> frame payloadFired when the websocket recieves a frame.## event: WebSocket.framesent-- <[Object]> web socket frame data+- type: <[Object]> web socket frame data- `payload` <[string]|[Buffer]> frame payloadFired when the websocket sends a frame.## event: WebSocket.socketerror-- <[String]> the error message+- type: <[String]> the error messageFired when the websocket has an error.@@ -4956,7 +4954,7 @@ for (const worker of page.workers())<!-- GEN:stop -->## event: Worker.close-- <[Worker]>+- type: <[Worker]>Emitted when this dedicated [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) is terminated.@@ -5065,7 +5063,7 @@ This methods attaches Playwright to an existing browser instance.- `params` <[Object]>- `wsEndpoint` <[string]> A browser websocket endpoint to connect to. **required**- `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.- - `logger` <[Logger]> Logger sink for Playwright logging.+ - `logger` <[Logger]> Logger sink for Playwright logging. Optional.- `timeout` <[number]> Maximum time in milliseconds to wait for the connection to be established. Defaults to `30000` (30 seconds). Pass `0` to disable timeout.## method: BrowserType.executablePath@@ -5475,7 +5473,7 @@ message arguments### param: Logger.log.hints- `hints` <[Object]>- - `color` <[string]> preferred logger color+ - `color` <[string]> Optional preferred logger color.optional formatting hints@@ -5548,14 +5546,14 @@ const backgroundPage = await context.waitForEvent('backgroundpage');<!-- GEN:stop -->## event: ChromiumBrowserContext.backgroundpage-- <[Page]>+- type: <[Page]>Emitted when new background page is created in the context.> **NOTE** Only works with persistent context.## event: ChromiumBrowserContext.serviceworker-- <[Worker]>+- type: <[Worker]>Emitted when new service worker is created in the context.diff --git a/docs-src/api-params.md b/docs-src/api-params.mdindex 918c439efe..f980fb84ae 100644--- a/docs-src/api-params.md+++ b/docs-src/api-params.md@@ -1,14 +1,12 @@## navigation-wait-until-- `waitUntil` <"load"|"domcontentloaded"|"networkidle">- - `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.- - `'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.When to consider operation succeeded, defaults to `load`. Events can be either:+* `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.+* `'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.## navigation-timeout-- `timeout` <[number]>Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout.@@ -19,14 +17,12 @@ The default value can be changed by using the[`method: Page.setDefaultTimeout`]() methods.## wait-for-timeout-- `timeout` <[number]>maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The defaultvalue can be changed by using the [`method: BrowserContext.setDefaultTimeout`]().## input-timeout-- `timeout` <[number]>Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by@@ -34,7 +30,6 @@ using the [`method: BrowserContext.setDefaultTimeout`]() or[`method: Page.setDefaultTimeout`]() methods.## input-no-wait-after-- `noWaitAfter` <[boolean]>Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can@@ -42,20 +37,17 @@ opt out of waiting via setting this flag. You would only need this option in theto inaccessible pages. Defaults to `false`.## input-force-- `force` <[boolean]>Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.## input-selector-- `selector` <[string]>A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See[working with selectors](#working-with-selectors) for more details.## input-position-- `position` <[Object]>- `x` <[number]>- `y` <[number]>@@ -64,57 +56,49 @@ A point to use relative to the top-left corner of element padding box. If not spelement.## input-modifiers-- `modifiers` <[Array]<"Alt"|"Control"|"Meta"|"Shift">>Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores currentmodifiers back. If not specified, currently pressed modifiers are used.## input-button-- `button` <"left"|"right"|"middle">Defaults to `left`.## input-files-- `files` <[string]|[Array]<[string]>|[Object]|[Array]<[Object]>>- `name` <[string]> [File] name **required**- `mimeType` <[string]> [File] type **required**- `buffer` <[Buffer]> File content **required**## input-down-up-delay-- `delay` <[number]>Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0.## input-click-count-- `clickCount` <[number]>defaults to 1. See [UIEvent.detail].## query-selector-- `selector` <[string]>A selector to query for. See [working with selectors](#working-with-selectors) for more details.## wait-for-selector-state-- `state` <"attached"|"detached"|"visible"|"hidden">- - `'attached'` - wait for element to be present in DOM.- - `'detached'` - wait for element to not be present in DOM.- - `'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.Defaults to `'visible'`. Can be either:+* `'attached'` - wait for element to be present in DOM.+* `'detached'` - wait for element to not be present in DOM.+* `'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.## context-option-storage-state-- `storageState` <[string]|[Object]>- `cookies` <[Array]<[Object]>> Optional cookies to set for context- `name` <[string]> **required**@@ -136,25 +120,21 @@ Populates context with given storage state. This method can be used to initializobtained via [`method: BrowserContext.storageState`](). Either a path to the file with saved storage, or an object with the following fields:## context-option-acceptdownloads-- `acceptDownloads` <[boolean]>Whether to automatically download all the attachments. Defaults to `false` where all the downloads are canceled.## context-option-ignorehttpserrors-- `ignoreHTTPSErrors` <[boolean]>Whether to ignore HTTPS errors during navigation. Defaults to `false`.## context-option-bypasscsp-- `bypassCSP` <[boolean]>Toggles bypassing page's Content-Security-Policy.## context-option-viewport-- `viewport` <[null]|[Object]>- `width` <[number]> page width in pixels.- `height` <[number]> page height in pixels.@@ -162,78 +142,66 @@ Toggles bypassing page's Content-Security-Policy.Sets a consistent viewport for each page. Defaults to an 1280x720 viewport. `null` disables the default viewport.## context-option-useragent-- `userAgent` <[string]>Specific user agent to use in this context.## context-option-devicescalefactor-- `deviceScaleFactor` <[number]>Specify device scale factor (can be thought of as dpr). Defaults to `1`.## context-option-ismobile-- `isMobile` <[boolean]>Whether the `meta viewport` tag is taken into account and touch events are enabled. Defaults to `false`. Not supportedin Firefox.## context-option-hastouch-- `hasTouch` <[boolean]>Specifies if viewport supports touch events. Defaults to false.## context-option-javascriptenabled-- `javaScriptEnabled` <[boolean]>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)for a list of supported timezone IDs.## context-option-geolocation-- `geolocation` <[Object]>- `latitude` <[number]> Latitude between -90 and 90.- `longitude` <[number]> Longitude between -180 and 180.- `accuracy` <[number]> Non-negative accuracy value. Defaults to `0`.## context-option-locale-- `locale` <[string]>Specify user locale, for example `en-GB`, `de-DE`, etc. Locale will affect `navigator.language` value, `Accept-Language`request header value as well as number and date formatting rules.## context-option-permissions-- `permissions` <[Array]<[string]>>A list of permissions to grant to all pages in this context. See[`method: BrowserContext.grantPermissions`]() for more details.## context-option-extrahttpheaders-- `extraHTTPHeaders` <[Object]<[string], [string]>>An object containing additional HTTP headers to be sent with every request. All header values must be strings.## context-option-offline-- `offline` <[boolean]>Whether to emulate network being offline. Defaults to `false`.## context-option-httpcredentials-- `httpCredentials` <[Object]>- `username` <[string]>- `password` <[string]>@@ -241,20 +209,17 @@ Whether to emulate network being offline. Defaults to `false`.Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication).## context-option-colorscheme-- `colorScheme` <"light"|"dark"|"no-preference">Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. See[`method: Page.emulateMedia`]() for more details. Defaults to '`light`'.## context-option-logger-- `logger` <[Logger]>Logger sink for Playwright logging.## context-option-videospath-- `videosPath` <[string]>**NOTE** Use [`param: recordVideo`]() instead, it takes precedence over `videosPath`. Enables video recording for all pages to@@ -262,7 +227,6 @@ Logger sink for Playwright logging.[`method: BrowserContext.close`]() for videos to be saved.## context-option-videosize-- `videoSize` <[Object]>- `width` <[number]> Video frame width.- `height` <[number]> Video frame height.@@ -273,7 +237,6 @@ recorded video. Can only be used if `videosPath` is set. If not specified the sidown if necessary to fit specified size.## context-option-recordhar-- `recordHar` <[Object]>- `omitContent` <[boolean]> Optional setting to control whether to omit request content from the HAR. Defaults to`false`.@@ -284,7 +247,6 @@ specified, the HAR is not recorded. Make sure to await [`method: BrowserContext.saved.## context-option-recordvideo-- `recordVideo` <[Object]>- `dir` <[string]> Path to the directory to put videos into.- `size` <[Object]> Optional dimensions of the recorded videos. If not specified the size will be equal to `viewport`.@@ -297,7 +259,6 @@ Enables video recording for all pages into `recordVideo.dir` directory. If not ssure to await [`method: BrowserContext.close`]() for videos to be saved.## context-option-proxy-- `proxy` <[Object]>- `server` <[string]> Proxy to be used for all requests. HTTP and SOCKS proxies are supported, for example`http://myproxy.com:3128` or `socks5://myproxy.com:3128`. Short form `myproxy.com:3128` is considered an HTTP proxy.diff --git a/docs/api.md b/docs/api.mdindex 7a510725dc..be87323d78 100644--- a/docs/api.md+++ b/docs/api.md@@ -397,7 +397,7 @@ Emitted when Browser context gets closed. This might happen because of one of th* The [`browser.close()`](#browserclose) method was called.#### browserContext.on('page')-- <[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.@@ -417,13 +417,13 @@ console.log(await page.evaluate('location.href'));- `cookies` <[Array]<[Object]>>- `name` <[string]> **required**- `value` <[string]> **required**- - `url` <[string]> either url or domain / path are required- - `domain` <[string]> either url or domain / path are required- - `path` <[string]> either url or domain / path are required- - `expires` <[number]> Unix time in seconds.- - `httpOnly` <[boolean]>- - `secure` <[boolean]>- - `sameSite` <"Strict"|"Lax"|"None">+ - `url` <[string]> either url or domain / path are required. Optional.+ - `domain` <[string]> either url or domain / path are required Optional.+ - `path` <[string]> either url or domain / path are required Optional.+ - `expires` <[number]> Unix time in seconds. Optional.+ - `httpOnly` <[boolean]> Optional.+ - `secure` <[boolean]> Optional.+ - `sameSite` <"Strict"|"Lax"|"None"> Optional.- returns: <[Promise]>Adds cookies into this browser context. All pages within this context will have these cookies installed. Cookies can be obtained via [`browserContext.cookies([urls])`](#browsercontextcookiesurls).@@ -434,8 +434,8 @@ await browserContext.addCookies([cookieObject1, cookieObject2]);#### browserContext.addInitScript(script[, arg])- `script` <[function]|[string]|[Object]> Script to be evaluated in all pages in the browser context.- - `path` <[string]> Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the current working directory.- - `content` <[string]> Raw script content.+ - `path` <[string]> Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the current working directory. Optional.+ - `content` <[string]> Raw script content. Optional.- `arg` <[Serializable]> Optional argument to pass to `script` (only supported when passing a function).- returns: <[Promise]>@@ -592,22 +592,22 @@ const crypto = require('crypto');#### browserContext.grantPermissions(permissions[, options])- `permissions` <[Array]<[string]>> A permission or an array of permissions to grant. Permissions can be one of the following values:- - `'geolocation'`- - `'midi'`- - `'midi-sysex'` (system-exclusive midi)- - `'notifications'`- - `'push'`- - `'camera'`- - `'microphone'`- - `'background-sync'`- - `'ambient-light-sensor'`- - `'accelerometer'`- - `'gyroscope'`- - `'magnetometer'`- - `'accessibility-events'`- - `'clipboard-read'`- - `'clipboard-write'`- - `'payment-handler'`+ * `'geolocation'`+ * `'midi'`+ * `'midi-sysex'` (system-exclusive midi)+ * `'notifications'`+ * `'push'`+ * `'camera'`+ * `'microphone'`+ * `'background-sync'`+ * `'ambient-light-sensor'`+ * `'accelerometer'`+ * `'gyroscope'`+ * `'magnetometer'`+ * `'accessibility-events'`+ * `'clipboard-read'`+ * `'clipboard-write'`+ * `'payment-handler'`- `options` <[Object]>- `origin` <[string]> The [origin] to grant permissions to, e.g. "https://example.com".- returns: <[Promise]>@@ -889,7 +889,7 @@ page.removeListener('request', logRequest);Emitted when the page closes.#### page.on('console')-- <[ConsoleMessage]>+- type: <[ConsoleMessage]>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.@@ -935,7 +935,7 @@ await new Promise((resolve, reject) => {```#### page.on('dialog')-- <[Dialog]>+- type: <[Dialog]>Emitted when a JavaScript dialog appears, such as `alert`, `prompt`, `confirm` or `beforeunload`. Playwright can respond to the dialog via [`dialog.accept([promptText])`](#dialogacceptprompttext) or [`dialog.dismiss()`](#dialogdismiss) methods.@@ -944,14 +944,14 @@ Emitted when a JavaScript dialog appears, such as `alert`, `prompt`, `confirm` oEmitted when the JavaScript [`DOMContentLoaded`](https://developer.mozilla.org/en-US/docs/Web/Events/DOMContentLoaded) event is dispatched.#### page.on('download')-- <[Download]>+- type: <[Download]>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.#### page.on('filechooser')-- <[FileChooser]>+- type: <[FileChooser]>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])`](#filechoosersetfilesfiles-options) that can be uploaded after that.@@ -962,17 +962,17 @@ page.on('filechooser', async (fileChooser) => {```#### page.on('frameattached')-- <[Frame]>+- type: <[Frame]>Emitted when a frame is attached.#### page.on('framedetached')-- <[Frame]>+- type: <[Frame]>Emitted when a frame is detached.#### page.on('framenavigated')-- <[Frame]>+- type: <[Frame]>Emitted when a frame is navigated to a new url.@@ -981,12 +981,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.#### page.on('pageerror')-- <[Error]> The exception message+- type: <[Error]> The exception messageEmitted when an uncaught exception happens within the page.#### page.on('popup')-- <[Page]> Page corresponding to "popup" window+- type: <[Page]> Page corresponding to "popup" windowEmitted 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.@@ -1003,34 +1003,34 @@ console.log(await popup.evaluate('location.href'));> **NOTE** Use [`page.waitForLoadState([state, options])`](#pagewaitforloadstatestate-options) to wait until the page gets to a particular state (you should not need it in most cases).#### page.on('request')-- <[Request]>+- type: <[Request]>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)`](#pagerouteurl-handler) or [`browserContext.route(url, handler)`](#browsercontextrouteurl-handler).#### page.on('requestfailed')-- <[Request]>+- type: <[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')](#pageonrequestfinished) event and not with [page.on('requestfailed')](#pageonrequestfailed).#### page.on('requestfinished')-- <[Request]>+- type: <[Request]>Emitted when a request finishes successfully after downloading the response body. For a successful response, the sequence of events is `request`, `response` and `requestfinished`.#### page.on('response')-- <[Response]>+- type: <[Response]>Emitted 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')-- <[WebSocket]> websocket+- type: <[WebSocket]> websocketEmitted when <[WebSocket]> request is sent.#### page.on('worker')-- <[Worker]>+- type: <[Worker]>Emitted when a dedicated [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) is spawned by the page.@@ -1087,12 +1087,12 @@ const divsCounts = await page.$$eval('div', (divs, min) => divs.length >= min, 1```#### page.accessibility-- returns: <[Accessibility]>+- type: <[Accessibility]>#### page.addInitScript(script[, arg])- `script` <[function]|[string]|[Object]> Script to be evaluated in the page.- - `path` <[string]> Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the current working directory.- - `content` <[string]> Raw script content.+ - `path` <[string]> Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the current working directory. Optional.+ - `content` <[string]> Raw script content. Optional.- `arg` <[Serializable]> Optional argument to pass to `script` (only supported when passing a function).- returns: <[Promise]>@@ -1117,10 +1117,10 @@ await page.addInitScript(preloadFile);#### page.addScriptTag(params)- `params` <[Object]>- - `url` <[string]> URL of a script to be added.- - `path` <[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.- - `content` <[string]> Raw JavaScript content to be injected into frame.- - `type` <[string]> 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.+ - `url` <[string]> URL of a script to be added. Optional.+ - `path` <[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. Optional.+ - `content` <[string]> Raw JavaScript content to be injected into frame. Optional.+ - `type` <[string]> 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.- returns: <[Promise]<[ElementHandle]>>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.@@ -1129,9 +1129,9 @@ Shortcut for main frame's [`frame.addScriptTag(params)`](#frameaddscripttagparam#### page.addStyleTag(params)- `params` <[Object]>- - `url` <[string]> URL of the `<link>` tag.- - `path` <[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.- - `content` <[string]> Raw CSS content to be injected into frame.+ - `url` <[string]> URL of the `<link>` tag. Optional.+ - `path` <[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. Optional.+ - `content` <[string]> Raw CSS content to be injected into frame. Optional.- returns: <[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.@@ -1213,7 +1213,7 @@ Gets the full HTML contents of the page, including the doctype.Get the browser context that the page belongs to.#### page.coverage-- returns: <[null]|[ChromiumCoverage]>+- type: <[null]|[ChromiumCoverage]>Browser-specific Coverage implementation, only available for Chromium atm. See [ChromiumCoverage](#class-chromiumcoverage) for more details.@@ -1279,8 +1279,8 @@ await page.dispatchEvent('#source', 'dragstart', { dataTransfer });#### page.emulateMedia(params)- `params` <[Object]>- - `media` <[null]|"screen"|"print"> 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.- - `colorScheme` <[null]|"light"|"dark"|"no-preference"> 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.+ - `media` <[null]|"screen"|"print"> 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.+ - `colorScheme` <[null]|"light"|"dark"|"no-preference"> 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.- returns: <[Promise]>```js@@ -1317,7 +1317,7 @@ await page.evaluate(() => matchMedia('(prefers-color-scheme: no-preference)').ma- `arg` <[EvaluationArgument]> Optional argument to pass to `pageFunction`- returns: <[Promise]<[Serializable]>>-Returns the value of the `pageFunction` invacation.+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.@@ -1355,7 +1355,7 @@ Shortcut for main frame's [`frame.evaluate(pageFunction[, arg])`](#frameevaluate- `arg` <[EvaluationArgument]> Optional argument to pass to `pageFunction`- returns: <[Promise]<[JSHandle]>>-Returns the value of the `pageFunction` invacation as in-page object (JSHandle).+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).@@ -1520,8 +1520,8 @@ Shortcut for main frame's [`frame.focus(selector[, options])`](#framefocusselect#### page.frame(frameSelector)- `frameSelector` <[string]|[Object]> Frame name or other frame lookup options.- - `name` <[string]> frame name specified in the `iframe`'s `name` attribute- - `url` <[string]|[RegExp]|[Function]> A glob pattern, regex pattern or predicate receiving frame's `url` as a [URL] object.+ - `name` <[string]> Frame name specified in the `iframe`'s `name` attribute. Optional.+ - `url` <[string]|[RegExp]|[Function]> A glob pattern, regex pattern or predicate receiving frame's `url` as a [URL] object. Optional.- returns: <[null]|[Frame]>Returns frame matching the specified criteria. Either `name` or `url` must be specified.@@ -1552,9 +1552,9 @@ Returns element attribute value.- `options` <[Object]>- `timeout` <[number]> 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)`](#browsercontextsetdefaultnavigationtimeouttimeout), [`browserContext.setDefaultTimeout(timeout)`](#browsercontextsetdefaulttimeouttimeout), [`page.setDefaultNavigationTimeout(timeout)`](#pagesetdefaultnavigationtimeouttimeout) or [`page.setDefaultTimeout(timeout)`](#pagesetdefaulttimeouttimeout) methods.- `waitUntil` <"load"|"domcontentloaded"|"networkidle"> When to consider operation succeeded, defaults to `load`. Events can be either:- - `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.- - `'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.+ * `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.+ * `'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.- returns: <[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 back, returns `null`.@@ -1565,9 +1565,9 @@ Navigate to the previous page in history.- `options` <[Object]>- `timeout` <[number]> 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)`](#browsercontextsetdefaultnavigationtimeouttimeout), [`browserContext.setDefaultTimeout(timeout)`](#browsercontextsetdefaulttimeouttimeout), [`page.setDefaultNavigationTimeout(timeout)`](#pagesetdefaultnavigationtimeouttimeout) or [`page.setDefaultTimeout(timeout)`](#pagesetdefaulttimeouttimeout) methods.- `waitUntil` <"load"|"domcontentloaded"|"networkidle"> When to consider operation succeeded, defaults to `load`. Events can be either:- - `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.- - `'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.+ * `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.+ * `'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.- returns: <[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`.@@ -1580,9 +1580,9 @@ Navigate to the next page in history.- `referer` <[string]> Referer header value. If provided it will take preference over the referer header value set by [`page.setExtraHTTPHeaders(headers)`](#pagesetextrahttpheadersheaders).- `timeout` <[number]> 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)`](#browsercontextsetdefaultnavigationtimeouttimeout), [`browserContext.setDefaultTimeout(timeout)`](#browsercontextsetdefaulttimeouttimeout), [`page.setDefaultNavigationTimeout(timeout)`](#pagesetdefaultnavigationtimeouttimeout) or [`page.setDefaultTimeout(timeout)`](#pagesetdefaulttimeouttimeout) methods.- `waitUntil` <"load"|"domcontentloaded"|"networkidle"> When to consider operation succeeded, defaults to `load`. Events can be either:- - `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.- - `'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.+ * `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.+ * `'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.- returns: <[Promise]<[null]|[Response]>>Returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of the last redirect.@@ -1645,7 +1645,7 @@ Returns `element.innerText`.Indicates that the page has been closed.#### page.keyboard-- returns: <[Keyboard]>+- type: <[Keyboard]>#### page.mainFrame()- returns: <[Frame]>@@ -1653,7 +1653,7 @@ Indicates that the page has been closed.The page's main frame. Page is guaranteed to have a main frame which persists during navigations.#### page.mouse-- returns: <[Mouse]>+- type: <[Mouse]>#### page.opener()- returns: <[Promise]<[null]|[Page]>>@@ -1666,11 +1666,11 @@ Returns the opener for popup pages and `null` for others. If the opener has been- `footerTemplate` <[string]> HTML template for the print footer. Should use the same format as the `headerTemplate`.- `format` <[string]> Paper format. If set, takes priority over `width` or `height` options. Defaults to 'Letter'.- `headerTemplate` <[string]> HTML template for the print header. Should be valid HTML markup with following classes used to inject printing values into them:- - `'date'` formatted print date- - `'title'` document title- - `'url'` document location- - `'pageNumber'` current page number- - `'totalPages'` total pages in the document+ * `'date'` formatted print date+ * `'title'` document title+ * `'url'` document location+ * `'pageNumber'` current page number+ * `'totalPages'` total pages in the document- `height` <[string]|[number]> Paper height, accepts values labeled with units.- `landscape` <[boolean]> Paper orientation. Defaults to `false`.- `margin` <[Object]> Paper margins, defaults to none.@@ -1745,7 +1745,7 @@ Focuses the element, and then uses [`keyboard.down(key)`](#keyboarddownkey) and`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 suported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`.+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.@@ -1769,9 +1769,9 @@ await browser.close();- `options` <[Object]>- `timeout` <[number]> 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)`](#browsercontextsetdefaultnavigationtimeouttimeout), [`browserContext.setDefaultTimeout(timeout)`](#browsercontextsetdefaulttimeouttimeout), [`page.setDefaultNavigationTimeout(timeout)`](#pagesetdefaultnavigationtimeouttimeout) or [`page.setDefaultTimeout(timeout)`](#pagesetdefaulttimeouttimeout) methods.- `waitUntil` <"load"|"domcontentloaded"|"networkidle"> When to consider operation succeeded, defaults to `load`. Events can be either:- - `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.- - `'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.+ * `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.+ * `'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.- returns: <[Promise]<[null]|[Response]>>Returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of the last redirect.@@ -1831,9 +1831,9 @@ Returns the buffer with the captured screenshot.#### page.selectOption(selector, values[, options])- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](#working-with-selectors) for more details.- `values` <[null]|[string]|[ElementHandle]|[Array]<[string]>|[Object]|[Array]<[ElementHandle]>|[Array]<[Object]>> 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.- - `value` <[string]> Matches by `option.value`.- - `label` <[string]> Matches by `option.label`.- - `index` <[number]> Matches by the index.+ - `value` <[string]> Matches by `option.value`. Optional.+ - `label` <[string]> Matches by `option.label`. Optional.+ - `index` <[number]> Matches by the index. Optional.- `options` <[Object]>- `noWaitAfter` <[boolean]> Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`.- `timeout` <[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)`](#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](#pagesetdefaulttimeouttimeout) methods.@@ -1862,9 +1862,9 @@ Shortcut for main frame's [`frame.selectOption(selector, values[, options])`](#f- `options` <[Object]>- `timeout` <[number]> 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)`](#browsercontextsetdefaultnavigationtimeouttimeout), [`browserContext.setDefaultTimeout(timeout)`](#browsercontextsetdefaulttimeouttimeout), [`page.setDefaultNavigationTimeout(timeout)`](#pagesetdefaultnavigationtimeouttimeout) or [`page.setDefaultTimeout(timeout)`](#pagesetdefaulttimeouttimeout) methods.- `waitUntil` <"load"|"domcontentloaded"|"networkidle"> When to consider operation succeeded, defaults to `load`. Events can be either:- - `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.- - `'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.+ * `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.+ * `'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.- returns: <[Promise]>#### page.setDefaultNavigationTimeout(timeout)@@ -1968,7 +1968,7 @@ Returns `element.textContent`.Returns the page's title. Shortcut for main frame's [`frame.title()`](#frametitle).#### page.touchscreen-- returns: <[Touchscreen]>+- type: <[Touchscreen]>#### page.type(selector, text[, options])- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](#working-with-selectors) for more details.@@ -2079,10 +2079,10 @@ await page.waitForFunction(selector => !!document.querySelector(selector), selecShortcut for main frame's [`frame.waitForFunction(pageFunction[, arg, options])`](#framewaitforfunctionpagefunction-arg-options).#### page.waitForLoadState([state, options])-- `state` <"load"|"domcontentloaded"|"networkidle"> Load state to wait for, defaults to `load`. If the state has been already reached while loading current document, the method resolves immediately. Optional.- - `'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.+- `state` <"load"|"domcontentloaded"|"networkidle"> 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.- `options` <[Object]>- `timeout` <[number]> 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)`](#browsercontextsetdefaultnavigationtimeouttimeout), [`browserContext.setDefaultTimeout(timeout)`](#browsercontextsetdefaulttimeouttimeout), [`page.setDefaultNavigationTimeout(timeout)`](#pagesetdefaultnavigationtimeouttimeout) or [`page.setDefaultTimeout(timeout)`](#pagesetdefaulttimeouttimeout) methods.- returns: <[Promise]>@@ -2112,9 +2112,9 @@ Shortcut for main frame's [`frame.waitForLoadState([state, options])`](#framewai- `timeout` <[number]> 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)`](#browsercontextsetdefaultnavigationtimeouttimeout), [`browserContext.setDefaultTimeout(timeout)`](#browsercontextsetdefaulttimeouttimeout), [`page.setDefaultNavigationTimeout(timeout)`](#pagesetdefaultnavigationtimeouttimeout) or [`page.setDefaultTimeout(timeout)`](#pagesetdefaulttimeouttimeout) methods.- `url` <[string]|[RegExp]|[Function]> A glob pattern, regex pattern or predicate receiving [URL] to match while waiting for the navigation.- `waitUntil` <"load"|"domcontentloaded"|"networkidle"> When to consider operation succeeded, defaults to `load`. Events can be either:- - `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.- - `'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.+ * `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.+ * `'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.- returns: <[Promise]<[null]|[Response]>>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`.@@ -2168,10 +2168,10 @@ return finalResponse.ok();- `selector` <[string]> A selector to query for. See [working with selectors](#working-with-selectors) for more details.- `options` <[Object]>- `state` <"attached"|"detached"|"visible"|"hidden"> Defaults to `'visible'`. Can be either:- - `'attached'` - wait for element to be present in DOM.- - `'detached'` - wait for element to not be present in DOM.- - `'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.+ * `'attached'` - wait for element to be present in DOM.+ * `'detached'` - wait for element to not be present in DOM.+ * `'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.- `timeout` <[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)`](#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](#pagesetdefaulttimeouttimeout) methods.- returns: <[Promise]<[null]|[ElementHandle]>>@@ -2225,9 +2225,9 @@ This method returns all of the dedicated [WebWorkers](https://developer.mozilla.At 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:@@ -2358,10 +2358,10 @@ const divsCounts = await frame.$$eval('div', (divs, min) => divs.length >= min,#### frame.addScriptTag(params)- `params` <[Object]>- - `url` <[string]> URL of a script to be added.- - `path` <[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.- - `content` <[string]> Raw JavaScript content to be injected into frame.- - `type` <[string]> 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.+ - `url` <[string]> URL of a script to be added. Optional.+ - `path` <[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. Optional.+ - `content` <[string]> Raw JavaScript content to be injected into frame. Optional.+ - `type` <[string]> 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.- returns: <[Promise]<[ElementHandle]>>Returns the added tag when the script's onload fires or when the script content was injected into frame.@@ -2370,9 +2370,9 @@ Adds a `<script>` tag into the page with the desired url or content.#### frame.addStyleTag(params)- `params` <[Object]>- - `url` <[string]> URL of the `<link>` tag.- - `path` <[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.- - `content` <[string]> Raw CSS content to be injected into frame.+ - `url` <[string]> URL of the `<link>` tag. Optional.+ - `path` <[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. Optional.+ - `content` <[string]> Raw CSS content to be injected into frame. Optional.- returns: <[Promise]<[ElementHandle]>>Returns the added tag when the stylesheet's onload fires or when the CSS content was injected into frame.@@ -2601,9 +2601,9 @@ Returns element attribute value.- `referer` <[string]> Referer header value. If provided it will take preference over the referer header value set by [`page.setExtraHTTPHeaders(headers)`](#pagesetextrahttpheadersheaders).- `timeout` <[number]> 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)`](#browsercontextsetdefaultnavigationtimeouttimeout), [`browserContext.setDefaultTimeout(timeout)`](#browsercontextsetdefaulttimeouttimeout), [`page.setDefaultNavigationTimeout(timeout)`](#pagesetdefaultnavigationtimeouttimeout) or [`page.setDefaultTimeout(timeout)`](#pagesetdefaulttimeouttimeout) methods.- `waitUntil` <"load"|"domcontentloaded"|"networkidle"> When to consider operation succeeded, defaults to `load`. Events can be either:- - `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.- - `'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.+ * `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.+ * `'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.- returns: <[Promise]<[null]|[Response]>>Returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of the last redirect.@@ -2693,7 +2693,7 @@ Parent frame, if any. Detached frames and main frames return `null`.`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 suported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`.+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.@@ -2704,9 +2704,9 @@ Shortcuts such as `key: "Control+o"` or `key: "Control+Shift+T"` are supported a#### frame.selectOption(selector, values[, options])- `selector` <[string]> A selector to query for. See [working with selectors](#working-with-selectors) for more details.- `values` <[null]|[string]|[ElementHandle]|[Array]<[string]>|[Object]|[Array]<[ElementHandle]>|[Array]<[Object]>> 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.- - `value` <[string]> Matches by `option.value`.- - `label` <[string]> Matches by `option.label`.- - `index` <[number]> Matches by the index.+ - `value` <[string]> Matches by `option.value`. Optional.+ - `label` <[string]> Matches by `option.label`. Optional.+ - `index` <[number]> Matches by the index. Optional.- `options` <[Object]>- `noWaitAfter` <[boolean]> Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`.- `timeout` <[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)`](#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](#pagesetdefaulttimeouttimeout) methods.@@ -2732,9 +2732,9 @@ frame.selectOption('select#colors', 'red', 'green', 'blue');- `options` <[Object]>- `timeout` <[number]> 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)`](#browsercontextsetdefaultnavigationtimeouttimeout), [`browserContext.setDefaultTimeout(timeout)`](#browsercontextsetdefaulttimeouttimeout), [`page.setDefaultNavigationTimeout(timeout)`](#pagesetdefaultnavigationtimeouttimeout) or [`page.setDefaultTimeout(timeout)`](#pagesetdefaulttimeouttimeout) methods.- `waitUntil` <"load"|"domcontentloaded"|"networkidle"> When to consider operation succeeded, defaults to `load`. Events can be either:- - `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.- - `'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.+ * `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.+ * `'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.- returns: <[Promise]>#### frame.setInputFiles(selector, files[, options])@@ -2863,10 +2863,10 @@ await frame.waitForFunction(selector => !!document.querySelector(selector), sele```#### frame.waitForLoadState([state, options])-- `state` <"load"|"domcontentloaded"|"networkidle"> Load state to wait for, defaults to `load`. If the state has been already reached while loading current document, the method returns immediately. Optional.- - `'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.+- `state` <"load"|"domcontentloaded"|"networkidle"> 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.- `options` <[Object]>- `timeout` <[number]> 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)`](#browsercontextsetdefaultnavigationtimeouttimeout), [`browserContext.setDefaultTimeout(timeout)`](#browsercontextsetdefaulttimeouttimeout), [`page.setDefaultNavigationTimeout(timeout)`](#pagesetdefaultnavigationtimeouttimeout) or [`page.setDefaultTimeout(timeout)`](#pagesetdefaulttimeouttimeout) methods.- returns: <[Promise]>@@ -2885,9 +2885,9 @@ await frame.waitForLoadState(); // Waits for 'load' state by default.- `timeout` <[number]> 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)`](#browsercontextsetdefaultnavigationtimeouttimeout), [`browserContext.setDefaultTimeout(timeout)`](#browsercontextsetdefaulttimeouttimeout), [`page.setDefaultNavigationTimeout(timeout)`](#pagesetdefaultnavigationtimeouttimeout) or [`page.setDefaultTimeout(timeout)`](#pagesetdefaulttimeouttimeout) methods.- `url` <[string]|[RegExp]|[Function]> URL string, URL regex pattern or predicate receiving [URL] to match while waiting for the navigation.- `waitUntil` <"load"|"domcontentloaded"|"networkidle"> When to consider operation succeeded, defaults to `load`. Events can be either:- - `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.- - `'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.+ * `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.+ * `'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.- returns: <[Promise]<[null]|[Response]>>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`.@@ -2907,10 +2907,10 @@ const [response] = await Promise.all([- `selector` <[string]> A selector to query for. See [working with selectors](#working-with-selectors) for more details.- `options` <[Object]>- `state` <"attached"|"detached"|"visible"|"hidden"> Defaults to `'visible'`. Can be either:- - `'attached'` - wait for element to be present in DOM.- - `'detached'` - wait for element to not be present in DOM.- - `'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.+ * `'attached'` - wait for element to be present in DOM.+ * `'detached'` - wait for element to not be present in DOM.+ * `'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.- `timeout` <[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)`](#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](#pagesetdefaulttimeouttimeout) methods.- returns: <[Promise]<[null]|[ElementHandle]>>@@ -3072,8 +3072,8 @@ expect(await feedHandle.$$eval('.tweet', nodes => nodes.map(n => n.innerText))).- returns: <[Promise]<[null]|[Object]>>- `x` <[number]> the x coordinate of the element in pixels.- `y` <[number]> the y coordinate of the element in pixels.- - width <[number]> the width of the element in pixels.- - height <[number]> the height of the element in pixels.+ - `width` <[number]> the width of the element in pixels.+ - `height` <[number]> the height of the element in pixels.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.@@ -3260,7 +3260,7 @@ Focuses the element, and then uses [`keyboard.down(key)`](#keyboarddownkey) and`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 suported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`.+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.@@ -3288,13 +3288,13 @@ This method waits for the [actionability](./actionability.md) checks, then scrolThis method waits for [actionability](./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.+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.#### elementHandle.selectOption(values[, options])- `values` <[null]|[string]|[ElementHandle]|[Array]<[string]>|[Object]|[Array]<[ElementHandle]>|[Array]<[Object]>> 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.- - `value` <[string]> Matches by `option.value`.- - `label` <[string]> Matches by `option.label`.- - `index` <[number]> Matches by the index.+ - `value` <[string]> Matches by `option.value`. Optional.+ - `label` <[string]> Matches by `option.label`. Optional.+ - `index` <[number]> Matches by the index. Optional.- `options` <[Object]>- `noWaitAfter` <[boolean]> Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`.- `timeout` <[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)`](#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](#pagesetdefaulttimeouttimeout) methods.@@ -3435,10 +3435,10 @@ If the element does not satisfy the condition for the `timeout` milliseconds, th- `selector` <[string]> A selector to query for. See [working with selectors](#working-with-selectors) for more details.- `options` <[Object]>- `state` <"attached"|"detached"|"visible"|"hidden"> Defaults to `'visible'`. Can be either:- - `'attached'` - wait for element to be present in DOM.- - `'detached'` - wait for element to not be present in DOM.- - `'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.+ * `'attached'` - wait for element to be present in DOM.+ * `'detached'` - wait for element to not be present in DOM.+ * `'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.- `timeout` <[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)`](#browsercontextsetdefaulttimeouttimeout) or [`page.setDefaultTimeout(timeout)`](#pagesetdefaulttimeouttimeout) methods.- returns: <[Promise]<[null]|[ElementHandle]>>@@ -3543,7 +3543,7 @@ Fetches a single property from the referenced object.#### jsHandle.jsonValue()- returns: <[Promise]<[Serializable]>>-Returns a JSON representation of the object. If the object has a [`toJSON`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#toJSON()_behavior) function, it **will not be called**.+Returns a JSON representation of the object. If the object has a `toJSON` function, it **will not be called**.> **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.@@ -3563,7 +3563,7 @@ Returns a JSON representation of the object. If the object has a [`toJSON`](http#### consoleMessage.location()- returns: <[Object]>- - `url` <[string]> URL of the resource if available, otherwise empty string.+ - `url` <[string]> URL of the resource.- `lineNumber` <[number]> 0-based line number in the resource.- `columnNumber` <[number]> 0-based column number in the resource.@@ -3813,7 +3813,7 @@ Dispatches a `keydown` event.`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 suported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`.+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.@@ -3847,7 +3847,7 @@ page.keyboard.insertText('嗨');`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 suported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`.+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.@@ -3977,9 +3977,9 @@ Dispatches a `touchstart` and `touchend` event with a single touch at the positi### 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.@@ -4210,8 +4210,8 @@ Selectors can be used to install custom selector engines. See [Working with sele#### selectors.register(name, script[, options])- `name` <[string]> 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.- `script` <[function]|[string]|[Object]> Script that evaluates to a selector engine instance.- - `path` <[string]> Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the current working directory.- - `content` <[string]> Raw script content.+ - `path` <[string]> Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the current working directory. Optional.+ - `content` <[string]> Raw script content. Optional.- `options` <[Object]>- `contentScript` <[boolean]> Whether to run this selector engine in isolated JavaScript environment. This environment has access to the same DOM, but not any JavaScript objects from the frame's scripts. Defaults to `false`. Note that running as a content script is not guaranteed when this engine is used together with other registered engines.- returns: <[Promise]>@@ -4266,20 +4266,20 @@ Whenever a network route is set up with [`page.route(url, handler)`](#pagerouteu#### route.abort([errorCode])- `errorCode` <[string]> Optional error code. Defaults to `failed`, could be one of the following:- - `'aborted'` - An operation was aborted (due to user action)- - `'accessdenied'` - Permission to access a resource, other than the network, was denied- - `'addressunreachable'` - The IP address is unreachable. This usually means that there is no route to the specified host or network.- - `'blockedbyclient'` - The client chose to block the request.- - `'blockedbyresponse'` - The request failed because the response was delivered along with requirements which are not met ('X-Frame-Options' and 'Content-Security-Policy' ancestor checks, for instance).- - `'connectionaborted'` - A connection timed out as a result of not receiving an ACK for data sent.- - `'connectionclosed'` - A connection was closed (corresponding to a TCP FIN).- - `'connectionfailed'` - A connection attempt failed.- - `'connectionrefused'` - A connection attempt was refused.- - `'connectionreset'` - A connection was reset (corresponding to a TCP RST).- - `'internetdisconnected'` - The Internet connection has been lost.- - `'namenotresolved'` - The host name could not be resolved.- - `'timedout'` - An operation timed out.- - `'failed'` - A generic failure occurred.+ * `'aborted'` - An operation was aborted (due to user action)+ * `'accessdenied'` - Permission to access a resource, other than the network, was denied+ * `'addressunreachable'` - The IP address is unreachable. This usually means that there is no route to the specified host or network.+ * `'blockedbyclient'` - The client chose to block the request.+ * `'blockedbyresponse'` - The request failed because the response was delivered along with requirements which are not met ('X-Frame-Options' and 'Content-Security-Policy' ancestor checks, for instance).+ * `'connectionaborted'` - A connection timed out as a result of not receiving an ACK for data sent.+ * `'connectionclosed'` - A connection was closed (corresponding to a TCP FIN).+ * `'connectionfailed'` - A connection attempt failed.+ * `'connectionrefused'` - A connection attempt was refused.+ * `'connectionreset'` - A connection was reset (corresponding to a TCP RST).+ * `'internetdisconnected'` - The Internet connection has been lost.+ * `'namenotresolved'` - The host name could not be resolved.+ * `'timedout'` - An operation timed out.+ * `'failed'` - A generic failure occurred.- returns: <[Promise]>Aborts the route's request.@@ -4359,19 +4359,19 @@ The [WebSocket] class represents websocket connections in the page.Fired when the websocket closes.#### webSocket.on('framereceived')-- <[Object]> web socket frame data+- type: <[Object]> web socket frame data- `payload` <[string]|[Buffer]> frame payloadFired when the websocket recieves a frame.#### webSocket.on('framesent')-- <[Object]> web socket frame data+- type: <[Object]> web socket frame data- `payload` <[string]|[Buffer]> frame payloadFired when the websocket sends a frame.#### webSocket.on('socketerror')-- <[String]> the error message+- type: <[String]> the error messageFired when the websocket has an error.@@ -4499,7 +4499,7 @@ for (const worker of page.workers())<!-- GEN:stop -->#### worker.on('close')-- <[Worker]>+- type: <[Worker]>Emitted when this dedicated [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) is terminated.@@ -4593,7 +4593,7 @@ const { chromium } = require('playwright'); // Or 'firefox' or 'webkit'.- `params` <[Object]>- `wsEndpoint` <[string]> A browser websocket endpoint to connect to. **required**- `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.- - `logger` <[Logger]> Logger sink for Playwright logging.+ - `logger` <[Logger]> Logger sink for Playwright logging. Optional.- `timeout` <[number]> Maximum time in milliseconds to wait for the connection to be established. Defaults to `30000` (30 seconds). Pass `0` to disable timeout.- returns: <[Promise]<[Browser]>>@@ -4792,7 +4792,7 @@ Determines whether sink is interested in the logger with the given name and seve- `message` <[string]|[Error]> log message format- `args` <[Array]<[Object]>> message arguments- `hints` <[Object]> optional formatting hints- - `color` <[string]> preferred logger color+ - `color` <[string]> Optional preferred logger color.### class: ChromiumBrowser* extends: [Browser]@@ -4886,14 +4886,14 @@ const backgroundPage = await context.waitForEvent('backgroundpage');<!-- GEN:stop -->#### chromiumBrowserContext.on('backgroundpage')-- <[Page]>+- type: <[Page]>Emitted when new background page is created in the context.> **NOTE** Only works with persistent context.#### chromiumBrowserContext.on('serviceworker')-- <[Worker]>+- type: <[Worker]>Emitted when new service worker is created in the context.diff --git a/types/types.d.ts b/types/types.d.tsindex f6c3a630ae..d190f110ec 100644--- a/types/types.d.ts+++ b/types/types.d.ts@@ -86,7 +86,7 @@ type BindingSource = { context: BrowserContext, page: Page, frame: Frame };*/export interface Page {/**- * Returns the value of the `pageFunction` invacation.+ * 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.* Passing argument to `pageFunction`:@@ -116,7 +116,7 @@ export interface Page {evaluate<R>(pageFunction: PageFunction<void, R>, arg?: any): Promise<R>;/**- * Returns the value of the `pageFunction` invacation as in-page object (JSHandle).+ * 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.* A string can also be passed in instead of a function:@@ -248,8 +248,7 @@ export interface Page {* 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.*- * **NOTE** Functions installed via `page.exposeBinding` survive navigations.- *+ * > **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'.@@ -348,7 +347,7 @@ export interface Page {/*** 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.+ * > **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;@@ -388,7 +387,7 @@ 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')`, 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([@@ -398,19 +397,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])` 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)` or `browserContext.route(url, 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')` event and not with `page.on('requestfailed')`.*/on(event: 'requestfailed', listener: (request: Request) => void): this;@@ -420,7 +419,7 @@ export interface Page {on(event: 'requestfinished', listener: (request: Request) => void): this;/**- * Emitted when response status and headers are received for a request. For a successful response, the sequence of events is `request`, `response` and `requestfinished`.+ * Emitted when [response] status and headers are received for a request. For a successful response, the sequence of events is `request`, `response` and `requestfinished`.*/on(event: 'response', listener: (response: Response) => void): this;@@ -492,7 +491,7 @@ export interface Page {/*** 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.+ * > **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;@@ -532,7 +531,7 @@ 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')`, 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([@@ -542,19 +541,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])` 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)` or `browserContext.route(url, 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')` event and not with `page.on('requestfailed')`.*/once(event: 'requestfailed', listener: (request: Request) => void): this;@@ -564,7 +563,7 @@ export interface Page {once(event: 'requestfinished', listener: (request: Request) => void): this;/**- * Emitted when response status and headers are received for a request. For a successful response, the sequence of events is `request`, `response` and `requestfinished`.+ * Emitted when [response] status and headers are received for a request. For a successful response, the sequence of events is `request`, `response` and `requestfinished`.*/once(event: 'response', listener: (response: Response) => void): this;@@ -636,7 +635,7 @@ export interface Page {/*** 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.+ * > **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;@@ -676,7 +675,7 @@ 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')`, 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([@@ -686,19 +685,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])` 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)` or `browserContext.route(url, 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')` event and not with `page.on('requestfailed')`.*/addListener(event: 'requestfailed', listener: (request: Request) => void): this;@@ -708,7 +707,7 @@ export interface Page {addListener(event: 'requestfinished', listener: (request: Request) => void): this;/**- * Emitted when response status and headers are received for a request. For a successful response, the sequence of events is `request`, `response` and `requestfinished`.+ * Emitted when [response] status and headers are received for a request. For a successful response, the sequence of events is `request`, `response` and `requestfinished`.*/addListener(event: 'response', listener: (response: Response) => void): this;@@ -780,7 +779,7 @@ export interface Page {/*** 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.+ * > **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;@@ -820,7 +819,7 @@ 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')`, 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([@@ -830,19 +829,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])` 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)` or `browserContext.route(url, 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')` event and not with `page.on('requestfailed')`.*/removeListener(event: 'requestfailed', listener: (request: Request) => void): this;@@ -852,7 +851,7 @@ export interface Page {removeListener(event: 'requestfinished', listener: (request: Request) => void): this;/**- * Emitted when response status and headers are received for a request. For a successful response, the sequence of events is `request`, `response` and `requestfinished`.+ * Emitted when [response] status and headers are received for a request. For a successful response, the sequence of events is `request`, `response` and `requestfinished`.*/removeListener(event: 'response', listener: (response: Response) => void): this;@@ -924,7 +923,7 @@ export interface Page {/*** 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.+ * > **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;@@ -964,7 +963,7 @@ 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')`, 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([@@ -974,19 +973,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])` 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)` or `browserContext.route(url, 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')` event and not with `page.on('requestfailed')`.*/off(event: 'requestfailed', listener: (request: Request) => void): this;@@ -996,7 +995,7 @@ export interface Page {off(event: 'requestfinished', listener: (request: Request) => void): this;/**- * Emitted when response status and headers are received for a request. For a successful response, the sequence of events is `request`, `response` and `requestfinished`.+ * Emitted when [response] status and headers are received for a request. For a successful response, the sequence of events is `request`, `response` and `requestfinished`.*/off(event: 'response', listener: (response: Response) => void): this;@@ -1014,10 +1013,8 @@ 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.- *+ * - 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@@ -1029,7 +1026,7 @@ 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])` and `page.addInitScript(script[, 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).*/@@ -1101,15 +1098,13 @@ 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.- *+ * - 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.@@ -1134,13 +1129,11 @@ export interface Page {/*** 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.- *+ * - 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.@@ -1196,8 +1189,9 @@ export interface Page {* 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.+ * > **NOTE** if `runBeforeUnload` is passed as true, a `beforeunload` dialog might be summoned+ *+ * > and should be handled manually via `page.on('dialog')` event.* @param options*/close(options?: {@@ -1224,17 +1218,14 @@ export interface Page {/*** 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.- *+ * - 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.*- * **NOTE** `page.dblclick()` dispatches two `click` events and a single `dblclick` event.- *+ * > **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.* @param options@@ -1287,15 +1278,13 @@ export interface Page {* ```* 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+ * - FocusEvent+ * - KeyboardEvent+ * - MouseEvent+ * - PointerEvent+ * - TouchEvent+ * - 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@@ -1361,8 +1350,7 @@ export interface Page {* If the `playwrightFunction` returns a Promise, it will be awaited.* See `browserContext.exposeFunction(name, playwrightFunction)` for context-wide exposed function.*- * **NOTE** Functions installed via `page.exposeFunction` survive navigations.- *+ * > **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'.@@ -1461,7 +1449,7 @@ export interface Page {*/frame(frameSelector: string|{/**- * frame name specified in the `iframe`'s `name` attribute+ * Frame name specified in the `iframe`'s `name` attribute.*/name?: string;@@ -1502,9 +1490,9 @@ export interface Page {/*** When to consider operation succeeded, defaults to `load`. Events can be either:- * - `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.- * - `'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.+ * - `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.+ * - `'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";}): Promise<null|Response>;@@ -1522,9 +1510,9 @@ export interface Page {/*** When to consider operation succeeded, defaults to `load`. Events can be either:- * - `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.- * - `'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.+ * - `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.+ * - `'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";}): Promise<null|Response>;@@ -1532,18 +1520,16 @@ export interface Page {/*** 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.- *+ * - 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()`.*- * **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.+ * > **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.* Shortcut for main frame's `frame.goto(url[, options])`* @param url URL to navigate page to. The url should include scheme, e.g. `https://`.* @param options@@ -1561,22 +1547,20 @@ export interface Page {/*** When to consider operation succeeded, defaults to `load`. Events can be either:- * - `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.- * - `'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.+ * - `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.+ * - `'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";}): 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.- *+ * - 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.@@ -1654,12 +1638,10 @@ export interface Page {/*** Returns the PDF buffer.*- * **NOTE** Generating a pdf is currently only supported in Chromium headless.- *+ * > **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.- *+ * > **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.* ```js* // Generates a PDF with 'screen' media type.* await page.emulateMedia({media: 'screen'});@@ -1667,37 +1649,32 @@ export interface Page {* ```* 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.- *+ * - `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- *+ * - `px` - pixel+ * - `in` - inch+ * - `cm` - centimeter+ * - `mm` - millimeter* The `format` options are:- *- * `Letter`: 8.5in x 11in- * `Legal`: 8.5in x 14in- * `Tabloid`: 11in x 17in- * `Ledger`: 17in x 11in- * `A0`: 33.1in x 46.8in- * `A1`: 23.4in x 33.1in- * `A2`: 16.54in x 23.4in- * `A3`: 11.7in x 16.54in- * `A4`: 8.27in x 11.7in- * `A5`: 5.83in x 8.27in- * `A6`: 4.13in x 5.83in- *- *- * **NOTE** `headerTemplate` and `footerTemplate` markup have the following limitations:- *- * Script tags inside templates are not evaluated.- * Page styles are not visible inside templates.+ * - `Letter`: 8.5in x 11in+ * - `Legal`: 8.5in x 14in+ * - `Tabloid`: 11in x 17in+ * - `Ledger`: 17in x 11in+ * - `A0`: 33.1in x 46.8in+ * - `A1`: 23.4in x 33.1in+ * - `A2`: 16.54in x 23.4in+ * - `A3`: 11.7in x 16.54in+ * - `A4`: 8.27in x 11.7in+ * - `A5`: 5.83in x 8.27in+ * - `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*/pdf(options?: {@@ -1718,11 +1695,11 @@ export interface Page {/*** HTML template for the print header. Should be valid HTML markup with following classes used to inject printing values into them:- * - `'date'` formatted print date- * - `'title'` document title- * - `'url'` document location- * - `'pageNumber'` current page number- * - `'totalPages'` total pages in the document+ * - `'date'` formatted print date+ * - `'title'` document title+ * - `'url'` document location+ * - `'pageNumber'` current page number+ * - `'totalPages'` total pages in the document*/headerTemplate?: string;@@ -1796,7 +1773,7 @@ export interface Page {* 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:* `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 suported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`.+ * 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.@@ -1844,9 +1821,9 @@ export interface Page {/*** When to consider operation succeeded, defaults to `load`. Events can be either:- * - `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.- * - `'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.+ * - `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.+ * - `'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";}): Promise<null|Response>;@@ -1855,8 +1832,7 @@ export interface Page {* 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.- *+ * > **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();@@ -1873,7 +1849,7 @@ export interface Page {* ```* Page routes take precedence over browser context routes (set up with `browserContext.route(url, handler)`) when request matches both handlers.*- * **NOTE** Enabling routing disables http cache.+ * > **NOTE** Enabling routing disables http cache.* @param url A glob pattern, regex pattern or predicate receiving URL to match while routing.* @param handler handler function to route the request.*/@@ -1882,7 +1858,7 @@ export interface Page {/*** Returns the buffer with the captured screenshot.*- * **NOTE** Screenshots take at least 1/6 second on Chromium OS X and Chromium Windows. See https://crbug.com/741689 for discussion.+ * > **NOTE** Screenshots take at least 1/6 second on Chromium OS X and Chromium Windows. See https://crbug.com/741689 for discussion.* @param options*/screenshot(options?: {@@ -2015,25 +1991,23 @@ export interface Page {/*** When to consider operation succeeded, defaults to `load`. Events can be either:- * - `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.- * - `'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.+ * - `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.+ * - `'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";}): 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])`+ * - `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)`.* @param timeout Maximum navigation time in milliseconds*/setDefaultNavigationTimeout(timeout: number): void;@@ -2041,7 +2015,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)` takes priority over `page.setDefaultTimeout(timeout)`.* @param timeout Maximum time in milliseconds*/setDefaultTimeout(timeout: number): void;@@ -2049,7 +2023,7 @@ export interface Page {/*** The extra HTTP headers will be sent with every request the page initiates.*- * **NOTE** page.setExtraHTTPHeaders does not guarantee the order of headers in the outgoing requests.+ * > **NOTE** page.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.*/setExtraHTTPHeaders(headers: { [key: string]: string; }): Promise<void>;@@ -2130,17 +2104,14 @@ 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.- *+ * - 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.*- * **NOTE** `page.tap()` requires that the `hasTouch` option of the browser context be set to true.- *+ * > **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.* @param options@@ -2226,15 +2197,13 @@ export interface Page {/*** 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.- *+ * - 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.@@ -2344,7 +2313,7 @@ export interface Page {/*** 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.+ * > **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>;@@ -2384,7 +2353,7 @@ 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')`, 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([@@ -2394,19 +2363,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])` 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)` or `browserContext.route(url, 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')` event and not with `page.on('requestfailed')`.*/waitForEvent(event: 'requestfailed', optionsOrPredicate?: { predicate?: (request: Request) => boolean, timeout?: number } | ((request: Request) => boolean)): Promise<Request>;@@ -2416,7 +2385,7 @@ export interface Page {waitForEvent(event: 'requestfinished', optionsOrPredicate?: { predicate?: (request: Request) => boolean, timeout?: number } | ((request: Request) => boolean)): Promise<Request>;/**- * Emitted when response status and headers are received for a request. For a successful response, the sequence of events is `request`, `response` and `requestfinished`.+ * Emitted when [response] status and headers are received for a request. For a successful response, the sequence of events is `request`, `response` and `requestfinished`.*/waitForEvent(event: 'response', optionsOrPredicate?: { predicate?: (response: Response) => boolean, timeout?: number } | ((response: Response) => boolean)): Promise<Response>;@@ -2447,9 +2416,9 @@ export interface Page {* console.log(await popup.title()); // Popup is ready to use.* ```* Shortcut for main frame's `frame.waitForLoadState([state, options])`.- * @param state Load state to wait for, defaults to `load`. If the state has been already reached while loading current document, the method resolves immediately. Optional. - `'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 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?: {@@ -2485,9 +2454,9 @@ export interface Page {/*** When to consider operation succeeded, defaults to `load`. Events can be either:- * - `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.- * - `'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.+ * - `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.+ * - `'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";}): Promise<null|Response>;@@ -2544,18 +2513,16 @@ export interface Page {/*** This method returns all of the dedicated WebWorkers associated with the page.*- * **NOTE** This does not contain ServiceWorkers+ * > **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.- *+ * - `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.* An example of dumping frame tree:* ```js* const { firefox } = require('playwright'); // Or 'chromium' or 'webkit'.@@ -2791,15 +2758,13 @@ export interface Frame {/*** 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.- *+ * - 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.* @param options@@ -2825,13 +2790,11 @@ 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.- *+ * - 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.* @param options@@ -2889,16 +2852,14 @@ 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.- *+ * - 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.*- * **NOTE** `frame.dblclick()` dispatches two `click` events and a single `dblclick` event.+ * > **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 options*/@@ -2950,15 +2911,13 @@ export interface Frame {* ```* 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+ * - FocusEvent+ * - KeyboardEvent+ * - MouseEvent+ * - PointerEvent+ * - TouchEvent+ * - 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@@ -3036,17 +2995,16 @@ export interface Frame {/*** 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.- *+ * - 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`.- * **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.* @param url URL to navigate frame to. The url should include scheme, e.g. `https://`.* @param options*/@@ -3063,22 +3021,20 @@ export interface Frame {/*** When to consider operation succeeded, defaults to `load`. Events can be either:- * - `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.- * - `'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.+ * - `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.+ * - `'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";}): 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.- *+ * - 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.* @param options@@ -3142,7 +3098,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.+ * > **NOTE** This value is calculated once when the frame is created, and will not update if the attribute is changed later.*/name(): string;@@ -3159,7 +3115,7 @@ export interface 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:* `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 suported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`.+ * 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.@@ -3255,9 +3211,9 @@ export interface Frame {/*** When to consider operation succeeded, defaults to `load`. Events can be either:- * - `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.- * - `'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.+ * - `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.+ * - `'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";}): Promise<void>;@@ -3313,16 +3269,14 @@ export interface Frame {/*** 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.- *+ * - 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.*- * **NOTE** `frame.tap()` requires that the `hasTouch` option of the browser context be set to true.+ * > **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 options*/@@ -3404,15 +3358,13 @@ export interface Frame {/*** 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.- *+ * - 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.* @param options@@ -3446,9 +3398,9 @@ export interface Frame {* await frame.click('button'); // Click triggers navigation.* await frame.waitForLoadState(); // Waits for 'load' state by default.* ```- * @param state Load state to wait for, defaults to `load`. If the state has been already reached while loading current document, the method returns immediately. Optional. - `'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 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?: {@@ -3483,9 +3435,9 @@ export interface Frame {/*** When to consider operation succeeded, defaults to `load`. Events can be either:- * - `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.- * - `'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.+ * - `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.+ * - `'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";}): Promise<null|Response>;@@ -3556,10 +3508,16 @@ export interface BrowserContext {*/exposeBinding(name: string, playwrightBinding: (source: BindingSource, arg: JSHandle) => any, options: { handle: true }): Promise<void>;exposeBinding(name: string, playwrightBinding: (source: BindingSource, ...args: any[]) => any, options?: { handle?: boolean }): Promise<void>;+ /**+ * 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.+ */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')` 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([@@ -3569,14 +3527,20 @@ 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])` 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;+ /**+ * 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.+ */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')` 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([@@ -3586,14 +3550,20 @@ 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])` 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;+ /**+ * 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.+ */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')` 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([@@ -3603,14 +3573,20 @@ 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])` 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;+ /**+ * 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.+ */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')` 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([@@ -3620,14 +3596,20 @@ 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])` 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;+ /**+ * 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.+ */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')` 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([@@ -3637,7 +3619,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])` 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;@@ -3660,17 +3642,17 @@ export interface BrowserContext {value: string;/**- * either url or domain / path are required+ * either url or domain / path are required.*/url?: string;/**- * either url or domain / path are required+ * either url or domain / path are required Optional.*/domain?: string;/**- * either url or domain / path are required+ * either url or domain / path are required Optional.*/path?: string;@@ -3679,19 +3661,26 @@ export interface BrowserContext {*/expires?: number;+ /**+ * Optional.+ */httpOnly?: boolean;+ /**+ * Optional.+ */secure?: boolean;+ /**+ * Optional.+ */sameSite?: "Lax"|"None"|"Strict";}>): 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.- *+ * - 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@@ -3705,7 +3694,7 @@ 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])` and `page.addInitScript(script[, 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).*/@@ -3745,7 +3734,7 @@ export interface BrowserContext {/*** Closes the browser context. All the pages that belong to the browser context will be closed.*- * **NOTE** the default browser context cannot be closed.+ * > **NOTE** the default browser context cannot be closed.*/close(): Promise<void>;@@ -3788,22 +3777,22 @@ export interface BrowserContext {/*** Grants specified permissions to the browser context. Only grants corresponding permissions to the given origin if specified.- * @param permissions A permission or an array of permissions to grant. Permissions can be one of the following values: - `'geolocation'`- * - `'midi'`- * - `'midi-sysex'` (system-exclusive midi)- * - `'notifications'`- * - `'push'`- * - `'camera'`- * - `'microphone'`- * - `'background-sync'`- * - `'ambient-light-sensor'`- * - `'accelerometer'`- * - `'gyroscope'`- * - `'magnetometer'`- * - `'accessibility-events'`- * - `'clipboard-read'`- * - `'clipboard-write'`- * - `'payment-handler'`+ * @param permissions A permission or an array of permissions to grant. Permissions can be one of the following values: - `'geolocation'`+ * - `'midi'`+ * - `'midi-sysex'` (system-exclusive midi)+ * - `'notifications'`+ * - `'push'`+ * - `'camera'`+ * - `'microphone'`+ * - `'background-sync'`+ * - `'ambient-light-sensor'`+ * - `'accelerometer'`+ * - `'gyroscope'`+ * - `'magnetometer'`+ * - `'accessibility-events'`+ * - `'clipboard-read'`+ * - `'clipboard-write'`+ * - `'payment-handler'`* @param options*/grantPermissions(permissions: Array<string>, options?: {@@ -3843,7 +3832,7 @@ export interface BrowserContext {* ```* Page routes (set up with `page.route(url, handler)`) take precedence over browser context routes when request matches both handlers.*- * **NOTE** Enabling routing disables http cache.+ * > **NOTE** Enabling routing disables http cache.* @param url A glob pattern, regex pattern or predicate receiving URL to match while routing.* @param handler handler function to route the request.*/@@ -3851,16 +3840,14 @@ export interface BrowserContext {/*** 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])`+ * - `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)`.* @param timeout Maximum navigation time in milliseconds*/setDefaultNavigationTimeout(timeout: number): void;@@ -3868,7 +3855,7 @@ 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)`, `page.setDefaultTimeout(timeout)` and `browserContext.setDefaultNavigationTimeout(timeout)` take priority over `browserContext.setDefaultTimeout(timeout)`.* @param timeout Maximum time in milliseconds*/setDefaultTimeout(timeout: number): void;@@ -3876,7 +3863,7 @@ export interface BrowserContext {/*** 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.*- * **NOTE** `browserContext.setExtraHTTPHeaders` does not guarantee the order of headers in the outgoing requests.+ * > **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.*/setExtraHTTPHeaders(headers: { [key: string]: string; }): Promise<void>;@@ -3887,7 +3874,7 @@ export interface BrowserContext {* 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])` to grant permissions for the browser context pages to read its geolocation.* @param geolocation*/setGeolocation(geolocation: null|{@@ -3910,7 +3897,7 @@ export interface BrowserContext {/*** Provide credentials for 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.+ * > **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*/setHTTPCredentials(httpCredentials: null|{@@ -3979,10 +3966,16 @@ export interface BrowserContext {*/unroute(url: string|RegExp|((url: URL) => boolean), handler?: ((route: Route, request: Request) => void)): Promise<void>;+ /**+ * 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.+ */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')` 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([@@ -3992,7 +3985,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])` 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>;}@@ -4097,7 +4090,7 @@ export interface JSHandle<T = any> {/*** Returns a JSON representation of the object. If the object has a `toJSON` function, it **will not be called**.*- * **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.+ * > **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.*/jsonValue(): Promise<T>;/**@@ -4212,7 +4205,7 @@ 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.+ * > **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.* @param options*/@@ -4254,14 +4247,12 @@ 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.- *+ * - 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.* 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.* @param options@@ -4285,12 +4276,10 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {/*** 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.- *+ * - 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.* 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.* @param options@@ -4348,16 +4337,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.- *+ * - 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.* 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.*- * **NOTE** `elementHandle.dblclick()` dispatches two `click` events and a single `dblclick` event.+ * > **NOTE** `elementHandle.dblclick()` dispatches two `click` events and a single `dblclick` event.* @param options*/dblclick(options?: {@@ -4408,15 +4395,13 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {* ```* 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+ * - FocusEvent+ * - KeyboardEvent+ * - MouseEvent+ * - PointerEvent+ * - TouchEvent+ * - 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@@ -4458,12 +4443,10 @@ 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.- *+ * - 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.* 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.* @param options@@ -4513,7 +4496,7 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {* 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:* `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 suported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`.+ * 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.@@ -4570,7 +4553,7 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {}): 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`.+ * 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.* @param options*/@@ -4703,16 +4686,14 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {/*** 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.- *+ * - 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.* 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.*- * **NOTE** `elementHandle.tap()` requires that the `hasTouch` option of the browser context be set to true.+ * > **NOTE** `elementHandle.tap()` requires that the `hasTouch` option of the browser context be set to true.* @param options*/tap(options?: {@@ -4788,14 +4769,12 @@ 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 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.- *+ * - 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.* 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.* @param options@@ -4820,13 +4799,11 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {/*** 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.- *+ * - `"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.* 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@@ -4874,10 +4851,16 @@ 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.- * In `browserType.launch([options])` 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.+ * > **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.+ * >+ *+ * > In `browserType.launch([options])` 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.* @param options*/launch(options?: LaunchOptions): Promise<Browser>;@@ -5349,15 +5332,11 @@ export interface ChromiumBrowser extends Browser {/*** 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.- *+ * - 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.- * Getting Started with DevTools Protocol: https://github.com/aslushnikov/getting-started-with-cdp/blob/master/README.md- *+ * - Documentation on DevTools Protocol can be found here: DevTools Protocol Viewer.+ * - 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');@@ -5416,8 +5395,7 @@ 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`.- *+ * > **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();@@ -5506,14 +5484,39 @@ export {};* 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.*/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.+ */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.+ */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.+ */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.+ */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.+ */off(event: 'disconnected', listener: () => void): this;/**@@ -5839,14 +5842,14 @@ 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')` event.*/export interface ConsoleMessage {args(): Array<JSHandle>;location(): {/**- * URL of the resource if available, otherwise empty string.+ * URL of the resource.*/url: string;@@ -5870,7 +5873,7 @@ 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')` event.* An example of using `Dialog` class:* ```js* const { chromium } = require('playwright'); // Or 'firefox' or 'webkit'.@@ -5916,7 +5919,7 @@ 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')` 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@@ -5929,7 +5932,7 @@ export interface Dialog {* ...* ```*- * **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.+ * > **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.*/export interface Download {/**@@ -5983,7 +5986,7 @@ 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')` event.* ```js* page.on('filechooser', async (fileChooser) => {* await fileChooser.setFiles('/tmp/myfile.pdf');@@ -6089,13 +6092,13 @@ 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:* `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 suported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`.+ * 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)`.*- * **NOTE** Modifier keys DO influence `keyboard.down`. Holding down `Shift` will type the text in upper case.+ * > **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`.*/down(key: string): Promise<void>;@@ -6106,7 +6109,7 @@ export interface Keyboard {* page.keyboard.insertText('嗨');* ```*- * **NOTE** Modifier keys DO NOT effect `keyboard.insertText`. Holding down `Shift` will not type the text in upper case.+ * > **NOTE** Modifier keys DO NOT effect `keyboard.insertText`. Holding down `Shift` will not type the text in upper case.* @param text Sets input to the specified text value.*/insertText(text: string): Promise<void>;@@ -6114,7 +6117,7 @@ export interface Keyboard {/*** `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:* `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 suported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`.+ * 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.@@ -6148,7 +6151,7 @@ export interface Keyboard {* await page.keyboard.type('World', {delay: 100}); // Types slower, like a user* ```*- * **NOTE** Modifier keys DO NOT effect `keyboard.type`. Holding down `Shift` will not type the text in upper case.+ * > **NOTE** Modifier keys DO NOT effect `keyboard.type`. Holding down `Shift` will not type the text in upper case.* @param text A text to type into a focused element.* @param options*/@@ -6282,15 +6285,12 @@ 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.*- * 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.- *- * **NOTE** HTTP Error responses, such as 404 or 503, are still successful responses from HTTP standpoint, so request will complete with `'requestfinished'` event.- *+ * > **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 {@@ -6573,20 +6573,20 @@ export interface Selectors {export interface Route {/*** Aborts the route's request.- * @param errorCode Optional error code. Defaults to `failed`, could be one of the following: - `'aborted'` - An operation was aborted (due to user action)- * - `'accessdenied'` - Permission to access a resource, other than the network, was denied- * - `'addressunreachable'` - The IP address is unreachable. This usually means that there is no route to the specified host or network.- * - `'blockedbyclient'` - The client chose to block the request.- * - `'blockedbyresponse'` - The request failed because the response was delivered along with requirements which are not met ('X-Frame-Options' and 'Content-Security-Policy' ancestor checks, for instance).- * - `'connectionaborted'` - A connection timed out as a result of not receiving an ACK for data sent.- * - `'connectionclosed'` - A connection was closed (corresponding to a TCP FIN).- * - `'connectionfailed'` - A connection attempt failed.- * - `'connectionrefused'` - A connection attempt was refused.- * - `'connectionreset'` - A connection was reset (corresponding to a TCP RST).- * - `'internetdisconnected'` - The Internet connection has been lost.- * - `'namenotresolved'` - The host name could not be resolved.- * - `'timedout'` - An operation timed out.- * - `'failed'` - A generic failure occurred.+ * @param errorCode Optional error code. Defaults to `failed`, could be one of the following: - `'aborted'` - An operation was aborted (due to user action)+ * - `'accessdenied'` - Permission to access a resource, other than the network, was denied+ * - `'addressunreachable'` - The IP address is unreachable. This usually means that there is no route to the specified host or network.+ * - `'blockedbyclient'` - The client chose to block the request.+ * - `'blockedbyresponse'` - The request failed because the response was delivered along with requirements which are not met ('X-Frame-Options' and 'Content-Security-Policy' ancestor checks, for instance).+ * - `'connectionaborted'` - A connection timed out as a result of not receiving an ACK for data sent.+ * - `'connectionclosed'` - A connection was closed (corresponding to a TCP FIN).+ * - `'connectionfailed'` - A connection attempt failed.+ * - `'connectionrefused'` - A connection attempt was refused.+ * - `'connectionreset'` - A connection was reset (corresponding to a TCP RST).+ * - `'internetdisconnected'` - The Internet connection has been lost.+ * - `'namenotresolved'` - The host name could not be resolved.+ * - `'timedout'` - An operation timed out.+ * - `'failed'` - A generic failure occurred.*/abort(errorCode?: string): Promise<void>;@@ -6975,7 +6975,7 @@ export interface Logger {*/log(name: string, severity: "error"|"info"|"verbose"|"warning", message: string|Error, args: Array<Object>, hints: {/**- * preferred logger color+ * Optional preferred logger color.*/color?: string;}): void;@@ -6991,7 +6991,7 @@ export interface ChromiumBrowserContext extends BrowserContext {/*** Emitted when new background page is created in the context.*- * **NOTE** Only works with persistent context.+ * > **NOTE** Only works with persistent context.*/on(event: 'backgroundpage', listener: (page: Page) => void): this;@@ -7000,10 +7000,16 @@ export interface ChromiumBrowserContext extends BrowserContext {*/on(event: 'serviceworker', listener: (worker: Worker) => void): this;+ /**+ * 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.+ */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')` 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([@@ -7013,14 +7019,14 @@ 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])` 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;/*** Emitted when new background page is created in the context.*- * **NOTE** Only works with persistent context.+ * > **NOTE** Only works with persistent context.*/once(event: 'backgroundpage', listener: (page: Page) => void): this;@@ -7029,10 +7035,16 @@ export interface ChromiumBrowserContext extends BrowserContext {*/once(event: 'serviceworker', listener: (worker: Worker) => void): this;+ /**+ * 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.+ */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')` 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([@@ -7042,14 +7054,14 @@ 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])` 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;/*** Emitted when new background page is created in the context.*- * **NOTE** Only works with persistent context.+ * > **NOTE** Only works with persistent context.*/addListener(event: 'backgroundpage', listener: (page: Page) => void): this;@@ -7058,10 +7070,16 @@ export interface ChromiumBrowserContext extends BrowserContext {*/addListener(event: 'serviceworker', listener: (worker: Worker) => void): this;+ /**+ * 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.+ */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')` 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([@@ -7071,14 +7089,14 @@ 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])` 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;/*** Emitted when new background page is created in the context.*- * **NOTE** Only works with persistent context.+ * > **NOTE** Only works with persistent context.*/removeListener(event: 'backgroundpage', listener: (page: Page) => void): this;@@ -7087,10 +7105,16 @@ export interface ChromiumBrowserContext extends BrowserContext {*/removeListener(event: 'serviceworker', listener: (worker: Worker) => void): this;+ /**+ * 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.+ */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')` 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([@@ -7100,14 +7124,14 @@ 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])` 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;/*** Emitted when new background page is created in the context.*- * **NOTE** Only works with persistent context.+ * > **NOTE** Only works with persistent context.*/off(event: 'backgroundpage', listener: (page: Page) => void): this;@@ -7116,10 +7140,16 @@ export interface ChromiumBrowserContext extends BrowserContext {*/off(event: 'serviceworker', listener: (worker: Worker) => void): this;+ /**+ * 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.+ */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')` 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([@@ -7129,7 +7159,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])` 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;@@ -7152,7 +7182,7 @@ export interface ChromiumBrowserContext extends BrowserContext {/*** Emitted when new background page is created in the context.*- * **NOTE** Only works with persistent context.+ * > **NOTE** Only works with persistent context.*/waitForEvent(event: 'backgroundpage', optionsOrPredicate?: { predicate?: (page: Page) => boolean, timeout?: number } | ((page: Page) => boolean)): Promise<Page>;@@ -7161,10 +7191,16 @@ export interface ChromiumBrowserContext extends BrowserContext {*/waitForEvent(event: 'serviceworker', optionsOrPredicate?: { predicate?: (worker: Worker) => boolean, timeout?: number } | ((worker: Worker) => boolean)): Promise<Worker>;+ /**+ * 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.+ */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')` 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([@@ -7174,7 +7210,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])` 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>;@@ -7218,7 +7254,7 @@ export interface ChromiumCoverage {/*** Returns coverage is started*- * **NOTE** Anonymous scripts are ones that don't have an associated url. These are scripts that are dynamically created on the page using `eval` or `new Function`. If `reportAnonymousScripts` is set to `true`, anonymous scripts will have `__playwright_evaluation_script__` as their URL.+ * > **NOTE** Anonymous scripts are ones that don't have an associated url. These are scripts that are dynamically created on the page using `eval` or `new Function`. If `reportAnonymousScripts` is set to `true`, anonymous scripts will have `__playwright_evaluation_script__` as their URL.* @param options*/startJSCoverage(options?: {@@ -7236,7 +7272,7 @@ export interface ChromiumCoverage {/*** Returns the array of coverage reports for all stylesheets*- * **NOTE** CSS Coverage doesn't include dynamically injected style tags without sourceURLs.+ * > **NOTE** CSS Coverage doesn't include dynamically injected style tags without sourceURLs.*/stopCSSCoverage(): Promise<Array<{/**@@ -7268,7 +7304,7 @@ export interface ChromiumCoverage {/*** 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.+ * > **NOTE** JavaScript Coverage doesn't include anonymous scripts by default. However, scripts with sourceURLs are reported.*/stopJSCoverage(): Promise<Array<{/**@@ -7723,10 +7759,10 @@ export interface ConnectOptions {interface ElementHandleWaitForSelectorOptions {/*** Defaults to `'visible'`. Can be either:- * - `'attached'` - wait for element to be present in DOM.- * - `'detached'` - wait for element to not be present in DOM.- * - `'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.+ * - `'attached'` - wait for element to be present in DOM.+ * - `'detached'` - wait for element to not be present in DOM.+ * - `'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";@@ -7760,10 +7796,10 @@ export interface Cookie {interface PageWaitForSelectorOptions {/*** Defaults to `'visible'`. Can be either:- * - `'attached'` - wait for element to be present in DOM.- * - `'detached'` - wait for element to not be present in DOM.- * - `'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.+ * - `'attached'` - wait for element to be present in DOM.+ * - `'detached'` - wait for element to not be present in DOM.+ * - `'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";diff --git a/utils/doclint/check_public_api/Documentation.js b/utils/doclint/check_public_api/Documentation.jsindex c2bfa01d30..dc378ee27c 100644--- a/utils/doclint/check_public_api/Documentation.js+++ b/utils/doclint/check_public_api/Documentation.js@@ -14,6 +14,17 @@* limitations under the License.*/+// @ts-check++/** @typedef {{+ * type: 'text' | 'li' | 'code' | 'gen' | 'h1' | 'h2' | 'h3' | 'h4',+ * text?: string,+ * codeLang?: string,+ * lines?: string[],+ * liType?: 'default' | 'bullet' | 'ordinal',+ * children?: MarkdownNode[]+ * }} MarkdownNode */+class Documentation {/*** @param {!Array<!Documentation.Class>} classesArray@@ -32,15 +43,16 @@ Documentation.Class = class {* @param {string} name* @param {!Array<!Documentation.Member>} membersArray* @param {?string=} extendsName- * @param {string=} comment+ * @param {MarkdownNode[]=} spec* @param {string[]=} templates*/- constructor(name, membersArray, extendsName = null, comment = '', templates = []) {+ constructor(name, membersArray, extendsName = null, spec = undefined, templates = []) {this.name = name;this.membersArray = membersArray;- this.comment = comment;+ this.spec = spec;this.extends = extendsName;this.templates = templates;+ this.comment = '';this.index();}@@ -52,6 +64,10 @@ Documentation.Class = class {/** @type {!Array<!Documentation.Member>} */this.propertiesArray = [];/** @type {!Map<string, !Documentation.Member>} */+ this.options = new Map();+ /** @type {!Array<!Documentation.Member>} */+ this.optionsArray = [];+ /** @type {!Map<string, !Documentation.Member>} */this.methods = new Map();/** @type {!Array<!Documentation.Member>} */this.methodsArray = [];@@ -118,6 +134,16 @@ Documentation.Class = class {}}}++ visit(visitor) {+ visitor(this);+ for (const p of this.propertiesArray)+ p.visit(visitor);+ for (const m of this.methodsArray)+ m.visit(visitor);+ for (const e of this.eventsArray)+ e.visit(visitor);+ }};Documentation.Member = class {@@ -126,20 +152,19 @@ Documentation.Member = class {* @param {string} name* @param {?Documentation.Type} type* @param {!Array<!Documentation.Member>} argsArray- * @param {string=} comment- * @param {string=} returnComment+ * @param {MarkdownNode[]=} spec* @param {boolean=} required* @param {string[]=} templates*/- constructor(kind, name, type, argsArray, comment = '', returnComment = '', required = true, templates = []) {+ constructor(kind, name, type, argsArray, spec = undefined, required = true, templates = []) {this.kind = kind;this.name = name;this.type = type;- this.comment = comment;- this.returnComment = returnComment;+ this.spec = spec;this.argsArray = argsArray;this.required = required;this.templates = templates;+ this.comment = '';/** @type {!Map<string, !Documentation.Member>} */this.args = new Map();for (const arg of argsArray)@@ -150,34 +175,41 @@ Documentation.Member = class {* @param {string} name* @param {!Array<!Documentation.Member>} argsArray* @param {?Documentation.Type} returnType- * @param {string=} returnComment- * @param {string=} comment+ * @param {MarkdownNode[]=} spec* @param {string[]=} templates* @return {!Documentation.Member}*/- static createMethod(name, argsArray, returnType, returnComment, comment, templates) {- return new Documentation.Member('method', name, returnType, argsArray, comment, returnComment, undefined, templates);+ static createMethod(name, argsArray, returnType, spec, templates) {+ return new Documentation.Member('method', name, returnType, argsArray, spec, undefined, templates);}/*** @param {string} name* @param {!Documentation.Type} type- * @param {string=} comment+ * @param {MarkdownNode[]=} spec* @param {boolean=} required* @return {!Documentation.Member}*/- static createProperty(name, type, comment, required) {- return new Documentation.Member('property', name, type, [], comment, undefined, required);+ static createProperty(name, type, spec, required) {+ return new Documentation.Member('property', name, type, [], spec, required);}/*** @param {string} name* @param {?Documentation.Type=} type- * @param {string=} comment+ * @param {MarkdownNode[]=} spec* @return {!Documentation.Member}*/- static createEvent(name, type = null, comment) {- return new Documentation.Member('event', name, type, [], comment);+ static createEvent(name, type = null, spec) {+ return new Documentation.Member('event', name, type, [], spec);+ }++ visit(visitor) {+ visitor(this);+ if (this.type)+ this.type.visit(visitor);+ for (const arg of this.argsArray)+ arg.visit(visitor);}};@@ -190,7 +222,11 @@ Documentation.Type = class {this.name = name;this.properties = properties;}++ visit(visitor) {+ for (const p of this.properties || [])+ p.visit(visitor);+ }};module.exports = Documentation;-diff --git a/utils/doclint/check_public_api/JSBuilder.js b/utils/doclint/check_public_api/JSBuilder.jsindex fd8feef0e0..649b23cdba 100644--- a/utils/doclint/check_public_api/JSBuilder.js+++ b/utils/doclint/check_public_api/JSBuilder.js@@ -80,7 +80,7 @@ function checkSources(sources) {visit(classesByName.get(parent));};visit(cls);- return new Documentation.Class(cls.name, Array.from(membersMap.values()), undefined, cls.comment, cls.templates);+ return new Documentation.Class(cls.name, Array.from(membersMap.values()), undefined, undefined, cls.templates);});}@@ -280,7 +280,7 @@ function checkSources(sources) {const parameters = signature.parameters.map((s, index) => serializeSymbol(s, [], index < minArgumentCount));const templates = signature.typeParameters ? signature.typeParameters.map(t => t.symbol.name) : [];const returnType = serializeType(signature.getReturnType());- return Documentation.Member.createMethod(name, parameters, returnType.name !== 'void' ? returnType : null, undefined, undefined, templates);+ return Documentation.Member.createMethod(name, parameters, returnType.name !== 'void' ? returnType : null, undefined, templates);}/**diff --git a/utils/doclint/check_public_api/MDBuilder.js b/utils/doclint/check_public_api/MDBuilder.jsindex 398e5e9db9..78bc2d370b 100644--- a/utils/doclint/check_public_api/MDBuilder.js+++ b/utils/doclint/check_public_api/MDBuilder.js@@ -14,326 +14,276 @@* limitations under the License.*/+// @ts-check++const { parseArgument } = require('../../parse_md');const Documentation = require('./Documentation');-const commonmark = require('commonmark');++/** @typedef {import('./Documentation').MarkdownNode} MarkdownNode */class MDOutline {/**- * @param {!Page} page- * @param {string} text- * @return {!MDOutline}+ * @param {MarkdownNode[]} api*/- static async create(page, text) {- // Render markdown as HTML.- const reader = new commonmark.Parser();- const parsed = reader.parse(text);- const writer = new commonmark.HtmlRenderer();- const html = writer.render(parsed);+ constructor(api) {+ this.classesArray = /** @type {Documentation.Class[]} */ [];+ this.classes = /** @type {Map<string, Documentation.Class>} */ new Map();+ for (const clazz of api) {+ const c = parseClass(clazz);+ this.classesArray.push(c);+ this.classes.set(c.name, c);+ }+ this.signatures = this._generateComments();+ }- const logConsole = msg => console.log(msg.text());- page.on('console', logConsole);- // Extract headings.- await page.setContent(html);- const {classes, errors} = await page.evaluate(() => {- const classes = [];- const errors = [];- const headers = document.body.querySelectorAll('h3');- for (let i = 0; i < headers.length; i++) {- const fragment = extractSiblingsIntoFragment(headers[i], headers[i + 1]);- classes.push(parseClass(fragment));- }- return {classes, errors};+ _generateComments() {+ /**+ * @type {Map<string, string>}+ */+ const signatures = new Map();- /**- * @param {HTMLLIElement} element- * @param {boolean} defaultRequired- */- function parseProperty(element, defaultRequired) {- const clone = element.cloneNode(true);- const ul = clone.querySelector(':scope > ul');- const str = parseComment(extractSiblingsIntoFragment(clone.firstChild, ul));- const name = str.substring(0, str.indexOf('<')).replace(/\`/g, '').trim();- let type = findType(str);- const literals = type.match(/("[^"]+"(\|"[^"]+")*)/);- if (literals) {- const sorted = literals[1].split('|').sort((a, b) => a.localeCompare(b)).join('|');- type = type.substring(0, literals.index) + sorted + type.substring(literals.index + literals[0].length);- }- const properties = [];- let comment = str.substring(str.indexOf('<') + type.length + 2).trim();- const hasNonEnumProperties = type.split('|').some(part => {- const basicTypes = new Set(['string', 'number', 'boolean']);- const arrayTypes = new Set([...basicTypes].map(type => `Array<${type}>`));- return !basicTypes.has(part) && !arrayTypes.has(part) && !(part.startsWith('"') && part.endsWith('"'));- });- if (hasNonEnumProperties) {- for (const childElement of element.querySelectorAll(':scope > ul > li')) {- const text = childElement.textContent;- if (text.startsWith(`"`) || text.startsWith(`'`))- continue;- const property = parseProperty(childElement, true);- property.required = defaultRequired;- if (property.comment.toLowerCase().includes('defaults to '))- property.required = false;- if (property.comment.startsWith('Optional '))- property.required = false;- if (property.comment.toLowerCase().includes('if applicable.'))- property.required = false;- if (property.comment.toLowerCase().includes('if available.'))- property.required = false;- if (property.comment.includes('**required**'))- property.required = true;- properties.push(property);+ for (const clazz of this.classesArray) {+ for (const method of clazz.methodsArray) {+ const tokens = [];+ let hasOptional = false;+ for (const arg of method.argsArray) {+ const optional = !arg.required;+ if (tokens.length) {+ if (optional && !hasOptional)+ tokens.push(`[, ${arg.name}`);+ else+ tokens.push(`, ${arg.name}`);+ } else {+ if (optional && !hasOptional)+ tokens.push(`[${arg.name}`);+ else+ tokens.push(`${arg.name}`);}- } else if (ul) {- comment += '\n' + parseComment(ul).split('\n').map(l => ` - ${l}`).join('\n');- }- return {- name,- type,- comment,- properties- };- }-- /**- * @param {string} str- * @return {string}- */- function findType(str) {- const start = str.indexOf('<') + 1;- let count = 1;- for (let i = start; i < str.length; i++) {- if (str[i] === '<') count++;- if (str[i] === '>') count--;- if (!count)- return str.substring(start, i);+ hasOptional = hasOptional || optional;}- return 'unknown';+ if (hasOptional)+ tokens.push(']');+ const signature = tokens.join('');+ const methodName = `${clazz.name}.${method.name}`;+ signatures.set(methodName, signature);}+ }- /**- * @param {DocumentFragment} content- */- function parseClass(content) {- const members = [];- const commentWalker = document.createTreeWalker(content, NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_ELEMENT, {- acceptNode(node) {- if (node instanceof HTMLElement && node.tagName === 'H4')- return NodeFilter.FILTER_ACCEPT;- if (!(node instanceof Comment))- return NodeFilter.FILTER_REJECT;- if (node.data.trim().startsWith('GEN:toc'))- return NodeFilter.FILTER_ACCEPT;- return NodeFilter.FILTER_REJECT;- }- });- const commentEnd = commentWalker.nextNode();- const headers = content.querySelectorAll('h4');- const name = content.firstChild.textContent;- let extendsName = null;- let commentStart = content.firstChild.nextSibling;- const extendsElement = content.querySelector('ul');- if (extendsElement && extendsElement.textContent.trim().startsWith('extends:')) {- commentStart = extendsElement.nextSibling;- extendsName = extendsElement.querySelector('a').textContent;- }- const comment = parseComment(extractSiblingsIntoFragment(commentStart, commentEnd));- for (let i = 0; i < headers.length; i++) {- const fragment = extractSiblingsIntoFragment(headers[i], headers[i + 1]);- members.push(parseMember(fragment));- }- return {- name,- comment,- extendsName,- members- };- }+ for (const clazz of this.classesArray)+ clazz.visit(item => item.comment = renderComments(item.spec, signatures));+ return signatures;+ }+}- /**- * @param {Node} content- */- function parseComment(content) {- for (const code of content.querySelectorAll('pre > code'))- code.replaceWith('```' + code.className.substring('language-'.length) + '\n' + code.textContent + '```');- for (const code of content.querySelectorAll('code'))- code.replaceWith('`' + code.textContent + '`');- for (const strong of content.querySelectorAll('strong'))- strong.replaceWith('**' + parseComment(strong) + '**');- return content.textContent.trim();- }+/**+ * @param {MarkdownNode} node+ * @returns {Documentation.Class}+ */+function parseClass(node) {+ const members = [];+ let extendsName = null;+ const name = node.text.substring('class: '.length);+ for (const member of node.children) {+ if (member.type === 'li' && member.text.startsWith('extends: [')) {+ extendsName = member.text.substring('extends: ['.length, member.text.indexOf(']'));+ continue;+ }+ if (member.type === 'h2')+ members.push(parseMember(member));+ }+ return new Documentation.Class(name, members, extendsName, extractComments(node));+}- /**- * @param {DocumentFragment} content- */- function parseMember(content) {- const name = content.firstChild.textContent;- const args = [];- let returnType = null;+/**+ * @param {MarkdownNode} item+ * @returns {MarkdownNode[]}+ */+function extractComments(item) {+ return (item.children || []).filter(c => c.type !== 'gen' && !c.type.startsWith('h'));+}- const paramRegex = /^\w+\.[\w$]+\((.*)\)$/;- const matches = paramRegex.exec(name) || ['', ''];- const parameters = matches[1];- const optionalStartIndex = parameters.indexOf('[');- const optinalParamsStr = optionalStartIndex !== -1 ? parameters.substring(optionalStartIndex).replace(/[\[\]]/g, '') : '';- const optionalparams = new Set(optinalParamsStr.split(',').filter(x => x).map(x => x.trim()));- const ul = content.querySelector('ul');- for (const element of content.querySelectorAll('h4 + ul > li')) {- if (element.matches('li') && element.textContent.trim().startsWith('<')) {- returnType = parseProperty(element, element.textContent.trim().includes('data'));- } else if (element.matches('li') && element.firstChild.matches && element.firstChild.matches('code')) {- const property = parseProperty(element, false);- property.required = !optionalparams.has(property.name) && !property.name.startsWith('...');- args.push(property);- } else if (element.matches('li') && element.firstChild.nodeType === Element.TEXT_NODE && element.firstChild.textContent.toLowerCase().startsWith('return')) {- returnType = parseProperty(element, true);- const expectedText = 'returns: ';- let actualText = element.firstChild.textContent;- let angleIndex = actualText.indexOf('<');- let spaceIndex = actualText.indexOf(' ');- angleIndex = angleIndex === -1 ? actualText.length : angleIndex;- spaceIndex = spaceIndex === -1 ? actualText.length : spaceIndex + 1;- actualText = actualText.substring(0, Math.min(angleIndex, spaceIndex));- if (actualText !== expectedText)- errors.push(`${name} has mistyped 'return' type declaration: expected exactly '${expectedText}', found '${actualText}'.`);- }- }- const comment = parseComment(extractSiblingsIntoFragment(ul ? ul.nextSibling : content.querySelector('h4').nextSibling));- return {- name,- args,- returnType,- comment- };- }+/**+ * @param {MarkdownNode[]} spec+ * @param {Map<string, string>} [signatures]+ */+function renderComments(spec, signatures) {+ const result = [];+ for (const node of spec || []) {+ if (node.type === 'text') {+ const text = patchSignatures(node.text, signatures);- /**- * @param {!Node} fromInclusive- * @param {!Node} toExclusive- * @return {!DocumentFragment}- */- function extractSiblingsIntoFragment(fromInclusive, toExclusive) {- const fragment = document.createDocumentFragment();- let node = fromInclusive;- while (node && node !== toExclusive) {- const next = node.nextSibling;- fragment.appendChild(node);- node = next;- }- return fragment;+ // Render comments as text.+ if (text.startsWith('> ')) {+ result.push('');+ result.push(text);+ } else {+ result.push(text);}- });- page.off('console', logConsole);- return new MDOutline(classes, errors);- }-- constructor(classes, errors) {- this.classes = [];- this.errors = errors;- const classHeading = /^class: (\w+)$/;- const constructorRegex = /^new (\w+)\((.*)\)$/;- const methodRegex = /^(\w+)\.([\w$]+)\(([^']*)\)$/;- const propertyRegex = /^(\w+)\.(\w+)$/;- const eventRegex = /^.*\.on\('(\w+)'\)$/;- let currentClassName = null;- let currentClassMembers = [];- let currentClassComment = '';- let currentClassExtends = null;- for (const cls of classes) {- const match = cls.name.match(classHeading);- if (!match)+ }++ 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;- currentClassName = match[1];- currentClassComment = cls.comment;- currentClassExtends = cls.extendsName;- for (const member of cls.members) {- if (constructorRegex.test(member.name)) {- const match = member.name.match(constructorRegex);- handleMethod.call(this, member, match[1], 'constructor', match[2]);- } else if (methodRegex.test(member.name)) {- const match = member.name.match(methodRegex);- handleMethod.call(this, member, match[1], match[2], match[3]);- } else if (propertyRegex.test(member.name)) {- const match = member.name.match(propertyRegex);- handleProperty.call(this, member, match[1], match[2]);- } else if (eventRegex.test(member.name)) {- const match = member.name.match(eventRegex);- handleEvent.call(this, member, match[1]);- }- }- flushClassIfNeeded.call(this);+ const visit = (node, indent) => {+ result.push(`${indent}- ${patchSignatures(node.text, signatures)}`);+ for (const child of node.children || [])+ visit(child, indent + ' ');+ };+ visit(node, '');}+ }+ return result.join('\n');+}- function handleMethod(member, className, methodName, parameters) {- if (!currentClassName || !className || !methodName || className.toLowerCase() !== currentClassName.toLowerCase()) {- this.errors.push(`Failed to process header as method: ${member.name}`);- return;- }- parameters = parameters.trim().replace(/[\[\]]/g, '');- if (parameters !== member.args.map(arg => arg.name).join(', '))- this.errors.push(`Heading arguments for "${member.name}" do not match described ones, i.e. "${parameters}" != "${member.args.map(a => a.name).join(', ')}"`);- const args = member.args.map(createPropertyFromJSON);- let returnType = null;- let returnComment = '';- if (member.returnType) {- const returnProperty = createPropertyFromJSON(member.returnType);- returnType = returnProperty.type;- returnComment = returnProperty.comment;- }- const method = Documentation.Member.createMethod(methodName, args, returnType, returnComment, member.comment);- currentClassMembers.push(method);+/**+ * @param {string} comment+ * @param {Map<string, string>} signatures+ */+function patchSignatures(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}')\``;+ if (type === 'method') {+ const signature = signatures.get(`${clazzPrefix}${clazz}.${name}`) || '';+ return `\`${className}.${name}(${signature})\``;}+ return `\`${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;+}- function createPropertyFromJSON(payload) {- const type = new Documentation.Type(payload.type, payload.properties.map(createPropertyFromJSON));- const required = payload.required;- return Documentation.Member.createProperty(payload.name, type, payload.comment, required);- }+/**+ * @param {MarkdownNode} member+ * @returns {Documentation.Member}+ */+function parseMember(member) {+ const args = [];+ const match = member.text.match(/(event|method|property|async method|): (JS|CDP|[A-Z])([^.]+)\.(.*)/);+ const name = match[4];+ let returnType = null;+ const options = [];- function handleProperty(member, className, propertyName) {- if (!currentClassName || !className || !propertyName || className.toLowerCase() !== currentClassName.toLowerCase()) {- this.errors.push(`Failed to process header as property: ${member.name}`);- return;- }- const type = member.returnType ? member.returnType.type : null;- const properties = member.returnType ? member.returnType.properties : [];- currentClassMembers.push(createPropertyFromJSON({type, name: propertyName, properties, comment: member.comment}));- }+ for (const item of member.children || []) {+ if (item.type === 'li' && item.liType === 'default')+ returnType = parseType(item);+ }+ if (!returnType)+ returnType = new Documentation.Type('void');+ if (match[1] === 'async method')+ returnType.name = `Promise<${returnType.name}>`;- function handleEvent(member, eventName) {- if (!currentClassName || !eventName) {- this.errors.push(`Failed to process header as event: ${member.name}`);- return;- }- currentClassMembers.push(Documentation.Member.createEvent(eventName, member.returnType && createPropertyFromJSON(member.returnType).type, member.comment));- }+ if (match[1] === 'event')+ return Documentation.Member.createEvent(name, returnType, extractComments(member));+ if (match[1] === 'property')+ return Documentation.Member.createProperty(name, returnType, extractComments(member), true);- function flushClassIfNeeded() {- if (currentClassName === null)- return;- this.classes.push(new Documentation.Class(currentClassName, currentClassMembers, currentClassExtends, currentClassComment));- currentClassName = null;- currentClassMembers = [];+ for (const item of member.children || []) {+ if (item.type === 'h3' && item.text.startsWith('param:'))+ args.push(parseProperty(item));+ if (item.type === 'h3' && item.text.startsWith('option:'))+ options.push(parseProperty(item));+ }++ if (options.length) {+ options.sort((o1, o2) => o1.name.localeCompare(o2.name));+ for (const option of options)+ option.required = false;+ const type = new Documentation.Type('Object', options);+ args.push(Documentation.Member.createProperty('options', type, undefined, false));+ }+ return Documentation.Member.createMethod(name, args, returnType, extractComments(member));+}++/**+ * @param {MarkdownNode} spec+ * @return {Documentation.Member}+ */+function parseProperty(spec) {+ const param = spec.children[0];+ 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)));+}++/**+ * @param {MarkdownNode=} spec+ * @return {Documentation.Type}+ */+function parseType(spec) {+ const { type } = parseArgument(spec.text);+ 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 properties = [];+ const hasNonEnumProperties = typeName.split('|').some(part => {+ const basicTypes = new Set(['string', 'number', 'boolean']);+ const arrayTypes = new Set([...basicTypes].map(type => `Array<${type}>`));+ return !basicTypes.has(part) && !arrayTypes.has(part) && !(part.startsWith('"') && part.endsWith('"'));+ });+ 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 }]);+ properties.push(Documentation.Member.createProperty(name, parseType(child), comments, guessRequired(text)));}}+ return new Documentation.Type(typeName, properties);+}++/**+ * @param {string} comment+ */+function guessRequired(comment) {+ let required = true;+ if (comment.toLowerCase().includes('defaults to '))+ required = false;+ if (comment.startsWith('Optional'))+ required = false;+ if (comment.endsWith('Optional.'))+ required = false;+ if (comment.toLowerCase().includes('if set'))+ required = false;+ if (comment.toLowerCase().includes('if applicable'))+ required = false;+ if (comment.toLowerCase().includes('if available'))+ required = false;+ if (comment.includes('**required**'))+ required = true;+ return required;}+module.exports =/**- * @param {!Page} page- * @param {!Array<!Source>} sources- * @param {!boolean} copyDocsFromSuperClasses- * @return {!Promise<{documentation: !Documentation, errors: !Array<string>}>}+ * @param {any} api+ * @param {boolean} copyDocsFromSuperClasses*/-module.exports = async function(page, sources, copyDocsFromSuperClasses) {- const classes = [];+ function(api, copyDocsFromSuperClasses) {const errors = [];- for (const source of sources) {- const outline = await MDOutline.create(page, source.text());- classes.push(...outline.classes);- errors.push(...outline.errors);- }- const documentation = new Documentation(classes);+ const outline = new MDOutline(api);+ const documentation = new Documentation(outline.classesArray);if (copyDocsFromSuperClasses) {// Push base class documentation to derived classes.@@ -356,5 +306,7 @@ module.exports = async function(page, sources, copyDocsFromSuperClasses) {clazz.index();}}- return { documentation, errors };+ 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 dc47ebfeb7..b1565d4891 100644--- a/utils/doclint/check_public_api/index.js+++ b/utils/doclint/check_public_api/index.js@@ -24,12 +24,10 @@ const EXCLUDE_PROPERTIES = new Set([]);/**- * @param {!Page} page- * @param {!Array<!Source>} mdSources* @return {!Promise<!Array<!Message>>}*/-module.exports = async function lint(page, mdSources, jsSources) {- const mdResult = await mdBuilder(page, mdSources, true);+module.exports = function lint(api, jsSources) {+ const mdResult = mdBuilder(api, true);const jsResult = jsBuilder.checkSources(jsSources);const jsDocumentation = filterJSDocumentation(jsSources, jsResult.documentation);const mdDocumentation = mdResult.documentation;@@ -120,12 +118,14 @@ function compareDocumentations(actual, expected) {for (const methodName of methodDiff.equal) {const actualMethod = actualClass.methods.get(methodName);const expectedMethod = expectedClass.methods.get(methodName);- if (!actualMethod.type !== !expectedMethod.type) {- if (actualMethod.type)- errors.push(`Method ${className}.${methodName} has unneeded description of return type`);- else- errors.push(`Method ${className}.${methodName} is missing return type description`);- } else if (actualMethod.type) {+ const hasActualType = actualMethod.type && actualMethod.type.name !== 'void';+ const hasExpectedType = expectedMethod.type && expectedMethod.type.name !== 'void';+ if (hasActualType !== hasExpectedType) {+ if (hasActualType)+ errors.push(`Method ${className}.${methodName} has unneeded description of return type: `+ actualMethod.type.name);+ else if (hasExpectedType)+ errors.push(`Method ${className}.${methodName} is missing return type description: ` + expectedMethod.type.name);+ } else if (hasActualType) {checkType(`Method ${className}.${methodName} has the wrong return type: `, actualMethod.type, expectedMethod.type);}const actualArgs = Array.from(actualMethod.args.keys());diff --git a/utils/doclint/check_public_api/test/check-duplicates/doc.md b/utils/doclint/check_public_api/test/check-duplicates/doc.mdindex ea743ecd1e..dc182a3553 100644--- a/utils/doclint/check_public_api/test/check-duplicates/doc.md+++ b/utils/doclint/check_public_api/test/check-duplicates/doc.md@@ -1,15 +1,17 @@-### class: Bar+# class: Bar-### class: Foo+# class: Foo-#### foo.test()+## method: Foo.test-#### foo.test()+## method: Foo.test-#### foo.title(arg, arg)-- `arg` <[number]>+## method: Foo.title++### param: Foo.title.arg- `arg` <[number]>-### class: Bar+### param: Foo.title.arg+- `arg` <[number]>-[number]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type "Number"+# class: Bardiff --git a/utils/doclint/check_public_api/test/check-nullish/api.ts b/utils/doclint/check_public_api/test/check-nullish/api.tsindex a2b440d5f1..c771dccfea 100644--- a/utils/doclint/check_public_api/test/check-nullish/api.ts+++ b/utils/doclint/check_public_api/test/check-nullish/api.ts@@ -1,5 +1,5 @@class Foo {- bar(options: {x: number, y: number, maybe?: number, nullable: string|null, object?: {one: number, two?: number}}) {+ bar(options?: {x?: number, y?: number, maybe?: number, nullable?: string|null, object?: {one: number, two?: number}}) {}diff --git a/utils/doclint/check_public_api/test/check-nullish/doc.md b/utils/doclint/check_public_api/test/check-nullish/doc.mdindex e9e74259b5..6b1c3c4a56 100644--- a/utils/doclint/check_public_api/test/check-nullish/doc.md+++ b/utils/doclint/check_public_api/test/check-nullish/doc.md@@ -1,32 +1,33 @@-### class: Foo--#### foo.bar(options)-- `options` <[Object]>- - `x` <[number]> **required**- - `y` <[number]> **required**- - `nullable` <?[string]> **required**- - `maybe` <[number]>- - `object` <[Object]>- - `one` <[number]>- - `two` <[number]> defaults to `2`.--#### foo.baz()+# class: Foo++## method: Foo.bar++### option: Foo.bar.x+- `x` <[number]>++### option: Foo.bar.y+- `y` <[number]>++### option: Foo.bar.nullable+- `nullable` <?[string]>++### option: Foo.bar.maybe+- `maybe` <[number]>++### option: Foo.bar.object+- `object` <[Object]>+ - `one` <[number]>+ - `two` <[number]> defaults to `2`.++## method: Foo.baz- returns: <?[Object]>- `abc` <[number]>- `def` <[number]> if applicable.- `ghi` <[string]>--#### foo.goBack()+## method: Foo.goBack- returns: <[Promise]<?[Response]>> Promise which resolves to the main resource response. In case of multiple redirects, the navigation will resolve with the response of the last redirect. Ifcan not go back, resolves to `null`.-#### foo.response()+## method: Foo.response- returns: <?[Response]> A matching [Response] object, or `null` if the response has not been received yet.---[string]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type "String"-[Object]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Object_type "Object"-[number]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type "number"-[Promise]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Promise_type "Promise"-[Response]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Response_type "Response"diff --git a/utils/doclint/check_public_api/test/check-returns/doc.md b/utils/doclint/check_public_api/test/check-returns/doc.mdindex 1dffb8b6f0..74cf3c5b84 100644--- a/utils/doclint/check_public_api/test/check-returns/doc.md+++ b/utils/doclint/check_public_api/test/check-returns/doc.md@@ -1,14 +1,11 @@-### class: Foo+# class: Foo-#### foo.asyncFunction()+## async method: Foo.asyncFunction-#### foo.return42()+## method: Foo.return42-#### foo.returnNothing()+## method: Foo.returnNothing- returns: <[number]>-#### foo.www()-- returns <[string]>--[string]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type "String"-[number]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type "Number"+## method: Foo.www+- returns: <[string]>diff --git a/utils/doclint/check_public_api/test/check-returns/result.txt b/utils/doclint/check_public_api/test/check-returns/result.txtindex ceb202b25f..2af6e82b0a 100644--- a/utils/doclint/check_public_api/test/check-returns/result.txt+++ b/utils/doclint/check_public_api/test/check-returns/result.txt@@ -1,4 +1,2 @@-[MarkDown] foo.www() has mistyped 'return' type declaration: expected exactly 'returns: ', found 'returns '.-[MarkDown] Method Foo.asyncFunction is missing return type description-[MarkDown] Method Foo.return42 is missing return type description-[MarkDown] Method Foo.returnNothing has unneeded description of return type\ No newline at end of file+[MarkDown] Method Foo.return42 is missing return type description: number+[MarkDown] Method Foo.returnNothing has unneeded description of return type: number\ No newline at end of filediff --git a/utils/doclint/check_public_api/test/check-sorting/doc.md b/utils/doclint/check_public_api/test/check-sorting/doc.mdindex 0c97192b34..0f07761206 100644--- a/utils/doclint/check_public_api/test/check-sorting/doc.md+++ b/utils/doclint/check_public_api/test/check-sorting/doc.md@@ -1,15 +1,15 @@-### class: Foo+# class: Foo-#### foo.on('c')+## event: Foo.c-#### foo.on('a')+## event: Foo.a-#### foo.aaa()+## method: Foo.aaa-#### foo.on('b')+## event: Foo.b-#### foo.ddd+## property: Foo.ddd-#### foo.ccc()+## method: Foo.ccc-#### foo.bbb()+## method: Foo.bbbdiff --git a/utils/doclint/check_public_api/test/diff-arguments/api.ts b/utils/doclint/check_public_api/test/diff-arguments/api.tsindex 35c054db0f..1474a6a9d9 100644--- a/utils/doclint/check_public_api/test/diff-arguments/api.ts+++ b/utils/doclint/check_public_api/test/diff-arguments/api.ts@@ -2,10 +2,10 @@ class Foo {foo(arg1: string, arg3 = {}) {}- test(...filePaths : string[]) {+ test(filePaths : string[]) {}- bar(options: {visibility?: boolean}) {+ bar(options?: {visibility?: boolean}) {}}export {Foo};\ No newline at end of filediff --git a/utils/doclint/check_public_api/test/diff-arguments/doc.md b/utils/doclint/check_public_api/test/diff-arguments/doc.mdindex a991bfa66b..8176ef07e2 100644--- a/utils/doclint/check_public_api/test/diff-arguments/doc.md+++ b/utils/doclint/check_public_api/test/diff-arguments/doc.md@@ -1,14 +1,19 @@-### class: Foo-#### foo.bar(options)-- `options` <[Object]>- - `visibility` <[boolean]>-#### foo.foo(arg1, arg2)+# class: Foo++## method: Foo.bar++### option: Foo.bar.visibility+- `visibility` <[boolean]>++## method: Foo.foo++### param: Foo.foo.arg1- `arg1` <[string]>++### param: Foo.foo.arg2- `arg2` <[string]>-#### foo.test(...files)-- `...filePaths` <...[string]>+## method: Foo.test-[Object]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object "Object"-[string]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type "String"-[boolean]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type "Boolean"+### param: Foo.test.filePaths+- `filePaths` <[Array]<[string]>>diff --git a/utils/doclint/check_public_api/test/diff-arguments/result.txt b/utils/doclint/check_public_api/test/diff-arguments/result.txtindex 2fcfe77331..2d789b55f7 100644--- a/utils/doclint/check_public_api/test/diff-arguments/result.txt+++ b/utils/doclint/check_public_api/test/diff-arguments/result.txt@@ -1,4 +1,3 @@-[MarkDown] Heading arguments for "foo.test(...files)" do not match described ones, i.e. "...files" != "...filePaths"[MarkDown] Method Foo.foo() fails to describe its parameters:- Implemented but not documented argument: arg3- Documented but not implemented argument: arg2\ No newline at end of filediff --git a/utils/doclint/check_public_api/test/diff-classes/doc.md b/utils/doclint/check_public_api/test/diff-classes/doc.mdindex 7e51ca4754..98fdcac4cd 100644--- a/utils/doclint/check_public_api/test/diff-classes/doc.md+++ b/utils/doclint/check_public_api/test/diff-classes/doc.md@@ -1,5 +1,5 @@-### class: Foo+# class: Foo-### class: Bar+# class: Bar-### class: Baz+# class: Bazdiff --git a/utils/doclint/check_public_api/test/diff-events/doc.md b/utils/doclint/check_public_api/test/diff-events/doc.mdindex 44249e2394..f461f99f8a 100644--- a/utils/doclint/check_public_api/test/diff-events/doc.md+++ b/utils/doclint/check_public_api/test/diff-events/doc.md@@ -1,5 +1,5 @@-### class: Foo+# class: Foo-#### foo.on('start')+## event: Foo.start-#### foo.on('stop')+## event: Foo.stopdiff --git a/utils/doclint/check_public_api/test/diff-methods/doc.md b/utils/doclint/check_public_api/test/diff-methods/doc.mdindex 489d014988..a41355af9d 100644--- a/utils/doclint/check_public_api/test/diff-methods/doc.md+++ b/utils/doclint/check_public_api/test/diff-methods/doc.md@@ -1,10 +1,10 @@-### class: Foo+# class: Foo-#### foo.$()+## method: Foo.$-#### foo.money$$money()+## method: Foo.money$$money-#### foo.proceed()+## method: Foo.proceed-#### foo.start()+## method: Foo.startdiff --git a/utils/doclint/check_public_api/test/diff-properties/doc.md b/utils/doclint/check_public_api/test/diff-properties/doc.mdindex 75d4fd106f..e355b26f5a 100644--- a/utils/doclint/check_public_api/test/diff-properties/doc.md+++ b/utils/doclint/check_public_api/test/diff-properties/doc.md@@ -1,5 +1,5 @@-### class: Foo+# class: Foo-#### foo.a+## property: Foo.a-#### foo.c+## property: Foo.cdiff --git a/utils/doclint/check_public_api/test/md-builder-comments/doc.md b/utils/doclint/check_public_api/test/md-builder-comments/doc.mdindex 0fb5f63e1c..f8f3d0381e 100644--- a/utils/doclint/check_public_api/test/md-builder-comments/doc.md+++ b/utils/doclint/check_public_api/test/md-builder-comments/doc.md@@ -1,15 +1,18 @@-### class: Foo+# class: Foo-#### foo.method(arg1, arg2)-- `arg1` <[string]> A single line argument comment-- `arg2` <[string]> A multiline argument comment:- - it could be this- - or it could be that+## method: Foo.method- returns: <[Promise]<[ElementHandle]>>The method does something.-[string]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type "String"-[Promise]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise "Promise"-[ElementHandle]: # "ElementHandle"-[ElementHandle]: # "Frame"+### param: Foo.method.arg1+- `arg1` <[string]>++A single line argument comment++### param: Foo.method.arg2+- `arg2` <[string]>++A multiline argument comment:+* it could be this+* or it could be thatdiff --git a/utils/doclint/check_public_api/test/md-builder-comments/result.txt b/utils/doclint/check_public_api/test/md-builder-comments/result.txtindex 8b78ebca3b..4a4a546efc 100644--- a/utils/doclint/check_public_api/test/md-builder-comments/result.txt+++ b/utils/doclint/check_public_api/test/md-builder-comments/result.txt@@ -25,7 +25,7 @@"name": "string"},"kind": "property",- "comment": "A multiline argument comment:\n - it could be this\n - or it could be that"+ "comment": "A multiline argument comment:\n- it could be this\n- or it could be that"}]}diff --git a/utils/doclint/check_public_api/test/md-builder-common/doc.md b/utils/doclint/check_public_api/test/md-builder-common/doc.mdindex 6f2d6b19eb..2ab67c7329 100644--- a/utils/doclint/check_public_api/test/md-builder-common/doc.md+++ b/utils/doclint/check_public_api/test/md-builder-common/doc.md@@ -1,24 +1,23 @@-### class: Foo+# class: FooThis is a class.-#### foo.on('frame')-- <[Frame]>+## event: Foo.frame+- type: <[Frame]>This event is dispatched.-#### foo.$(selector)-- `selector` <[string]> A selector to query page for+## method: Foo.$- returns: <[Promise]<[ElementHandle]>>The method runs document.querySelector.-#### foo.url-- <[string]>+### param: Foo.$.selector+- `selector` <[string]>-Contains the URL of the request.+A selector to query page for++## property: Foo.url+- type: <[string]>-[string]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type "String"-[Promise]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise "Promise"-[ElementHandle]: # "ElementHandle"-[ElementHandle]: # "Frame"+Contains the URL of the request.diff --git a/utils/doclint/check_public_api/test/md-builder-common/result.txt b/utils/doclint/check_public_api/test/md-builder-common/result.txtindex 8c9694baff..d1e50f6185 100644--- a/utils/doclint/check_public_api/test/md-builder-common/result.txt+++ b/utils/doclint/check_public_api/test/md-builder-common/result.txt@@ -7,7 +7,7 @@{"name": "frame","type": {- "name": "[Frame]"+ "name": "Frame"},"kind": "event","comment": "This event is dispatched."diff --git a/utils/doclint/check_public_api/test/test.js b/utils/doclint/check_public_api/test/test.jsindex f72411ee5e..5040bb2305 100644--- a/utils/doclint/check_public_api/test/test.js+++ b/utils/doclint/check_public_api/test/test.js@@ -16,20 +16,14 @@const fs = require('fs');const path = require('path');-const playwright = require('../../../../');const checkPublicAPI = require('..');const Source = require('../../Source');const mdBuilder = require('../MDBuilder');const jsBuilder = require('../JSBuilder');const { folio } = require('folio');+const { parseMd } = require('../../../parse_md');const fixtures = folio.extend();-fixtures.page.init(async({}, test) => {- const browser = await playwright.chromium.launch();- const page = await browser.newPage();- await test(page);- await browser.close();-}, { scope: 'worker' });const { describe, it, expect } = fixtures.build();describe('checkPublicAPI', function() {@@ -49,22 +43,22 @@ describe('checkPublicAPI', function() {});async function testLint(name) {- it(name, async({page}) => {+ it(name, async({}) => {const dirPath = path.join(__dirname, name);- const mdSources = await Source.readdir(dirPath, '.md');+ const api = parseMd(fs.readFileSync(path.join(dirPath, 'doc.md')).toString());const tsSources = await Source.readdir(dirPath, '.ts');const jsSources = await Source.readdir(dirPath, '.js');- const messages = await checkPublicAPI(page, mdSources, jsSources.concat(tsSources));+ const messages = await checkPublicAPI(api, jsSources.concat(tsSources));const errors = messages.map(message => message.text);expect(errors.join('\n')).toBe(fs.readFileSync(path.join(dirPath, 'result.txt')).toString());});}async function testMDBuilder(name) {- it(name, async({page}) => {+ it(name, ({}) => {const dirPath = path.join(__dirname, name);- const sources = await Source.readdir(dirPath, '.md');- const {documentation} = await mdBuilder(page, sources, true);+ const api = parseMd(fs.readFileSync(path.join(dirPath, 'doc.md')).toString());+ const {documentation} = mdBuilder(api, true);expect(serialize(documentation)).toBe(fs.readFileSync(path.join(dirPath, 'result.txt')).toString());});}diff --git a/utils/doclint/cli.js b/utils/doclint/cli.jsindex 415bf17288..f426c9fabb 100755--- a/utils/doclint/cli.js+++ b/utils/doclint/cli.js@@ -18,12 +18,12 @@const playwright = require('../../');const fs = require('fs');const path = require('path');-const os = require('os');const Source = require('./Source');const Message = require('./Message');const { parseMd, renderMd, parseArgument, applyTemplates } = require('./../parse_md');const { spawnSync } = require('child_process');const preprocessor = require('./preprocessor');+const mdBuilder = require('./check_public_api/MDBuilder');const PROJECT_DIR = path.join(__dirname, '..', '..');const VERSION = require(path.join(PROJECT_DIR, 'package.json')).version;@@ -62,7 +62,8 @@ async function run() {// Generate signatures{const nodes = applyTemplates(parseMd(body), parseMd(params));- const signatures = new Map();+ const { outline } = mdBuilder(nodes);+ const signatures = outline.signatures;for (const clazz of nodes) {clazz.type = 'h3';for (const member of clazz.children) {@@ -70,7 +71,7 @@ async function run() {continue;member.type = 'h4';- let match = member.text.match(/(event|method|namespace|async method|): (JS|CDP|[A-Z])([^.]+)\.(.*)/);+ let match = member.text.match(/(event|method|property|async method|): (JS|CDP|[A-Z])([^.]+)\.(.*)/);if (!match)continue;@@ -89,9 +90,9 @@ async function run() {if (item.type === 'li' && item.liType === 'default') {const { type } = parseArgument(item.text);if (match[1] === 'method')- item.text = `returns: ${type}`;+ item.text = `returns: <${type}>`;else- item.text = `returns: <[Promise]${type}>`;+ item.text = `returns: <[Promise]<${type}>>`;returnContainer.push(item);continue;}@@ -103,6 +104,8 @@ async function run() {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);}@@ -121,6 +124,8 @@ async function run() {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);}}@@ -134,33 +139,13 @@ async function run() {if (optionsContainer[0])optionsContainer[0].children.sort((o1, o2) => o1.text.localeCompare(o2.text));member.children = [...argChildren, ...optionsContainer, ...returnContainer, ...nonArgChildren];-- const tokens = [];- let hasOptional = false;- for (const arg of args) {- const optional = arg.name === 'options' || arg.text.includes('Optional');- if (tokens.length) {- if (optional && !hasOptional)- tokens.push(`[, ${arg.name}`);- else- tokens.push(`, ${arg.name}`);- } else {- if (optional && !hasOptional)- tokens.push(`[${arg.name}`);- else- tokens.push(`${arg.name}`);- }- hasOptional = hasOptional || optional;- }- if (hasOptional)- tokens.push(']');- const signature = tokens.join('');- const methodName = `${match[2].toLowerCase() + match[3]}.${match[4]}`;- signatures.set(methodName, signature);+ 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})`;}- if (match[1] === 'namespace') {+ if (match[1] === 'property') {member.text = `${match[2].toLowerCase() + match[3]}.${match[4]}`;continue;}@@ -187,12 +172,13 @@ async function run() {for (const source of mdSources.filter(source => source.hasUpdatedText()))messages.push(Message.warning(`WARN: updated ${source.projectPath()}`));- const browser = await playwright.chromium.launch();- const page = await browser.newPage();+ 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(...await checkPublicAPI(page, [api], jsSources));- await browser.close();+ messages.push(...checkPublicAPI(api, jsSources));for (const source of mdSources) {if (!source.hasUpdatedText())diff --git a/utils/doclint/generateApiJson.js b/utils/doclint/generateApiJson.jsindex 9c79e918c9..a75574d2c6 100644--- a/utils/doclint/generateApiJson.js+++ b/utils/doclint/generateApiJson.js@@ -14,21 +14,20 @@* limitations under the License.*/-const playwright = require('../..');+const fs = require('fs');const path = require('path');-const Source = require('./Source');+const { parseMd, applyTemplates } = require('../parse_md');const mdBuilder = require('./check_public_api/MDBuilder');const PROJECT_DIR = path.join(__dirname, '..', '..');-(async () => {- const api = await Source.readFile(path.join(PROJECT_DIR, 'docs', 'api.md'));- const browser = await playwright.chromium.launch();- const page = await browser.newPage();- const { documentation } = await mdBuilder(page, [api], false);+{+ const apiBody = parseMd(fs.readFileSync(path.join(PROJECT_DIR, 'docs-src', 'api-body.md')).toString());+ const apiParams = parseMd(fs.readFileSync(path.join(PROJECT_DIR, 'docs-src', 'api-params.md')).toString());+ const api = applyTemplates(apiBody, apiParams);+ const { documentation } = mdBuilder(api, false);const result = serialize(documentation);console.log(JSON.stringify(result));- await browser.close();-})()+}function serialize(documentation) {const result = {};diff --git a/utils/doclint/preprocessor/index.js b/utils/doclint/preprocessor/index.jsindex 925ef10ead..9f5b4b8872 100644--- a/utils/doclint/preprocessor/index.js+++ b/utils/doclint/preprocessor/index.js@@ -193,7 +193,7 @@ function generateLinks(source, signatures, messages) {const linkOffset = offset + lineNumber + match.index;const hrefOffset = offset + lineNumber + match.index + 3 + name.length;let replacement;- const memberMatch = name.match(/`(event|method|namespace):\s(JS|CDP|[A-Z])([^.]+)\.(.*)`/m);+ 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}`));@@ -203,10 +203,11 @@ function generateLinks(source, signatures, messages) {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(method);+ let signature = signatures.get(key);if (signature === undefined) {- messages.push(Message.error(`Bad method link: ${source.filePath()}:${lineNumber + 1}: ${method}`));+ messages.push(Message.error(`Bad method link: ${source.filePath()}:${lineNumber + 1}: ${key}`));signature = '(\u2026)';}replacement = method + '(' + signature + ')';diff --git a/utils/generate_types/index.js b/utils/generate_types/index.jsindex 775f7187d8..86387a9b26 100644--- a/utils/generate_types/index.js+++ b/utils/generate_types/index.js@@ -17,12 +17,14 @@//@ts-checkconst path = require('path');const Source = require('../doclint/Source');-const {chromium, devices} = require('../..');+const {devices} = require('../..');const Documentation = require('../doclint/check_public_api/Documentation');const PROJECT_DIR = path.join(__dirname, '..', '..');const fs = require('fs');const {parseOverrides} = require('./parseOverrides');const exported = require('./exported.json');+const { parseMd, applyTemplates } = require('../parse_md');+const objectDefinitions = [];const handledMethods = new Set();/** @type {Documentation} */@@ -35,11 +37,10 @@ let hadChanges = false;fs.mkdirSync(typesDir)writeFile(path.join(typesDir, 'protocol.d.ts'), fs.readFileSync(path.join(PROJECT_DIR, 'src', 'server', 'chromium', 'protocol.ts'), 'utf8'));writeFile(path.join(typesDir, 'trace.d.ts'), fs.readFileSync(path.join(PROJECT_DIR, 'src', 'trace', 'traceTypes.ts'), 'utf8'));- const browser = await chromium.launch();- const page = await browser.newPage();- const api = await Source.readFile(path.join(PROJECT_DIR, 'docs', 'api.md'));- const {documentation: mdDocumentation} = await require('../doclint/check_public_api/MDBuilder')(page, [api], true);- await browser.close();+ const apiBody = parseMd(fs.readFileSync(path.join(PROJECT_DIR, 'docs-src', 'api-body.md')).toString());+ const apiParams = parseMd(fs.readFileSync(path.join(PROJECT_DIR, 'docs-src', 'api-params.md')).toString());+ const api = applyTemplates(apiBody, apiParams);+ const {documentation: mdDocumentation} = require('../doclint/check_public_api/MDBuilder')(api, true);const sources = await Source.readdir(path.join(PROJECT_DIR, 'src', 'client'), '', []);const {documentation: jsDocumentation} = await require('../doclint/check_public_api/JSBuilder').checkSources(sources);documentation = mergeDocumentation(mdDocumentation, jsDocumentation);@@ -408,8 +409,6 @@ function memberJSDOC(member, indent) {if (member.comment)lines.push(...member.comment.split('\n'));lines.push(...member.argsArray.map(arg => `@param ${arg.name.replace(/\./g, '')} ${arg.comment.replace('\n', ' ')}`));- if (member.returnComment)- lines.push(`@returns ${member.returnComment}`);if (!lines.length)return indent;return writeComment(lines.join('\n'), indent) + '\n' + indent;diff --git a/utils/parse_md.js b/utils/parse_md.jsindex 1b0abc40dc..89d1938893 100644--- a/utils/parse_md.js+++ b/utils/parse_md.js@@ -268,16 +268,22 @@ function applyTemplates(body, params) {return body;}+/**+ * @param {string} line+ * @returns {{ name: string, type: string, text: string }}+ */function parseArgument(line) {- let match = line.match(/`([^`]+)` (.*)/);+ let match = line.match(/^`([^`]+)` (.*)/);+ if (!match)+ match = line.match(/^(returns): (.*)/);if (!match)- match = line.match(/(returns): (.*)/);+ match = line.match(/^(type): (.*)/);if (!match)throw new Error('Invalid argument: ' + line);const name = match[1];const remainder = match[2];if (!remainder.startsWith('<'))- console.error('Bad argument:', remainder);+ throw new Error('Bad argument: ' + remainder);let depth = 0;for (let i = 0; i < remainder.length; ++i) {const c = remainder.charAt(i);@@ -286,9 +292,9 @@ function parseArgument(line) {if (c === '>')--depth;if (depth === 0)- return { name, type: remainder.substring(0, i + 1), text: remainder.substring(i + 2) };+ return { name, type: remainder.substring(1, i), text: remainder.substring(i + 2) };}throw new Error('Should not be reached');}-module.exports = { parseMd, renderMd, parseArgument, applyTemplates };+module.exports = { parseMd, renderMd, parseArgument, applyTemplates, clone };