Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
docs: disambiguate events (#4597)
Pavel Feldman150d778ca7f0
diff --git a/docs-src/api-body.md b/docs-src/api-body.mdindex 6acf3d4be1..c66f4fd4c3 100644--- a/docs-src/api-body.md+++ b/docs-src/api-body.md@@ -1,8 +1,8 @@### class: Browser* extends: [EventEmitter](https://nodejs.org/api/events.html#events_class_eventemitter)-A Browser is created when Playwright connects to a browser instance, either through-[browserType.launch()]() or [browserType.connect()]().+A Browser is created when Playwright connects to a browser instance, either through [browserType.launch()]() or+[browserType.connect()]().An example of using a [Browser] to create a [Page]:@@ -18,31 +18,30 @@ const { firefox } = require('playwright'); // Or 'chromium' or 'webkit'.```See [ChromiumBrowser], [FirefoxBrowser] and [WebKitBrowser] for browser-specific features. Note that-[browserType.connect()]() and-[browserType.launch()]() always return a specific browser instance, based on the-browser being connected to or launched.+[browserType.connect()]() and [browserType.launch()]() always return a specific browser instance, based on the browser+being connected to or launched.<!-- GEN:toc --><!-- GEN:stop -->-#### event: 'disconnected'+#### event Browser.disconnectedEmitted 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.-#### browser.close+#### method Browser.close- returns: <[Promise]>-In case this browser is obtained using [browserType.launch()](), closes the browser and all of-its pages (if any were opened).+In case this browser is obtained using [browserType.launch()](), closes the browser and all of its pages (if any were+opened).-In case this browser is obtained using [browserType.connect()](), clears all created contexts-belonging to this browser and disconnects from the browser server.+In case this browser is obtained using [browserType.connect()](), clears all created contexts belonging to this browser+and disconnects from the browser server.The [Browser] object itself is considered to be disposed and cannot be used anymore.-#### browser.contexts+#### method Browser.contexts- returns: <[Array]<[BrowserContext]>>Returns an array of all open browser contexts. In a newly created browser, this will return zero browser contexts.@@ -55,12 +54,12 @@ const context = await browser.newContext();console.log(browser.contexts().length); // prints `1````-#### browser.isConnected+#### method Browser.isConnected- returns: <[boolean]>Indicates that the browser is connected.-#### browser.newContext+#### method Browser.newContext- `options` <[Object]>- %%-shared-context-params-%%-as-is- %%-context-option-proxy-%%@@ -80,7 +79,7 @@ Creates a new browser context. It won't share cookies/cache with other browser c})();```-#### browser.newPage+#### method Browser.newPage- `options` <[Object]>- %%-shared-context-params-%%-as-is- %%-context-option-proxy-%%@@ -90,10 +89,10 @@ Creates a new browser context. It won't share cookies/cache with other browser cCreates a new page in a new browser context. Closing this page will close the context as well.This is a convenience API that should only be used for the single-page scenarios and short snippets. Production code and-testing frameworks should explicitly create [browser.newContext()]() followed by the-[browserContext.newPage()]() to control their exact life times.+testing frameworks should explicitly create [browser.newContext()]() followed by the [browserContext.newPage()]() to+control their exact life times.-#### browser.version+#### method Browser.version- returns: <[string]>Returns the browser version.@@ -122,19 +121,18 @@ await context.close();<!-- GEN:toc --><!-- GEN:stop -->-#### event: 'close'+#### event BrowserContext.closeEmitted 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.-#### event: 'page'+#### event BrowserContext.page- <[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.+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 apopup with `window.open('http://example.com')`, this event will fire when the network request to "http://example.com" is@@ -148,10 +146,10 @@ const [page] = await Promise.all([console.log(await page.evaluate('location.href'));```-> **NOTE** Use [page.waitForLoadState()]() to wait until the page-gets to a particular state (you should not need it in most cases).+> **NOTE** Use [page.waitForLoadState()]() to wait until the page gets to a particular state (you should not need it in+most cases).-#### browserContext.addCookies+#### method BrowserContext.addCookies- `cookies` <[Array]<[Object]>>- `name` <[string]> **required**- `value` <[string]> **required**@@ -168,7 +166,7 @@ gets to a particular state (you should not need it in most cases).await browserContext.addCookies([cookieObject1, cookieObject2]);```-#### browserContext.addInitScript+#### method BrowserContext.addInitScript- `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 [current working directory](https://nodejs.org/api/process.html#process_process_cwd).- `content` <[string]> Raw script content.@@ -196,18 +194,18 @@ await browserContext.addInitScript({});```-> **NOTE** The order of evaluation of multiple scripts installed via [browserContext.addInitScript()]() and [page.addInitScript()]() is-not defined.+> **NOTE** The order of evaluation of multiple scripts installed via [browserContext.addInitScript()]() and+[page.addInitScript()]() is not defined.-#### browserContext.browser+#### method BrowserContext.browser- returns: <[null]|[Browser]> Returns the browser instance of the context. If it was launched as a persistent context null gets returned.-#### browserContext.clearCookies+#### method BrowserContext.clearCookies- returns: <[Promise]>Clears context cookies.-#### browserContext.clearPermissions+#### method BrowserContext.clearPermissions- returns: <[Promise]>Clears all permission overrides for the browser context.@@ -219,14 +217,14 @@ await context.grantPermissions(['clipboard-read']);context.clearPermissions();```-#### browserContext.close+#### method BrowserContext.close- returns: <[Promise]>Closes the browser context. All the pages that belong to the browser context will be closed.> **NOTE** the default browser context cannot be closed.-#### browserContext.cookies+#### method BrowserContext.cookies- `urls` <[string]|[Array]<[string]>> Optional list of URLs.- returns: <[Promise]<[Array]<[Object]>>>- `name` <[string]>@@ -241,7 +239,7 @@ Closes the browser context. All the pages that belong to the browser context wilIf no URLs are specified, this method returns all cookies. If URLs are specified, only cookies that affect those URLsare returned.-#### browserContext.exposeBinding+#### method BrowserContext.exposeBinding- `name` <[string]> Name of the function on the window object.- `playwrightBinding` <[function]> Callback function that will be called in the Playwright's context.- `options` <[Object]>@@ -255,8 +253,7 @@ of `playwrightBinding`. If the `playwrightBinding` returns a [Promise], it willThe first argument of the `playwrightBinding` function contains information about the caller: `{ browserContext:BrowserContext, page: Page, frame: Frame }`.-See [page.exposeBinding()]() for page-only-version.+See [page.exposeBinding()]() for page-only version.An example of exposing page URL to all frames in all pages in the context:@@ -296,7 +293,7 @@ await page.setContent(``);```-#### browserContext.exposeFunction+#### method BrowserContext.exposeFunction- `name` <[string]> Name of the function on the window object.- `playwrightFunction` <[function]> Callback function that will be called in the Playwright's context.- returns: <[Promise]>@@ -333,7 +330,7 @@ const crypto = require('crypto');})();```-#### browserContext.grantPermissions+#### method BrowserContext.grantPermissions- `permissions` <[Array]<[string]>> A permission or an array of permissions to grant. Permissions can be one of the following values:- `'geolocation'`- `'midi'`@@ -358,15 +355,15 @@ const crypto = require('crypto');Grants specified permissions to the browser context. Only grants corresponding permissions to the given origin ifspecified.-#### browserContext.newPage+#### method BrowserContext.newPage- returns: <[Promise]<[Page]>>Creates a new page in the browser context.-#### browserContext.pages+#### method BrowserContext.pages- returns: <[Array]<[Page]>> All open pages in the context. Non visible pages, such as `"background_page"`, will not be listed here. You can find them using [chromiumBrowserContext.backgroundPages()]().-#### browserContext.route+#### method BrowserContext.route- `url` <[string]|[RegExp]|[function]\([URL]\):[boolean]> A glob pattern, regex pattern or predicate receiving [URL] to match while routing.- `handler` <[function]\([Route], [Request]\)> handler function to route the request.- returns: <[Promise]>@@ -394,12 +391,12 @@ await page.goto('https://example.com');await browser.close();```-Page routes (set up with [page.route()]()) take precedence over browser context routes-when request matches both handlers.+Page routes (set up with [page.route()]()) take precedence over browser context routes when request matches both+handlers.> **NOTE** Enabling routing disables http cache.-#### browserContext.setDefaultNavigationTimeout+#### method BrowserContext.setDefaultNavigationTimeout- `timeout` <[number]> Maximum navigation time in millisecondsThis setting will change the default maximum navigation time for the following methods and related shortcuts:@@ -410,31 +407,28 @@ This setting will change the default maximum navigation time for the following m* [page.setContent()]()* [page.waitForNavigation()]()-> **NOTE** [page.setDefaultNavigationTimeout()]() and-[page.setDefaultTimeout()]() take priority over+> **NOTE** [page.setDefaultNavigationTimeout()]() and [page.setDefaultTimeout()]() take priority over[browserContext.setDefaultNavigationTimeout()]().-#### browserContext.setDefaultTimeout+#### method BrowserContext.setDefaultTimeout- `timeout` <[number]> Maximum time in millisecondsThis setting will change the default maximum time for all the methods accepting `timeout` option.-> **NOTE** [page.setDefaultNavigationTimeout()](),-[page.setDefaultTimeout()]() and-[browserContext.setDefaultNavigationTimeout()]() take priority over-[browserContext.setDefaultTimeout()]().+> **NOTE** [page.setDefaultNavigationTimeout()](), [page.setDefaultTimeout()]() and+[browserContext.setDefaultNavigationTimeout()]() take priority over [browserContext.setDefaultTimeout()]().-#### browserContext.setExtraHTTPHeaders+#### method BrowserContext.setExtraHTTPHeaders- `headers` <[Object]<[string], [string]>> An object containing additional HTTP headers to be sent with every request. All header values must be strings.- returns: <[Promise]>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()](). If page-overrides a particular header, page-specific header value will be used instead of the browser context header value.+with page-specific extra HTTP headers set with [page.setExtraHTTPHeaders()](). 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.-#### browserContext.setGeolocation+#### method BrowserContext.setGeolocation- `geolocation` <[null]|[Object]>- `latitude` <[number]> Latitude between -90 and 90. **required**- `longitude` <[number]> Longitude between -180 and 180. **required**@@ -447,10 +441,10 @@ Sets the context's geolocation. Passing `null` or `undefined` emulates positionawait browserContext.setGeolocation({latitude: 59.95, longitude: 30.31667});```-> **NOTE** Consider using [browserContext.grantPermissions()]() to grant-permissions for the browser context pages to read its geolocation.+> **NOTE** Consider using [browserContext.grantPermissions()]() to grant permissions for the browser context pages to+read its geolocation.-#### browserContext.setHTTPCredentials+#### method BrowserContext.setHTTPCredentials- `httpCredentials` <[null]|[Object]>- `username` <[string]> **required**- `password` <[string]> **required**@@ -462,11 +456,11 @@ Provide credentials for [HTTP authentication](https://developer.mozilla.org/en-U`null` to disable authentication will be unreliable. To remove or replace credentials, create a new browser contextinstead.-#### browserContext.setOffline+#### method BrowserContext.setOffline- `offline` <[boolean]> Whether to emulate network being offline for the browser context.- returns: <[Promise]>-#### browserContext.storageState+#### method BrowserContext.storageState- returns: <[Promise]<[Object]>>- `cookies` <[Array]<[Object]>>- `name` <[string]>@@ -485,15 +479,15 @@ instead.Returns storage state for this browser context, contains current cookies and local storage snapshot.-#### browserContext.unroute+#### method BrowserContext.unroute- `url` <[string]|[RegExp]|[function]\([URL]\):[boolean]> A glob pattern, regex pattern or predicate receiving [URL] used to register a routing with [browserContext.route()]().- `handler` <[function]\([Route], [Request]\)> Optional handler function used to register a routing with [browserContext.route()]().- returns: <[Promise]>-Removes a route created with [browserContext.route()](). When `handler` is-not specified, removes all routes for the `url`.+Removes a route created with [browserContext.route()](). When `handler` is not specified, removes all routes for the+`url`.-#### browserContext.waitForEvent+#### method BrowserContext.waitForEvent- `event` <[string]> Event name, same one would pass into `browserContext.on(event)`.- `optionsOrPredicate` <[Function]|[Object]> Either a predicate that receives an event or an options object. Optional.- `predicate` <[Function]> receives the event data and resolves to truthy value when the waiting should resolve.@@ -554,11 +548,11 @@ page.removeListener('request', logRequest);<!-- GEN:toc --><!-- GEN:stop -->-#### event: 'close'+#### event Page.closeEmitted when the page closes.-#### event: 'console'+#### event Page.console- <[ConsoleMessage]>Emitted when JavaScript within the page calls one of console API methods, e.g. `console.log` or `console.dir`. Also@@ -576,7 +570,7 @@ page.on('console', msg => {page.evaluate(() => console.log('hello', 5, {foo: 'bar'}));```-#### event: 'crash'+#### event Page.crashEmitted when the page crashes. Browser pages might crash if they try to allocate too much memory. When the page crashes,ongoing and subsequent operations will throw.@@ -607,18 +601,18 @@ await new Promise((resolve, reject) => {});```-#### event: 'dialog'+#### event Page.dialog- <[Dialog]>Emitted when a JavaScript dialog appears, such as `alert`, `prompt`, `confirm` or `beforeunload`. Playwright can respondto the dialog via [dialog.accept()]() or [dialog.dismiss()]() methods.-#### event: 'domcontentloaded'+#### event Page.domcontentloadedEmitted when the JavaScript [`DOMContentLoaded`](https://developer.mozilla.org/en-US/docs/Web/Events/DOMContentLoaded)event is dispatched.-#### event: 'download'+#### event Page.download- <[Download]>Emitted when attachment download started. User can access basic file operations on downloaded content via the passed@@ -628,12 +622,11 @@ Emitted when attachment download started. User can access basic file operationsdownloaded content. If `acceptDownloads` is not set or set to `false`, download events are emitted, but the actualdownload is not performed and user has no access to the downloaded files.-#### event: 'filechooser'+#### event Page.filechooser- <[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()]() that can be-uploaded after that.+respond to it via setting the input files using [fileChooser.setFiles()]() that can be uploaded after that.```jspage.on('filechooser', async (fileChooser) => {@@ -641,35 +634,35 @@ page.on('filechooser', async (fileChooser) => {});```-#### event: 'frameattached'+#### event Page.frameattached- <[Frame]>Emitted when a frame is attached.-#### event: 'framedetached'+#### event Page.framedetached- <[Frame]>Emitted when a frame is detached.-#### event: 'framenavigated'+#### event Page.framenavigated- <[Frame]>Emitted when a frame is navigated to a new url.-#### event: 'load'+#### event Page.loadEmitted when the JavaScript [`load`](https://developer.mozilla.org/en-US/docs/Web/Events/load) event is dispatched.-#### event: 'pageerror'+#### event Page.pageerror- <[Error]> The exception messageEmitted when an uncaught exception happens within the page.-#### event: 'popup'+#### event Page.popup- <[Page]> Page corresponding to "popup" window-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 apopup with `window.open('http://example.com')`, this event will fire when the network request to "http://example.com" is@@ -683,48 +676,47 @@ const [popup] = await Promise.all([console.log(await popup.evaluate('location.href'));```-> **NOTE** Use [page.waitForLoadState()]() to wait until the page-gets to a particular state (you should not need it in most cases).+> **NOTE** Use [page.waitForLoadState()]() to wait until the page gets to a particular state (you should not need it in+most cases).-#### event: 'request'+#### event Page.request- <[Request]>Emitted when a page issues a request. The [request] object is read-only. In order to intercept and mutate requests, see[page.route()]() or [browserContext.route()]().-#### event: 'requestfailed'+#### event Page.requestfailed- <[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')]().+will complete with [page.on('requestfinished')]() event and not with [page.on('requestfailed')]().-#### event: 'requestfinished'+#### event Page.requestfinished- <[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: 'response'+#### event Page.response- <[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: 'websocket'+#### event Page.websocket- <[WebSocket]> websocketEmitted when <[WebSocket]> request is sent.-#### event: 'worker'+#### event Page.worker- <[Worker]>Emitted when a dedicated [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) is spawned by thepage.-#### page.$+#### method Page.$- %%-query-selector-%%- returns: <[Promise]<[null]|[ElementHandle]>>@@ -733,7 +725,7 @@ return value resolves to `null`.Shortcut for main frame's [frame.$()]().-#### page.$$+#### method Page.$$- %%-query-selector-%%- returns: <[Promise]<[Array]<[ElementHandle]>>>@@ -742,7 +734,7 @@ return value resolves to `[]`.Shortcut for main frame's [frame.$$()]().-#### page.$eval+#### method Page.$eval- %%-query-selector-%%- `pageFunction` <[function]\([Element]\)> Function to be evaluated in browser context- `arg` <[EvaluationArgument]> Optional argument to pass to `pageFunction`@@ -763,7 +755,7 @@ const html = await page.$eval('.main-container', (e, suffix) => e.outerHTML + suShortcut for main frame's [frame.$eval()]().-#### page.$$eval+#### method Page.$$eval- %%-query-selector-%%- `pageFunction` <[function]\([Array]<[Element]>\)> Function to be evaluated in browser context- `arg` <[EvaluationArgument]> Optional argument to pass to `pageFunction`@@ -780,10 +772,10 @@ Examples:const divsCounts = await page.$$eval('div', (divs, min) => divs.length >= min, 10);```-#### page.accessibility+#### namespace Page.accessibility- returns: <[Accessibility]>-#### page.addInitScript+#### method Page.addInitScript- `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 [current working directory](https://nodejs.org/api/process.html#process_process_cwd).- `content` <[string]> Raw script content.@@ -808,10 +800,10 @@ const preloadFile = fs.readFileSync('./preload.js', 'utf8');await page.addInitScript(preloadFile);```-> **NOTE** The order of evaluation of multiple scripts installed via [browserContext.addInitScript()]() and [page.addInitScript()]() is-not defined.+> **NOTE** The order of evaluation of multiple scripts installed via [browserContext.addInitScript()]() and+[page.addInitScript()]() is not defined.-#### page.addScriptTag+#### method Page.addScriptTag- `script` <[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 [current working directory](https://nodejs.org/api/process.html#process_process_cwd).@@ -823,7 +815,7 @@ Adds a `<script>` tag into the page with the desired url or content.Shortcut for main frame's [frame.addScriptTag()]().-#### page.addStyleTag+#### method Page.addStyleTag- `style` <[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 [current working directory](https://nodejs.org/api/process.html#process_process_cwd).@@ -835,12 +827,12 @@ content.Shortcut for main frame's [frame.addStyleTag()]().-#### page.bringToFront+#### method Page.bringToFront- returns: <[Promise]>Brings page to front (activates tab).-#### page.check+#### method Page.check- %%-input-selector-%%- `options` <[Object]>- %%-input-force-%%@@ -862,7 +854,7 @@ Passing zero timeout disables this.Shortcut for main frame's [frame.check()]().-#### page.click+#### method Page.click- %%-input-selector-%%- `options` <[Object]>- %%-input-button-%%@@ -887,7 +879,7 @@ Passing zero timeout disables this.Shortcut for main frame's [frame.click()]().-#### page.close+#### method Page.close- `options` <[Object]>- `runBeforeUnload` <[boolean]> Defaults to `false`. Whether to run the [before unload](https://developer.mozilla.org/en-US/docs/Web/Events/beforeunload) page handlers.- returns: <[Promise]>@@ -899,23 +891,23 @@ handlers.> **NOTE** if `runBeforeUnload` is passed as true, a `beforeunload` dialog might be summoned> and should be handled manually via [page.on('dialog')]() event.-#### page.content+#### method Page.content- returns: <[Promise]<[string]>>Gets the full HTML contents of the page, including the doctype.-#### page.context+#### method Page.context- returns: <[BrowserContext]>Get the browser context that the page belongs to.-#### page.coverage+#### namespace Page.coverage- returns: <[null]|[ChromiumCoverage]>Browser-specific Coverage implementation, only available for Chromium atm. See[ChromiumCoverage](#class-chromiumcoverage) for more details.-#### page.dblclick+#### method Page.dblclick- %%-input-selector-%%- `options` <[Object]>- %%-input-button-%%@@ -941,7 +933,7 @@ Passing zero timeout disables this.Shortcut for main frame's [frame.dblclick()]().-#### page.dispatchEvent+#### method Page.dispatchEvent- %%-input-selector-%%- `type` <[string]> DOM event type: `"click"`, `"dragstart"`, etc.- `eventInit` <[EvaluationArgument]> Optional event-specific initialization properties.@@ -977,7 +969,7 @@ const dataTransfer = await page.evaluateHandle(() => new DataTransfer());await page.dispatchEvent('#source', 'dragstart', { dataTransfer });```-#### page.emulateMedia+#### method Page.emulateMedia- `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.@@ -1012,7 +1004,7 @@ await page.evaluate(() => matchMedia('(prefers-color-scheme: no-preference)').ma// → false```-#### page.evaluate+#### method Page.evaluate- `pageFunction` <[function]|[string]> Function to be evaluated in the page context- `arg` <[EvaluationArgument]> Optional argument to pass to `pageFunction`- returns: <[Promise]<[Serializable]>> Promise which resolves to the return value of `pageFunction`@@ -1051,7 +1043,7 @@ await bodyHandle.dispose();Shortcut for main frame's [frame.evaluate()]().-#### page.evaluateHandle+#### method Page.evaluateHandle- `pageFunction` <[function]|[string]> Function to be evaluated in the page context- `arg` <[EvaluationArgument]> Optional argument to pass to `pageFunction`- returns: <[Promise]<[JSHandle]>> Promise which resolves to the return value of `pageFunction` as in-page object (JSHandle)@@ -1077,7 +1069,7 @@ console.log(await resultHandle.jsonValue());await resultHandle.dispose();```-#### page.exposeBinding+#### method Page.exposeBinding- `name` <[string]> Name of the function on the window object.- `playwrightBinding` <[function]> Callback function that will be called in the Playwright's context.- `options` <[Object]>@@ -1091,8 +1083,7 @@ executes `playwrightBinding` in Node.js and returns a [Promise] which resolves tThe first argument of the `playwrightBinding` function contains information about the caller: `{ browserContext:BrowserContext, page: Page, frame: Frame }`.-See [browserContext.exposeBinding()]()-for the context-wide version.+See [browserContext.exposeBinding()]() for the context-wide version.> **NOTE** Functions installed via `page.exposeBinding` survive navigations.@@ -1134,7 +1125,7 @@ await page.setContent(``);```-#### page.exposeFunction+#### method Page.exposeFunction- `name` <[string]> Name of the function on the window object- `playwrightFunction` <[function]> Callback function which will be called in Playwright's context.- returns: <[Promise]>@@ -1145,8 +1136,7 @@ executes `playwrightFunction` in Node.js and returns a [Promise] which resolvesIf the `playwrightFunction` returns a [Promise], it will be awaited.-See [browserContext.exposeFunction()]() for-context-wide exposed function.+See [browserContext.exposeFunction()]() for context-wide exposed function.> **NOTE** Functions installed via `page.exposeFunction` survive navigations.@@ -1202,7 +1192,7 @@ const fs = require('fs');})();```-#### page.fill+#### method Page.fill- %%-input-selector-%%- `value` <[string]> Value to fill for the `<input>`, `<textarea>` or `[contenteditable]` element.- `options` <[Object]>@@ -1219,7 +1209,7 @@ To send fine-grained keyboard events, use [page.type()]().Shortcut for main frame's [frame.fill()]()-#### page.focus+#### method Page.focus- %%-input-selector-%%- `options` <[Object]>- %%-input-timeout-%%@@ -1230,7 +1220,7 @@ waits until a matching element appears in the DOM.Shortcut for main frame's [frame.focus()]().-#### page.frame+#### method Page.frame- `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.@@ -1246,10 +1236,10 @@ const frame = page.frame({ url: /.*domain.*/ });Returns frame matching the specified criteria. Either `name` or `url` must be specified.-#### page.frames+#### method Page.frames- returns: <[Array]<[Frame]>> An array of all frames attached to the page.-#### page.getAttribute+#### method Page.getAttribute- %%-input-selector-%%- `name` <[string]> Attribute name to get the value for.- `options` <[Object]>@@ -1258,7 +1248,7 @@ Returns frame matching the specified criteria. Either `name` or `url` must be spReturns element attribute value.-#### page.goBack+#### method Page.goBack- `options` <[Object]>- %%-navigation-timeout-%%- %%-navigation-wait-until-%%@@ -1266,7 +1256,7 @@ Returns element attribute value.Navigate to the previous page in history.-#### page.goForward+#### method Page.goForward- `options` <[Object]>- %%-navigation-timeout-%%- %%-navigation-wait-until-%%@@ -1274,7 +1264,7 @@ Navigate to the previous page in history.Navigate to the next page in history.-#### page.goto+#### method Page.goto- `url` <[string]> URL to navigate page to. The url should include scheme, e.g. `https://`.- `options` <[Object]>- %%-navigation-timeout-%%@@ -1300,7 +1290,7 @@ issue](https://bugs.chromium.org/p/chromium/issues/detail?id=761295).Shortcut for main frame's [frame.goto()]()-#### page.hover+#### method Page.hover- %%-input-selector-%%- `options` <[Object]>- %%-input-position-%%@@ -1321,7 +1311,7 @@ Passing zero timeout disables this.Shortcut for main frame's [frame.hover()]().-#### page.innerHTML+#### method Page.innerHTML- %%-input-selector-%%- `options` <[Object]>- %%-input-timeout-%%@@ -1329,7 +1319,7 @@ Shortcut for main frame's [frame.hover()]().Resolves to the `element.innerHTML`.-#### page.innerText+#### method Page.innerText- %%-input-selector-%%- `options` <[Object]>- %%-input-timeout-%%@@ -1337,26 +1327,26 @@ Resolves to the `element.innerHTML`.Resolves to the `element.innerText`.-#### page.isClosed+#### method Page.isClosed- returns: <[boolean]>Indicates that the page has been closed.-#### page.keyboard+#### namespace Page.keyboard- returns: <[Keyboard]>-#### page.mainFrame+#### method Page.mainFrame- returns: <[Frame]> The page's main frame.Page is guaranteed to have a main frame which persists during navigations.-#### page.mouse+#### namespace Page.mouse- returns: <[Mouse]>-#### page.opener+#### method Page.opener- returns: <[Promise]<[null]|[Page]>> Promise which resolves to the opener for popup pages and `null` for others. If the opener has been closed already the promise may resolve to `null`.-#### page.pdf+#### method Page.pdf- `options` <[Object]>- `path` <[string]> The file path to save the PDF to. If `path` is a relative path, then it is resolved relative to [current working directory](https://nodejs.org/api/process.html#process_process_cwd). If no path is provided, the PDF won't be saved to the disk.- `scale` <[number]> Scale of the webpage rendering. Defaults to `1`. Scale amount must be between 0.1 and 2.@@ -1427,7 +1417,7 @@ The `format` options are:> 1. Script tags inside templates are not evaluated.> 2. Page styles are not visible inside templates.-#### page.press+#### method Page.press- %%-input-selector-%%- `key` <[string]> Name of the key to press or a character to generate, such as `ArrowLeft` or `a`.- `options` <[Object]>@@ -1467,13 +1457,13 @@ await page.screenshot({ path: 'O.png' });await browser.close();```-#### page.reload+#### method Page.reload- `options` <[Object]>- %%-navigation-timeout-%%- %%-navigation-wait-until-%%- returns: <[Promise]<[null]|[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.-#### page.route+#### method Page.route- `url` <[string]|[RegExp]|[function]\([URL]\):[boolean]> A glob pattern, regex pattern or predicate receiving [URL] to match while routing.- `handler` <[function]\([Route], [Request]\)> handler function to route the request.- returns: <[Promise]>.@@ -1502,11 +1492,12 @@ await page.goto('https://example.com');await browser.close();```-Page routes take precedence over browser context routes (set up with [browserContext.route()]()) when request matches both handlers.+Page routes take precedence over browser context routes (set up with [browserContext.route()]()) when request matches+both handlers.> **NOTE** Enabling routing disables http cache.-#### page.screenshot+#### method Page.screenshot- `options` <[Object]>- `path` <[string]> The file path to save the image to. The screenshot type will be inferred from file extension. If `path` is a relative path, then it is resolved relative to [current working directory](https://nodejs.org/api/process.html#process_process_cwd). If no path is provided, the image won't be saved to the disk.- `type` <"png"|"jpeg"> Specify screenshot type, defaults to `png`.@@ -1524,7 +1515,7 @@ Page routes take precedence over browser context routes (set up with [browserCon> **NOTE** Screenshots take at least 1/6 second on Chromium OS X and Chromium Windows. See https://crbug.com/741689 fordiscussion.-#### page.selectOption+#### method Page.selectOption- %%-input-selector-%%- `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`.@@ -1552,14 +1543,14 @@ page.selectOption('select#colors', ['red', 'green', 'blue']);Shortcut for main frame's [frame.selectOption()]()-#### page.setContent+#### method Page.setContent- `html` <[string]> HTML markup to assign to the page.- `options` <[Object]>- %%-navigation-timeout-%%- %%-navigation-wait-until-%%- returns: <[Promise]>-#### page.setDefaultNavigationTimeout+#### method Page.setDefaultNavigationTimeout- `timeout` <[number]> Maximum navigation time in millisecondsThis setting will change the default maximum navigation time for the following methods and related shortcuts:@@ -1570,20 +1561,17 @@ This setting will change the default maximum navigation time for the following m* [page.setContent()]()* [page.waitForNavigation()]()-> **NOTE** [page.setDefaultNavigationTimeout()]() takes priority over-[page.setDefaultTimeout()](),-[browserContext.setDefaultTimeout()]() and-[browserContext.setDefaultNavigationTimeout()]().+> **NOTE** [page.setDefaultNavigationTimeout()]() takes priority over [page.setDefaultTimeout()](),+[browserContext.setDefaultTimeout()]() and [browserContext.setDefaultNavigationTimeout()]().-#### page.setDefaultTimeout+#### method Page.setDefaultTimeout- `timeout` <[number]> Maximum time in millisecondsThis setting will change the default maximum time for all the methods accepting `timeout` option.-> **NOTE** [page.setDefaultNavigationTimeout()]() takes priority over-[page.setDefaultTimeout()]().+> **NOTE** [page.setDefaultNavigationTimeout()]() takes priority over [page.setDefaultTimeout()]().-#### page.setExtraHTTPHeaders+#### method Page.setExtraHTTPHeaders- `headers` <[Object]<[string], [string]>> An object containing additional HTTP headers to be sent with every request. All header values must be strings.- returns: <[Promise]>@@ -1591,7 +1579,7 @@ 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.-#### page.setInputFiles+#### method Page.setInputFiles- %%-input-selector-%%- %%-input-files-%%- `options` <[Object]>@@ -1606,15 +1594,14 @@ Sets the value of the file input to these file paths or files. If some of the `fare resolved relative to the [current working directory](https://nodejs.org/api/process.html#process_process_cwd). Forempty array, clears the selected files.-#### page.setViewportSize+#### method Page.setViewportSize- `viewportSize` <[Object]>- `width` <[number]> page width in pixels. **required**- `height` <[number]> page height in pixels. **required**- returns: <[Promise]>In the case of multiple pages in a single browser, each page can have its own viewport size. However,-[browser.newContext()]() allows to set viewport size (and more) for all pages in the-context at once.+[browser.newContext()]() allows to set viewport size (and more) for all pages in the context at once.`page.setViewportSize` will resize the page. A lot of websites don't expect phones to change size, so you should set theviewport size before navigating to the page.@@ -1628,7 +1615,7 @@ await page.setViewportSize({await page.goto('https://example.com');```-#### page.tap+#### method Page.tap- %%-input-selector-%%- `options` <[Object]>- %%-input-position-%%@@ -1652,7 +1639,7 @@ Passing zero timeout disables this.Shortcut for main frame's [frame.tap()]().-#### page.textContent+#### method Page.textContent- %%-input-selector-%%- `options` <[Object]>- %%-input-timeout-%%@@ -1660,15 +1647,15 @@ Shortcut for main frame's [frame.tap()]().Resolves to the `element.textContent`.-#### page.title+#### method Page.title- returns: <[Promise]<[string]>> The page's title.Shortcut for main frame's [frame.title()]().-#### page.touchscreen+#### namespace Page.touchscreen- returns: <[Touchscreen]>-#### page.type+#### method Page.type- %%-input-selector-%%- `text` <[string]> A text to type into a focused element.- `options` <[Object]>@@ -1689,7 +1676,7 @@ await page.type('#mytextarea', 'World', {delay: 100}); // Types slower, like a uShortcut for main frame's [frame.type()]().-#### page.uncheck+#### method Page.uncheck- %%-input-selector-%%- `options` <[Object]>- %%-input-force-%%@@ -1711,30 +1698,29 @@ Passing zero timeout disables this.Shortcut for main frame's [frame.uncheck()]().-#### page.unroute+#### method Page.unroute- `url` <[string]|[RegExp]|[function]\([URL]\):[boolean]> A glob pattern, regex pattern or predicate receiving [URL] to match while routing.- `handler` <[function]\([Route], [Request]\)> Optional handler function to route the request.- returns: <[Promise]>-Removes a route created with [page.route()](). When `handler` is not specified, removes-all routes for the `url`.+Removes a route created with [page.route()](). When `handler` is not specified, removes all routes for the `url`.-#### page.url+#### method Page.url- returns: <[string]>Shortcut for main frame's [frame.url()]().-#### page.video+#### method Page.video- returns: <[null]|[Video]>Video object associated with this page.-#### page.viewportSize+#### method Page.viewportSize- returns: <[null]|[Object]>- `width` <[number]> page width in pixels.- `height` <[number]> page height in pixels.-#### page.waitForEvent+#### method Page.waitForEvent- `event` <[string]> Event name, same one would pass into `page.on(event)`.- `optionsOrPredicate` <[Function]|[Object]> Either a predicate that receives an event or an options object. Optional.- `predicate` <[Function]> receives the event data and resolves to truthy value when the waiting should resolve.@@ -1744,7 +1730,7 @@ Video object associated with this page.Waits for event to fire and passes its value into the predicate function. Resolves when the predicate returns truthyvalue. Will throw an error if the page is closed before the event is fired.-#### page.waitForFunction+#### method Page.waitForFunction- `pageFunction` <[function]|[string]> Function to be evaluated in browser context- `arg` <[EvaluationArgument]> Optional argument to pass to `pageFunction`- `options` <[Object]>@@ -1776,7 +1762,7 @@ await page.waitForFunction(selector => !!document.querySelector(selector), selecShortcut for main frame's [frame.waitForFunction()]().-#### page.waitForLoadState+#### method Page.waitForLoadState- `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.@@ -1804,7 +1790,7 @@ console.log(await popup.title()); // Popup is ready to use.Shortcut for main frame's [frame.waitForLoadState()]().-#### page.waitForNavigation+#### method Page.waitForNavigation- `options` <[Object]>- %%-navigation-timeout-%%- `url` <[string]|[RegExp]|[Function]> A glob pattern, regex pattern or predicate receiving [URL] to match while waiting for the navigation.@@ -1827,7 +1813,7 @@ considered a navigation.Shortcut for main frame's [frame.waitForNavigation()]().-#### page.waitForRequest+#### method Page.waitForRequest- `urlOrPredicate` <[string]|[RegExp]|[Function]> Request URL string, regex or predicate receiving [Request] object.- `options` <[Object]>- `timeout` <[number]> Maximum wait time in milliseconds, defaults to 30 seconds, pass `0` to disable the timeout. The default value can be changed by using the [page.setDefaultTimeout()]() method.@@ -1843,7 +1829,7 @@ return firstRequest.url();await page.waitForRequest(request => request.url().searchParams.get('foo') === 'bar' && request.url().searchParams.get('foo2') === 'bar2');```-#### page.waitForResponse+#### method Page.waitForResponse- `urlOrPredicate` <[string]|[RegExp]|[function]\([Response]\):[boolean]> Request URL string, regex or predicate receiving [Response] object.- `options` <[Object]>- `timeout` <[number]> Maximum wait time in milliseconds, defaults to 30 seconds, pass `0` to disable the timeout. The default value can be changed by using the [browserContext.setDefaultTimeout()]() or [page.setDefaultTimeout()]() methods.@@ -1855,7 +1841,7 @@ const finalResponse = await page.waitForResponse(response => response.url() ===return finalResponse.ok();```-#### page.waitForSelector+#### method Page.waitForSelector- %%-query-selector-%%- `options` <[Object]>- %%-wait-for-selector-state-%%@@ -1885,7 +1871,7 @@ const { chromium } = require('playwright'); // Or 'firefox' or 'webkit'.})();```-#### page.waitForTimeout+#### method Page.waitForTimeout- `timeout` <[number]> A timeout to wait for- returns: <[Promise]>@@ -1901,20 +1887,20 @@ await page.waitForTimeout(1000);Shortcut for main frame's [frame.waitForTimeout()]().-#### page.workers+#### method Page.workers- returns: <[Array]<[Worker]>> This method returns all of the dedicated [WebWorkers](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) associated with the page.> **NOTE** This does not contain ServiceWorkers### class: Frame-At every point of time, page exposes its current frame tree via the [page.mainFrame()]() and-[frame.childFrames()]() methods.+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:-- [frame.on('frameattached')]() - fired when the frame gets attached to the page. A Frame can be attached to the page only once.-- [frame.on('framenavigated')]() - fired when the frame commits navigation to a different URL.-- [frame.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:@@ -1948,7 +1934,7 @@ console.log(text);<!-- GEN:toc --><!-- GEN:stop -->-#### frame.$+#### method Frame.$- %%-query-selector-%%- returns: <[Promise]<[null]|[ElementHandle]>> Promise which resolves to ElementHandle pointing to the frame element.@@ -1956,7 +1942,7 @@ The method finds an element matching the specified selector within the frame. Seselectors](#working-with-selectors) for more details. If no elements match the selector, the return value resolves to`null`.-#### frame.$$+#### method Frame.$$- %%-query-selector-%%- returns: <[Promise]<[Array]<[ElementHandle]>>> Promise which resolves to ElementHandles pointing to the frame elements.@@ -1964,7 +1950,7 @@ The method finds all elements matching the specified selector within the frame.selectors](#working-with-selectors) for more details. If no elements match the selector, the return value resolves to`[]`.-#### frame.$eval+#### method Frame.$eval- %%-query-selector-%%- `pageFunction` <[function]\([Element]\)> Function to be evaluated in browser context- `arg` <[EvaluationArgument]> Optional argument to pass to `pageFunction`@@ -1984,7 +1970,7 @@ const preloadHref = await frame.$eval('link[rel=preload]', el => el.href);const html = await frame.$eval('.main-container', (e, suffix) => e.outerHTML + suffix, 'hello');```-#### frame.$$eval+#### method Frame.$$eval- %%-query-selector-%%- `pageFunction` <[function]\([Array]<[Element]>\)> Function to be evaluated in browser context- `arg` <[EvaluationArgument]> Optional argument to pass to `pageFunction`@@ -2001,7 +1987,7 @@ Examples:const divsCounts = await frame.$$eval('div', (divs, min) => divs.length >= min, 10);```-#### frame.addScriptTag+#### method Frame.addScriptTag- `script` <[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 [current working directory](https://nodejs.org/api/process.html#process_process_cwd).@@ -2011,7 +1997,7 @@ const divsCounts = await frame.$$eval('div', (divs, min) => divs.length >= min,Adds a `<script>` tag into the page with the desired url or content.-#### frame.addStyleTag+#### method Frame.addStyleTag- `style` <[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 [current working directory](https://nodejs.org/api/process.html#process_process_cwd).@@ -2021,7 +2007,7 @@ Adds a `<script>` tag into the page with the desired url or content.Adds a `<link rel="stylesheet">` tag into the page with the desired url or a `<style type="text/css">` tag with thecontent.-#### frame.check+#### method Frame.check- %%-input-selector-%%- `options` <[Object]>- %%-input-force-%%@@ -2041,10 +2027,10 @@ This method checks an element matching `selector` by performing the following stWhen all steps combined have not finished during the specified `timeout`, this method rejects with a [TimeoutError].Passing zero timeout disables this.-#### frame.childFrames+#### method Frame.childFrames- returns: <[Array]<[Frame]>>-#### frame.click+#### method Frame.click- %%-input-selector-%%- `options` <[Object]>- %%-input-button-%%@@ -2067,12 +2053,12 @@ This method clicks an element matching `selector` by performing the following stWhen all steps combined have not finished during the specified `timeout`, this method rejects with a [TimeoutError].Passing zero timeout disables this.-#### frame.content+#### method Frame.content- returns: <[Promise]<[string]>>Gets the full HTML contents of the frame, including the doctype.-#### frame.dblclick+#### method Frame.dblclick- %%-input-selector-%%- `options` <[Object]>- %%-input-button-%%@@ -2096,7 +2082,7 @@ Passing zero timeout disables this.> **NOTE** `frame.dblclick()` dispatches two `click` events and a single `dblclick` event.-#### frame.dispatchEvent+#### method Frame.dispatchEvent- %%-input-selector-%%- `type` <[string]> DOM event type: `"click"`, `"dragstart"`, etc.- `eventInit` <[EvaluationArgument]> Optional event-specific initialization properties.@@ -2132,7 +2118,7 @@ const dataTransfer = await frame.evaluateHandle(() => new DataTransfer());await frame.dispatchEvent('#source', 'dragstart', { dataTransfer });```-#### frame.evaluate+#### method Frame.evaluate- `pageFunction` <[function]|[string]> Function to be evaluated in browser context- `arg` <[EvaluationArgument]> Optional argument to pass to `pageFunction`- returns: <[Promise]<[Serializable]>> Promise which resolves to the return value of `pageFunction`@@ -2165,7 +2151,7 @@ const html = await frame.evaluate(([body, suffix]) => body.innerHTML + suffix, [await bodyHandle.dispose();```-#### frame.evaluateHandle+#### method Frame.evaluateHandle- `pageFunction` <[function]|[string]> Function to be evaluated in the page context- `arg` <[EvaluationArgument]> Optional argument to pass to `pageFunction`- returns: <[Promise]<[JSHandle]>> Promise which resolves to the return value of `pageFunction` as in-page object (JSHandle)@@ -2196,7 +2182,7 @@ console.log(await resultHandle.jsonValue());await resultHandle.dispose();```-#### frame.fill+#### method Frame.fill- %%-input-selector-%%- `value` <[string]> Value to fill for the `<input>`, `<textarea>` or `[contenteditable]` element.- `options` <[Object]>@@ -2211,7 +2197,7 @@ clear the input field.To send fine-grained keyboard events, use [frame.type()]().-#### frame.focus+#### method Frame.focus- %%-input-selector-%%- `options` <[Object]>- %%-input-timeout-%%@@ -2220,11 +2206,10 @@ To send fine-grained keyboard events, use [frame.type()]().This method fetches an element with `selector` and focuses it. If there's no element matching `selector`, the methodwaits until a matching element appears in the DOM.-#### frame.frameElement+#### method Frame.frameElement- returns: <[Promise]<[ElementHandle]>> Promise that resolves with a `frame` or `iframe` element handle which corresponds to this frame.-This is an inverse of [elementHandle.contentFrame()](). Note that returned handle actually-belongs to the parent frame.+This is an inverse of [elementHandle.contentFrame()](). Note that returned handle actually belongs to the parent frame.This method throws an error if the frame has been detached before `frameElement()` returns.@@ -2234,7 +2219,7 @@ const contentFrame = await frameElement.contentFrame();console.log(frame === contentFrame); // -> true```-#### frame.getAttribute+#### method Frame.getAttribute- %%-input-selector-%%- `name` <[string]> Attribute name to get the value for.- `options` <[Object]>@@ -2243,7 +2228,7 @@ console.log(frame === contentFrame); // -> trueReturns element attribute value.-#### frame.goto+#### method Frame.goto- `url` <[string]> URL to navigate frame to. The url should include scheme, e.g. `https://`.- `options` <[Object]>- %%-navigation-timeout-%%@@ -2267,7 +2252,7 @@ to `about:blank` or navigation to the same URL with a different hash, which woul> **NOTE** Headless mode doesn't support navigation to a PDF document. See the [upstreamissue](https://bugs.chromium.org/p/chromium/issues/detail?id=761295).-#### frame.hover+#### method Frame.hover- %%-input-selector-%%- `options` <[Object]>- %%-input-position-%%@@ -2286,7 +2271,7 @@ This method hovers over an element matching `selector` by performing the followiWhen all steps combined have not finished during the specified `timeout`, this method rejects with a [TimeoutError].Passing zero timeout disables this.-#### frame.innerHTML+#### method Frame.innerHTML- %%-input-selector-%%- `options` <[Object]>- %%-input-timeout-%%@@ -2294,7 +2279,7 @@ Passing zero timeout disables this.Resolves to the `element.innerHTML`.-#### frame.innerText+#### method Frame.innerText- %%-input-selector-%%- `options` <[Object]>- %%-input-timeout-%%@@ -2302,12 +2287,12 @@ Resolves to the `element.innerHTML`.Resolves to the `element.innerText`.-#### frame.isDetached+#### method Frame.isDetached- returns: <[boolean]>Returns `true` if the frame has been detached, or `false` otherwise.-#### frame.name+#### method Frame.name- returns: <[string]>Returns frame's name attribute as specified in the tag.@@ -2317,15 +2302,15 @@ 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 changedlater.-#### frame.page+#### method Frame.page- returns: <[Page]>Returns the page containing this frame.-#### frame.parentFrame+#### method Frame.parentFrame- returns: <[null]|[Frame]> Parent frame, if any. Detached frames and main frames return `null`.-#### frame.press+#### method Frame.press- %%-input-selector-%%- `key` <[string]> Name of the key to press or a character to generate, such as `ArrowLeft` or `a`.- `options` <[Object]>@@ -2351,7 +2336,7 @@ texts.Shortcuts such as `key: "Control+o"` or `key: "Control+Shift+T"` are supported as well. When speficied with themodifier, modifier is pressed and being held while the subsequent key is being pressed.-#### frame.selectOption+#### method Frame.selectOption- %%-query-selector-%%- `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`.@@ -2376,14 +2361,14 @@ frame.selectOption('select#colors', { label: 'Blue' });frame.selectOption('select#colors', 'red', 'green', 'blue');```-#### frame.setContent+#### method Frame.setContent- `html` <[string]> HTML markup to assign to the page.- `options` <[Object]>- %%-navigation-timeout-%%- %%-navigation-wait-until-%%- returns: <[Promise]>-#### frame.setInputFiles+#### method Frame.setInputFiles- %%-input-selector-%%- %%-input-files-%%- `options` <[Object]>@@ -2398,7 +2383,7 @@ Sets the value of the file input to these file paths or files. If some of the `fare resolved relative to the [current working directory](https://nodejs.org/api/process.html#process_process_cwd). Forempty array, clears the selected files.-#### frame.tap+#### method Frame.tap- %%-input-selector-%%- `options` <[Object]>- %%-input-position-%%@@ -2420,7 +2405,7 @@ Passing zero timeout disables this.> **NOTE** `frame.tap()` requires that the `hasTouch` option of the browser context be set to true.-#### frame.textContent+#### method Frame.textContent- %%-input-selector-%%- `options` <[Object]>- %%-input-timeout-%%@@ -2428,10 +2413,10 @@ Passing zero timeout disables this.Resolves to the `element.textContent`.-#### frame.title+#### method Frame.title- returns: <[Promise]<[string]>> The page's title.-#### frame.type+#### method Frame.type- %%-input-selector-%%- `text` <[string]> A text to type into a focused element.- `options` <[Object]>@@ -2450,7 +2435,7 @@ await frame.type('#mytextarea', 'Hello'); // Types instantlyawait frame.type('#mytextarea', 'World', {delay: 100}); // Types slower, like a user```-#### frame.uncheck+#### method Frame.uncheck- %%-input-selector-%%- `options` <[Object]>- %%-input-force-%%@@ -2470,12 +2455,12 @@ This method checks an element matching `selector` by performing the following stWhen all steps combined have not finished during the specified `timeout`, this method rejects with a [TimeoutError].Passing zero timeout disables this.-#### frame.url+#### method Frame.url- returns: <[string]>Returns frame's url.-#### frame.waitForFunction+#### method Frame.waitForFunction- `pageFunction` <[function]|[string]> Function to be evaluated in browser context- `arg` <[EvaluationArgument]> Optional argument to pass to `pageFunction`- `options` <[Object]>@@ -2505,7 +2490,7 @@ const selector = '.foo';await frame.waitForFunction(selector => !!document.querySelector(selector), selector);```-#### frame.waitForLoadState+#### method Frame.waitForLoadState- `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.@@ -2522,7 +2507,7 @@ await frame.click('button'); // Click triggers navigation.await frame.waitForLoadState(); // The promise resolves after 'load' event.```-#### frame.waitForNavigation+#### method Frame.waitForNavigation- `options` <[Object]>- %%-navigation-timeout-%%- `url` <[string]|[RegExp]|[Function]> URL string, URL regex pattern or predicate receiving [URL] to match while waiting for the navigation.@@ -2542,7 +2527,7 @@ const [response] = await Promise.all([**NOTE** Usage of the [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) to change the URL isconsidered a navigation.-#### frame.waitForSelector+#### method Frame.waitForSelector- %%-query-selector-%%- `options` <[Object]>- %%-wait-for-selector-state-%%@@ -2572,7 +2557,7 @@ const { webkit } = require('playwright'); // Or 'chromium' or 'firefox'.})();```-#### frame.waitForTimeout+#### method Frame.waitForTimeout- `timeout` <[number]> A timeout to wait for- returns: <[Promise]>@@ -2602,8 +2587,7 @@ const { chromium } = require('playwright'); // Or 'firefox' or 'webkit'.ElementHandle prevents DOM element from garbage collection unless the handle is disposed with [jsHandle.dispose()]().ElementHandles are auto-disposed when their origin frame gets navigated.-ElementHandle instances can be used as an argument in [page.$eval()]() and-[page.evaluate()]() methods.+ElementHandle instances can be used as an argument in [page.$eval()]() and [page.evaluate()]() methods.<!-- GEN:toc --><!-- GEN:stop -->@@ -2611,7 +2595,7 @@ ElementHandle instances can be used as an argument in [page.$eval()]() and<!-- GEN:toc-extends-JSHandle --><!-- GEN:stop -->-#### elementHandle.$+#### method ElementHandle.$- %%-query-selector-%%- returns: <[Promise]<[null]|[ElementHandle]>>@@ -2619,7 +2603,7 @@ The method finds an element matching the specified selector in the `ElementHandlselectors](#working-with-selectors) for more details. If no elements match the selector, the return value resolves to`null`.-#### elementHandle.$$+#### method ElementHandle.$$- %%-query-selector-%%- returns: <[Promise]<[Array]<[ElementHandle]>>>@@ -2627,7 +2611,7 @@ The method finds all elements matching the specified selector in the `ElementHanselectors](#working-with-selectors) for more details. If no elements match the selector, the return value resolves to`[]`.-#### elementHandle.$eval+#### method ElementHandle.$eval- %%-query-selector-%%- `pageFunction` <[function]\([Element]\)> Function to be evaluated in browser context- `arg` <[EvaluationArgument]> Optional argument to pass to `pageFunction`@@ -2647,7 +2631,7 @@ expect(await tweetHandle.$eval('.like', node => node.innerText)).toBe('100');expect(await tweetHandle.$eval('.retweets', node => node.innerText)).toBe('10');```-#### elementHandle.$$eval+#### method ElementHandle.$$eval- %%-query-selector-%%- `pageFunction` <[function]\([Array]<[Element]>\)> Function to be evaluated in browser context- `arg` <[EvaluationArgument]> Optional argument to pass to `pageFunction`@@ -2673,7 +2657,7 @@ const feedHandle = await page.$('.feed');expect(await feedHandle.$$eval('.tweet', nodes => nodes.map(n => n.innerText))).toEqual(['Hello!', 'Hi!']);```-#### elementHandle.boundingBox+#### method ElementHandle.boundingBox- returns: <[Promise]<[null]|[Object]>>- `x` <[number]> the x coordinate of the element in pixels.- `y` <[number]> the y coordinate of the element in pixels.@@ -2698,7 +2682,7 @@ const box = await elementHandle.boundingBox();await page.mouse.click(box.x + box.width / 2, box.y + box.height / 2);```-#### elementHandle.check+#### method ElementHandle.check- `options` <[Object]>- %%-input-force-%%- %%-input-no-wait-after-%%@@ -2718,7 +2702,7 @@ If the element is detached from the DOM at any moment during the action, this meWhen all steps combined have not finished during the specified `timeout`, this method rejects with a [TimeoutError].Passing zero timeout disables this.-#### elementHandle.click+#### method ElementHandle.click- `options` <[Object]>- %%-input-button-%%- %%-input-click-count-%%@@ -2741,10 +2725,10 @@ If the element is detached from the DOM at any moment during the action, this meWhen all steps combined have not finished during the specified `timeout`, this method rejects with a [TimeoutError].Passing zero timeout disables this.-#### elementHandle.contentFrame+#### method ElementHandle.contentFrame- returns: <[Promise]<[null]|[Frame]>> Resolves to the content frame for element handles referencing iframe nodes, or `null` otherwise-#### elementHandle.dblclick+#### method ElementHandle.dblclick- `options` <[Object]>- %%-input-button-%%- %%-input-down-up-delay-%%@@ -2768,7 +2752,7 @@ Passing zero timeout disables this.> **NOTE** `elementHandle.dblclick()` dispatches two `click` events and a single `dblclick` event.-#### elementHandle.dispatchEvent+#### method ElementHandle.dispatchEvent- `type` <[string]> DOM event type: `"click"`, `"dragstart"`, etc.- `eventInit` <[EvaluationArgument]> Optional event-specific initialization properties.- returns: <[Promise]>@@ -2801,7 +2785,7 @@ const dataTransfer = await page.evaluateHandle(() => new DataTransfer());await elementHandle.dispatchEvent('dragstart', { dataTransfer });```-#### elementHandle.fill+#### method ElementHandle.fill- `value` <[string]> Value to set for the `<input>`, `<textarea>` or `[contenteditable]` element.- `options` <[Object]>- %%-input-no-wait-after-%%@@ -2812,18 +2796,18 @@ This method waits for [actionability](./actionability.md) checks, focuses the elevent after filling. If the element is not an `<input>`, `<textarea>` or `[contenteditable]` element, this method throwsan error. Note that you can pass an empty string to clear the input field.-#### elementHandle.focus+#### method ElementHandle.focus- returns: <[Promise]>Calls [focus](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus) on the element.-#### elementHandle.getAttribute+#### method ElementHandle.getAttribute- `name` <[string]> Attribute name to get the value for.- returns: <[Promise]<[null]|[string]>>Returns element attribute value.-#### elementHandle.hover+#### method ElementHandle.hover- `options` <[Object]>- %%-input-position-%%- %%-input-modifiers-%%@@ -2842,16 +2826,16 @@ If the element is detached from the DOM at any moment during the action, this meWhen all steps combined have not finished during the specified `timeout`, this method rejects with a [TimeoutError].Passing zero timeout disables this.-#### elementHandle.innerHTML+#### method ElementHandle.innerHTML- returns: <[Promise]<[string]>> Resolves to the `element.innerHTML`.-#### elementHandle.innerText+#### method ElementHandle.innerText- returns: <[Promise]<[string]>> Resolves to the `element.innerText`.-#### elementHandle.ownerFrame+#### method ElementHandle.ownerFrame- returns: <[Promise]<[null]|[Frame]>> Returns the frame containing the given element.-#### elementHandle.press+#### method ElementHandle.press- `key` <[string]> Name of the key to press or a character to generate, such as `ArrowLeft` or `a`.- `options` <[Object]>- `delay` <[number]> Time to wait between `keydown` and `keyup` in milliseconds. Defaults to 0.@@ -2878,7 +2862,7 @@ texts.Shortcuts such as `key: "Control+o"` or `key: "Control+Shift+T"` are supported as well. When speficied with themodifier, modifier is pressed and being held while the subsequent key is being pressed.-#### elementHandle.screenshot+#### method ElementHandle.screenshot- `options` <[Object]>- `path` <[string]> The file path to save the image to. The screenshot type will be inferred from file extension. If `path` is a relative path, then it is resolved relative to [current working directory](https://nodejs.org/api/process.html#process_process_cwd). If no path is provided, the image won't be saved to the disk.- `type` <"png"|"jpeg"> Specify screenshot type, defaults to `png`.@@ -2890,7 +2874,7 @@ modifier, modifier is pressed and being held while the subsequent key is being pThis method waits for the [actionability](./actionability.md) checks, then scrolls element into view before taking ascreenshot. If the element is detached from DOM, the method throws an error.-#### elementHandle.scrollIntoViewIfNeeded+#### method ElementHandle.scrollIntoViewIfNeeded- `options` <[Object]>- %%-input-timeout-%%- returns: <[Promise]>@@ -2902,7 +2886,7 @@ completely visible as defined byThrows 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+#### method ElementHandle.selectOption- `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`.@@ -2929,7 +2913,7 @@ handle.selectOption('red', 'green', 'blue');handle.selectOption({ value: 'blue' }, { index: 2 }, 'red');```-#### elementHandle.selectText+#### method ElementHandle.selectText- `options` <[Object]>- %%-input-timeout-%%- returns: <[Promise]>@@ -2937,7 +2921,7 @@ handle.selectOption({ value: 'blue' }, { index: 2 }, 'red');This method waits for [actionability](./actionability.md) checks, then focuses the element and selects all its textcontent.-#### elementHandle.setInputFiles+#### method ElementHandle.setInputFiles- %%-input-files-%%- `options` <[Object]>- %%-input-no-wait-after-%%@@ -2951,7 +2935,7 @@ Sets the value of the file input to these file paths or files. If some of the `fare resolved relative to the [current working directory](https://nodejs.org/api/process.html#process_process_cwd). Forempty array, clears the selected files.-#### elementHandle.tap+#### method ElementHandle.tap- `options` <[Object]>- %%-input-position-%%- %%-input-modifiers-%%@@ -2973,13 +2957,13 @@ Passing zero timeout disables this.> **NOTE** `elementHandle.tap()` requires that the `hasTouch` option of the browser context be set to true.-#### elementHandle.textContent+#### method ElementHandle.textContent- returns: <[Promise]<[null]|[string]>> Resolves to the `node.textContent`.-#### elementHandle.toString+#### method ElementHandle.toString- returns: <[string]>-#### elementHandle.type+#### method ElementHandle.type- `text` <[string]> A text to type into a focused element.- `options` <[Object]>- `delay` <[number]> Time to wait between key presses in milliseconds. Defaults to 0.@@ -3004,7 +2988,7 @@ await elementHandle.type('some text');await elementHandle.press('Enter');```-#### elementHandle.uncheck+#### method ElementHandle.uncheck- `options` <[Object]>- %%-input-force-%%- %%-input-no-wait-after-%%@@ -3024,7 +3008,7 @@ If the element is detached from the DOM at any moment during the action, this meWhen all steps combined have not finished during the specified `timeout`, this method rejects with a [TimeoutError].Passing zero timeout disables this.-#### elementHandle.waitForElementState+#### method ElementHandle.waitForElementState- `state` <"visible"|"hidden"|"stable"|"enabled"|"disabled"> A state to wait for, see below for more details.- `options` <[Object]>- %%-input-timeout-%%@@ -3040,7 +3024,7 @@ This method throws when the element is detached while waiting, unless waiting foIf the element does not satisfy the condition for the `timeout` milliseconds, this method will throw.-#### elementHandle.waitForSelector+#### method ElementHandle.waitForSelector- %%-query-selector-%%- `options` <[Object]>- %%-wait-for-selector-state-%%@@ -3063,8 +3047,7 @@ const span = await div.waitForSelector('span', { state: 'attached' });### class: JSHandle-JSHandle represents an in-page JavaScript object. JSHandles can be created with the-[page.evaluateHandle()]() method.+JSHandle represents an in-page JavaScript object. JSHandles can be created with the [page.evaluateHandle()]() method.```jsconst windowHandle = await page.evaluateHandle(() => window);@@ -3072,27 +3055,26 @@ const windowHandle = await page.evaluateHandle(() => window);```JSHandle prevents the referenced JavaScript object being garbage collected unless the handle is exposed with-[jsHandle.dispose()](). JSHandles are auto-disposed when their origin frame gets navigated or the parent context-gets destroyed.+[jsHandle.dispose()](). JSHandles are auto-disposed when their origin frame gets navigated or the parent context gets+destroyed.-JSHandle instances can be used as an argument in [page.$eval()](),-[page.evaluate()]() and [page.evaluateHandle()]()+JSHandle instances can be used as an argument in [page.$eval()](), [page.evaluate()]() and [page.evaluateHandle()]()methods.<!-- GEN:toc --><!-- GEN:stop -->-#### jsHandle.asElement+#### method JSHandle.asElement- returns: <[null]|[ElementHandle]>Returns either `null` or the object handle itself, if the object handle is an instance of [ElementHandle].-#### jsHandle.dispose+#### method JSHandle.dispose- returns: <[Promise]> Promise which resolves when the object handle is successfully disposed.The `jsHandle.dispose` method stops referencing the element handle.-#### jsHandle.evaluate+#### method JSHandle.evaluate- `pageFunction` <[function]> Function to be evaluated in browser context- `arg` <[EvaluationArgument]> Optional argument to pass to `pageFunction`- returns: <[Promise]<[Serializable]>> Promise which resolves to the return value of `pageFunction`@@ -3109,7 +3091,7 @@ const tweetHandle = await page.$('.tweet .retweets');expect(await tweetHandle.evaluate((node, suffix) => node.innerText, ' retweets')).toBe('10 retweets');```-#### jsHandle.evaluateHandle+#### method JSHandle.evaluateHandle- `pageFunction` <[function]|[string]> Function to be evaluated- `arg` <[EvaluationArgument]> Optional argument to pass to `pageFunction`- returns: <[Promise]<[JSHandle]>> Promise which resolves to the return value of `pageFunction` as in-page object (JSHandle)@@ -3124,7 +3106,7 @@ for the promise to resolve and return its value.See [page.evaluateHandle()]() for more details.-#### jsHandle.getProperties+#### method JSHandle.getProperties- returns: <[Promise]<[Map]<[string], [JSHandle]>>>The method returns a map with **own property names** as keys and JSHandle instances for the property values.@@ -3137,13 +3119,13 @@ const documentHandle = properties.get('document');await handle.dispose();```-#### jsHandle.getProperty+#### method JSHandle.getProperty- `propertyName` <[string]> property to get- returns: <[Promise]<[JSHandle]>>Fetches a single property from the referenced object.-#### jsHandle.jsonValue+#### method JSHandle.jsonValue- returns: <[Promise]<[Serializable]>>Returns a JSON representation of the object. If the object has a@@ -3160,19 +3142,19 @@ error if the object has circular references.<!-- GEN:toc --><!-- GEN:stop -->-#### consoleMessage.args+#### method ConsoleMessage.args- returns: <[Array]<[JSHandle]>>-#### consoleMessage.location+#### method ConsoleMessage.location- returns: <[Object]>- `url` <[string]> URL of the resource if available, otherwise empty string.- `lineNumber` <[number]> 0-based line number in the resource.- `columnNumber` <[number]> 0-based column number in the resource.-#### consoleMessage.text+#### method ConsoleMessage.text- returns: <[string]>-#### consoleMessage.type+#### method ConsoleMessage.type- returns: <[string]>One of the following values: `'log'`, `'debug'`, `'info'`, `'error'`, `'warning'`, `'dir'`, `'dirxml'`, `'table'`,@@ -3203,20 +3185,20 @@ const { chromium } = require('playwright'); // Or 'firefox' or 'webkit'.<!-- GEN:toc --><!-- GEN:stop -->-#### dialog.accept+#### method Dialog.accept- `promptText` <[string]> A text to enter in prompt. Does not cause any effects if the dialog's `type` is not prompt. Optional.- returns: <[Promise]> Promise which resolves when the dialog has been accepted.-#### dialog.defaultValue+#### method Dialog.defaultValue- returns: <[string]> If dialog is prompt, returns default prompt value. Otherwise, returns empty string.-#### dialog.dismiss+#### method Dialog.dismiss- returns: <[Promise]> Promise which resolves when the dialog has been dismissed.-#### dialog.message+#### method Dialog.message- returns: <[string]> A message displayed in the dialog.-#### dialog.type+#### method Dialog.type- returns: <[string]> Dialog's type, can be one of `alert`, `beforeunload`, `confirm` or `prompt`.### class: Download@@ -3245,33 +3227,33 @@ download is not performed and user has no access to the downloaded files.<!-- GEN:toc --><!-- GEN:stop -->-#### download.createReadStream+#### method Download.createReadStream- returns: <[Promise]<[null]|[Readable]>>Returns readable stream for current download or `null` if download failed.-#### download.delete+#### method Download.delete- returns: <[Promise]>Deletes the downloaded file.-#### download.failure+#### method Download.failure- returns: <[Promise]<[null]|[string]>>Returns download error if any.-#### download.path+#### method Download.path- returns: <[Promise]<[null]|[string]>>Returns path to the downloaded file in case of successful download.-#### download.saveAs+#### method Download.saveAs- `path` <[string]> Path where the download should be saved.- returns: <[Promise]>Saves the download to a user-specified path.-#### download.suggestedFilename+#### method Download.suggestedFilename- returns: <[string]>Returns suggested filename for this download. It is typically computed by the browser from the@@ -3279,7 +3261,7 @@ Returns suggested filename for this download. It is typically computed by the bror the `download` attribute. See the spec on [whatwg](https://html.spec.whatwg.org/#downloading-resources). Differentbrowsers can use different logic for computing it.-#### download.url+#### method Download.url- returns: <[string]>Returns downloaded url.@@ -3295,7 +3277,7 @@ console.log(await page.video().path());<!-- GEN:toc --><!-- GEN:stop -->-#### video.path+#### method Video.path- returns: <[Promise]<[string]>>Returns the file system path this video will be recorded to. The video is guaranteed to be written to the filesystem@@ -3314,22 +3296,22 @@ page.on('filechooser', async (fileChooser) => {<!-- GEN:toc --><!-- GEN:stop -->-#### fileChooser.element+#### method FileChooser.element- returns: <[ElementHandle]>Returns input element associated with this file chooser.-#### fileChooser.isMultiple+#### method FileChooser.isMultiple- returns: <[boolean]>Returns whether this file chooser accepts multiple files.-#### fileChooser.page+#### method FileChooser.page- returns: <[Page]>Returns page this file chooser belongs to.-#### fileChooser.setFiles+#### method FileChooser.setFiles- %%-input-files-%%- `options` <[Object]>- %%-input-no-wait-after-%%@@ -3342,12 +3324,11 @@ For empty array, clears the selected files.### class: Keyboard-Keyboard provides an api for managing a virtual keyboard. The high level api is-[keyboard.type()](), which takes raw characters and generates proper keydown, keypress/input,-and keyup events on your page.+Keyboard provides an api for managing a virtual keyboard. The high level api is [keyboard.type()](), which takes raw+characters and generates proper keydown, keypress/input, and keyup events on your page.-For finer control, you can use [keyboard.down()](), [keyboard.up()](), and-[keyboard.insertText()]() to manually fire events as if they were generated from a real keyboard.+For finer control, you can use [keyboard.down()](), [keyboard.up()](), and [keyboard.insertText()]() to manually fire+events as if they were generated from a real keyboard.An example of holding down `Shift` in order to select and delete some text:@@ -3384,7 +3365,7 @@ await page.keyboard.press('Meta+A');<!-- GEN:toc --><!-- GEN:stop -->-#### keyboard.down+#### method Keyboard.down- `key` <[string]> Name of the key to press or a character to generate, such as `ArrowLeft` or `a`.- returns: <[Promise]>@@ -3413,7 +3394,7 @@ After the key is pressed once, subsequent calls to [keyboard.down()]() will have> **NOTE** Modifier keys DO influence `keyboard.down`. Holding down `Shift` will type the text in upper case.-#### keyboard.insertText+#### method Keyboard.insertText- `text` <[string]> Sets input to the specified text value.- returns: <[Promise]>@@ -3425,7 +3406,7 @@ page.keyboard.insertText('嗨');> **NOTE** Modifier keys DO NOT effect `keyboard.insertText`. Holding down `Shift` will not type the text in upper case.-#### keyboard.press+#### method Keyboard.press- `key` <[string]> Name of the key to press or a character to generate, such as `ArrowLeft` or `a`.- `options` <[Object]>- `delay` <[number]> Time to wait between `keydown` and `keyup` in milliseconds. Defaults to 0.@@ -3462,7 +3443,7 @@ await browser.close();Shortcut for [keyboard.down()]() and [keyboard.up()]().-#### keyboard.type+#### method Keyboard.type- `text` <[string]> A text to type into a focused element.- `options` <[Object]>- `delay` <[number]> Time to wait between key presses in milliseconds. Defaults to 0.@@ -3479,7 +3460,7 @@ 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.-#### keyboard.up+#### method Keyboard.up- `key` <[string]> Name of the key to press or a character to generate, such as `ArrowLeft` or `a`.- returns: <[Promise]>@@ -3505,7 +3486,7 @@ await page.mouse.up();<!-- GEN:toc --><!-- GEN:stop -->-#### mouse.click+#### method Mouse.click- `x` <[number]>- `y` <[number]>- `options` <[Object]>@@ -3516,7 +3497,7 @@ await page.mouse.up();Shortcut for [mouse.move()](), [mouse.down()](), [mouse.up()]().-#### mouse.dblclick+#### method Mouse.dblclick- `x` <[number]>- `y` <[number]>- `options` <[Object]>@@ -3524,10 +3505,9 @@ Shortcut for [mouse.move()](), [mouse.down()](), [mouse.up()]().- %%-input-down-up-delay-%%- returns: <[Promise]>-Shortcut for [mouse.move()](), [mouse.down()](), [mouse.up()](),-[mouse.down()]() and [mouse.up()]().+Shortcut for [mouse.move()](), [mouse.down()](), [mouse.up()](), [mouse.down()]() and [mouse.up()]().-#### mouse.down+#### method Mouse.down- `options` <[Object]>- %%-input-button-%%- %%-input-click-count-%%@@ -3535,7 +3515,7 @@ Shortcut for [mouse.move()](), [mouse.down()](), [mouse.up()](),Dispatches a `mousedown` event.-#### mouse.move+#### method Mouse.move- `x` <[number]>- `y` <[number]>- `options` <[Object]>@@ -3544,7 +3524,7 @@ Dispatches a `mousedown` event.Dispatches a `mousemove` event.-#### mouse.up+#### method Mouse.up- `options` <[Object]>- %%-input-button-%%- %%-input-click-count-%%@@ -3557,7 +3537,7 @@ Dispatches a `mouseup` event.The Touchscreen class operates in main-frame CSS pixels relative to the top-left corner of the viewport. Methods on thetouchscreen can only be used in browser contexts that have been intialized with `hasTouch` set to true.-#### touchscreen.tap+#### method Touchscreen.tap- `x` <[number]>- `y` <[number]>- returns: <[Promise]>@@ -3583,7 +3563,7 @@ request is issued to a redirected url.<!-- GEN:toc --><!-- GEN:stop -->-#### request.failure+#### method Request.failure- returns: <[null]|[Object]> Object describing request failure, if any- `errorText` <[string]> Human-readable error message, e.g. `'net::ERR_FAILED'`.@@ -3597,33 +3577,33 @@ page.on('requestfailed', request => {});```-#### request.frame+#### method Request.frame- returns: <[Frame]> A [Frame] that initiated this request.-#### request.headers+#### method Request.headers- returns: <[Object]<[string], [string]>> An object with HTTP headers associated with the request. All header names are lower-case.-#### request.isNavigationRequest+#### method Request.isNavigationRequest- returns: <[boolean]>Whether this request is driving frame's navigation.-#### request.method+#### method Request.method- returns: <[string]> Request's method (GET, POST, etc.)-#### request.postData+#### method Request.postData- returns: <[null]|[string]> Request's post body, if any.-#### request.postDataBuffer+#### method Request.postDataBuffer- returns: <[null]|[Buffer]> Request's post body in a binary form, if any.-#### request.postDataJSON+#### method Request.postDataJSON- returns: <[null]|[Object]> Parsed request's body for `form-urlencoded` and JSON as a fallback if any.When the response is `application/x-www-form-urlencoded` then a key/value object of the values will be returned.Otherwise it will be parsed as JSON.-#### request.redirectedFrom+#### method Request.redirectedFrom- returns: <[null]|[Request]> Request that was redirected by the server to this one, if any.When the server responds with a redirect, Playwright creates a new [Request] object. The two requests are connected by@@ -3644,7 +3624,7 @@ const response = await page.goto('https://google.com');console.log(response.request().redirectedFrom()); // null```-#### request.redirectedTo+#### method Request.redirectedTo- returns: <[null]|[Request]> New request issued by the browser if the server responded with redirect.This method is the opposite of [request.redirectedFrom()]():@@ -3653,17 +3633,17 @@ This method is the opposite of [request.redirectedFrom()]():console.log(request.redirectedFrom().redirectedTo() === request); // true```-#### request.resourceType+#### method Request.resourceType- returns: <[string]>Contains the request's resource type as it was perceived by the rendering engine. ResourceType will be one of thefollowing: `document`, `stylesheet`, `image`, `media`, `font`, `script`, `texttrack`, `xhr`, `fetch`, `eventsource`,`websocket`, `manifest`, `other`.-#### request.response+#### method Request.response- returns: <[Promise]<[null]|[Response]>> A matching [Response] object, or `null` if the response was not received due to error.-#### request.timing+#### method Request.timing- returns: <[Object]>- `startTime` <[number]> Request start time in milliseconds elapsed since January 1, 1970 00:00:00 UTC- `domainLookupStart` <[number]> Time immediately before the browser starts the domain name lookup for the resource. The value is given in milliseconds relative to `startTime`, -1 if not available.@@ -3687,7 +3667,7 @@ const [request] = await Promise.all([console.log(request.timing());```-#### request.url+#### method Request.url- returns: <[string]> URL of the request.### class: Response@@ -3697,45 +3677,45 @@ console.log(request.timing());<!-- GEN:toc --><!-- GEN:stop -->-#### response.body+#### method Response.body- returns: <[Promise]<[Buffer]>> Promise which resolves to a buffer with response body.-#### response.finished+#### method Response.finished- returns: <[Promise]<[null]|[Error]>> Waits for this response to finish, returns failure error if request failed.-#### response.frame+#### method Response.frame- returns: <[Frame]> A [Frame] that initiated this response.-#### response.headers+#### method Response.headers- returns: <[Object]<[string], [string]>> An object with HTTP headers associated with the response. All header names are lower-case.-#### response.json+#### method Response.json- returns: <[Promise]<[Serializable]>> Promise which resolves to a JSON representation of response body.This method will throw if the response body is not parsable via `JSON.parse`.-#### response.ok+#### method Response.ok- returns: <[boolean]>Contains a boolean stating whether the response was successful (status in the range 200-299) or not.-#### response.request+#### method Response.request- returns: <[Request]> A matching [Request] object.-#### response.status+#### method Response.status- returns: <[number]>Contains the status code of the response (e.g., 200 for a success).-#### response.statusText+#### method Response.statusText- returns: <[string]>Contains the status text of the response (e.g. usually an "OK" for a success).-#### response.text+#### method Response.text- returns: <[Promise]<[string]>> Promise which resolves to a text representation of response body.-#### response.url+#### method Response.url- returns: <[string]>Contains the URL of the response.@@ -3748,7 +3728,7 @@ information.<!-- GEN:toc --><!-- GEN:stop -->-#### selectors.register+#### method Selectors.register- `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 [current working directory](https://nodejs.org/api/process.html#process_process_cwd).@@ -3802,12 +3782,13 @@ const { selectors, firefox } = require('playwright'); // Or 'chromium' or 'webk### class: Route-Whenever a network route is set up with [page.route()]() or [browserContext.route()](), the `Route` object allows to handle the route.+Whenever a network route is set up with [page.route()]() or [browserContext.route()](), the `Route` object allows to+handle the route.<!-- GEN:toc --><!-- GEN:stop -->-#### route.abort+#### method Route.abort- `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@@ -3827,7 +3808,7 @@ Whenever a network route is set up with [page.route()]() or [browserContext.routAborts the route's request.-#### route.continue+#### method Route.continue- `overrides` <[Object]> Optional request overrides, can override following properties:- `url` <[string]> If set changes the request URL. New URL must have same protocol as original one.- `method` <[string]> If set changes the request method (e.g. GET or POST)@@ -3849,7 +3830,7 @@ await page.route('**/*', (route, request) => {});```-#### route.fulfill+#### method Route.fulfill- `response` <[Object]> Response that will fulfill this route's request.- `status` <[number]> Response status code, defaults to `200`.- `headers` <[Object]<[string], [string]>> Optional response headers. Header values will be converted to a string.@@ -3878,7 +3859,7 @@ An example of serving static file:await page.route('**/xhr_endpoint', route => route.fulfill({ path: 'mock_data.json' }));```-#### route.request+#### method Route.request- returns: <[Request]> A request to be routed.### class: WebSocket@@ -3888,38 +3869,38 @@ The [WebSocket] class represents websocket connections in the page.<!-- GEN:toc --><!-- GEN:stop -->-#### event: 'close'+#### event WebSocket.closeFired when the websocket closes.-#### event: 'framereceived'+#### event WebSocket.framereceived- <[Object]> web socket frame data- `payload` <[string]|[Buffer]> frame payloadFired when the websocket recieves a frame.-#### event: 'framesent'+#### event WebSocket.framesent- <[Object]> web socket frame data- `payload` <[string]|[Buffer]> frame payloadFired when the websocket sends a frame.-#### event: 'socketerror'+#### event WebSocket.socketerror- <[String]> the error messageFired when the websocket has an error.-#### webSocket.isClosed+#### method WebSocket.isClosed- returns: <[boolean]>Indicates that the web socket has been closed.-#### webSocket.url+#### method WebSocket.url- returns: <[string]>Contains the URL of the WebSocket.-#### webSocket.waitForEvent+#### method WebSocket.waitForEvent- `event` <[string]> Event name, same one would pass into `webSocket.on(event)`.- `optionsOrPredicate` <[Function]|[Object]> Either a predicate that receives an event or an options object. Optional.- `predicate` <[Function]> receives the event data and resolves to truthy value when the waiting should resolve.@@ -3932,7 +3913,8 @@ value. Will throw an error if the webSocket is closed before the event is fired.### class: TimeoutError* extends: [Error]-TimeoutError is emitted whenever certain operations are terminated due to timeout, e.g. [page.waitForSelector()]() or [browserType.launch()]().+TimeoutError is emitted whenever certain operations are terminated due to timeout, e.g. [page.waitForSelector()]() or+[browserType.launch()]().### class: Accessibility@@ -3953,7 +3935,7 @@ assistive technologies themselves. By default, Playwright tries to approximate t<!-- GEN:toc --><!-- GEN:stop -->-#### accessibility.snapshot+#### method Accessibility.snapshot- `options` <[Object]>- `interestingOnly` <[boolean]> Prune uninteresting nodes from the tree. Defaults to `true`.- `root` <[ElementHandle]> The root DOM element for the snapshot. Defaults to the whole page.@@ -4036,12 +4018,12 @@ for (const worker of page.workers())<!-- GEN:toc --><!-- GEN:stop -->-#### event: 'close'+#### event Worker.close- <[Worker]>Emitted when this dedicated [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) is terminated.-#### worker.evaluate+#### method Worker.evaluate- `pageFunction` <[function]|[string]> Function to be evaluated in the worker context- `arg` <[EvaluationArgument]> Optional argument to pass to `pageFunction`- returns: <[Promise]<[Serializable]>> Promise which resolves to the return value of `pageFunction`@@ -4053,7 +4035,7 @@ If the function passed to the `worker.evaluate` returns a non-[Serializable] val`undefined`. DevTools Protocol also supports transferring some additional values that are not serializable by `JSON`:`-0`, `NaN`, `Infinity`, `-Infinity`, and bigint literals.-#### worker.evaluateHandle+#### method Worker.evaluateHandle- `pageFunction` <[function]|[string]> Function to be evaluated in the page context- `arg` <[EvaluationArgument]> Optional argument to pass to `pageFunction`- returns: <[Promise]<[JSHandle]>> Promise which resolves to the return value of `pageFunction` as in-page object (JSHandle)@@ -4064,7 +4046,7 @@ in-page object (JSHandle).If the function passed to the `worker.evaluateHandle` returns a [Promise], then `worker.evaluateHandle` would wait forthe promise to resolve and return its value.-#### worker.url+#### method Worker.url- returns: <[string]>### class: BrowserServer@@ -4072,28 +4054,28 @@ the promise to resolve and return its value.<!-- GEN:toc --><!-- GEN:stop -->-#### event: 'close'+#### event BrowserServer.closeEmitted when the browser server closes.-#### browserServer.close+#### method BrowserServer.close- returns: <[Promise]>Closes the browser gracefully and makes sure the process is terminated.-#### browserServer.kill+#### method BrowserServer.kill- returns: <[Promise]>Kills the browser process and waits for the process to exit.-#### browserServer.process+#### method BrowserServer.process- returns: <[ChildProcess]> Spawned browser application process.-#### browserServer.wsEndpoint+#### method BrowserServer.wsEndpoint- returns: <[string]> Browser websocket url.-Browser websocket endpoint which can be used as an argument to-[browserType.connect()]() to establish connection to the browser.+Browser websocket endpoint which can be used as an argument to [browserType.connect()]() to establish connection to the+browser.### class: BrowserType@@ -4115,7 +4097,7 @@ const { chromium } = require('playwright'); // Or 'firefox' or 'webkit'.<!-- GEN:toc --><!-- GEN:stop -->-#### browserType.connect+#### method BrowserType.connect- `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.@@ -4125,10 +4107,10 @@ const { chromium } = require('playwright'); // Or 'firefox' or 'webkit'.This methods attaches Playwright to an existing browser instance.-#### browserType.executablePath+#### method BrowserType.executablePath- returns: <[string]> A path where Playwright expects to find a bundled browser executable.-#### browserType.launch+#### method BrowserType.launch- `options` <[Object]>- `headless` <[boolean]> Whether to run browser in headless mode. More details for [Chromium](https://developers.google.com/web/updates/2017/04/headless-chrome) and [Firefox](https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Headless_mode). Defaults to `true` unless the `devtools` option is `true`.- `executablePath` <[string]> Path to a browser executable to run instead of the bundled one. If `executablePath` is a relative path, then it is resolved relative to [current working directory](https://nodejs.org/api/process.html#process_process_cwd). Note that Playwright only works with the bundled Chromium, Firefox or WebKit, use at your own risk.@@ -4175,7 +4157,7 @@ a description of the differences between Chromium and Chrome. [`Thisarticle`](https://chromium.googlesource.com/chromium/src/+/lkgr/docs/chromium_browser_vs_google_chrome.md) describessome differences for Linux users.-#### browserType.launchPersistentContext+#### method BrowserType.launchPersistentContext- `userDataDir` <[string]> Path to a User Data Directory, which stores browser session data like cookies and local storage. More details for [Chromium](https://chromium.googlesource.com/chromium/src/+/master/docs/user_data_dir.md) and [Firefox](https://developer.mozilla.org/en-US/docs/Mozilla/Command_Line_Options#User_Profile).- `options` <[Object]>- `headless` <[boolean]> Whether to run browser in headless mode. More details for [Chromium](https://developers.google.com/web/updates/2017/04/headless-chrome) and [Firefox](https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Headless_mode). Defaults to `true` unless the `devtools` option is `true`.@@ -4202,7 +4184,7 @@ some differences for Linux users.Launches browser that uses persistent storage located at `userDataDir` and returns the only context. Closing thiscontext will automatically close the browser.-#### browserType.launchServer+#### method BrowserType.launchServer- `options` <[Object]>- `headless` <[boolean]> Whether to run browser in headless mode. More details for [Chromium](https://developers.google.com/web/updates/2017/04/headless-chrome) and [Firefox](https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Headless_mode). Defaults to `true` unless the `devtools` option is `true`.- `port` <[number]> Port to use for the web socket. Defaults to 0 that picks any available port.@@ -4242,7 +4224,7 @@ const { chromium } = require('playwright'); // Or 'webkit' or 'firefox'.})();```-#### browserType.name+#### method BrowserType.name- returns: <[string]>Returns browser name. For example: `'chromium'`, `'webkit'` or `'firefox'`.@@ -4268,14 +4250,14 @@ const { chromium } = require('playwright'); // Or 'firefox' or 'webkit'.<!-- GEN:toc --><!-- GEN:stop -->-#### logger.isEnabled+#### method Logger.isEnabled- `name` <[string]> logger name- `severity` <"verbose"|"info"|"warning"|"error">- returns: <[boolean]>Determines whether sink is interested in the logger with the given name and severity.-#### logger.log+#### method Logger.log- `name` <[string]> logger name- `severity` <"verbose"|"info"|"warning"|"error">- `message` <[string]|[Error]> log message format@@ -4287,9 +4269,8 @@ Determines whether sink is interested in the logger with the given name and seve* extends: [Browser]Chromium-specific features including Tracing, service worker support, etc. You can use-[chromiumBrowser.startTracing()]() and-[chromiumBrowser.stopTracing()]() to create a trace file which can be opened in Chrome-DevTools or [timeline viewer](https://chromedevtools.github.io/timeline-viewer/).+[chromiumBrowser.startTracing()]() and [chromiumBrowser.stopTracing()]() to create a trace file which can be opened in+Chrome DevTools or [timeline viewer](https://chromedevtools.github.io/timeline-viewer/).```jsawait browser.startTracing(page, {path: 'trace.json'});@@ -4303,10 +4284,10 @@ await browser.stopTracing();<!-- GEN:toc-extends-Browser --><!-- GEN:stop -->-#### chromiumBrowser.newBrowserCDPSession+#### method ChromiumBrowser.newBrowserCDPSession- returns: <[Promise]<[CDPSession]>> Promise that resolves to the newly created browser session.-#### chromiumBrowser.startTracing+#### method ChromiumBrowser.startTracing- `page` <[Page]> Optional, if specified, tracing includes screenshots of the given page.- `options` <[Object]>- `path` <[string]> A path to write the trace file to.@@ -4316,7 +4297,7 @@ await browser.stopTracing();Only one trace can be active at a time per browser.-#### chromiumBrowser.stopTracing+#### method ChromiumBrowser.stopTracing- returns: <[Promise]<[Buffer]>> Promise which resolves to buffer with trace data.### class: ChromiumBrowserContext@@ -4334,26 +4315,26 @@ const backgroundPage = await context.waitForEvent('backgroundpage');<!-- GEN:toc-extends-BrowserContext --><!-- GEN:stop -->-#### event: 'backgroundpage'+#### event ChromiumBrowserContext.backgroundpage- <[Page]>Emitted when new background page is created in the context.> **NOTE** Only works with persistent context.-#### event: 'serviceworker'+#### event ChromiumBrowserContext.serviceworker- <[Worker]>Emitted when new service worker is created in the context.-#### chromiumBrowserContext.backgroundPages+#### method ChromiumBrowserContext.backgroundPages- returns: <[Array]<[Page]>> All existing background pages in the context.-#### chromiumBrowserContext.newCDPSession+#### method ChromiumBrowserContext.newCDPSession- `page` <[Page]> Page to create new session for.- returns: <[Promise]<[CDPSession]>> Promise that resolves to the newly created session.-#### chromiumBrowserContext.serviceWorkers+#### method ChromiumBrowserContext.serviceWorkers- returns: <[Array]<[Worker]>> All existing service workers in the context.### class: ChromiumCoverage@@ -4385,12 +4366,12 @@ const v8toIstanbul = require('v8-to-istanbul');<!-- GEN:toc --><!-- GEN:stop -->-#### chromiumCoverage.startCSSCoverage+#### method ChromiumCoverage.startCSSCoverage- `options` <[Object]>- `resetOnNavigation` <[boolean]> Whether to reset coverage on every navigation. Defaults to `true`.- returns: <[Promise]> Promise that resolves when coverage is started-#### chromiumCoverage.startJSCoverage+#### method ChromiumCoverage.startJSCoverage- `options` <[Object]>- `resetOnNavigation` <[boolean]> Whether to reset coverage on every navigation. Defaults to `true`.- `reportAnonymousScripts` <[boolean]> Whether anonymous scripts generated by the page should be reported. Defaults to `false`.@@ -4400,7 +4381,7 @@ const v8toIstanbul = require('v8-to-istanbul');on the page using `eval` or `new Function`. If `reportAnonymousScripts` is set to `true`, anonymous scripts will have`__playwright_evaluation_script__` as their URL.-#### chromiumCoverage.stopCSSCoverage+#### method ChromiumCoverage.stopCSSCoverage- returns: <[Promise]<[Array]<[Object]>>> Promise that resolves to the array of coverage reports for all stylesheets- `url` <[string]> StyleSheet URL- `text` <[string]> StyleSheet content, if available.@@ -4410,7 +4391,7 @@ on the page using `eval` or `new Function`. If `reportAnonymousScripts` is set t> **NOTE** CSS Coverage doesn't include dynamically injected style tags without sourceURLs.-#### chromiumCoverage.stopJSCoverage+#### method ChromiumCoverage.stopJSCoverage- returns: <[Promise]<[Array]<[Object]>>> Promise that resolves to the array of coverage reports for all scripts- `url` <[string]> Script URL- `scriptId` <[string]> Script ID@@ -4451,13 +4432,13 @@ await client.send('Animation.setPlaybackRate', {<!-- GEN:toc --><!-- GEN:stop -->-#### cdpSession.detach+#### method CDPSession.detach- returns: <[Promise]>Detaches the CDPSession from the target. Once detached, the CDPSession object won't emit any events and can't be used tosend messages.-#### cdpSession.send+#### method CDPSession.send- `method` <[string]> protocol method name- `params` <[Object]> Optional method parameters- returns: <[Promise]<[Object]>>diff --git a/docs/api.md b/docs/api.mdindex 6c131fb0cb..79f30ee396 100644--- a/docs/api.md+++ b/docs/api.md@@ -158,7 +158,7 @@ See [ChromiumBrowser], [FirefoxBrowser] and [WebKitBrowser] for browser-specificbeing connected to or launched.<!-- GEN:toc -->-- [event: 'disconnected'](#event-disconnected)+- [browser.on('disconnected')](#browserondisconnected)- [browser.close()](#browserclose)- [browser.contexts()](#browsercontexts)- [browser.isConnected()](#browserisconnected)@@ -167,7 +167,7 @@ being connected to or launched.- [browser.version()](#browserversion)<!-- GEN:stop -->-#### event: 'disconnected'+#### browser.on('disconnected')Emitted when Browser gets disconnected from the browser application. This might happen because of one of the following:* Browser application is closed or crashed.@@ -372,8 +372,8 @@ await context.close();```<!-- GEN:toc -->-- [event: 'close'](#event-close)-- [event: 'page'](#event-page)+- [browserContext.on('close')](#browsercontextonclose)+- [browserContext.on('page')](#browsercontextonpage)- [browserContext.addCookies(cookies)](#browsercontextaddcookiescookies)- [browserContext.addInitScript(script[, arg])](#browsercontextaddinitscriptscript-arg)- [browserContext.browser()](#browsercontextbrowser)@@ -398,18 +398,18 @@ await context.close();- [browserContext.waitForEvent(event[, optionsOrPredicate])](#browsercontextwaitforeventevent-optionsorpredicate)<!-- GEN:stop -->-#### event: 'close'+#### browserContext.on('close')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()](#browserclose) method was called.-#### event: 'page'+#### browserContext.on('page')- <[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')](#event-popup) to receive events about popups relevant to a specific page.+also fire for popup pages. See also [page.on('popup')](#pageonpopup) to receive events about popups relevant to a specific page.The earliest moment that page is available is when it has navigated to the initial url. For example, when opening apopup with `window.open('http://example.com')`, this event will fire when the network request to "http://example.com" is@@ -823,25 +823,25 @@ page.removeListener('request', logRequest);```<!-- GEN:toc -->-- [event: 'close'](#event-close-1)-- [event: 'console'](#event-console)-- [event: 'crash'](#event-crash)-- [event: 'dialog'](#event-dialog)-- [event: 'domcontentloaded'](#event-domcontentloaded)-- [event: 'download'](#event-download)-- [event: 'filechooser'](#event-filechooser)-- [event: 'frameattached'](#event-frameattached)-- [event: 'framedetached'](#event-framedetached)-- [event: 'framenavigated'](#event-framenavigated)-- [event: 'load'](#event-load)-- [event: 'pageerror'](#event-pageerror)-- [event: 'popup'](#event-popup)-- [event: 'request'](#event-request)-- [event: 'requestfailed'](#event-requestfailed)-- [event: 'requestfinished'](#event-requestfinished)-- [event: 'response'](#event-response)-- [event: 'websocket'](#event-websocket)-- [event: 'worker'](#event-worker)+- [page.on('close')](#pageonclose)+- [page.on('console')](#pageonconsole)+- [page.on('crash')](#pageoncrash)+- [page.on('dialog')](#pageondialog)+- [page.on('domcontentloaded')](#pageondomcontentloaded)+- [page.on('download')](#pageondownload)+- [page.on('filechooser')](#pageonfilechooser)+- [page.on('frameattached')](#pageonframeattached)+- [page.on('framedetached')](#pageonframedetached)+- [page.on('framenavigated')](#pageonframenavigated)+- [page.on('load')](#pageonload)+- [page.on('pageerror')](#pageonpageerror)+- [page.on('popup')](#pageonpopup)+- [page.on('request')](#pageonrequest)+- [page.on('requestfailed')](#pageonrequestfailed)+- [page.on('requestfinished')](#pageonrequestfinished)+- [page.on('response')](#pageonresponse)+- [page.on('websocket')](#pageonwebsocket)+- [page.on('worker')](#pageonworker)- [page.$(selector)](#pageselector)- [page.$$(selector)](#pageselector-1)- [page.$eval(selector, pageFunction[, arg])](#pageevalselector-pagefunction-arg)@@ -913,11 +913,11 @@ page.removeListener('request', logRequest);- [page.workers()](#pageworkers)<!-- GEN:stop -->-#### event: 'close'+#### page.on('close')Emitted when the page closes.-#### event: 'console'+#### page.on('console')- <[ConsoleMessage]>Emitted when JavaScript within the page calls one of console API methods, e.g. `console.log` or `console.dir`. Also@@ -935,7 +935,7 @@ page.on('console', msg => {page.evaluate(() => console.log('hello', 5, {foo: 'bar'}));```-#### event: 'crash'+#### page.on('crash')Emitted when the page crashes. Browser pages might crash if they try to allocate too much memory. When the page crashes,ongoing and subsequent operations will throw.@@ -966,18 +966,18 @@ await new Promise((resolve, reject) => {});```-#### event: 'dialog'+#### page.on('dialog')- <[Dialog]>Emitted when a JavaScript dialog appears, such as `alert`, `prompt`, `confirm` or `beforeunload`. Playwright can respondto the dialog via [dialog.accept([promptText])](#dialogacceptprompttext) or [dialog.dismiss()](#dialogdismiss) methods.-#### event: 'domcontentloaded'+#### page.on('domcontentloaded')Emitted when the JavaScript [`DOMContentLoaded`](https://developer.mozilla.org/en-US/docs/Web/Events/DOMContentLoaded)event is dispatched.-#### event: 'download'+#### page.on('download')- <[Download]>Emitted when attachment download started. User can access basic file operations on downloaded content via the passed@@ -987,7 +987,7 @@ Emitted when attachment download started. User can access basic file operationsdownloaded content. If `acceptDownloads` is not set or set to `false`, download events are emitted, but the actualdownload is not performed and user has no access to the downloaded files.-#### event: 'filechooser'+#### page.on('filechooser')- <[FileChooser]>Emitted when a file chooser is supposed to appear, such as after clicking the `<input type=file>`. Playwright can@@ -999,34 +999,34 @@ page.on('filechooser', async (fileChooser) => {});```-#### event: 'frameattached'+#### page.on('frameattached')- <[Frame]>Emitted when a frame is attached.-#### event: 'framedetached'+#### page.on('framedetached')- <[Frame]>Emitted when a frame is detached.-#### event: 'framenavigated'+#### page.on('framenavigated')- <[Frame]>Emitted when a frame is navigated to a new url.-#### event: 'load'+#### page.on('load')Emitted when the JavaScript [`load`](https://developer.mozilla.org/en-US/docs/Web/Events/load) event is dispatched.-#### event: 'pageerror'+#### page.on('pageerror')- <[Error]> The exception messageEmitted when an uncaught exception happens within the page.-#### event: 'popup'+#### page.on('popup')- <[Page]> Page corresponding to "popup" window-Emitted when the page opens a new tab or window. This event is emitted in addition to the [browserContext.on('page')](#event-page),+Emitted when the page opens a new tab or window. This event is emitted in addition to the [browserContext.on('page')](#browsercontextonpage),but only for popups relevant to this page.The earliest moment that page is available is when it has navigated to the initial url. For example, when opening a@@ -1044,38 +1044,38 @@ 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 inmost cases).-#### event: 'request'+#### page.on('request')- <[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).-#### event: 'requestfailed'+#### page.on('requestfailed')- <[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-requestfinished) event and not with [page.on('requestfailed')](#event-requestfailed).+will complete with [page.on('requestfinished')](#pageonrequestfinished) event and not with [page.on('requestfailed')](#pageonrequestfailed).-#### event: 'requestfinished'+#### page.on('requestfinished')- <[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: 'response'+#### page.on('response')- <[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: 'websocket'+#### page.on('websocket')- <[WebSocket]> websocketEmitted when <[WebSocket]> request is sent.-#### event: 'worker'+#### page.on('worker')- <[Worker]>Emitted when a dedicated [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) is spawned by the@@ -1256,7 +1256,7 @@ If `runBeforeUnload` is `false` the result will resolve only after the page hashandlers.> **NOTE** if `runBeforeUnload` is passed as true, a `beforeunload` dialog might be summoned-> and should be handled manually via [page.on('dialog')](#event-dialog) event.+> and should be handled manually via [page.on('dialog')](#pageondialog) event.#### page.content()- returns: <[Promise]<[string]>>@@ -2296,9 +2296,9 @@ At every point of time, page exposes its current frame tree via the [page.mainFrmethods.[Frame] object's lifecycle is controlled by three events, dispatched on the page object:-- [frame.on('frameattached')](#event-frameattached) - fired when the frame gets attached to the page. A Frame can be attached to the page only once.-- [frame.on('framenavigated')](#event-framenavigated) - fired when the frame commits navigation to a different URL.-- [frame.on('framedetached')](#event-framedetached) - 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:@@ -3659,7 +3659,7 @@ error if the object has circular references.### class: ConsoleMessage-[ConsoleMessage] objects are dispatched by page via the [page.on('console')](#event-console) event.+[ConsoleMessage] objects are dispatched by page via the [page.on('console')](#pageonconsole) event.<!-- GEN:toc -->- [consoleMessage.args()](#consolemessageargs)@@ -3689,7 +3689,7 @@ One of the following values: `'log'`, `'debug'`, `'info'`, `'error'`, `'warning'### class: Dialog-[Dialog] objects are dispatched by page via the [page.on('dialog')](#event-dialog) event.+[Dialog] objects are dispatched by page via the [page.on('dialog')](#pageondialog) event.An example of using `Dialog` class:@@ -3734,7 +3734,7 @@ const { chromium } = require('playwright'); // Or 'firefox' or 'webkit'.### class: Download-[Download] objects are dispatched by page via the [page.on('download')](#event-download) event.+[Download] objects are dispatched by page via the [page.on('download')](#pageondownload) event.All the downloaded files belonging to the browser context are deleted when the browser context is closed. All downloadedfiles are deleted when the browser closes.@@ -3824,7 +3824,7 @@ upon closing the browser context.### class: FileChooser-[FileChooser] objects are dispatched by the page in the [page.on('filechooser')](#event-filechooser) event.+[FileChooser] objects are dispatched by the page in the [page.on('filechooser')](#pageonfilechooser) event.```jspage.on('filechooser', async (fileChooser) => {@@ -4103,12 +4103,12 @@ 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')](#event-request) emitted when the request is issued by the page.-- [page.on('response')](#event-response) emitted when/if the response status and headers are received for the request.-- [page.on('requestfinished')](#event-requestfinished) 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')](#event-requestfailed) event is emitted.+the [page.on('requestfailed')](#pageonrequestfailed) event is emitted.> **NOTE** HTTP Error responses, such as 404 or 503, are still successful responses from HTTP standpoint, so requestwill complete with `'requestfinished'` event.@@ -4453,32 +4453,32 @@ await page.route('**/xhr_endpoint', route => route.fulfill({ path: 'mock_data.jsThe [WebSocket] class represents websocket connections in the page.<!-- GEN:toc -->-- [event: 'close'](#event-close-2)-- [event: 'framereceived'](#event-framereceived)-- [event: 'framesent'](#event-framesent)-- [event: 'socketerror'](#event-socketerror)+- [webSocket.on('close')](#websocketonclose)+- [webSocket.on('framereceived')](#websocketonframereceived)+- [webSocket.on('framesent')](#websocketonframesent)+- [webSocket.on('socketerror')](#websocketonsocketerror)- [webSocket.isClosed()](#websocketisclosed)- [webSocket.url()](#websocketurl)- [webSocket.waitForEvent(event[, optionsOrPredicate])](#websocketwaitforeventevent-optionsorpredicate)<!-- GEN:stop -->-#### event: 'close'+#### webSocket.on('close')Fired when the websocket closes.-#### event: 'framereceived'+#### webSocket.on('framereceived')- <[Object]> web socket frame data- `payload` <[string]|[Buffer]> frame payloadFired when the websocket recieves a frame.-#### event: 'framesent'+#### webSocket.on('framesent')- <[Object]> web socket frame data- `payload` <[string]|[Buffer]> frame payloadFired when the websocket sends a frame.-#### event: 'socketerror'+#### webSocket.on('socketerror')- <[String]> the error messageFired when the websocket has an error.@@ -4610,13 +4610,13 @@ for (const worker of page.workers())```<!-- GEN:toc -->-- [event: 'close'](#event-close-3)+- [worker.on('close')](#workeronclose)- [worker.evaluate(pageFunction[, arg])](#workerevaluatepagefunction-arg)- [worker.evaluateHandle(pageFunction[, arg])](#workerevaluatehandlepagefunction-arg)- [worker.url()](#workerurl)<!-- GEN:stop -->-#### event: 'close'+#### worker.on('close')- <[Worker]>Emitted when this dedicated [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) is terminated.@@ -4650,14 +4650,14 @@ the promise to resolve and return its value.### class: BrowserServer<!-- GEN:toc -->-- [event: 'close'](#event-close-4)+- [browserServer.on('close')](#browserserveronclose)- [browserServer.close()](#browserserverclose)- [browserServer.kill()](#browserserverkill)- [browserServer.process()](#browserserverprocess)- [browserServer.wsEndpoint()](#browserserverwsendpoint)<!-- GEN:stop -->-#### event: 'close'+#### browserServer.on('close')Emitted when the browser server closes.@@ -4932,7 +4932,7 @@ await browser.stopTracing();<!-- GEN:stop --><!-- GEN:toc-extends-Browser -->-- [event: 'disconnected'](#event-disconnected)+- [browser.on('disconnected')](#browserondisconnected)- [browser.close()](#browserclose)- [browser.contexts()](#browsercontexts)- [browser.isConnected()](#browserisconnected)@@ -4967,16 +4967,16 @@ const backgroundPage = await context.waitForEvent('backgroundpage');```<!-- GEN:toc -->-- [event: 'backgroundpage'](#event-backgroundpage)-- [event: 'serviceworker'](#event-serviceworker)+- [chromiumBrowserContext.on('backgroundpage')](#chromiumbrowsercontextonbackgroundpage)+- [chromiumBrowserContext.on('serviceworker')](#chromiumbrowsercontextonserviceworker)- [chromiumBrowserContext.backgroundPages()](#chromiumbrowsercontextbackgroundpages)- [chromiumBrowserContext.newCDPSession(page)](#chromiumbrowsercontextnewcdpsessionpage)- [chromiumBrowserContext.serviceWorkers()](#chromiumbrowsercontextserviceworkers)<!-- GEN:stop --><!-- GEN:toc-extends-BrowserContext -->-- [event: 'close'](#event-close)-- [event: 'page'](#event-page)+- [browserContext.on('close')](#browsercontextonclose)+- [browserContext.on('page')](#browsercontextonpage)- [browserContext.addCookies(cookies)](#browsercontextaddcookiescookies)- [browserContext.addInitScript(script[, arg])](#browsercontextaddinitscriptscript-arg)- [browserContext.browser()](#browsercontextbrowser)@@ -5001,14 +5001,14 @@ const backgroundPage = await context.waitForEvent('backgroundpage');- [browserContext.waitForEvent(event[, optionsOrPredicate])](#browsercontextwaitforeventevent-optionsorpredicate)<!-- GEN:stop -->-#### event: 'backgroundpage'+#### chromiumBrowserContext.on('backgroundpage')- <[Page]>Emitted when new background page is created in the context.> **NOTE** Only works with persistent context.-#### event: 'serviceworker'+#### chromiumBrowserContext.on('serviceworker')- <[Worker]>Emitted when new service worker is created in the context.@@ -5141,7 +5141,7 @@ send messages.Firefox browser instance does not expose Firefox-specific features.<!-- GEN:toc-extends-Browser -->-- [event: 'disconnected'](#event-disconnected)+- [browser.on('disconnected')](#browserondisconnected)- [browser.close()](#browserclose)- [browser.contexts()](#browsercontexts)- [browser.isConnected()](#browserisconnected)@@ -5156,7 +5156,7 @@ Firefox browser instance does not expose Firefox-specific features.WebKit browser instance does not expose WebKit-specific features.<!-- GEN:toc-extends-Browser -->-- [event: 'disconnected'](#event-disconnected)+- [browser.on('disconnected')](#browserondisconnected)- [browser.close()](#browserclose)- [browser.contexts()](#browsercontexts)- [browser.isConnected()](#browserisconnected)diff --git a/docs/multi-pages.md b/docs/multi-pages.mdindex cb1c7d46b0..93ca0c36b6 100644--- a/docs/multi-pages.md+++ b/docs/multi-pages.md@@ -90,7 +90,7 @@ context.on('page', async page => {#### API reference-- [event: 'page'](./api.md#event-page)+- [browserContext.on('page')](./api.md#browsercontextonpage)## Handling popups@@ -122,4 +122,4 @@ page.on('popup', async popup => {#### API reference-- [event: 'popup'](./api.md#event-popup)+- [page.on('popup')](./api.md#pageonpopup)diff --git a/docs/navigations.md b/docs/navigations.mdindex b4344fb485..11c595f727 100644--- a/docs/navigations.md+++ b/docs/navigations.md@@ -18,9 +18,9 @@ Playwright splits the process of showing a new document in a page into **navigat- [`page.url()`](api.md#pageurl) is set to the new url- document content is loaded over network and parsed-- [`domcontentloaded`](api.md#event-domcontentloaded) event is fired+- [`domcontentloaded`](api.md#pageondomcontentloaded) event is fired- page executes some scripts and loads resources like stylesheets and images-- [`load`](api.md#event-load) event is fired+- [`load`](api.md#pageonload) event is fired- page executes dynamically loaded scripts- `networkidle` is fired when no new network requests are made for 500 msdiff --git a/docs/network.md b/docs/network.mdindex d88e9490fd..7f53aa1e12 100644--- a/docs/network.md+++ b/docs/network.md@@ -30,7 +30,7 @@ await page.goto('https://example.com');#### API reference-- [`browser.newContext([options])`](./api.md#browsernewcontextoptions)+- [browser.newContext([options])](./api.md#browsernewcontextoptions)<br/>@@ -58,9 +58,9 @@ Note that handling the event forks the control flow and makes script harder to f#### API reference-- [`Download`](https://github.com/microsoft/playwright/blob/master/docs/api.md#class-download)-- [`page.on('download')`](https://github.com/microsoft/playwright/blob/master/docs/api.md#event-download)-- [`page.waitForEvent(event)`](https://github.com/microsoft/playwright/blob/master/docs/api.md##pagewaitforeventevent-optionsorpredicate)+- [Download](https://github.com/microsoft/playwright/blob/master/docs/api.md#class-download)+- [page.on('download')](https://github.com/microsoft/playwright/blob/master/docs/api.md#event-download)+- [page.waitForEvent(event)](https://github.com/microsoft/playwright/blob/master/docs/api.md##pagewaitforeventevent-optionsorpredicate)<br/>@@ -116,10 +116,10 @@ const [response] = await Promise.all([- [class `Request`](./api.md#class-request)- [class `Response`](./api.md#class-response)-- [event `'request'`](./api.md#event-request)-- [event `'response'`](./api.md#event-response)-- [`page.waitForRequest(urlOrPredicate[, options])`](./api.md#pagewaitforrequesturlorpredicate-options)-- [`page.waitForResponse(urlOrPredicate[, options])`](./api.md#pagewaitforresponseurlorpredicate-options)+- [page.on('request')](./api.md#pageonrequest)+- [page.on('response')](./api.md#pageonresponse)+- [page.waitForRequest(urlOrPredicate[, options])](./api.md#pagewaitforrequesturlorpredicate-options)+- [page.waitForResponse(urlOrPredicate[, options])](./api.md#pagewaitforresponseurlorpredicate-options)<br/>@@ -150,11 +150,11 @@ await page.goto('https://example.com');#### API reference-- [`browserContext.route(url, handler)`](./api.md#browsercontextrouteurl-handler)-- [`browserContext.unroute(url[, handler])`](./api.md#browsercontextunrouteurl-handler)-- [`page.route(url, handler)`](./api.md#pagerouteurl-handler)-- [`page.unroute(url[, handler])`](./api.md#pageunrouteurl-handler)-- [`Route`](./api.md#class-route)+- [browserContext.route(url, handler)](./api.md#browsercontextrouteurl-handler)+- [browserContext.unroute(url[, handler])](./api.md#browsercontextunrouteurl-handler)+- [page.route(url, handler)](./api.md#pagerouteurl-handler)+- [page.unroute(url[, handler])](./api.md#pageunrouteurl-handler)+- [Route](./api.md#class-route)<br/>@@ -188,8 +188,8 @@ await page.route('**/*', route => {#### API reference-- [`page.route(url, handler)`](./api.md#pagerouteurl-handler)-- [`browserContext.route(url, handler)`](./api.md#browsercontextrouteurl-handler)-- [`route.abort([errorCode])`](./api.md#routeaborterrorcode)+- [page.route(url, handler)](./api.md#pagerouteurl-handler)+- [browserContext.route(url, handler)](./api.md#browsercontextrouteurl-handler)+- [route.abort([errorCode])](./api.md#routeaborterrorcode)<br/>diff --git a/docs/verification.md b/docs/verification.mdindex fe379b7e1f..9dca950e66 100644--- a/docs/verification.md+++ b/docs/verification.md@@ -98,7 +98,7 @@ await msg.args[1].jsonValue() // 42- [class: ConsoleMessage](./api.md#class-consolemessage)- [class: Page](./api.md#class-page)-- [event: 'console'](./api.md#event-console)+- [page.on('console')](./api.md#pageonconsole)<br/>@@ -119,7 +119,7 @@ await page.goto('data:text/html,<script>throw new Error("Test")</script>');#### API reference- [class: Page](./api.md#class-page)-- [event: 'pageerror'](./api.md#event-pageerror)+- [page.on('pageerror')](./api.md#pageonpageerror)<br/>@@ -153,6 +153,6 @@ const [popup] = await Promise.all([#### API reference- [class: Page](./api.md#class-page)-- [event: 'requestfailed'](./api.md#event-requestfailed)-- [event: 'dialog'](./api.md#event-dialog)-- [event: 'popup'](./api.md#event-popup)+- [page.on('requestfailed')](./api.md#pageonrequestfailed)+- [page.on('dialog')](./api.md#pageondialog)+- [page.on('popup')](./api.md#pageonpopup)diff --git a/utils/doclint/check_public_api/MDBuilder.js b/utils/doclint/check_public_api/MDBuilder.jsindex e4752d6378..398e5e9db9 100644--- a/utils/doclint/check_public_api/MDBuilder.js+++ b/utils/doclint/check_public_api/MDBuilder.js@@ -233,9 +233,9 @@ class MDOutline {this.errors = errors;const classHeading = /^class: (\w+)$/;const constructorRegex = /^new (\w+)\((.*)\)$/;- const methodRegex = /^(\w+)\.([\w$]+)\((.*)\)$/;+ const methodRegex = /^(\w+)\.([\w$]+)\(([^']*)\)$/;const propertyRegex = /^(\w+)\.(\w+)$/;- const eventRegex = /^event: '(\w+)'$/;+ const eventRegex = /^.*\.on\('(\w+)'\)$/;let currentClassName = null;let currentClassMembers = [];let currentClassComment = '';diff --git a/utils/doclint/check_public_api/index.js b/utils/doclint/check_public_api/index.jsindex 614827bcea..dc47ebfeb7 100644--- a/utils/doclint/check_public_api/index.js+++ b/utils/doclint/check_public_api/index.js@@ -102,9 +102,9 @@ function compareDocumentations(actual, expected) {const expectedClasses = Array.from(expected.classes.keys()).sort();const classesDiff = diff(actualClasses, expectedClasses);for (const className of classesDiff.extra)- errors.push(`Non-existing class found: ${className}`);+ errors.push(`Documented but not implemented class: ${className}`);for (const className of classesDiff.missing)- errors.push(`Class not found: ${className}`);+ errors.push(`Implemented but not documented class: ${className}`);for (const className of classesDiff.equal) {const actualClass = actual.classes.get(className);@@ -113,9 +113,9 @@ function compareDocumentations(actual, expected) {const expectedMethods = Array.from(expectedClass.methods.keys()).sort();const methodDiff = diff(actualMethods, expectedMethods);for (const methodName of methodDiff.extra)- errors.push(`Non-existing method found: ${className}.${methodName}()`);+ errors.push(`Documented but not implemented method: ${className}.${methodName}()`);for (const methodName of methodDiff.missing)- errors.push(`Method not found: ${className}.${methodName}()`);+ errors.push(`Implemented but not documented method: ${className}.${methodName}()`);for (const methodName of methodDiff.equal) {const actualMethod = actualClass.methods.get(methodName);@@ -134,9 +134,9 @@ function compareDocumentations(actual, expected) {if (argsDiff.extra.length || argsDiff.missing.length) {const text = [`Method ${className}.${methodName}() fails to describe its parameters:`];for (const arg of argsDiff.missing)- text.push(`- Argument not found: ${arg}`);+ text.push(`- Implemented but not documented argument: ${arg}`);for (const arg of argsDiff.extra)- text.push(`- Non-existing argument found: ${arg}`);+ text.push(`- Documented but not implemented argument: ${arg}`);errors.push(text.join('\n'));}@@ -147,20 +147,20 @@ function compareDocumentations(actual, expected) {const expectedProperties = Array.from(expectedClass.properties.keys()).sort();const propertyDiff = diff(actualProperties, expectedProperties);for (const propertyName of propertyDiff.extra)- errors.push(`Non-existing property found: ${className}.${propertyName}`);+ errors.push(`Documented but not implemented property: ${className}.${propertyName}`);for (const propertyName of propertyDiff.missing) {if (propertyName === 'T')continue;- errors.push(`Property not found: ${className}.${propertyName}`);+ errors.push(`Implemented but not documented property: ${className}.${propertyName}`);}const actualEvents = Array.from(actualClass.events.keys()).sort();const expectedEvents = Array.from(expectedClass.events.keys()).sort();const eventsDiff = diff(actualEvents, expectedEvents);for (const eventName of eventsDiff.extra)- errors.push(`Non-existing event found in class ${className}: '${eventName}'`);+ errors.push(`Documented but not implemented event ${className}: '${eventName}'`);for (const eventName of eventsDiff.missing)- errors.push(`Event not found in class ${className}: '${eventName}'`);+ errors.push(`Implemented but not documented event ${className}: '${eventName}'`);}diff --git a/utils/doclint/check_public_api/test/check-sorting/doc.md b/utils/doclint/check_public_api/test/check-sorting/doc.mdindex 9b3162824a..0c97192b34 100644--- a/utils/doclint/check_public_api/test/check-sorting/doc.md+++ b/utils/doclint/check_public_api/test/check-sorting/doc.md@@ -1,12 +1,12 @@### class: Foo-#### event: 'c'+#### foo.on('c')-#### event: 'a'+#### foo.on('a')#### foo.aaa()-#### event: 'b'+#### foo.on('b')#### foo.ddddiff --git a/utils/doclint/check_public_api/test/diff-arguments/result.txt b/utils/doclint/check_public_api/test/diff-arguments/result.txtindex bd6b1f0eb1..2fcfe77331 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,4 @@[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:-- Argument not found: arg3-- Non-existing argument found: arg2\ No newline at end of file+- 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/result.txt b/utils/doclint/check_public_api/test/diff-classes/result.txtindex 2852a437c6..37e0cbf023 100644--- a/utils/doclint/check_public_api/test/diff-classes/result.txt+++ b/utils/doclint/check_public_api/test/diff-classes/result.txt@@ -1,3 +1,3 @@-[MarkDown] Non-existing class found: Bar-[MarkDown] Non-existing class found: Baz-[MarkDown] Class not found: Other\ No newline at end of file+[MarkDown] Documented but not implemented class: Bar+[MarkDown] Documented but not implemented class: Baz+[MarkDown] Implemented but not documented class: Other\ No newline at end of filediff --git a/utils/doclint/check_public_api/test/diff-events/doc.md b/utils/doclint/check_public_api/test/diff-events/doc.mdindex 3da9c79511..44249e2394 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-#### event: 'start'+#### foo.on('start')-#### event: 'stop'+#### foo.on('stop')diff --git a/utils/doclint/check_public_api/test/diff-events/result.txt b/utils/doclint/check_public_api/test/diff-events/result.txtindex 8a18433aed..2584564bf6 100644--- a/utils/doclint/check_public_api/test/diff-events/result.txt+++ b/utils/doclint/check_public_api/test/diff-events/result.txt@@ -1,2 +1,2 @@-[MarkDown] Non-existing event found in class Foo: 'stop'-[MarkDown] Event not found in class Foo: 'finish'\ No newline at end of file+[MarkDown] Implemented but not documented event Foo: 'finish'+[MarkDown] Implemented but not documented event Foo: 'start'\ No newline at end of filediff --git a/utils/doclint/check_public_api/test/diff-methods/result.txt b/utils/doclint/check_public_api/test/diff-methods/result.txtindex d919f52e99..3f1ef2fea6 100644--- a/utils/doclint/check_public_api/test/diff-methods/result.txt+++ b/utils/doclint/check_public_api/test/diff-methods/result.txt@@ -1,3 +1,3 @@-[MarkDown] Non-existing method found: Foo.proceed()-[MarkDown] Method not found: Foo.stop()-[MarkDown] Property not found: Foo.zzz\ No newline at end of file+[MarkDown] Documented but not implemented method: Foo.proceed()+[MarkDown] Implemented but not documented method: Foo.stop()+[MarkDown] Implemented but not documented property: Foo.zzz\ No newline at end of filediff --git a/utils/doclint/check_public_api/test/diff-properties/result.txt b/utils/doclint/check_public_api/test/diff-properties/result.txtindex 382a4d41b8..1c3039dd53 100644--- a/utils/doclint/check_public_api/test/diff-properties/result.txt+++ b/utils/doclint/check_public_api/test/diff-properties/result.txt@@ -1,2 +1,2 @@-[MarkDown] Non-existing property found: Foo.c-[MarkDown] Property not found: Foo.b\ No newline at end of file+[MarkDown] Documented but not implemented property: Foo.c+[MarkDown] Implemented but not documented property: Foo.b\ No newline at end of filediff --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 42695c4cd4..6f2d6b19eb 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@@ -2,7 +2,7 @@This is a class.-#### event: 'frame'+#### foo.on('frame')- <[Frame]>This event is dispatched.diff --git a/utils/doclint/cli.js b/utils/doclint/cli.jsindex 0e2550eddf..bbcf01fb28 100755--- a/utils/doclint/cli.js+++ b/utils/doclint/cli.js@@ -59,47 +59,67 @@ async function run() {{const nodes = parseMd(renderMdTemplate(body, params));const signatures = new Map();- let h4;+ let lastMethod;let args;- const flush = () => {- if (h4 && !['page.accessibility', 'page.mouse', 'page.keyboard', 'page.coverage', 'page.touchscreen'].includes(h4.h4)) {- 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;+ const flushMethodSignature = () => {+ if (!lastMethod)+ return;+ 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}`);}- if (hasOptional)- tokens.push(']');- const signature = tokens.join('');- signatures.set(h4.h4, signature);- h4.h4 = `${h4.h4}(${signature})`;+ hasOptional = hasOptional || optional;}- h4 = null;+ if (hasOptional)+ tokens.push(']');+ const signature = tokens.join('');+ signatures.set(lastMethod.h4, signature);+ lastMethod.h4 = `${lastMethod.h4}(${signature})`;+ lastMethod = null;args = null;};for (const node of nodes) {if (node.h1 || node.h2 || node.h3 || node.h4)- flush();+ flushMethodSignature();+if (node.h4) {- h4 = node.h4.startsWith('event:') ? null : node;- args = node.h4.startsWith('event:') ? null : [];+ lastMethod = null;+ args = null;+ let match = node.h4.match(/(event|method|namespace) (JS|CDP|[A-Z])([^.]+)\.(.*)/);+ if (!match)+ continue;+ if (match[1] === 'event') {+ node.h4 = `${match[2].toLowerCase() + match[3]}.on('${match[4]}')`;+ continue;+ }++ if (match[1] === 'method') {+ node.h4 = `${match[2].toLowerCase() + match[3]}.${match[4]}`;+ lastMethod = node;+ args = [];+ continue;+ }++ if (match[1] === 'namespace') {+ node.h4 = `${match[2].toLowerCase() + match[3]}.${match[4]}`;+ continue;+ }+continue;}- if (args && node.li && node.liType === 'default' && !node.li.startsWith('returns')) {+ if (args && node.li && node.liType === 'default' && !node.li.startsWith('returns'))args.push(parseArgument(node.li));- }}api.setText([comment, header, renderMd(nodes), footer].join('\n'));@@ -202,7 +222,8 @@ async function getChromeVersion() {function getRepositoryFiles() {const out = spawnSync('git', ['ls-files'], {cwd: PROJECT_DIR});- return out.stdout.toString().trim().split('\n').map(file => path.join(PROJECT_DIR, file));+ const files = out.stdout.toString().trim().split('\n').filter(f => !f.startsWith('docs-src'));+ return files.map(file => path.join(PROJECT_DIR, file));}async function getFirefoxVersion() {diff --git a/utils/doclint/preprocessor/index.js b/utils/doclint/preprocessor/index.jsindex 214e8c5c54..edfa1e29c6 100644--- a/utils/doclint/preprocessor/index.js+++ b/utils/doclint/preprocessor/index.js@@ -126,7 +126,6 @@ function autocorrectInvalidLinks(projectRoot, sources, allowedFilePaths) {}const sourceEdits = new SourceEdits(source);let offset = 0;- const edits = [];const lines = source.text().split('\n');lines.forEach((line, lineNumber) => {@@ -192,10 +191,10 @@ function generateLinks(source, signatures, messages) {while (match = linkRegex.exec(line)) {const [, name] = match;const hrefOffset = offset + lineNumber + match.index + 3 + name.length;- const eventMatch = name.match(/.*on\('(.*)'\)/);+ const eventMatch = name.match(/.*on\('.*'\)/);let replacement;if (eventMatch) {- replacement = `#event-${eventMatch[1]}`;+ replacement = eventMatch[0];} else {const method = name.substring(0, name.length - 2);let signature = signatures.get(method);@@ -204,9 +203,9 @@ function generateLinks(source, signatures, messages) {signature = '\u2026';}sourceEdits.edit(hrefOffset - 3, hrefOffset - 3, signature);- replacement = `#${(name + signature).toLowerCase().replace(/[^a-z]/gm, '')}`;+ replacement = name + signature;}- sourceEdits.edit(hrefOffset, hrefOffset, replacement);+ sourceEdits.edit(hrefOffset, hrefOffset, '#' + replacement.toLowerCase().replace(/[^a-z]/gm, ''));}offset += line.length;});