| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237 |
- #!/usr/bin/node
- "use strict";
- // If we don't have this, we're done for
- const { exit } = require('process');
- const fs = require('fs');
- const path = require('path');
- // Don't explode, but be helpful when we have unsatisfied deps
- try {
- require('uuid');
- require('playwright');
- require('express');
- } catch {
- console.log("Required dependencies are not installed. Cannot continue, run `npm i` to fix.");
- exit(1);
- }
- // Get what we actually want from our deps
- const { v4 : uuidv4 } = require('uuid');
- const { chromium, firefox, webkit, devices } = require('playwright');
- const express = require('express');
- // Defines our interface
- // let sharedir = require.resolve('playwright'); // api.json should be shipped with playwright itself
- // var theFile = path.dirname(sharedir) + '/api.json';
- // let rawdata = fs.readFileSync(theFile);
- // On newer versions of playwright, instead of using hash tables they just lazily output arrays, so we have to convert this
- // let spec = JSON.parse(rawdata);
- let spec = [{"name":"Accessibility","spec":[{"type":"text","text":"The Accessibility class provides methods for inspecting Chromium's accessibility tree. The accessibility tree is used by assistive technology such as [screen readers](https://en.wikipedia.org/wiki/Screen_reader) or [switches](https://en.wikipedia.org/wiki/Switch_access)."},{"type":"text","text":"Accessibility is a very platform-specific thing. On different platforms, there are different screen readers that might have wildly different output."},{"type":"text","text":"Rendering engines of Chromium, Firefox and WebKit have a concept of \"accessibility tree\", which is then translated into different platform-specific APIs. Accessibility namespace gives access to this Accessibility Tree."},{"type":"text","text":"Most of the accessibility tree gets filtered out when converting from internal browser AX Tree to Platform-specific AX-Tree or by assistive technologies themselves. By default, Playwright tries to approximate this filtering, exposing only the \"interesting\" nodes of the tree."}],"langs":{"only":["csharp","js","python"],"aliases":{},"types":{},"overrides":{}},"comment":"The Accessibility class provides methods for inspecting Chromium's accessibility tree. The accessibility tree is used by\nassistive technology such as [screen readers](https://en.wikipedia.org/wiki/Screen_reader) or\n[switches](https://en.wikipedia.org/wiki/Switch_access).\n\nAccessibility is a very platform-specific thing. On different platforms, there are different screen readers that might\nhave wildly different output.\n\nRendering engines of Chromium, Firefox and WebKit have a concept of \"accessibility tree\", which is then translated into\ndifferent platform-specific APIs. Accessibility namespace gives access to this Accessibility Tree.\n\nMost of the accessibility tree gets filtered out when converting from internal browser AX Tree to Platform-specific\nAX-Tree or by assistive technologies themselves. By default, Playwright tries to approximate this filtering, exposing\nonly the \"interesting\" nodes of the tree.","members":[{"kind":"method","langs":{"types":{"java":{"name":"","union":[{"name":"null"},{"name":"string"}],"expression":"[null]|[string]"},"csharp":{"name":"JsonElement?","expression":"[JsonElement?]"}}},"name":"snapshot","type":{"name":"","union":[{"name":"null"},{"name":"Object","properties":[{"kind":"property","langs":{},"name":"role","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"The [role](https://www.w3.org/TR/wai-aria/#usage_intro)."}],"required":true,"comment":"The [role](https://www.w3.org/TR/wai-aria/#usage_intro).","deprecated":false,"async":false,"alias":"role"},{"kind":"property","langs":{},"name":"name","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A human readable name for the node."}],"required":true,"comment":"A human readable name for the node.","deprecated":false,"async":false,"alias":"name"},{"kind":"property","langs":{},"name":"value","type":{"name":"","union":[{"name":"string"},{"name":"float"}],"expression":"[string]|[float]"},"spec":[{"type":"text","text":"The current value of the node, if applicable."}],"required":false,"comment":"The current value of the node, if applicable.","deprecated":false,"async":false,"alias":"value"},{"kind":"property","langs":{},"name":"description","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"An additional human readable description of the node, if applicable."}],"required":false,"comment":"An additional human readable description of the node, if applicable.","deprecated":false,"async":false,"alias":"description"},{"kind":"property","langs":{},"name":"keyshortcuts","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Keyboard shortcuts associated with this node, if applicable."}],"required":false,"comment":"Keyboard shortcuts associated with this node, if applicable.","deprecated":false,"async":false,"alias":"keyshortcuts"},{"kind":"property","langs":{},"name":"roledescription","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A human readable alternative to the role, if applicable."}],"required":false,"comment":"A human readable alternative to the role, if applicable.","deprecated":false,"async":false,"alias":"roledescription"},{"kind":"property","langs":{},"name":"valuetext","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A description of the current value, if applicable."}],"required":false,"comment":"A description of the current value, if applicable.","deprecated":false,"async":false,"alias":"valuetext"},{"kind":"property","langs":{},"name":"disabled","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether the node is disabled, if applicable."}],"required":false,"comment":"Whether the node is disabled, if applicable.","deprecated":false,"async":false,"alias":"disabled"},{"kind":"property","langs":{},"name":"expanded","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether the node is expanded or collapsed, if applicable."}],"required":false,"comment":"Whether the node is expanded or collapsed, if applicable.","deprecated":false,"async":false,"alias":"expanded"},{"kind":"property","langs":{},"name":"focused","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether the node is focused, if applicable."}],"required":false,"comment":"Whether the node is focused, if applicable.","deprecated":false,"async":false,"alias":"focused"},{"kind":"property","langs":{},"name":"modal","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether the node is [modal](https://en.wikipedia.org/wiki/Modal_window), if applicable."}],"required":false,"comment":"Whether the node is [modal](https://en.wikipedia.org/wiki/Modal_window), if applicable.","deprecated":false,"async":false,"alias":"modal"},{"kind":"property","langs":{},"name":"multiline","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether the node text input supports multiline, if applicable."}],"required":false,"comment":"Whether the node text input supports multiline, if applicable.","deprecated":false,"async":false,"alias":"multiline"},{"kind":"property","langs":{},"name":"multiselectable","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether more than one child can be selected, if applicable."}],"required":false,"comment":"Whether more than one child can be selected, if applicable.","deprecated":false,"async":false,"alias":"multiselectable"},{"kind":"property","langs":{},"name":"readonly","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether the node is read only, if applicable."}],"required":false,"comment":"Whether the node is read only, if applicable.","deprecated":false,"async":false,"alias":"readonly"},{"kind":"property","langs":{},"name":"required","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether the node is required, if applicable."}],"required":false,"comment":"Whether the node is required, if applicable.","deprecated":false,"async":false,"alias":"required"},{"kind":"property","langs":{},"name":"selected","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether the node is selected in its parent node, if applicable."}],"required":false,"comment":"Whether the node is selected in its parent node, if applicable.","deprecated":false,"async":false,"alias":"selected"},{"kind":"property","langs":{},"name":"checked","type":{"name":"","union":[{"name":"boolean"},{"name":"\"mixed\""}],"expression":"[boolean]|\"mixed\""},"spec":[{"type":"text","text":"Whether the checkbox is checked, or \"mixed\", if applicable."}],"required":false,"comment":"Whether the checkbox is checked, or \"mixed\", if applicable.","deprecated":false,"async":false,"alias":"checked"},{"kind":"property","langs":{},"name":"pressed","type":{"name":"","union":[{"name":"boolean"},{"name":"\"mixed\""}],"expression":"[boolean]|\"mixed\""},"spec":[{"type":"text","text":"Whether the toggle button is checked, or \"mixed\", if applicable."}],"required":false,"comment":"Whether the toggle button is checked, or \"mixed\", if applicable.","deprecated":false,"async":false,"alias":"pressed"},{"kind":"property","langs":{},"name":"level","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"The level of a heading, if applicable."}],"required":false,"comment":"The level of a heading, if applicable.","deprecated":false,"async":false,"alias":"level"},{"kind":"property","langs":{},"name":"valuemin","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"The minimum value in a node, if applicable."}],"required":false,"comment":"The minimum value in a node, if applicable.","deprecated":false,"async":false,"alias":"valuemin"},{"kind":"property","langs":{},"name":"valuemax","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"The maximum value in a node, if applicable."}],"required":false,"comment":"The maximum value in a node, if applicable.","deprecated":false,"async":false,"alias":"valuemax"},{"kind":"property","langs":{},"name":"autocomplete","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"What kind of autocomplete is supported by a control, if applicable."}],"required":false,"comment":"What kind of autocomplete is supported by a control, if applicable.","deprecated":false,"async":false,"alias":"autocomplete"},{"kind":"property","langs":{},"name":"haspopup","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"What kind of popup is currently being shown for a node, if applicable."}],"required":false,"comment":"What kind of popup is currently being shown for a node, if applicable.","deprecated":false,"async":false,"alias":"haspopup"},{"kind":"property","langs":{},"name":"invalid","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Whether and in what way this node's value is invalid, if applicable."}],"required":false,"comment":"Whether and in what way this node's value is invalid, if applicable.","deprecated":false,"async":false,"alias":"invalid"},{"kind":"property","langs":{},"name":"orientation","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Whether the node is oriented horizontally or vertically, if applicable."}],"required":false,"comment":"Whether the node is oriented horizontally or vertically, if applicable.","deprecated":false,"async":false,"alias":"orientation"},{"kind":"property","langs":{},"name":"children","type":{"name":"Array","templates":[{"name":"Object"}],"expression":"[Array]<[Object]>"},"spec":[{"type":"text","text":"Child nodes, if any, if applicable."}],"required":false,"comment":"Child nodes, if any, if applicable.","deprecated":false,"async":false,"alias":"children"}]}],"expression":"[null]|[Object]"},"spec":[{"type":"text","text":"Captures the current state of the accessibility tree. The returned object represents the root accessible node of the page."},{"type":"note","noteType":"note","text":"The Chromium accessibility tree contains nodes that go unused on most platforms and by most screen readers. Playwright will discard them as well for an easier to process tree, unless `interestingOnly` is set to `false`."},{"type":"text","text":"An example of dumping the entire accessibility tree:"},{"type":"code","lines":["const snapshot = await page.accessibility.snapshot();","console.log(snapshot);"],"codeLang":"js"},{"type":"code","lines":["String snapshot = page.accessibility().snapshot();","System.out.println(snapshot);"],"codeLang":"java"},{"type":"code","lines":["snapshot = await page.accessibility.snapshot()","print(snapshot)"],"codeLang":"python async"},{"type":"code","lines":["snapshot = page.accessibility.snapshot()","print(snapshot)"],"codeLang":"python sync"},{"type":"code","lines":["var accessibilitySnapshot = await page.Accessibility.SnapshotAsync();","Console.WriteLine(System.Text.Json.JsonSerializer.Serialize(accessibilitySnapshot));"],"codeLang":"csharp"},{"type":"text","text":"An example of logging the focused node's name:"},{"type":"code","lines":["const snapshot = await page.accessibility.snapshot();","const node = findFocusedNode(snapshot);","console.log(node && node.name);","","function findFocusedNode(node) {"," if (node.focused)"," return node;"," for (const child of node.children || []) {"," const foundNode = findFocusedNode(child);"," return foundNode;"," }"," return null;","}"],"codeLang":"js"},{"type":"code","lines":["var accessibilitySnapshot = await page.Accessibility.SnapshotAsync();","Console.WriteLine(System.Text.Json.JsonSerializer.Serialize(accessibilitySnapshot));"],"codeLang":"csharp"},{"type":"code","lines":["// FIXME","String snapshot = page.accessibility().snapshot();"],"codeLang":"java"},{"type":"code","lines":["def find_focused_node(node):"," if (node.get(\"focused\"))"," return node"," for child in (node.get(\"children\") or []):"," found_node = find_focused_node(child)"," return found_node"," return None","","snapshot = await page.accessibility.snapshot()","node = find_focused_node(snapshot)","if node:"," print(node[\"name\"])"],"codeLang":"python async"},{"type":"code","lines":["def find_focused_node(node):"," if (node.get(\"focused\"))"," return node"," for child in (node.get(\"children\") or []):"," found_node = find_focused_node(child)"," return found_node"," return None","","snapshot = page.accessibility.snapshot()","node = find_focused_node(snapshot)","if node:"," print(node[\"name\"])"],"codeLang":"python sync"}],"required":true,"comment":"Captures the current state of the accessibility tree. The returned object represents the root accessible node of the\npage.\n\n> NOTE: The Chromium accessibility tree contains nodes that go unused on most platforms and by most screen readers.\nPlaywright will discard them as well for an easier to process tree, unless `interestingOnly` is set to `false`.\n\nAn example of dumping the entire accessibility tree:\n\n```js\nconst snapshot = await page.accessibility.snapshot();\nconsole.log(snapshot);\n```\n\n```java\nString snapshot = page.accessibility().snapshot();\nSystem.out.println(snapshot);\n```\n\n```python async\nsnapshot = await page.accessibility.snapshot()\nprint(snapshot)\n```\n\n```python sync\nsnapshot = page.accessibility.snapshot()\nprint(snapshot)\n```\n\n```csharp\nvar accessibilitySnapshot = await page.Accessibility.SnapshotAsync();\nConsole.WriteLine(System.Text.Json.JsonSerializer.Serialize(accessibilitySnapshot));\n```\n\nAn example of logging the focused node's name:\n\n```js\nconst snapshot = await page.accessibility.snapshot();\nconst node = findFocusedNode(snapshot);\nconsole.log(node && node.name);\n\nfunction findFocusedNode(node) {\n if (node.focused)\n return node;\n for (const child of node.children || []) {\n const foundNode = findFocusedNode(child);\n return foundNode;\n }\n return null;\n}\n```\n\n```csharp\nvar accessibilitySnapshot = await page.Accessibility.SnapshotAsync();\nConsole.WriteLine(System.Text.Json.JsonSerializer.Serialize(accessibilitySnapshot));\n```\n\n```java\n// FIXME\nString snapshot = page.accessibility().snapshot();\n```\n\n```python async\ndef find_focused_node(node):\n if (node.get(\"focused\"))\n return node\n for child in (node.get(\"children\") or []):\n found_node = find_focused_node(child)\n return found_node\n return None\n\nsnapshot = await page.accessibility.snapshot()\nnode = find_focused_node(snapshot)\nif node:\n print(node[\"name\"])\n```\n\n```python sync\ndef find_focused_node(node):\n if (node.get(\"focused\"))\n return node\n for child in (node.get(\"children\") or []):\n found_node = find_focused_node(child)\n return found_node\n return None\n\nsnapshot = page.accessibility.snapshot()\nnode = find_focused_node(snapshot)\nif node:\n print(node[\"name\"])\n```\n","deprecated":false,"async":true,"alias":"snapshot","args":[{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"interestingOnly","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Prune uninteresting nodes from the tree. Defaults to `true`."}],"required":false,"comment":"Prune uninteresting nodes from the tree. Defaults to `true`.","deprecated":false,"async":false,"alias":"interestingOnly"},{"kind":"property","langs":{},"name":"root","type":{"name":"ElementHandle","expression":"[ElementHandle]"},"spec":[{"type":"text","text":"The root DOM element for the snapshot. Defaults to the whole page."}],"required":false,"comment":"The root DOM element for the snapshot. Defaults to the whole page.","deprecated":false,"async":false,"alias":"root"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]}]},{"name":"Android","spec":[{"type":"text","text":"Playwright has **experimental** support for Android automation. See [here](./mobile.md) for more information. You can access android namespace via:"},{"type":"code","lines":["const { _android: android } = require('playwright');"],"codeLang":"js"},{"type":"text","text":"An example of the Android automation script would be:"},{"type":"code","lines":["const { _android: android } = require('playwright');","","(async () => {"," // Connect to the device."," const [device] = await android.devices();"," console.log(`Model: ${device.model()}`);"," console.log(`Serial: ${device.serial()}`);"," // Take screenshot of the whole device."," await device.screenshot({ path: 'device.png' });",""," {"," // --------------------- WebView -----------------------",""," // Launch an application with WebView."," await device.shell('am force-stop org.chromium.webview_shell');"," await device.shell('am start org.chromium.webview_shell/.WebViewBrowserActivity');"," // Get the WebView."," const webview = await device.webView({ pkg: 'org.chromium.webview_shell' });",""," // Fill the input box."," await device.fill({ res: 'org.chromium.webview_shell:id/url_field' }, 'github.com/microsoft/playwright');"," await device.press({ res: 'org.chromium.webview_shell:id/url_field' }, 'Enter');",""," // Work with WebView's page as usual."," const page = await webview.page();"," await page.waitForNavigation({ url: /.*microsoft\\/playwright.*/ });"," console.log(await page.title());"," }",""," {"," // --------------------- Browser -----------------------",""," // Launch Chrome browser."," await device.shell('am force-stop com.android.chrome');"," const context = await device.launchBrowser();",""," // Use BrowserContext as usual."," const page = await context.newPage();"," await page.goto('https://webkit.org/');"," console.log(await page.evaluate(() => window.location.href));"," await page.screenshot({ path: 'page.png' });",""," await context.close();"," }",""," // Close the device."," await device.close();","})();"],"codeLang":"js"},{"type":"text","text":"Note that since you don't need Playwright to install web browsers when testing Android, you can omit browser download via setting the following environment variable when installing Playwright:"},{"type":"code","lines":["PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm i -D playwright"],"codeLang":"bash js"}],"langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"comment":"Playwright has **experimental** support for Android automation. See [here](./mobile.md) for more information. You can\naccess android namespace via:\n\n```js\nconst { _android: android } = require('playwright');\n```\n\nAn example of the Android automation script would be:\n\n```js\nconst { _android: android } = require('playwright');\n\n(async () => {\n // Connect to the device.\n const [device] = await android.devices();\n console.log(`Model: ${device.model()}`);\n console.log(`Serial: ${device.serial()}`);\n // Take screenshot of the whole device.\n await device.screenshot({ path: 'device.png' });\n\n {\n // --------------------- WebView -----------------------\n\n // Launch an application with WebView.\n await device.shell('am force-stop org.chromium.webview_shell');\n await device.shell('am start org.chromium.webview_shell/.WebViewBrowserActivity');\n // Get the WebView.\n const webview = await device.webView({ pkg: 'org.chromium.webview_shell' });\n\n // Fill the input box.\n await device.fill({ res: 'org.chromium.webview_shell:id/url_field' }, 'github.com/microsoft/playwright');\n await device.press({ res: 'org.chromium.webview_shell:id/url_field' }, 'Enter');\n\n // Work with WebView's page as usual.\n const page = await webview.page();\n await page.waitForNavigation({ url: /.*microsoft\\/playwright.*/ });\n console.log(await page.title());\n }\n\n {\n // --------------------- Browser -----------------------\n\n // Launch Chrome browser.\n await device.shell('am force-stop com.android.chrome');\n const context = await device.launchBrowser();\n\n // Use BrowserContext as usual.\n const page = await context.newPage();\n await page.goto('https://webkit.org/');\n console.log(await page.evaluate(() => window.location.href));\n await page.screenshot({ path: 'page.png' });\n\n await context.close();\n }\n\n // Close the device.\n await device.close();\n})();\n```\n\nNote that since you don't need Playwright to install web browsers when testing Android, you can omit browser download\nvia setting the following environment variable when installing Playwright:\n\n```bash js\nPLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm i -D playwright\n```\n","members":[{"kind":"method","langs":{},"name":"devices","type":{"name":"Array","templates":[{"name":"AndroidDevice"}],"expression":"[Array]<[AndroidDevice]>"},"spec":[{"type":"text","text":"Returns the list of detected Android devices."}],"required":true,"comment":"Returns the list of detected Android devices.","deprecated":false,"async":true,"alias":"devices","args":[]},{"kind":"method","langs":{},"name":"setDefaultTimeout","type":{"name":"void"},"spec":[{"type":"text","text":"This setting will change the default maximum time for all the methods accepting `timeout` option."}],"required":true,"comment":"This setting will change the default maximum time for all the methods accepting `timeout` option.","deprecated":false,"async":false,"alias":"setDefaultTimeout","args":[{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds"}],"required":true,"comment":"Maximum time in milliseconds","deprecated":false,"async":false,"alias":"timeout"}]}]},{"name":"AndroidDevice","spec":[{"type":"text","text":"`AndroidDevice` represents a connected device, either real hardware or emulated. Devices can be obtained using [`method: Android.devices`]."}],"langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"comment":"`AndroidDevice` represents a connected device, either real hardware or emulated. Devices can be obtained using\n[`method: Android.devices`].","members":[{"kind":"event","langs":{},"name":"webView","type":{"name":"AndroidWebView","expression":"[AndroidWebView]"},"spec":[{"type":"text","text":"Emitted when a new WebView instance is detected."}],"required":true,"comment":"Emitted when a new WebView instance is detected.","deprecated":false,"async":false,"alias":"webView","args":[]},{"kind":"method","langs":{},"name":"close","type":{"name":"void"},"spec":[{"type":"text","text":"Disconnects from the device."}],"required":true,"comment":"Disconnects from the device.","deprecated":false,"async":true,"alias":"close","args":[]},{"kind":"method","langs":{},"name":"drag","type":{"name":"void"},"spec":[{"type":"text","text":"Drags the widget defined by `selector` towards `dest` point."}],"required":true,"comment":"Drags the widget defined by `selector` towards `dest` point.","deprecated":false,"async":true,"alias":"drag","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"AndroidSelector","expression":"[AndroidSelector]"},"spec":[{"type":"text","text":"Selector to drag."}],"required":true,"comment":"Selector to drag.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"dest","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"x","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"x"},{"kind":"property","langs":{},"name":"y","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"y"}],"expression":"[Object]"},"spec":[{"type":"text","text":"Point to drag to."}],"required":true,"comment":"Point to drag to.","deprecated":false,"async":false,"alias":"dest"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"speed","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Optional speed of the drag in pixels per second."}],"required":false,"comment":"Optional speed of the drag in pixels per second.","deprecated":false,"async":false,"alias":"speed"},{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: AndroidDevice.setDefaultTimeout`] method."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: AndroidDevice.setDefaultTimeout`] method.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"fill","type":{"name":"void"},"spec":[{"type":"text","text":"Fills the specific `selector` input box with `text`."}],"required":true,"comment":"Fills the specific `selector` input box with `text`.","deprecated":false,"async":true,"alias":"fill","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"AndroidSelector","expression":"[AndroidSelector]"},"spec":[{"type":"text","text":"Selector to fill."}],"required":true,"comment":"Selector to fill.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"text","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Text to be filled in the input box."}],"required":true,"comment":"Text to be filled in the input box.","deprecated":false,"async":false,"alias":"text"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: AndroidDevice.setDefaultTimeout`] method."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: AndroidDevice.setDefaultTimeout`] method.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"fling","type":{"name":"void"},"spec":[{"type":"text","text":"Flings the widget defined by `selector` in the specified `direction`."}],"required":true,"comment":"Flings the widget defined by `selector` in the specified `direction`.","deprecated":false,"async":true,"alias":"fling","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"AndroidSelector","expression":"[AndroidSelector]"},"spec":[{"type":"text","text":"Selector to fling."}],"required":true,"comment":"Selector to fling.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"direction","type":{"name":"AndroidFlingDirection","union":[{"name":"\"down\""},{"name":"\"up\""},{"name":"\"left\""},{"name":"\"right\""}],"expression":"[AndroidFlingDirection]<\"down\"|\"up\"|\"left\"|\"right\">"},"spec":[{"type":"text","text":"Fling direction."}],"required":true,"comment":"Fling direction.","deprecated":false,"async":false,"alias":"direction"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"speed","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Optional speed of the fling in pixels per second."}],"required":false,"comment":"Optional speed of the fling in pixels per second.","deprecated":false,"async":false,"alias":"speed"},{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: AndroidDevice.setDefaultTimeout`] method."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: AndroidDevice.setDefaultTimeout`] method.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"info","type":{"name":"AndroidElementInfo","expression":"[AndroidElementInfo]"},"spec":[{"type":"text","text":"Returns information about a widget defined by `selector`."}],"required":true,"comment":"Returns information about a widget defined by `selector`.","deprecated":false,"async":true,"alias":"info","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"AndroidSelector","expression":"[AndroidSelector]"},"spec":[{"type":"text","text":"Selector to return information about."}],"required":true,"comment":"Selector to return information about.","deprecated":false,"async":false,"alias":"selector"}]},{"kind":"property","langs":{},"name":"input","type":{"name":"AndroidInput","expression":"[AndroidInput]"},"spec":[],"required":true,"comment":"","deprecated":false,"async":false,"alias":"input","args":[]},{"kind":"method","langs":{},"name":"installApk","type":{"name":"void"},"spec":[{"type":"text","text":"Installs an apk on the device."}],"required":true,"comment":"Installs an apk on the device.","deprecated":false,"async":true,"alias":"installApk","args":[{"kind":"property","langs":{},"name":"file","type":{"name":"","union":[{"name":"string"},{"name":"Buffer"}],"expression":"[string]|[Buffer]"},"spec":[{"type":"text","text":"Either a path to the apk file, or apk file content."}],"required":true,"comment":"Either a path to the apk file, or apk file content.","deprecated":false,"async":false,"alias":"file"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"args","type":{"name":"Array","templates":[{"name":"string"}],"expression":"[Array]<[string]>"},"spec":[{"type":"text","text":"Optional arguments to pass to the `shell:cmd package install` call. Defaults to `-r -t -S`."}],"required":false,"comment":"Optional arguments to pass to the `shell:cmd package install` call. Defaults to `-r -t -S`.","deprecated":false,"async":false,"alias":"args"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"launchBrowser","type":{"name":"BrowserContext","expression":"[BrowserContext]"},"spec":[{"type":"text","text":"Launches Chrome browser on the device, and returns its persistent context."}],"required":true,"comment":"Launches Chrome browser on the device, and returns its persistent context.","deprecated":false,"async":true,"alias":"launchBrowser","args":[{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"acceptDownloads","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether to automatically download all the attachments. Defaults to `false` where all the downloads are canceled."}],"required":false,"comment":"Whether to automatically download all the attachments. Defaults to `false` where all the downloads are canceled.","deprecated":false,"async":false,"alias":"acceptDownloads"},{"kind":"property","langs":{},"name":"bypassCSP","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Toggles bypassing page's Content-Security-Policy."}],"required":false,"comment":"Toggles bypassing page's Content-Security-Policy.","deprecated":false,"async":false,"alias":"bypassCSP"},{"kind":"property","langs":{},"name":"colorScheme","type":{"name":"ColorScheme","union":[{"name":"\"light\""},{"name":"\"dark\""},{"name":"\"no-preference\""}],"expression":"[ColorScheme]<\"light\"|\"dark\"|\"no-preference\">"},"spec":[{"type":"text","text":"Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. See [`method: Page.emulateMedia`] for more details. Defaults to `'light'`."}],"required":false,"comment":"Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. See\n[`method: Page.emulateMedia`] for more details. Defaults to `'light'`.","deprecated":false,"async":false,"alias":"colorScheme"},{"kind":"property","langs":{},"name":"command","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Optional package name to launch instead of default Chrome for Android."}],"required":false,"comment":"Optional package name to launch instead of default Chrome for Android.","deprecated":false,"async":false,"alias":"command"},{"kind":"property","langs":{},"name":"deviceScaleFactor","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Specify device scale factor (can be thought of as dpr). Defaults to `1`."}],"required":false,"comment":"Specify device scale factor (can be thought of as dpr). Defaults to `1`.","deprecated":false,"async":false,"alias":"deviceScaleFactor"},{"kind":"property","langs":{},"name":"extraHTTPHeaders","type":{"name":"Object","templates":[{"name":"string"},{"name":"string"}],"expression":"[Object]<[string], [string]>"},"spec":[{"type":"text","text":"An object containing additional HTTP headers to be sent with every request. All header values must be strings."}],"required":false,"comment":"An object containing additional HTTP headers to be sent with every request. All header values must be strings.","deprecated":false,"async":false,"alias":"extraHTTPHeaders"},{"kind":"property","langs":{},"name":"geolocation","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"latitude","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Latitude between -90 and 90."}],"required":true,"comment":"Latitude between -90 and 90.","deprecated":false,"async":false,"alias":"latitude"},{"kind":"property","langs":{},"name":"longitude","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Longitude between -180 and 180."}],"required":true,"comment":"Longitude between -180 and 180.","deprecated":false,"async":false,"alias":"longitude"},{"kind":"property","langs":{},"name":"accuracy","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Non-negative accuracy value. Defaults to `0`."}],"required":false,"comment":"Non-negative accuracy value. Defaults to `0`.","deprecated":false,"async":false,"alias":"accuracy"}],"expression":"[Object]"},"spec":[],"required":false,"comment":"","deprecated":false,"async":false,"alias":"geolocation"},{"kind":"property","langs":{},"name":"hasTouch","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Specifies if viewport supports touch events. Defaults to false."}],"required":false,"comment":"Specifies if viewport supports touch events. Defaults to false.","deprecated":false,"async":false,"alias":"hasTouch"},{"kind":"property","langs":{},"name":"httpCredentials","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"username","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"username"},{"kind":"property","langs":{},"name":"password","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"password"}],"expression":"[Object]"},"spec":[{"type":"text","text":"Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication)."}],"required":false,"comment":"Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication).","deprecated":false,"async":false,"alias":"httpCredentials"},{"kind":"property","langs":{},"name":"ignoreHTTPSErrors","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether to ignore HTTPS errors during navigation. Defaults to `false`."}],"required":false,"comment":"Whether to ignore HTTPS errors during navigation. Defaults to `false`.","deprecated":false,"async":false,"alias":"ignoreHTTPSErrors"},{"kind":"property","langs":{},"name":"isMobile","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether the `meta viewport` tag is taken into account and touch events are enabled. Defaults to `false`. Not supported in Firefox."}],"required":false,"comment":"Whether the `meta viewport` tag is taken into account and touch events are enabled. Defaults to `false`. Not supported\nin Firefox.","deprecated":false,"async":false,"alias":"isMobile"},{"kind":"property","langs":{},"name":"javaScriptEnabled","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether or not to enable JavaScript in the context. Defaults to `true`."}],"required":false,"comment":"Whether or not to enable JavaScript in the context. Defaults to `true`.","deprecated":false,"async":false,"alias":"javaScriptEnabled"},{"kind":"property","langs":{},"name":"locale","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Specify user locale, for example `en-GB`, `de-DE`, etc. Locale will affect `navigator.language` value, `Accept-Language` request header value as well as number and date formatting rules."}],"required":false,"comment":"Specify user locale, for example `en-GB`, `de-DE`, etc. Locale will affect `navigator.language` value, `Accept-Language`\nrequest header value as well as number and date formatting rules.","deprecated":false,"async":false,"alias":"locale"},{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"logger","type":{"name":"Logger","expression":"[Logger]"},"spec":[{"type":"text","text":"Logger sink for Playwright logging."}],"required":false,"comment":"Logger sink for Playwright logging.","deprecated":false,"async":false,"alias":"logger"},{"kind":"property","langs":{"only":["python"],"aliases":{},"types":{},"overrides":{}},"name":"noViewport","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Does not enforce fixed viewport, allows resizing window in the headed mode."}],"required":false,"comment":"Does not enforce fixed viewport, allows resizing window in the headed mode.","deprecated":false,"async":false,"alias":"noViewport"},{"kind":"property","langs":{},"name":"offline","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether to emulate network being offline. Defaults to `false`."}],"required":false,"comment":"Whether to emulate network being offline. Defaults to `false`.","deprecated":false,"async":false,"alias":"offline"},{"kind":"property","langs":{},"name":"permissions","type":{"name":"Array","templates":[{"name":"string"}],"expression":"[Array]<[string]>"},"spec":[{"type":"text","text":"A list of permissions to grant to all pages in this context. See [`method: BrowserContext.grantPermissions`] for more details."}],"required":false,"comment":"A list of permissions to grant to all pages in this context. See [`method: BrowserContext.grantPermissions`] for more\ndetails.","deprecated":false,"async":false,"alias":"permissions"},{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"recordHar","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"omitContent","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Optional setting to control whether to omit request content from the HAR. Defaults to `false`."}],"required":false,"comment":"Optional setting to control whether to omit request content from the HAR. Defaults to `false`.","deprecated":false,"async":false,"alias":"omitContent"},{"kind":"property","langs":{},"name":"path","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"Path on the filesystem to write the HAR file to."}],"required":true,"comment":"Path on the filesystem to write the HAR file to.","deprecated":false,"async":false,"alias":"path"}],"expression":"[Object]"},"spec":[{"type":"text","text":"Enables [HAR](http://www.softwareishard.com/blog/har-12-spec) recording for all pages into `recordHar.path` file. If not specified, the HAR is not recorded. Make sure to await [`method: BrowserContext.close`] for the HAR to be saved."}],"required":false,"comment":"Enables [HAR](http://www.softwareishard.com/blog/har-12-spec) recording for all pages into `recordHar.path` file. If not\nspecified, the HAR is not recorded. Make sure to await [`method: BrowserContext.close`] for the HAR to be saved.","deprecated":false,"async":false,"alias":"recordHar"},{"kind":"property","langs":{"only":["csharp","java","python"],"aliases":{"python":"record_har_omit_content"},"types":{},"overrides":{}},"name":"recordHarOmitContent","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Optional setting to control whether to omit request content from the HAR. Defaults to `false`."}],"required":false,"comment":"Optional setting to control whether to omit request content from the HAR. Defaults to `false`.","deprecated":false,"async":false,"alias":"recordHarOmitContent"},{"kind":"property","langs":{"only":["csharp","java","python"],"aliases":{"python":"record_har_path"},"types":{},"overrides":{}},"name":"recordHarPath","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"Enables [HAR](http://www.softwareishard.com/blog/har-12-spec) recording for all pages into the specified HAR file on the filesystem. If not specified, the HAR is not recorded. Make sure to call [`method: BrowserContext.close`] for the HAR to be saved."}],"required":false,"comment":"Enables [HAR](http://www.softwareishard.com/blog/har-12-spec) recording for all pages into the specified HAR file on the\nfilesystem. If not specified, the HAR is not recorded. Make sure to call [`method: BrowserContext.close`] for the HAR to\nbe saved.","deprecated":false,"async":false,"alias":"recordHarPath"},{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"recordVideo","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"dir","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"Path to the directory to put videos into."}],"required":true,"comment":"Path to the directory to put videos into.","deprecated":false,"async":false,"alias":"dir"},{"kind":"property","langs":{},"name":"size","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"width","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"Video frame width."}],"required":true,"comment":"Video frame width.","deprecated":false,"async":false,"alias":"width"},{"kind":"property","langs":{},"name":"height","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"Video frame height."}],"required":true,"comment":"Video frame height.","deprecated":false,"async":false,"alias":"height"}],"expression":"[Object]"},"spec":[{"type":"text","text":"Optional dimensions of the recorded videos. If not specified the size will be equal to `viewport` scaled down to fit into 800x800. If `viewport` is not configured explicitly the video size defaults to 800x450. Actual picture of each page will be scaled down if necessary to fit the specified size."}],"required":false,"comment":"Optional dimensions of the recorded videos. If not specified the size will be equal to `viewport` scaled down to fit\ninto 800x800. If `viewport` is not configured explicitly the video size defaults to 800x450. Actual picture of each page\nwill be scaled down if necessary to fit the specified size.","deprecated":false,"async":false,"alias":"size"}],"expression":"[Object]"},"spec":[{"type":"text","text":"Enables video recording for all pages into `recordVideo.dir` directory. If not specified videos are not recorded. Make sure to await [`method: BrowserContext.close`] for videos to be saved."}],"required":false,"comment":"Enables video recording for all pages into `recordVideo.dir` directory. If not specified videos are not recorded. Make\nsure to await [`method: BrowserContext.close`] for videos to be saved.","deprecated":false,"async":false,"alias":"recordVideo"},{"kind":"property","langs":{"only":["csharp","java","python"],"aliases":{"python":"record_video_dir"},"types":{},"overrides":{}},"name":"recordVideoDir","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"Enables video recording for all pages into the specified directory. If not specified videos are not recorded. Make sure to call [`method: BrowserContext.close`] for videos to be saved."}],"required":false,"comment":"Enables video recording for all pages into the specified directory. If not specified videos are not recorded. Make sure\nto call [`method: BrowserContext.close`] for videos to be saved.","deprecated":false,"async":false,"alias":"recordVideoDir"},{"kind":"property","langs":{"only":["csharp","java","python"],"aliases":{"python":"record_video_size"},"types":{},"overrides":{}},"name":"recordVideoSize","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"width","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"Video frame width."}],"required":true,"comment":"Video frame width.","deprecated":false,"async":false,"alias":"width"},{"kind":"property","langs":{},"name":"height","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"Video frame height."}],"required":true,"comment":"Video frame height.","deprecated":false,"async":false,"alias":"height"}],"expression":"[Object]"},"spec":[{"type":"text","text":"Dimensions of the recorded videos. If not specified the size will be equal to `viewport` scaled down to fit into 800x800. If `viewport` is not configured explicitly the video size defaults to 800x450. Actual picture of each page will be scaled down if necessary to fit the specified size."}],"required":false,"comment":"Dimensions of the recorded videos. If not specified the size will be equal to `viewport` scaled down to fit into\n800x800. If `viewport` is not configured explicitly the video size defaults to 800x450. Actual picture of each page will\nbe scaled down if necessary to fit the specified size.","deprecated":false,"async":false,"alias":"recordVideoSize"},{"kind":"property","langs":{},"name":"reducedMotion","type":{"name":"ReducedMotion","union":[{"name":"\"reduce\""},{"name":"\"no-preference\""}],"expression":"[ReducedMotion]<\"reduce\"|\"no-preference\">"},"spec":[{"type":"text","text":"Emulates `'prefers-reduced-motion'` media feature, supported values are `'reduce'`, `'no-preference'`. See [`method: Page.emulateMedia`] for more details. Defaults to `'no-preference'`."}],"required":false,"comment":"Emulates `'prefers-reduced-motion'` media feature, supported values are `'reduce'`, `'no-preference'`. See\n[`method: Page.emulateMedia`] for more details. Defaults to `'no-preference'`.","deprecated":false,"async":false,"alias":"reducedMotion"},{"kind":"property","langs":{"aliases":{"java":"screenSize","csharp":"screenSize"},"types":{},"overrides":{}},"name":"screen","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"width","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"page width in pixels."}],"required":true,"comment":"page width in pixels.","deprecated":false,"async":false,"alias":"width"},{"kind":"property","langs":{},"name":"height","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"page height in pixels."}],"required":true,"comment":"page height in pixels.","deprecated":false,"async":false,"alias":"height"}],"expression":"[Object]"},"spec":[{"type":"text","text":"Emulates consistent window screen size available inside web page via `window.screen`. Is only used when the `viewport` is set."}],"required":false,"comment":"Emulates consistent window screen size available inside web page via `window.screen`. Is only used when the `viewport`\nis set.","deprecated":false,"async":false,"alias":"screen"},{"kind":"property","langs":{},"name":"timezoneId","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Changes the timezone of the context. See [ICU's metaZones.txt](https://cs.chromium.org/chromium/src/third_party/icu/source/data/misc/metaZones.txt?rcl=faee8bc70570192d82d2978a71e2a615788597d1) for a list of supported timezone IDs."}],"required":false,"comment":"Changes the timezone of the context. See\n[ICU's metaZones.txt](https://cs.chromium.org/chromium/src/third_party/icu/source/data/misc/metaZones.txt?rcl=faee8bc70570192d82d2978a71e2a615788597d1)\nfor a list of supported timezone IDs.","deprecated":false,"async":false,"alias":"timezoneId"},{"kind":"property","langs":{},"name":"userAgent","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Specific user agent to use in this context."}],"required":false,"comment":"Specific user agent to use in this context.","deprecated":false,"async":false,"alias":"userAgent"},{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"videoSize","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"width","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"Video frame width."}],"required":true,"comment":"Video frame width.","deprecated":false,"async":false,"alias":"width"},{"kind":"property","langs":{},"name":"height","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"Video frame height."}],"required":true,"comment":"Video frame height.","deprecated":false,"async":false,"alias":"height"}],"expression":"[Object]"},"spec":[{"type":"text","text":"**DEPRECATED** Use `recordVideo` instead."}],"required":false,"comment":"**DEPRECATED** Use `recordVideo` instead.","deprecated":true,"async":false,"alias":"videoSize"},{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"videosPath","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"**DEPRECATED** Use `recordVideo` instead."}],"required":false,"comment":"**DEPRECATED** Use `recordVideo` instead.","deprecated":true,"async":false,"alias":"videosPath"},{"kind":"property","langs":{"only":["js","java"],"aliases":{"java":"viewportSize"},"types":{},"overrides":{}},"name":"viewport","type":{"name":"","union":[{"name":"null"},{"name":"Object","properties":[{"kind":"property","langs":{},"name":"width","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"page width in pixels."}],"required":true,"comment":"page width in pixels.","deprecated":false,"async":false,"alias":"width"},{"kind":"property","langs":{},"name":"height","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"page height in pixels."}],"required":true,"comment":"page height in pixels.","deprecated":false,"async":false,"alias":"height"}]}],"expression":"[null]|[Object]"},"spec":[{"type":"text","text":"Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. `null` disables the default viewport."}],"required":false,"comment":"Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. `null` disables the default viewport.","deprecated":false,"async":false,"alias":"viewport"},{"kind":"property","langs":{"only":["csharp"],"aliases":{"csharp":"viewportSize"},"types":{},"overrides":{}},"name":"viewport","type":{"name":"","union":[{"name":"null"},{"name":"Object","properties":[{"kind":"property","langs":{},"name":"width","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"page width in pixels."}],"required":true,"comment":"page width in pixels.","deprecated":false,"async":false,"alias":"width"},{"kind":"property","langs":{},"name":"height","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"page height in pixels."}],"required":true,"comment":"page height in pixels.","deprecated":false,"async":false,"alias":"height"}]}],"expression":"[null]|[Object]"},"spec":[{"type":"text","text":"Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use `ViewportSize.NoViewport` to disable the default viewport."}],"required":false,"comment":"Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use `ViewportSize.NoViewport` to disable\nthe default viewport.","deprecated":false,"async":false,"alias":"viewport"},{"kind":"property","langs":{"only":["python"],"aliases":{},"types":{},"overrides":{}},"name":"viewport","type":{"name":"","union":[{"name":"null"},{"name":"Object","properties":[{"kind":"property","langs":{},"name":"width","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"page width in pixels."}],"required":true,"comment":"page width in pixels.","deprecated":false,"async":false,"alias":"width"},{"kind":"property","langs":{},"name":"height","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"page height in pixels."}],"required":true,"comment":"page height in pixels.","deprecated":false,"async":false,"alias":"height"}]}],"expression":"[null]|[Object]"},"spec":[{"type":"text","text":"Sets a consistent viewport for each page. Defaults to an 1280x720 viewport. `no_viewport` disables the fixed viewport."}],"required":false,"comment":"Sets a consistent viewport for each page. Defaults to an 1280x720 viewport. `no_viewport` disables the fixed viewport.","deprecated":false,"async":false,"alias":"viewport"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"longTap","type":{"name":"void"},"spec":[{"type":"text","text":"Performs a long tap on the widget defined by `selector`."}],"required":true,"comment":"Performs a long tap on the widget defined by `selector`.","deprecated":false,"async":true,"alias":"longTap","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"AndroidSelector","expression":"[AndroidSelector]"},"spec":[{"type":"text","text":"Selector to tap on."}],"required":true,"comment":"Selector to tap on.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: AndroidDevice.setDefaultTimeout`] method."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: AndroidDevice.setDefaultTimeout`] method.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"model","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Device model."}],"required":true,"comment":"Device model.","deprecated":false,"async":false,"alias":"model","args":[]},{"kind":"method","langs":{},"name":"open","type":{"name":"AndroidSocket","expression":"[AndroidSocket]"},"spec":[{"type":"text","text":"Launches a process in the shell on the device and returns a socket to communicate with the launched process."}],"required":true,"comment":"Launches a process in the shell on the device and returns a socket to communicate with the launched process.","deprecated":false,"async":true,"alias":"open","args":[{"kind":"property","langs":{},"name":"command","type":{"name":"string","expression":"[string]"},"spec":[],"required":true,"comment":"","deprecated":false,"async":false,"alias":"command"}]},{"kind":"method","langs":{},"name":"pinchClose","type":{"name":"void"},"spec":[{"type":"text","text":"Pinches the widget defined by `selector` in the closing direction."}],"required":true,"comment":"Pinches the widget defined by `selector` in the closing direction.","deprecated":false,"async":true,"alias":"pinchClose","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"AndroidSelector","expression":"[AndroidSelector]"},"spec":[{"type":"text","text":"Selector to pinch close."}],"required":true,"comment":"Selector to pinch close.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"percent","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"The size of the pinch as a percentage of the widget's size."}],"required":true,"comment":"The size of the pinch as a percentage of the widget's size.","deprecated":false,"async":false,"alias":"percent"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"speed","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Optional speed of the pinch in pixels per second."}],"required":false,"comment":"Optional speed of the pinch in pixels per second.","deprecated":false,"async":false,"alias":"speed"},{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: AndroidDevice.setDefaultTimeout`] method."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: AndroidDevice.setDefaultTimeout`] method.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"pinchOpen","type":{"name":"void"},"spec":[{"type":"text","text":"Pinches the widget defined by `selector` in the open direction."}],"required":true,"comment":"Pinches the widget defined by `selector` in the open direction.","deprecated":false,"async":true,"alias":"pinchOpen","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"AndroidSelector","expression":"[AndroidSelector]"},"spec":[{"type":"text","text":"Selector to pinch open."}],"required":true,"comment":"Selector to pinch open.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"percent","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"The size of the pinch as a percentage of the widget's size."}],"required":true,"comment":"The size of the pinch as a percentage of the widget's size.","deprecated":false,"async":false,"alias":"percent"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"speed","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Optional speed of the pinch in pixels per second."}],"required":false,"comment":"Optional speed of the pinch in pixels per second.","deprecated":false,"async":false,"alias":"speed"},{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: AndroidDevice.setDefaultTimeout`] method."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: AndroidDevice.setDefaultTimeout`] method.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"press","type":{"name":"void"},"spec":[{"type":"text","text":"Presses the specific `key` in the widget defined by `selector`."}],"required":true,"comment":"Presses the specific `key` in the widget defined by `selector`.","deprecated":false,"async":true,"alias":"press","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"AndroidSelector","expression":"[AndroidSelector]"},"spec":[{"type":"text","text":"Selector to press the key in."}],"required":true,"comment":"Selector to press the key in.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"key","type":{"name":"AndroidKey","expression":"[AndroidKey]"},"spec":[{"type":"text","text":"The key to press."}],"required":true,"comment":"The key to press.","deprecated":false,"async":false,"alias":"key"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: AndroidDevice.setDefaultTimeout`] method."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: AndroidDevice.setDefaultTimeout`] method.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"push","type":{"name":"void"},"spec":[{"type":"text","text":"Copies a file to the device."}],"required":true,"comment":"Copies a file to the device.","deprecated":false,"async":true,"alias":"push","args":[{"kind":"property","langs":{},"name":"file","type":{"name":"","union":[{"name":"string"},{"name":"Buffer"}],"expression":"[string]|[Buffer]"},"spec":[{"type":"text","text":"Either a path to the file, or file content."}],"required":true,"comment":"Either a path to the file, or file content.","deprecated":false,"async":false,"alias":"file"},{"kind":"property","langs":{},"name":"path","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Path to the file on the device."}],"required":true,"comment":"Path to the file on the device.","deprecated":false,"async":false,"alias":"path"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"mode","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"Optional file mode, defaults to `644` (`rw-r--r--`)."}],"required":false,"comment":"Optional file mode, defaults to `644` (`rw-r--r--`).","deprecated":false,"async":false,"alias":"mode"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"screenshot","type":{"name":"Buffer","expression":"[Buffer]"},"spec":[{"type":"text","text":"Returns the buffer with the captured screenshot of the device."}],"required":true,"comment":"Returns the buffer with the captured screenshot of the device.","deprecated":false,"async":true,"alias":"screenshot","args":[{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"path","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"The file path to save the image to. If `path` is a relative path, then it is resolved relative to the current working directory. If no path is provided, the image won't be saved to the disk."}],"required":false,"comment":"The file path to save the image to. If `path` is a relative path, then it is resolved relative to the current working\ndirectory. If no path is provided, the image won't be saved to the disk.","deprecated":false,"async":false,"alias":"path"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"scroll","type":{"name":"void"},"spec":[{"type":"text","text":"Scrolls the widget defined by `selector` in the specified `direction`."}],"required":true,"comment":"Scrolls the widget defined by `selector` in the specified `direction`.","deprecated":false,"async":true,"alias":"scroll","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"AndroidSelector","expression":"[AndroidSelector]"},"spec":[{"type":"text","text":"Selector to scroll."}],"required":true,"comment":"Selector to scroll.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"direction","type":{"name":"AndroidScrollDirection","union":[{"name":"\"down\""},{"name":"\"up\""},{"name":"\"left\""},{"name":"\"right\""}],"expression":"[AndroidScrollDirection]<\"down\"|\"up\"|\"left\"|\"right\">"},"spec":[{"type":"text","text":"Scroll direction."}],"required":true,"comment":"Scroll direction.","deprecated":false,"async":false,"alias":"direction"},{"kind":"property","langs":{},"name":"percent","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Distance to scroll as a percentage of the widget's size."}],"required":true,"comment":"Distance to scroll as a percentage of the widget's size.","deprecated":false,"async":false,"alias":"percent"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"speed","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Optional speed of the scroll in pixels per second."}],"required":false,"comment":"Optional speed of the scroll in pixels per second.","deprecated":false,"async":false,"alias":"speed"},{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: AndroidDevice.setDefaultTimeout`] method."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: AndroidDevice.setDefaultTimeout`] method.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"serial","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Device serial number."}],"required":true,"comment":"Device serial number.","deprecated":false,"async":false,"alias":"serial","args":[]},{"kind":"method","langs":{},"name":"setDefaultTimeout","type":{"name":"void"},"spec":[{"type":"text","text":"This setting will change the default maximum time for all the methods accepting `timeout` option."}],"required":true,"comment":"This setting will change the default maximum time for all the methods accepting `timeout` option.","deprecated":false,"async":false,"alias":"setDefaultTimeout","args":[{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds"}],"required":true,"comment":"Maximum time in milliseconds","deprecated":false,"async":false,"alias":"timeout"}]},{"kind":"method","langs":{},"name":"shell","type":{"name":"Buffer","expression":"[Buffer]"},"spec":[{"type":"text","text":"Executes a shell command on the device and returns its output."}],"required":true,"comment":"Executes a shell command on the device and returns its output.","deprecated":false,"async":true,"alias":"shell","args":[{"kind":"property","langs":{},"name":"command","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Shell command to execute."}],"required":true,"comment":"Shell command to execute.","deprecated":false,"async":false,"alias":"command"}]},{"kind":"method","langs":{},"name":"swipe","type":{"name":"void"},"spec":[{"type":"text","text":"Swipes the widget defined by `selector` in the specified `direction`."}],"required":true,"comment":"Swipes the widget defined by `selector` in the specified `direction`.","deprecated":false,"async":true,"alias":"swipe","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"AndroidSelector","expression":"[AndroidSelector]"},"spec":[{"type":"text","text":"Selector to swipe."}],"required":true,"comment":"Selector to swipe.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"direction","type":{"name":"AndroidSwipeDirection","union":[{"name":"\"down\""},{"name":"\"up\""},{"name":"\"left\""},{"name":"\"right\""}],"expression":"[AndroidSwipeDirection]<\"down\"|\"up\"|\"left\"|\"right\">"},"spec":[{"type":"text","text":"Swipe direction."}],"required":true,"comment":"Swipe direction.","deprecated":false,"async":false,"alias":"direction"},{"kind":"property","langs":{},"name":"percent","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Distance to swipe as a percentage of the widget's size."}],"required":true,"comment":"Distance to swipe as a percentage of the widget's size.","deprecated":false,"async":false,"alias":"percent"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"speed","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Optional speed of the swipe in pixels per second."}],"required":false,"comment":"Optional speed of the swipe in pixels per second.","deprecated":false,"async":false,"alias":"speed"},{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: AndroidDevice.setDefaultTimeout`] method."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: AndroidDevice.setDefaultTimeout`] method.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"tap","type":{"name":"void"},"spec":[{"type":"text","text":"Taps on the widget defined by `selector`."}],"required":true,"comment":"Taps on the widget defined by `selector`.","deprecated":false,"async":true,"alias":"tap","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"AndroidSelector","expression":"[AndroidSelector]"},"spec":[{"type":"text","text":"Selector to tap on."}],"required":true,"comment":"Selector to tap on.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"duration","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Optional duration of the tap in milliseconds."}],"required":false,"comment":"Optional duration of the tap in milliseconds.","deprecated":false,"async":false,"alias":"duration"},{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: AndroidDevice.setDefaultTimeout`] method."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: AndroidDevice.setDefaultTimeout`] method.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"wait","type":{"name":"void"},"spec":[{"type":"text","text":"Waits for the specific `selector` to either appear or disappear, depending on the `state`."}],"required":true,"comment":"Waits for the specific `selector` to either appear or disappear, depending on the `state`.","deprecated":false,"async":true,"alias":"wait","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"AndroidSelector","expression":"[AndroidSelector]"},"spec":[{"type":"text","text":"Selector to wait for."}],"required":true,"comment":"Selector to wait for.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"state","type":{"name":"\"gone\"","expression":"\"gone\""},"spec":[{"type":"text","text":"Optional state. Can be either:"},{"type":"li","text":"default - wait for element to be present.","liType":"bullet"},{"type":"li","text":"`'gone'` - wait for element to not be present.","liType":"bullet"}],"required":false,"comment":"Optional state. Can be either:\n- default - wait for element to be present.\n- `'gone'` - wait for element to not be present.","deprecated":false,"async":false,"alias":"state"},{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: AndroidDevice.setDefaultTimeout`] method."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: AndroidDevice.setDefaultTimeout`] method.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"waitForEvent","type":{"name":"any","expression":"[any]"},"spec":[{"type":"text","text":"Waits for event to fire and passes its value into the predicate function. Returns when the predicate returns truthy value."}],"required":true,"comment":"Waits for event to fire and passes its value into the predicate function. Returns when the predicate returns truthy\nvalue.","deprecated":false,"async":true,"alias":"waitForEvent","args":[{"kind":"property","langs":{"only":["js","python","java"],"aliases":{},"types":{},"overrides":{}},"name":"event","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Event name, same one typically passed into `*.on(event)`."}],"required":true,"comment":"Event name, same one typically passed into `*.on(event)`.","deprecated":false,"async":false,"alias":"event"},{"kind":"property","langs":{},"name":"optionsOrPredicate","type":{"name":"","union":[{"name":"function"},{"name":"Object","properties":[{"kind":"property","langs":{},"name":"predicate","type":{"name":"function","expression":"[function]"},"spec":[{"type":"text","text":"receives the event data and resolves to truthy value when the waiting should resolve."}],"required":true,"comment":"receives the event data and resolves to truthy value when the waiting should resolve.","deprecated":false,"async":false,"alias":"predicate"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can be changed by using the [`method: AndroidDevice.setDefaultTimeout`]."}],"required":false,"comment":"maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default\nvalue can be changed by using the [`method: AndroidDevice.setDefaultTimeout`].","deprecated":false,"async":false,"alias":"timeout"}]}],"expression":"[function]|[Object]"},"spec":[{"type":"text","text":"Either a predicate that receives an event or an options object. Optional."}],"required":false,"comment":"Either a predicate that receives an event or an options object. Optional.","deprecated":false,"async":false,"alias":"optionsOrPredicate"}]},{"kind":"method","langs":{},"name":"webView","type":{"name":"AndroidWebView","expression":"[AndroidWebView]"},"spec":[{"type":"text","text":"This method waits until `AndroidWebView` matching the `selector` is opened and returns it. If there is already an open `AndroidWebView` matching the `selector`, returns immediately."}],"required":true,"comment":"This method waits until `AndroidWebView` matching the `selector` is opened and returns it. If there is already an open\n`AndroidWebView` matching the `selector`, returns immediately.","deprecated":false,"async":true,"alias":"webView","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"pkg","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Package identifier."}],"required":true,"comment":"Package identifier.","deprecated":false,"async":false,"alias":"pkg"}],"expression":"[Object]"},"spec":[],"required":true,"comment":"","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: AndroidDevice.setDefaultTimeout`] method."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: AndroidDevice.setDefaultTimeout`] method.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"webViews","type":{"name":"Array","templates":[{"name":"AndroidWebView"}],"expression":"[Array]<[AndroidWebView]>"},"spec":[{"type":"text","text":"Currently open WebViews."}],"required":true,"comment":"Currently open WebViews.","deprecated":false,"async":false,"alias":"webViews","args":[]}]},{"name":"AndroidInput","spec":[],"langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"members":[{"kind":"method","langs":{},"name":"drag","type":{"name":"void"},"spec":[{"type":"text","text":"Performs a drag between `from` and `to` points."}],"required":true,"comment":"Performs a drag between `from` and `to` points.","deprecated":false,"async":true,"alias":"drag","args":[{"kind":"property","langs":{},"name":"from","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"x","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"x"},{"kind":"property","langs":{},"name":"y","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"y"}],"expression":"[Object]"},"spec":[{"type":"text","text":"The start point of the drag."}],"required":true,"comment":"The start point of the drag.","deprecated":false,"async":false,"alias":"from"},{"kind":"property","langs":{},"name":"to","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"x","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"x"},{"kind":"property","langs":{},"name":"y","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"y"}],"expression":"[Object]"},"spec":[{"type":"text","text":"The end point of the drag."}],"required":true,"comment":"The end point of the drag.","deprecated":false,"async":false,"alias":"to"},{"kind":"property","langs":{},"name":"steps","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"The number of steps in the drag. Each step takes 5 milliseconds to complete."}],"required":true,"comment":"The number of steps in the drag. Each step takes 5 milliseconds to complete.","deprecated":false,"async":false,"alias":"steps"}]},{"kind":"method","langs":{},"name":"press","type":{"name":"void"},"spec":[{"type":"text","text":"Presses the `key`."}],"required":true,"comment":"Presses the `key`.","deprecated":false,"async":true,"alias":"press","args":[{"kind":"property","langs":{},"name":"key","type":{"name":"AndroidKey","expression":"[AndroidKey]"},"spec":[{"type":"text","text":"Key to press."}],"required":true,"comment":"Key to press.","deprecated":false,"async":false,"alias":"key"}]},{"kind":"method","langs":{},"name":"swipe","type":{"name":"void"},"spec":[{"type":"text","text":"Swipes following the path defined by `segments`."}],"required":true,"comment":"Swipes following the path defined by `segments`.","deprecated":false,"async":true,"alias":"swipe","args":[{"kind":"property","langs":{},"name":"from","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"x","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"x"},{"kind":"property","langs":{},"name":"y","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"y"}],"expression":"[Object]"},"spec":[{"type":"text","text":"The point to start swiping from."}],"required":true,"comment":"The point to start swiping from.","deprecated":false,"async":false,"alias":"from"},{"kind":"property","langs":{},"name":"segments","type":{"name":"Array","templates":[{"name":"Object","properties":[{"kind":"property","langs":{},"name":"x","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"x"},{"kind":"property","langs":{},"name":"y","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"y"}]}],"expression":"[Array]<[Object]>"},"spec":[{"type":"text","text":"Points following the `from` point in the swipe gesture."}],"required":true,"comment":"Points following the `from` point in the swipe gesture.","deprecated":false,"async":false,"alias":"segments"},{"kind":"property","langs":{},"name":"steps","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"The number of steps for each segment. Each step takes 5 milliseconds to complete, so 100 steps means half a second per each segment."}],"required":true,"comment":"The number of steps for each segment. Each step takes 5 milliseconds to complete, so 100 steps means half a second per\neach segment.","deprecated":false,"async":false,"alias":"steps"}]},{"kind":"method","langs":{},"name":"tap","type":{"name":"void"},"spec":[{"type":"text","text":"Taps at the specified `point`."}],"required":true,"comment":"Taps at the specified `point`.","deprecated":false,"async":true,"alias":"tap","args":[{"kind":"property","langs":{},"name":"point","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"x","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"x"},{"kind":"property","langs":{},"name":"y","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"y"}],"expression":"[Object]"},"spec":[{"type":"text","text":"The point to tap at."}],"required":true,"comment":"The point to tap at.","deprecated":false,"async":false,"alias":"point"}]},{"kind":"method","langs":{},"name":"type","type":{"name":"void"},"spec":[{"type":"text","text":"Types `text` into currently focused widget."}],"required":true,"comment":"Types `text` into currently focused widget.","deprecated":false,"async":true,"alias":"type","args":[{"kind":"property","langs":{},"name":"text","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Text to type."}],"required":true,"comment":"Text to type.","deprecated":false,"async":false,"alias":"text"}]}]},{"name":"AndroidSocket","spec":[{"type":"text","text":"`AndroidSocket` is a way to communicate with a process launched on the `AndroidDevice`. Use [`method: AndroidDevice.open`] to open a socket."}],"langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"comment":"`AndroidSocket` is a way to communicate with a process launched on the `AndroidDevice`. Use\n[`method: AndroidDevice.open`] to open a socket.","members":[{"kind":"event","langs":{},"name":"close","type":{"name":"void"},"spec":[{"type":"text","text":"Emitted when the socket is closed."}],"required":true,"comment":"Emitted when the socket is closed.","deprecated":false,"async":false,"alias":"close","args":[]},{"kind":"event","langs":{},"name":"data","type":{"name":"Buffer","expression":"[Buffer]"},"spec":[{"type":"text","text":"Emitted when data is available to read from the socket."}],"required":true,"comment":"Emitted when data is available to read from the socket.","deprecated":false,"async":false,"alias":"data","args":[]},{"kind":"method","langs":{},"name":"close","type":{"name":"void"},"spec":[{"type":"text","text":"Closes the socket."}],"required":true,"comment":"Closes the socket.","deprecated":false,"async":true,"alias":"close","args":[]},{"kind":"method","langs":{},"name":"write","type":{"name":"void"},"spec":[{"type":"text","text":"Writes some `data` to the socket."}],"required":true,"comment":"Writes some `data` to the socket.","deprecated":false,"async":true,"alias":"write","args":[{"kind":"property","langs":{},"name":"data","type":{"name":"Buffer","expression":"[Buffer]"},"spec":[{"type":"text","text":"Data to write."}],"required":true,"comment":"Data to write.","deprecated":false,"async":false,"alias":"data"}]}]},{"name":"AndroidWebView","spec":[{"type":"text","text":"`AndroidWebView` represents a WebView open on the `AndroidDevice`. WebView is usually obtained using [`method: AndroidDevice.webView`]."}],"langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"comment":"`AndroidWebView` represents a WebView open on the `AndroidDevice`. WebView is usually obtained using\n[`method: AndroidDevice.webView`].","members":[{"kind":"event","langs":{},"name":"close","type":{"name":"void"},"spec":[{"type":"text","text":"Emitted when the WebView is closed."}],"required":true,"comment":"Emitted when the WebView is closed.","deprecated":false,"async":false,"alias":"close","args":[]},{"kind":"method","langs":{},"name":"page","type":{"name":"Page","expression":"[Page]"},"spec":[{"type":"text","text":"Connects to the WebView and returns a regular Playwright `Page` to interact with."}],"required":true,"comment":"Connects to the WebView and returns a regular Playwright `Page` to interact with.","deprecated":false,"async":true,"alias":"page","args":[]},{"kind":"method","langs":{},"name":"pid","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"WebView process PID."}],"required":true,"comment":"WebView process PID.","deprecated":false,"async":false,"alias":"pid","args":[]},{"kind":"method","langs":{},"name":"pkg","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"WebView package identifier."}],"required":true,"comment":"WebView package identifier.","deprecated":false,"async":false,"alias":"pkg","args":[]}]},{"name":"Browser","spec":[{"type":"li","text":"extends: [EventEmitter]","liType":"bullet"},{"type":"text","text":"A Browser is created via [`method: BrowserType.launch`]. An example of using a `Browser` to create a `Page`:"},{"type":"code","lines":["const { firefox } = require('playwright'); // Or 'chromium' or 'webkit'.","","(async () => {"," const browser = await firefox.launch();"," const page = await browser.newPage();"," await page.goto('https://example.com');"," await browser.close();","})();"],"codeLang":"js"},{"type":"code","lines":["import com.microsoft.playwright.*;","","public class Example {"," public static void main(String[] args) {"," try (Playwright playwright = Playwright.create()) {"," BrowserType firefox = playwright.firefox()"," Browser browser = firefox.launch();"," Page page = browser.newPage();"," page.navigate('https://example.com');"," browser.close();"," }"," }","}"],"codeLang":"java"},{"type":"code","lines":["import asyncio","from playwright.async_api import async_playwright","","async def run(playwright):"," firefox = playwright.firefox"," browser = await firefox.launch()"," page = await browser.new_page()"," await page.goto(\"https://example.com\")"," await browser.close()","","async def main():"," async with async_playwright() as playwright:"," await run(playwright)","asyncio.run(main())"],"codeLang":"python async"},{"type":"code","lines":["from playwright.sync_api import sync_playwright","","def run(playwright):"," firefox = playwright.firefox"," browser = firefox.launch()"," page = browser.new_page()"," page.goto(\"https://example.com\")"," browser.close()","","with sync_playwright() as playwright:"," run(playwright)"],"codeLang":"python sync"},{"type":"code","lines":["using Microsoft.Playwright;","using System.Threading.Tasks;","","class Program","{"," public static async Task Main()"," {"," using var playwright = await Playwright.CreateAsync();"," var firefox = playwright.Firefox;"," var browser = await firefox.LaunchAsync(new BrowserTypeLaunchOptions { Headless = false });"," var page = await browser.NewPageAsync();"," await page.GotoAsync(\"https://www.bing.com\");"," await browser.CloseAsync();"," }","}"],"codeLang":"csharp"}],"extends":"EventEmitter","langs":{},"comment":"- extends: [EventEmitter]\n\nA Browser is created via [`method: BrowserType.launch`]. An example of using a `Browser` to create a `Page`:\n\n```js\nconst { firefox } = require('playwright'); // Or 'chromium' or 'webkit'.\n\n(async () => {\n const browser = await firefox.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await browser.close();\n})();\n```\n\n```java\nimport com.microsoft.playwright.*;\n\npublic class Example {\n public static void main(String[] args) {\n try (Playwright playwright = Playwright.create()) {\n BrowserType firefox = playwright.firefox()\n Browser browser = firefox.launch();\n Page page = browser.newPage();\n page.navigate('https://example.com');\n browser.close();\n }\n }\n}\n```\n\n```python async\nimport asyncio\nfrom playwright.async_api import async_playwright\n\nasync def run(playwright):\n firefox = playwright.firefox\n browser = await firefox.launch()\n page = await browser.new_page()\n await page.goto(\"https://example.com\")\n await browser.close()\n\nasync def main():\n async with async_playwright() as playwright:\n await run(playwright)\nasyncio.run(main())\n```\n\n```python sync\nfrom playwright.sync_api import sync_playwright\n\ndef run(playwright):\n firefox = playwright.firefox\n browser = firefox.launch()\n page = browser.new_page()\n page.goto(\"https://example.com\")\n browser.close()\n\nwith sync_playwright() as playwright:\n run(playwright)\n```\n\n```csharp\nusing Microsoft.Playwright;\nusing System.Threading.Tasks;\n\nclass Program\n{\n public static async Task Main()\n {\n using var playwright = await Playwright.CreateAsync();\n var firefox = playwright.Firefox;\n var browser = await firefox.LaunchAsync(new BrowserTypeLaunchOptions { Headless = false });\n var page = await browser.NewPageAsync();\n await page.GotoAsync(\"https://www.bing.com\");\n await browser.CloseAsync();\n }\n}\n```\n","members":[{"kind":"event","langs":{},"name":"disconnected","type":{"name":"Browser","expression":"[Browser]"},"spec":[{"type":"text","text":"Emitted when Browser gets disconnected from the browser application. This might happen because of one of the following:"},{"type":"li","text":"Browser application is closed or crashed.","liType":"bullet"},{"type":"li","text":"The [`method: Browser.close`] method was called.","liType":"bullet"}],"required":true,"comment":"Emitted when Browser gets disconnected from the browser application. This might happen because of one of the following:\n- Browser application is closed or crashed.\n- The [`method: Browser.close`] method was called.","deprecated":false,"async":false,"alias":"disconnected","args":[]},{"kind":"method","langs":{},"name":"close","type":{"name":"void"},"spec":[{"type":"text","text":"In case this browser is obtained using [`method: BrowserType.launch`], closes the browser and all of its pages (if any were opened)."},{"type":"text","text":"In case this browser is connected to, clears all created contexts belonging to this browser and disconnects from the browser server."},{"type":"text","text":"The `Browser` object itself is considered to be disposed and cannot be used anymore."}],"required":true,"comment":"In case this browser is obtained using [`method: BrowserType.launch`], closes the browser and all of its pages (if any\nwere opened).\n\nIn case this browser is connected to, clears all created contexts belonging to this browser and disconnects from the\nbrowser server.\n\nThe `Browser` object itself is considered to be disposed and cannot be used anymore.","deprecated":false,"async":true,"alias":"close","args":[]},{"kind":"method","langs":{},"name":"contexts","type":{"name":"Array","templates":[{"name":"BrowserContext"}],"expression":"[Array]<[BrowserContext]>"},"spec":[{"type":"text","text":"Returns an array of all open browser contexts. In a newly created browser, this will return zero browser contexts."},{"type":"code","lines":["const browser = await pw.webkit.launch();","console.log(browser.contexts().length); // prints `0`","","const context = await browser.newContext();","console.log(browser.contexts().length); // prints `1`"],"codeLang":"js"},{"type":"code","lines":["Browser browser = pw.webkit().launch();","System.out.println(browser.contexts().size()); // prints \"0\"","BrowserContext context = browser.newContext();","System.out.println(browser.contexts().size()); // prints \"1\""],"codeLang":"java"},{"type":"code","lines":["browser = await pw.webkit.launch()","print(len(browser.contexts())) # prints `0`","context = await browser.new_context()","print(len(browser.contexts())) # prints `1`"],"codeLang":"python async"},{"type":"code","lines":["browser = pw.webkit.launch()","print(len(browser.contexts())) # prints `0`","context = browser.new_context()","print(len(browser.contexts())) # prints `1`"],"codeLang":"python sync"},{"type":"code","lines":["using var playwright = await Playwright.CreateAsync();","var browser = await playwright.Webkit.LaunchAsync();","System.Console.WriteLine(browser.Contexts.Count); // prints \"0\"","var context = await browser.NewContextAsync();","System.Console.WriteLine(browser.Contexts.Count); // prints \"1\""],"codeLang":"csharp"}],"required":true,"comment":"Returns an array of all open browser contexts. In a newly created browser, this will return zero browser contexts.\n\n```js\nconst browser = await pw.webkit.launch();\nconsole.log(browser.contexts().length); // prints `0`\n\nconst context = await browser.newContext();\nconsole.log(browser.contexts().length); // prints `1`\n```\n\n```java\nBrowser browser = pw.webkit().launch();\nSystem.out.println(browser.contexts().size()); // prints \"0\"\nBrowserContext context = browser.newContext();\nSystem.out.println(browser.contexts().size()); // prints \"1\"\n```\n\n```python async\nbrowser = await pw.webkit.launch()\nprint(len(browser.contexts())) # prints `0`\ncontext = await browser.new_context()\nprint(len(browser.contexts())) # prints `1`\n```\n\n```python sync\nbrowser = pw.webkit.launch()\nprint(len(browser.contexts())) # prints `0`\ncontext = browser.new_context()\nprint(len(browser.contexts())) # prints `1`\n```\n\n```csharp\nusing var playwright = await Playwright.CreateAsync();\nvar browser = await playwright.Webkit.LaunchAsync();\nSystem.Console.WriteLine(browser.Contexts.Count); // prints \"0\"\nvar context = await browser.NewContextAsync();\nSystem.Console.WriteLine(browser.Contexts.Count); // prints \"1\"\n```\n","deprecated":false,"async":false,"alias":"contexts","args":[]},{"kind":"method","langs":{},"name":"isConnected","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Indicates that the browser is connected."}],"required":true,"comment":"Indicates that the browser is connected.","deprecated":false,"async":false,"alias":"isConnected","args":[]},{"kind":"method","langs":{"only":["js","python"],"aliases":{},"types":{},"overrides":{}},"name":"newBrowserCDPSession","type":{"name":"CDPSession","expression":"[CDPSession]"},"spec":[{"type":"note","noteType":"note","text":"CDP Sessions are only supported on Chromium-based browsers."},{"type":"text","text":"Returns the newly created browser session."}],"required":true,"comment":"> NOTE: CDP Sessions are only supported on Chromium-based browsers.\n\nReturns the newly created browser session.","deprecated":false,"async":true,"alias":"newBrowserCDPSession","args":[]},{"kind":"method","langs":{},"name":"newContext","type":{"name":"BrowserContext","expression":"[BrowserContext]"},"spec":[{"type":"text","text":"Creates a new browser context. It won't share cookies/cache with other browser contexts."},{"type":"code","lines":["(async () => {"," const browser = await playwright.firefox.launch(); // Or 'chromium' or 'webkit'."," // Create a new incognito browser context."," const context = await browser.newContext();"," // Create a new page in a pristine context."," const page = await context.newPage();"," await page.goto('https://example.com');","})();"],"codeLang":"js"},{"type":"code","lines":["Browser browser = playwright.firefox().launch(); // Or 'chromium' or 'webkit'.","// Create a new incognito browser context.","BrowserContext context = browser.newContext();","// Create a new page in a pristine context.","Page page = context.newPage();","page.navigate('https://example.com');"],"codeLang":"java"},{"type":"code","lines":["browser = await playwright.firefox.launch() # or \"chromium\" or \"webkit\".","# create a new incognito browser context.","context = await browser.new_context()","# create a new page in a pristine context.","page = await context.new_page()","await page.goto(\"https://example.com\")"],"codeLang":"python async"},{"type":"code","lines":["browser = playwright.firefox.launch() # or \"chromium\" or \"webkit\".","# create a new incognito browser context.","context = browser.new_context()","# create a new page in a pristine context.","page = context.new_page()","page.goto(\"https://example.com\")"],"codeLang":"python sync"},{"type":"code","lines":["using var playwright = await Playwright.CreateAsync();","var browser = await playwright.Firefox.LaunchAsync();","// Create a new incognito browser context.","var context = await browser.NewContextAsync();","// Create a new page in a pristine context.","var page = await context.NewPageAsync(); ;","await page.GotoAsync(\"https://www.bing.com\");"],"codeLang":"csharp"}],"required":true,"comment":"Creates a new browser context. It won't share cookies/cache with other browser contexts.\n\n```js\n(async () => {\n const browser = await playwright.firefox.launch(); // Or 'chromium' or 'webkit'.\n // Create a new incognito browser context.\n const context = await browser.newContext();\n // Create a new page in a pristine context.\n const page = await context.newPage();\n await page.goto('https://example.com');\n})();\n```\n\n```java\nBrowser browser = playwright.firefox().launch(); // Or 'chromium' or 'webkit'.\n// Create a new incognito browser context.\nBrowserContext context = browser.newContext();\n// Create a new page in a pristine context.\nPage page = context.newPage();\npage.navigate('https://example.com');\n```\n\n```python async\nbrowser = await playwright.firefox.launch() # or \"chromium\" or \"webkit\".\n# create a new incognito browser context.\ncontext = await browser.new_context()\n# create a new page in a pristine context.\npage = await context.new_page()\nawait page.goto(\"https://example.com\")\n```\n\n```python sync\nbrowser = playwright.firefox.launch() # or \"chromium\" or \"webkit\".\n# create a new incognito browser context.\ncontext = browser.new_context()\n# create a new page in a pristine context.\npage = context.new_page()\npage.goto(\"https://example.com\")\n```\n\n```csharp\nusing var playwright = await Playwright.CreateAsync();\nvar browser = await playwright.Firefox.LaunchAsync();\n// Create a new incognito browser context.\nvar context = await browser.NewContextAsync();\n// Create a new page in a pristine context.\nvar page = await context.NewPageAsync(); ;\nawait page.GotoAsync(\"https://www.bing.com\");\n```\n","deprecated":false,"async":true,"alias":"newContext","args":[{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"acceptDownloads","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether to automatically download all the attachments. Defaults to `false` where all the downloads are canceled."}],"required":false,"comment":"Whether to automatically download all the attachments. Defaults to `false` where all the downloads are canceled.","deprecated":false,"async":false,"alias":"acceptDownloads"},{"kind":"property","langs":{},"name":"bypassCSP","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Toggles bypassing page's Content-Security-Policy."}],"required":false,"comment":"Toggles bypassing page's Content-Security-Policy.","deprecated":false,"async":false,"alias":"bypassCSP"},{"kind":"property","langs":{},"name":"colorScheme","type":{"name":"ColorScheme","union":[{"name":"\"light\""},{"name":"\"dark\""},{"name":"\"no-preference\""}],"expression":"[ColorScheme]<\"light\"|\"dark\"|\"no-preference\">"},"spec":[{"type":"text","text":"Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. See [`method: Page.emulateMedia`] for more details. Defaults to `'light'`."}],"required":false,"comment":"Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. See\n[`method: Page.emulateMedia`] for more details. Defaults to `'light'`.","deprecated":false,"async":false,"alias":"colorScheme"},{"kind":"property","langs":{},"name":"deviceScaleFactor","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Specify device scale factor (can be thought of as dpr). Defaults to `1`."}],"required":false,"comment":"Specify device scale factor (can be thought of as dpr). Defaults to `1`.","deprecated":false,"async":false,"alias":"deviceScaleFactor"},{"kind":"property","langs":{},"name":"extraHTTPHeaders","type":{"name":"Object","templates":[{"name":"string"},{"name":"string"}],"expression":"[Object]<[string], [string]>"},"spec":[{"type":"text","text":"An object containing additional HTTP headers to be sent with every request. All header values must be strings."}],"required":false,"comment":"An object containing additional HTTP headers to be sent with every request. All header values must be strings.","deprecated":false,"async":false,"alias":"extraHTTPHeaders"},{"kind":"property","langs":{},"name":"geolocation","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"latitude","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Latitude between -90 and 90."}],"required":true,"comment":"Latitude between -90 and 90.","deprecated":false,"async":false,"alias":"latitude"},{"kind":"property","langs":{},"name":"longitude","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Longitude between -180 and 180."}],"required":true,"comment":"Longitude between -180 and 180.","deprecated":false,"async":false,"alias":"longitude"},{"kind":"property","langs":{},"name":"accuracy","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Non-negative accuracy value. Defaults to `0`."}],"required":false,"comment":"Non-negative accuracy value. Defaults to `0`.","deprecated":false,"async":false,"alias":"accuracy"}],"expression":"[Object]"},"spec":[],"required":false,"comment":"","deprecated":false,"async":false,"alias":"geolocation"},{"kind":"property","langs":{},"name":"hasTouch","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Specifies if viewport supports touch events. Defaults to false."}],"required":false,"comment":"Specifies if viewport supports touch events. Defaults to false.","deprecated":false,"async":false,"alias":"hasTouch"},{"kind":"property","langs":{},"name":"httpCredentials","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"username","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"username"},{"kind":"property","langs":{},"name":"password","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"password"}],"expression":"[Object]"},"spec":[{"type":"text","text":"Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication)."}],"required":false,"comment":"Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication).","deprecated":false,"async":false,"alias":"httpCredentials"},{"kind":"property","langs":{},"name":"ignoreHTTPSErrors","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether to ignore HTTPS errors during navigation. Defaults to `false`."}],"required":false,"comment":"Whether to ignore HTTPS errors during navigation. Defaults to `false`.","deprecated":false,"async":false,"alias":"ignoreHTTPSErrors"},{"kind":"property","langs":{},"name":"isMobile","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether the `meta viewport` tag is taken into account and touch events are enabled. Defaults to `false`. Not supported in Firefox."}],"required":false,"comment":"Whether the `meta viewport` tag is taken into account and touch events are enabled. Defaults to `false`. Not supported\nin Firefox.","deprecated":false,"async":false,"alias":"isMobile"},{"kind":"property","langs":{},"name":"javaScriptEnabled","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether or not to enable JavaScript in the context. Defaults to `true`."}],"required":false,"comment":"Whether or not to enable JavaScript in the context. Defaults to `true`.","deprecated":false,"async":false,"alias":"javaScriptEnabled"},{"kind":"property","langs":{},"name":"locale","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Specify user locale, for example `en-GB`, `de-DE`, etc. Locale will affect `navigator.language` value, `Accept-Language` request header value as well as number and date formatting rules."}],"required":false,"comment":"Specify user locale, for example `en-GB`, `de-DE`, etc. Locale will affect `navigator.language` value, `Accept-Language`\nrequest header value as well as number and date formatting rules.","deprecated":false,"async":false,"alias":"locale"},{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"logger","type":{"name":"Logger","expression":"[Logger]"},"spec":[{"type":"text","text":"Logger sink for Playwright logging."}],"required":false,"comment":"Logger sink for Playwright logging.","deprecated":false,"async":false,"alias":"logger"},{"kind":"property","langs":{"only":["python"],"aliases":{},"types":{},"overrides":{}},"name":"noViewport","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Does not enforce fixed viewport, allows resizing window in the headed mode."}],"required":false,"comment":"Does not enforce fixed viewport, allows resizing window in the headed mode.","deprecated":false,"async":false,"alias":"noViewport"},{"kind":"property","langs":{},"name":"offline","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether to emulate network being offline. Defaults to `false`."}],"required":false,"comment":"Whether to emulate network being offline. Defaults to `false`.","deprecated":false,"async":false,"alias":"offline"},{"kind":"property","langs":{},"name":"permissions","type":{"name":"Array","templates":[{"name":"string"}],"expression":"[Array]<[string]>"},"spec":[{"type":"text","text":"A list of permissions to grant to all pages in this context. See [`method: BrowserContext.grantPermissions`] for more details."}],"required":false,"comment":"A list of permissions to grant to all pages in this context. See [`method: BrowserContext.grantPermissions`] for more\ndetails.","deprecated":false,"async":false,"alias":"permissions"},{"kind":"property","langs":{},"name":"proxy","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"server","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Proxy to be used for all requests. HTTP and SOCKS proxies are supported, for example `http://myproxy.com:3128` or `socks5://myproxy.com:3128`. Short form `myproxy.com:3128` is considered an HTTP proxy."}],"required":true,"comment":"Proxy to be used for all requests. HTTP and SOCKS proxies are supported, for example `http://myproxy.com:3128` or\n`socks5://myproxy.com:3128`. Short form `myproxy.com:3128` is considered an HTTP proxy.","deprecated":false,"async":false,"alias":"server"},{"kind":"property","langs":{},"name":"bypass","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Optional coma-separated domains to bypass proxy, for example `\".com, chromium.org, .domain.com\"`."}],"required":false,"comment":"Optional coma-separated domains to bypass proxy, for example `\".com, chromium.org, .domain.com\"`.","deprecated":false,"async":false,"alias":"bypass"},{"kind":"property","langs":{},"name":"username","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Optional username to use if HTTP proxy requires authentication."}],"required":false,"comment":"Optional username to use if HTTP proxy requires authentication.","deprecated":false,"async":false,"alias":"username"},{"kind":"property","langs":{},"name":"password","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Optional password to use if HTTP proxy requires authentication."}],"required":false,"comment":"Optional password to use if HTTP proxy requires authentication.","deprecated":false,"async":false,"alias":"password"}],"expression":"[Object]"},"spec":[{"type":"text","text":"Network proxy settings to use with this context."},{"type":"note","noteType":"note","text":"For Chromium on Windows the browser needs to be launched with the global proxy for this option to work. If all contexts override the proxy, global proxy will be never used and can be any string, for example `launch({ proxy: { server: 'http://per-context' } })`."}],"required":false,"comment":"Network proxy settings to use with this context.\n\n> NOTE: For Chromium on Windows the browser needs to be launched with the global proxy for this option to work. If all\ncontexts override the proxy, global proxy will be never used and can be any string, for example `launch({ proxy: {\nserver: 'http://per-context' } })`.","deprecated":false,"async":false,"alias":"proxy"},{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"recordHar","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"omitContent","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Optional setting to control whether to omit request content from the HAR. Defaults to `false`."}],"required":false,"comment":"Optional setting to control whether to omit request content from the HAR. Defaults to `false`.","deprecated":false,"async":false,"alias":"omitContent"},{"kind":"property","langs":{},"name":"path","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"Path on the filesystem to write the HAR file to."}],"required":true,"comment":"Path on the filesystem to write the HAR file to.","deprecated":false,"async":false,"alias":"path"}],"expression":"[Object]"},"spec":[{"type":"text","text":"Enables [HAR](http://www.softwareishard.com/blog/har-12-spec) recording for all pages into `recordHar.path` file. If not specified, the HAR is not recorded. Make sure to await [`method: BrowserContext.close`] for the HAR to be saved."}],"required":false,"comment":"Enables [HAR](http://www.softwareishard.com/blog/har-12-spec) recording for all pages into `recordHar.path` file. If not\nspecified, the HAR is not recorded. Make sure to await [`method: BrowserContext.close`] for the HAR to be saved.","deprecated":false,"async":false,"alias":"recordHar"},{"kind":"property","langs":{"only":["csharp","java","python"],"aliases":{"python":"record_har_omit_content"},"types":{},"overrides":{}},"name":"recordHarOmitContent","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Optional setting to control whether to omit request content from the HAR. Defaults to `false`."}],"required":false,"comment":"Optional setting to control whether to omit request content from the HAR. Defaults to `false`.","deprecated":false,"async":false,"alias":"recordHarOmitContent"},{"kind":"property","langs":{"only":["csharp","java","python"],"aliases":{"python":"record_har_path"},"types":{},"overrides":{}},"name":"recordHarPath","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"Enables [HAR](http://www.softwareishard.com/blog/har-12-spec) recording for all pages into the specified HAR file on the filesystem. If not specified, the HAR is not recorded. Make sure to call [`method: BrowserContext.close`] for the HAR to be saved."}],"required":false,"comment":"Enables [HAR](http://www.softwareishard.com/blog/har-12-spec) recording for all pages into the specified HAR file on the\nfilesystem. If not specified, the HAR is not recorded. Make sure to call [`method: BrowserContext.close`] for the HAR to\nbe saved.","deprecated":false,"async":false,"alias":"recordHarPath"},{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"recordVideo","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"dir","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"Path to the directory to put videos into."}],"required":true,"comment":"Path to the directory to put videos into.","deprecated":false,"async":false,"alias":"dir"},{"kind":"property","langs":{},"name":"size","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"width","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"Video frame width."}],"required":true,"comment":"Video frame width.","deprecated":false,"async":false,"alias":"width"},{"kind":"property","langs":{},"name":"height","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"Video frame height."}],"required":true,"comment":"Video frame height.","deprecated":false,"async":false,"alias":"height"}],"expression":"[Object]"},"spec":[{"type":"text","text":"Optional dimensions of the recorded videos. If not specified the size will be equal to `viewport` scaled down to fit into 800x800. If `viewport` is not configured explicitly the video size defaults to 800x450. Actual picture of each page will be scaled down if necessary to fit the specified size."}],"required":false,"comment":"Optional dimensions of the recorded videos. If not specified the size will be equal to `viewport` scaled down to fit\ninto 800x800. If `viewport` is not configured explicitly the video size defaults to 800x450. Actual picture of each page\nwill be scaled down if necessary to fit the specified size.","deprecated":false,"async":false,"alias":"size"}],"expression":"[Object]"},"spec":[{"type":"text","text":"Enables video recording for all pages into `recordVideo.dir` directory. If not specified videos are not recorded. Make sure to await [`method: BrowserContext.close`] for videos to be saved."}],"required":false,"comment":"Enables video recording for all pages into `recordVideo.dir` directory. If not specified videos are not recorded. Make\nsure to await [`method: BrowserContext.close`] for videos to be saved.","deprecated":false,"async":false,"alias":"recordVideo"},{"kind":"property","langs":{"only":["csharp","java","python"],"aliases":{"python":"record_video_dir"},"types":{},"overrides":{}},"name":"recordVideoDir","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"Enables video recording for all pages into the specified directory. If not specified videos are not recorded. Make sure to call [`method: BrowserContext.close`] for videos to be saved."}],"required":false,"comment":"Enables video recording for all pages into the specified directory. If not specified videos are not recorded. Make sure\nto call [`method: BrowserContext.close`] for videos to be saved.","deprecated":false,"async":false,"alias":"recordVideoDir"},{"kind":"property","langs":{"only":["csharp","java","python"],"aliases":{"python":"record_video_size"},"types":{},"overrides":{}},"name":"recordVideoSize","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"width","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"Video frame width."}],"required":true,"comment":"Video frame width.","deprecated":false,"async":false,"alias":"width"},{"kind":"property","langs":{},"name":"height","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"Video frame height."}],"required":true,"comment":"Video frame height.","deprecated":false,"async":false,"alias":"height"}],"expression":"[Object]"},"spec":[{"type":"text","text":"Dimensions of the recorded videos. If not specified the size will be equal to `viewport` scaled down to fit into 800x800. If `viewport` is not configured explicitly the video size defaults to 800x450. Actual picture of each page will be scaled down if necessary to fit the specified size."}],"required":false,"comment":"Dimensions of the recorded videos. If not specified the size will be equal to `viewport` scaled down to fit into\n800x800. If `viewport` is not configured explicitly the video size defaults to 800x450. Actual picture of each page will\nbe scaled down if necessary to fit the specified size.","deprecated":false,"async":false,"alias":"recordVideoSize"},{"kind":"property","langs":{},"name":"reducedMotion","type":{"name":"ReducedMotion","union":[{"name":"\"reduce\""},{"name":"\"no-preference\""}],"expression":"[ReducedMotion]<\"reduce\"|\"no-preference\">"},"spec":[{"type":"text","text":"Emulates `'prefers-reduced-motion'` media feature, supported values are `'reduce'`, `'no-preference'`. See [`method: Page.emulateMedia`] for more details. Defaults to `'no-preference'`."}],"required":false,"comment":"Emulates `'prefers-reduced-motion'` media feature, supported values are `'reduce'`, `'no-preference'`. See\n[`method: Page.emulateMedia`] for more details. Defaults to `'no-preference'`.","deprecated":false,"async":false,"alias":"reducedMotion"},{"kind":"property","langs":{"aliases":{"java":"screenSize","csharp":"screenSize"},"types":{},"overrides":{}},"name":"screen","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"width","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"page width in pixels."}],"required":true,"comment":"page width in pixels.","deprecated":false,"async":false,"alias":"width"},{"kind":"property","langs":{},"name":"height","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"page height in pixels."}],"required":true,"comment":"page height in pixels.","deprecated":false,"async":false,"alias":"height"}],"expression":"[Object]"},"spec":[{"type":"text","text":"Emulates consistent window screen size available inside web page via `window.screen`. Is only used when the `viewport` is set."}],"required":false,"comment":"Emulates consistent window screen size available inside web page via `window.screen`. Is only used when the `viewport`\nis set.","deprecated":false,"async":false,"alias":"screen"},{"kind":"property","langs":{"only":["js","python"],"aliases":{},"types":{},"overrides":{}},"name":"storageState","type":{"name":"","union":[{"name":"path"},{"name":"Object","properties":[{"kind":"property","langs":{},"name":"cookies","type":{"name":"Array","templates":[{"name":"Object","properties":[{"kind":"property","langs":{},"name":"name","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"name"},{"kind":"property","langs":{},"name":"value","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"value"},{"kind":"property","langs":{},"name":"url","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Optional either url or domain / path are required"}],"required":false,"comment":"Optional either url or domain / path are required","deprecated":false,"async":false,"alias":"url"},{"kind":"property","langs":{},"name":"domain","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Optional either url or domain / path are required"}],"required":false,"comment":"Optional either url or domain / path are required","deprecated":false,"async":false,"alias":"domain"},{"kind":"property","langs":{},"name":"path","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Optional either url or domain / path are required"}],"required":false,"comment":"Optional either url or domain / path are required","deprecated":false,"async":false,"alias":"path"},{"kind":"property","langs":{},"name":"expires","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Optional Unix time in seconds."}],"required":false,"comment":"Optional Unix time in seconds.","deprecated":false,"async":false,"alias":"expires"},{"kind":"property","langs":{},"name":"httpOnly","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Optional httpOnly flag"}],"required":false,"comment":"Optional httpOnly flag","deprecated":false,"async":false,"alias":"httpOnly"},{"kind":"property","langs":{},"name":"secure","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Optional secure flag"}],"required":false,"comment":"Optional secure flag","deprecated":false,"async":false,"alias":"secure"},{"kind":"property","langs":{},"name":"sameSite","type":{"name":"SameSiteAttribute","union":[{"name":"\"Strict\""},{"name":"\"Lax\""},{"name":"\"None\""}],"expression":"[SameSiteAttribute]<\"Strict\"|\"Lax\"|\"None\">"},"spec":[{"type":"text","text":"Optional sameSite flag"}],"required":false,"comment":"Optional sameSite flag","deprecated":false,"async":false,"alias":"sameSite"}]}],"expression":"[Array]<[Object]>"},"spec":[{"type":"text","text":"Optional cookies to set for context"}],"required":false,"comment":"Optional cookies to set for context","deprecated":false,"async":false,"alias":"cookies"},{"kind":"property","langs":{},"name":"origins","type":{"name":"Array","templates":[{"name":"Object","properties":[{"kind":"property","langs":{},"name":"origin","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"origin"},{"kind":"property","langs":{},"name":"localStorage","type":{"name":"Array","templates":[{"name":"Object","properties":[{"kind":"property","langs":{},"name":"name","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"name"},{"kind":"property","langs":{},"name":"value","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"value"}]}],"expression":"[Array]<[Object]>"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"localStorage"}]}],"expression":"[Array]<[Object]>"},"spec":[{"type":"text","text":"Optional localStorage to set for context"}],"required":false,"comment":"Optional localStorage to set for context","deprecated":false,"async":false,"alias":"origins"}]}],"expression":"[path]|[Object]"},"spec":[{"type":"text","text":"Populates context with given storage state. This option can be used to initialize context with logged-in information obtained via [`method: BrowserContext.storageState`]. Either a path to the file with saved storage, or an object with the following fields:"}],"required":false,"comment":"Populates context with given storage state. This option can be used to initialize context with logged-in information\nobtained via [`method: BrowserContext.storageState`]. Either a path to the file with saved storage, or an object with\nthe following fields:","deprecated":false,"async":false,"alias":"storageState"},{"kind":"property","langs":{"only":["csharp","java"],"aliases":{},"types":{},"overrides":{}},"name":"storageState","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Populates context with given storage state. This option can be used to initialize context with logged-in information obtained via [`method: BrowserContext.storageState`]."}],"required":false,"comment":"Populates context with given storage state. This option can be used to initialize context with logged-in information\nobtained via [`method: BrowserContext.storageState`].","deprecated":false,"async":false,"alias":"storageState"},{"kind":"property","langs":{"only":["csharp","java"],"aliases":{},"types":{},"overrides":{}},"name":"storageStatePath","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"Populates context with given storage state. This option can be used to initialize context with logged-in information obtained via [`method: BrowserContext.storageState`]. Path to the file with saved storage state."}],"required":false,"comment":"Populates context with given storage state. This option can be used to initialize context with logged-in information\nobtained via [`method: BrowserContext.storageState`]. Path to the file with saved storage state.","deprecated":false,"async":false,"alias":"storageStatePath"},{"kind":"property","langs":{},"name":"timezoneId","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Changes the timezone of the context. See [ICU's metaZones.txt](https://cs.chromium.org/chromium/src/third_party/icu/source/data/misc/metaZones.txt?rcl=faee8bc70570192d82d2978a71e2a615788597d1) for a list of supported timezone IDs."}],"required":false,"comment":"Changes the timezone of the context. See\n[ICU's metaZones.txt](https://cs.chromium.org/chromium/src/third_party/icu/source/data/misc/metaZones.txt?rcl=faee8bc70570192d82d2978a71e2a615788597d1)\nfor a list of supported timezone IDs.","deprecated":false,"async":false,"alias":"timezoneId"},{"kind":"property","langs":{},"name":"userAgent","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Specific user agent to use in this context."}],"required":false,"comment":"Specific user agent to use in this context.","deprecated":false,"async":false,"alias":"userAgent"},{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"videoSize","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"width","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"Video frame width."}],"required":true,"comment":"Video frame width.","deprecated":false,"async":false,"alias":"width"},{"kind":"property","langs":{},"name":"height","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"Video frame height."}],"required":true,"comment":"Video frame height.","deprecated":false,"async":false,"alias":"height"}],"expression":"[Object]"},"spec":[{"type":"text","text":"**DEPRECATED** Use `recordVideo` instead."}],"required":false,"comment":"**DEPRECATED** Use `recordVideo` instead.","deprecated":true,"async":false,"alias":"videoSize"},{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"videosPath","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"**DEPRECATED** Use `recordVideo` instead."}],"required":false,"comment":"**DEPRECATED** Use `recordVideo` instead.","deprecated":true,"async":false,"alias":"videosPath"},{"kind":"property","langs":{"only":["js","java"],"aliases":{"java":"viewportSize"},"types":{},"overrides":{}},"name":"viewport","type":{"name":"","union":[{"name":"null"},{"name":"Object","properties":[{"kind":"property","langs":{},"name":"width","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"page width in pixels."}],"required":true,"comment":"page width in pixels.","deprecated":false,"async":false,"alias":"width"},{"kind":"property","langs":{},"name":"height","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"page height in pixels."}],"required":true,"comment":"page height in pixels.","deprecated":false,"async":false,"alias":"height"}]}],"expression":"[null]|[Object]"},"spec":[{"type":"text","text":"Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. `null` disables the default viewport."}],"required":false,"comment":"Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. `null` disables the default viewport.","deprecated":false,"async":false,"alias":"viewport"},{"kind":"property","langs":{"only":["csharp"],"aliases":{"csharp":"viewportSize"},"types":{},"overrides":{}},"name":"viewport","type":{"name":"","union":[{"name":"null"},{"name":"Object","properties":[{"kind":"property","langs":{},"name":"width","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"page width in pixels."}],"required":true,"comment":"page width in pixels.","deprecated":false,"async":false,"alias":"width"},{"kind":"property","langs":{},"name":"height","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"page height in pixels."}],"required":true,"comment":"page height in pixels.","deprecated":false,"async":false,"alias":"height"}]}],"expression":"[null]|[Object]"},"spec":[{"type":"text","text":"Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use `ViewportSize.NoViewport` to disable the default viewport."}],"required":false,"comment":"Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use `ViewportSize.NoViewport` to disable\nthe default viewport.","deprecated":false,"async":false,"alias":"viewport"},{"kind":"property","langs":{"only":["python"],"aliases":{},"types":{},"overrides":{}},"name":"viewport","type":{"name":"","union":[{"name":"null"},{"name":"Object","properties":[{"kind":"property","langs":{},"name":"width","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"page width in pixels."}],"required":true,"comment":"page width in pixels.","deprecated":false,"async":false,"alias":"width"},{"kind":"property","langs":{},"name":"height","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"page height in pixels."}],"required":true,"comment":"page height in pixels.","deprecated":false,"async":false,"alias":"height"}]}],"expression":"[null]|[Object]"},"spec":[{"type":"text","text":"Sets a consistent viewport for each page. Defaults to an 1280x720 viewport. `no_viewport` disables the fixed viewport."}],"required":false,"comment":"Sets a consistent viewport for each page. Defaults to an 1280x720 viewport. `no_viewport` disables the fixed viewport.","deprecated":false,"async":false,"alias":"viewport"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"newPage","type":{"name":"Page","expression":"[Page]"},"spec":[{"type":"text","text":"Creates a new page in a new browser context. Closing this page will close the context as well."},{"type":"text","text":"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 [`method: Browser.newContext`] followed by the [`method: BrowserContext.newPage`] to control their exact life times."}],"required":true,"comment":"Creates a new page in a new browser context. Closing this page will close the context as well.\n\nThis is a convenience API that should only be used for the single-page scenarios and short snippets. Production code and\ntesting frameworks should explicitly create [`method: Browser.newContext`] followed by the\n[`method: BrowserContext.newPage`] to control their exact life times.","deprecated":false,"async":true,"alias":"newPage","args":[{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"acceptDownloads","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether to automatically download all the attachments. Defaults to `false` where all the downloads are canceled."}],"required":false,"comment":"Whether to automatically download all the attachments. Defaults to `false` where all the downloads are canceled.","deprecated":false,"async":false,"alias":"acceptDownloads"},{"kind":"property","langs":{},"name":"bypassCSP","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Toggles bypassing page's Content-Security-Policy."}],"required":false,"comment":"Toggles bypassing page's Content-Security-Policy.","deprecated":false,"async":false,"alias":"bypassCSP"},{"kind":"property","langs":{},"name":"colorScheme","type":{"name":"ColorScheme","union":[{"name":"\"light\""},{"name":"\"dark\""},{"name":"\"no-preference\""}],"expression":"[ColorScheme]<\"light\"|\"dark\"|\"no-preference\">"},"spec":[{"type":"text","text":"Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. See [`method: Page.emulateMedia`] for more details. Defaults to `'light'`."}],"required":false,"comment":"Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. See\n[`method: Page.emulateMedia`] for more details. Defaults to `'light'`.","deprecated":false,"async":false,"alias":"colorScheme"},{"kind":"property","langs":{},"name":"deviceScaleFactor","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Specify device scale factor (can be thought of as dpr). Defaults to `1`."}],"required":false,"comment":"Specify device scale factor (can be thought of as dpr). Defaults to `1`.","deprecated":false,"async":false,"alias":"deviceScaleFactor"},{"kind":"property","langs":{},"name":"extraHTTPHeaders","type":{"name":"Object","templates":[{"name":"string"},{"name":"string"}],"expression":"[Object]<[string], [string]>"},"spec":[{"type":"text","text":"An object containing additional HTTP headers to be sent with every request. All header values must be strings."}],"required":false,"comment":"An object containing additional HTTP headers to be sent with every request. All header values must be strings.","deprecated":false,"async":false,"alias":"extraHTTPHeaders"},{"kind":"property","langs":{},"name":"geolocation","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"latitude","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Latitude between -90 and 90."}],"required":true,"comment":"Latitude between -90 and 90.","deprecated":false,"async":false,"alias":"latitude"},{"kind":"property","langs":{},"name":"longitude","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Longitude between -180 and 180."}],"required":true,"comment":"Longitude between -180 and 180.","deprecated":false,"async":false,"alias":"longitude"},{"kind":"property","langs":{},"name":"accuracy","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Non-negative accuracy value. Defaults to `0`."}],"required":false,"comment":"Non-negative accuracy value. Defaults to `0`.","deprecated":false,"async":false,"alias":"accuracy"}],"expression":"[Object]"},"spec":[],"required":false,"comment":"","deprecated":false,"async":false,"alias":"geolocation"},{"kind":"property","langs":{},"name":"hasTouch","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Specifies if viewport supports touch events. Defaults to false."}],"required":false,"comment":"Specifies if viewport supports touch events. Defaults to false.","deprecated":false,"async":false,"alias":"hasTouch"},{"kind":"property","langs":{},"name":"httpCredentials","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"username","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"username"},{"kind":"property","langs":{},"name":"password","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"password"}],"expression":"[Object]"},"spec":[{"type":"text","text":"Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication)."}],"required":false,"comment":"Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication).","deprecated":false,"async":false,"alias":"httpCredentials"},{"kind":"property","langs":{},"name":"ignoreHTTPSErrors","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether to ignore HTTPS errors during navigation. Defaults to `false`."}],"required":false,"comment":"Whether to ignore HTTPS errors during navigation. Defaults to `false`.","deprecated":false,"async":false,"alias":"ignoreHTTPSErrors"},{"kind":"property","langs":{},"name":"isMobile","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether the `meta viewport` tag is taken into account and touch events are enabled. Defaults to `false`. Not supported in Firefox."}],"required":false,"comment":"Whether the `meta viewport` tag is taken into account and touch events are enabled. Defaults to `false`. Not supported\nin Firefox.","deprecated":false,"async":false,"alias":"isMobile"},{"kind":"property","langs":{},"name":"javaScriptEnabled","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether or not to enable JavaScript in the context. Defaults to `true`."}],"required":false,"comment":"Whether or not to enable JavaScript in the context. Defaults to `true`.","deprecated":false,"async":false,"alias":"javaScriptEnabled"},{"kind":"property","langs":{},"name":"locale","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Specify user locale, for example `en-GB`, `de-DE`, etc. Locale will affect `navigator.language` value, `Accept-Language` request header value as well as number and date formatting rules."}],"required":false,"comment":"Specify user locale, for example `en-GB`, `de-DE`, etc. Locale will affect `navigator.language` value, `Accept-Language`\nrequest header value as well as number and date formatting rules.","deprecated":false,"async":false,"alias":"locale"},{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"logger","type":{"name":"Logger","expression":"[Logger]"},"spec":[{"type":"text","text":"Logger sink for Playwright logging."}],"required":false,"comment":"Logger sink for Playwright logging.","deprecated":false,"async":false,"alias":"logger"},{"kind":"property","langs":{"only":["python"],"aliases":{},"types":{},"overrides":{}},"name":"noViewport","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Does not enforce fixed viewport, allows resizing window in the headed mode."}],"required":false,"comment":"Does not enforce fixed viewport, allows resizing window in the headed mode.","deprecated":false,"async":false,"alias":"noViewport"},{"kind":"property","langs":{},"name":"offline","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether to emulate network being offline. Defaults to `false`."}],"required":false,"comment":"Whether to emulate network being offline. Defaults to `false`.","deprecated":false,"async":false,"alias":"offline"},{"kind":"property","langs":{},"name":"permissions","type":{"name":"Array","templates":[{"name":"string"}],"expression":"[Array]<[string]>"},"spec":[{"type":"text","text":"A list of permissions to grant to all pages in this context. See [`method: BrowserContext.grantPermissions`] for more details."}],"required":false,"comment":"A list of permissions to grant to all pages in this context. See [`method: BrowserContext.grantPermissions`] for more\ndetails.","deprecated":false,"async":false,"alias":"permissions"},{"kind":"property","langs":{},"name":"proxy","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"server","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Proxy to be used for all requests. HTTP and SOCKS proxies are supported, for example `http://myproxy.com:3128` or `socks5://myproxy.com:3128`. Short form `myproxy.com:3128` is considered an HTTP proxy."}],"required":true,"comment":"Proxy to be used for all requests. HTTP and SOCKS proxies are supported, for example `http://myproxy.com:3128` or\n`socks5://myproxy.com:3128`. Short form `myproxy.com:3128` is considered an HTTP proxy.","deprecated":false,"async":false,"alias":"server"},{"kind":"property","langs":{},"name":"bypass","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Optional coma-separated domains to bypass proxy, for example `\".com, chromium.org, .domain.com\"`."}],"required":false,"comment":"Optional coma-separated domains to bypass proxy, for example `\".com, chromium.org, .domain.com\"`.","deprecated":false,"async":false,"alias":"bypass"},{"kind":"property","langs":{},"name":"username","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Optional username to use if HTTP proxy requires authentication."}],"required":false,"comment":"Optional username to use if HTTP proxy requires authentication.","deprecated":false,"async":false,"alias":"username"},{"kind":"property","langs":{},"name":"password","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Optional password to use if HTTP proxy requires authentication."}],"required":false,"comment":"Optional password to use if HTTP proxy requires authentication.","deprecated":false,"async":false,"alias":"password"}],"expression":"[Object]"},"spec":[{"type":"text","text":"Network proxy settings to use with this context."},{"type":"note","noteType":"note","text":"For Chromium on Windows the browser needs to be launched with the global proxy for this option to work. If all contexts override the proxy, global proxy will be never used and can be any string, for example `launch({ proxy: { server: 'http://per-context' } })`."}],"required":false,"comment":"Network proxy settings to use with this context.\n\n> NOTE: For Chromium on Windows the browser needs to be launched with the global proxy for this option to work. If all\ncontexts override the proxy, global proxy will be never used and can be any string, for example `launch({ proxy: {\nserver: 'http://per-context' } })`.","deprecated":false,"async":false,"alias":"proxy"},{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"recordHar","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"omitContent","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Optional setting to control whether to omit request content from the HAR. Defaults to `false`."}],"required":false,"comment":"Optional setting to control whether to omit request content from the HAR. Defaults to `false`.","deprecated":false,"async":false,"alias":"omitContent"},{"kind":"property","langs":{},"name":"path","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"Path on the filesystem to write the HAR file to."}],"required":true,"comment":"Path on the filesystem to write the HAR file to.","deprecated":false,"async":false,"alias":"path"}],"expression":"[Object]"},"spec":[{"type":"text","text":"Enables [HAR](http://www.softwareishard.com/blog/har-12-spec) recording for all pages into `recordHar.path` file. If not specified, the HAR is not recorded. Make sure to await [`method: BrowserContext.close`] for the HAR to be saved."}],"required":false,"comment":"Enables [HAR](http://www.softwareishard.com/blog/har-12-spec) recording for all pages into `recordHar.path` file. If not\nspecified, the HAR is not recorded. Make sure to await [`method: BrowserContext.close`] for the HAR to be saved.","deprecated":false,"async":false,"alias":"recordHar"},{"kind":"property","langs":{"only":["csharp","java","python"],"aliases":{"python":"record_har_omit_content"},"types":{},"overrides":{}},"name":"recordHarOmitContent","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Optional setting to control whether to omit request content from the HAR. Defaults to `false`."}],"required":false,"comment":"Optional setting to control whether to omit request content from the HAR. Defaults to `false`.","deprecated":false,"async":false,"alias":"recordHarOmitContent"},{"kind":"property","langs":{"only":["csharp","java","python"],"aliases":{"python":"record_har_path"},"types":{},"overrides":{}},"name":"recordHarPath","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"Enables [HAR](http://www.softwareishard.com/blog/har-12-spec) recording for all pages into the specified HAR file on the filesystem. If not specified, the HAR is not recorded. Make sure to call [`method: BrowserContext.close`] for the HAR to be saved."}],"required":false,"comment":"Enables [HAR](http://www.softwareishard.com/blog/har-12-spec) recording for all pages into the specified HAR file on the\nfilesystem. If not specified, the HAR is not recorded. Make sure to call [`method: BrowserContext.close`] for the HAR to\nbe saved.","deprecated":false,"async":false,"alias":"recordHarPath"},{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"recordVideo","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"dir","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"Path to the directory to put videos into."}],"required":true,"comment":"Path to the directory to put videos into.","deprecated":false,"async":false,"alias":"dir"},{"kind":"property","langs":{},"name":"size","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"width","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"Video frame width."}],"required":true,"comment":"Video frame width.","deprecated":false,"async":false,"alias":"width"},{"kind":"property","langs":{},"name":"height","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"Video frame height."}],"required":true,"comment":"Video frame height.","deprecated":false,"async":false,"alias":"height"}],"expression":"[Object]"},"spec":[{"type":"text","text":"Optional dimensions of the recorded videos. If not specified the size will be equal to `viewport` scaled down to fit into 800x800. If `viewport` is not configured explicitly the video size defaults to 800x450. Actual picture of each page will be scaled down if necessary to fit the specified size."}],"required":false,"comment":"Optional dimensions of the recorded videos. If not specified the size will be equal to `viewport` scaled down to fit\ninto 800x800. If `viewport` is not configured explicitly the video size defaults to 800x450. Actual picture of each page\nwill be scaled down if necessary to fit the specified size.","deprecated":false,"async":false,"alias":"size"}],"expression":"[Object]"},"spec":[{"type":"text","text":"Enables video recording for all pages into `recordVideo.dir` directory. If not specified videos are not recorded. Make sure to await [`method: BrowserContext.close`] for videos to be saved."}],"required":false,"comment":"Enables video recording for all pages into `recordVideo.dir` directory. If not specified videos are not recorded. Make\nsure to await [`method: BrowserContext.close`] for videos to be saved.","deprecated":false,"async":false,"alias":"recordVideo"},{"kind":"property","langs":{"only":["csharp","java","python"],"aliases":{"python":"record_video_dir"},"types":{},"overrides":{}},"name":"recordVideoDir","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"Enables video recording for all pages into the specified directory. If not specified videos are not recorded. Make sure to call [`method: BrowserContext.close`] for videos to be saved."}],"required":false,"comment":"Enables video recording for all pages into the specified directory. If not specified videos are not recorded. Make sure\nto call [`method: BrowserContext.close`] for videos to be saved.","deprecated":false,"async":false,"alias":"recordVideoDir"},{"kind":"property","langs":{"only":["csharp","java","python"],"aliases":{"python":"record_video_size"},"types":{},"overrides":{}},"name":"recordVideoSize","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"width","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"Video frame width."}],"required":true,"comment":"Video frame width.","deprecated":false,"async":false,"alias":"width"},{"kind":"property","langs":{},"name":"height","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"Video frame height."}],"required":true,"comment":"Video frame height.","deprecated":false,"async":false,"alias":"height"}],"expression":"[Object]"},"spec":[{"type":"text","text":"Dimensions of the recorded videos. If not specified the size will be equal to `viewport` scaled down to fit into 800x800. If `viewport` is not configured explicitly the video size defaults to 800x450. Actual picture of each page will be scaled down if necessary to fit the specified size."}],"required":false,"comment":"Dimensions of the recorded videos. If not specified the size will be equal to `viewport` scaled down to fit into\n800x800. If `viewport` is not configured explicitly the video size defaults to 800x450. Actual picture of each page will\nbe scaled down if necessary to fit the specified size.","deprecated":false,"async":false,"alias":"recordVideoSize"},{"kind":"property","langs":{},"name":"reducedMotion","type":{"name":"ReducedMotion","union":[{"name":"\"reduce\""},{"name":"\"no-preference\""}],"expression":"[ReducedMotion]<\"reduce\"|\"no-preference\">"},"spec":[{"type":"text","text":"Emulates `'prefers-reduced-motion'` media feature, supported values are `'reduce'`, `'no-preference'`. See [`method: Page.emulateMedia`] for more details. Defaults to `'no-preference'`."}],"required":false,"comment":"Emulates `'prefers-reduced-motion'` media feature, supported values are `'reduce'`, `'no-preference'`. See\n[`method: Page.emulateMedia`] for more details. Defaults to `'no-preference'`.","deprecated":false,"async":false,"alias":"reducedMotion"},{"kind":"property","langs":{"aliases":{"java":"screenSize","csharp":"screenSize"},"types":{},"overrides":{}},"name":"screen","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"width","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"page width in pixels."}],"required":true,"comment":"page width in pixels.","deprecated":false,"async":false,"alias":"width"},{"kind":"property","langs":{},"name":"height","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"page height in pixels."}],"required":true,"comment":"page height in pixels.","deprecated":false,"async":false,"alias":"height"}],"expression":"[Object]"},"spec":[{"type":"text","text":"Emulates consistent window screen size available inside web page via `window.screen`. Is only used when the `viewport` is set."}],"required":false,"comment":"Emulates consistent window screen size available inside web page via `window.screen`. Is only used when the `viewport`\nis set.","deprecated":false,"async":false,"alias":"screen"},{"kind":"property","langs":{"only":["js","python"],"aliases":{},"types":{},"overrides":{}},"name":"storageState","type":{"name":"","union":[{"name":"path"},{"name":"Object","properties":[{"kind":"property","langs":{},"name":"cookies","type":{"name":"Array","templates":[{"name":"Object","properties":[{"kind":"property","langs":{},"name":"name","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"name"},{"kind":"property","langs":{},"name":"value","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"value"},{"kind":"property","langs":{},"name":"url","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Optional either url or domain / path are required"}],"required":false,"comment":"Optional either url or domain / path are required","deprecated":false,"async":false,"alias":"url"},{"kind":"property","langs":{},"name":"domain","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Optional either url or domain / path are required"}],"required":false,"comment":"Optional either url or domain / path are required","deprecated":false,"async":false,"alias":"domain"},{"kind":"property","langs":{},"name":"path","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Optional either url or domain / path are required"}],"required":false,"comment":"Optional either url or domain / path are required","deprecated":false,"async":false,"alias":"path"},{"kind":"property","langs":{},"name":"expires","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Optional Unix time in seconds."}],"required":false,"comment":"Optional Unix time in seconds.","deprecated":false,"async":false,"alias":"expires"},{"kind":"property","langs":{},"name":"httpOnly","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Optional httpOnly flag"}],"required":false,"comment":"Optional httpOnly flag","deprecated":false,"async":false,"alias":"httpOnly"},{"kind":"property","langs":{},"name":"secure","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Optional secure flag"}],"required":false,"comment":"Optional secure flag","deprecated":false,"async":false,"alias":"secure"},{"kind":"property","langs":{},"name":"sameSite","type":{"name":"SameSiteAttribute","union":[{"name":"\"Strict\""},{"name":"\"Lax\""},{"name":"\"None\""}],"expression":"[SameSiteAttribute]<\"Strict\"|\"Lax\"|\"None\">"},"spec":[{"type":"text","text":"Optional sameSite flag"}],"required":false,"comment":"Optional sameSite flag","deprecated":false,"async":false,"alias":"sameSite"}]}],"expression":"[Array]<[Object]>"},"spec":[{"type":"text","text":"Optional cookies to set for context"}],"required":false,"comment":"Optional cookies to set for context","deprecated":false,"async":false,"alias":"cookies"},{"kind":"property","langs":{},"name":"origins","type":{"name":"Array","templates":[{"name":"Object","properties":[{"kind":"property","langs":{},"name":"origin","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"origin"},{"kind":"property","langs":{},"name":"localStorage","type":{"name":"Array","templates":[{"name":"Object","properties":[{"kind":"property","langs":{},"name":"name","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"name"},{"kind":"property","langs":{},"name":"value","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"value"}]}],"expression":"[Array]<[Object]>"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"localStorage"}]}],"expression":"[Array]<[Object]>"},"spec":[{"type":"text","text":"Optional localStorage to set for context"}],"required":false,"comment":"Optional localStorage to set for context","deprecated":false,"async":false,"alias":"origins"}]}],"expression":"[path]|[Object]"},"spec":[{"type":"text","text":"Populates context with given storage state. This option can be used to initialize context with logged-in information obtained via [`method: BrowserContext.storageState`]. Either a path to the file with saved storage, or an object with the following fields:"}],"required":false,"comment":"Populates context with given storage state. This option can be used to initialize context with logged-in information\nobtained via [`method: BrowserContext.storageState`]. Either a path to the file with saved storage, or an object with\nthe following fields:","deprecated":false,"async":false,"alias":"storageState"},{"kind":"property","langs":{"only":["csharp","java"],"aliases":{},"types":{},"overrides":{}},"name":"storageState","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Populates context with given storage state. This option can be used to initialize context with logged-in information obtained via [`method: BrowserContext.storageState`]."}],"required":false,"comment":"Populates context with given storage state. This option can be used to initialize context with logged-in information\nobtained via [`method: BrowserContext.storageState`].","deprecated":false,"async":false,"alias":"storageState"},{"kind":"property","langs":{"only":["csharp","java"],"aliases":{},"types":{},"overrides":{}},"name":"storageStatePath","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"Populates context with given storage state. This option can be used to initialize context with logged-in information obtained via [`method: BrowserContext.storageState`]. Path to the file with saved storage state."}],"required":false,"comment":"Populates context with given storage state. This option can be used to initialize context with logged-in information\nobtained via [`method: BrowserContext.storageState`]. Path to the file with saved storage state.","deprecated":false,"async":false,"alias":"storageStatePath"},{"kind":"property","langs":{},"name":"timezoneId","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Changes the timezone of the context. See [ICU's metaZones.txt](https://cs.chromium.org/chromium/src/third_party/icu/source/data/misc/metaZones.txt?rcl=faee8bc70570192d82d2978a71e2a615788597d1) for a list of supported timezone IDs."}],"required":false,"comment":"Changes the timezone of the context. See\n[ICU's metaZones.txt](https://cs.chromium.org/chromium/src/third_party/icu/source/data/misc/metaZones.txt?rcl=faee8bc70570192d82d2978a71e2a615788597d1)\nfor a list of supported timezone IDs.","deprecated":false,"async":false,"alias":"timezoneId"},{"kind":"property","langs":{},"name":"userAgent","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Specific user agent to use in this context."}],"required":false,"comment":"Specific user agent to use in this context.","deprecated":false,"async":false,"alias":"userAgent"},{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"videoSize","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"width","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"Video frame width."}],"required":true,"comment":"Video frame width.","deprecated":false,"async":false,"alias":"width"},{"kind":"property","langs":{},"name":"height","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"Video frame height."}],"required":true,"comment":"Video frame height.","deprecated":false,"async":false,"alias":"height"}],"expression":"[Object]"},"spec":[{"type":"text","text":"**DEPRECATED** Use `recordVideo` instead."}],"required":false,"comment":"**DEPRECATED** Use `recordVideo` instead.","deprecated":true,"async":false,"alias":"videoSize"},{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"videosPath","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"**DEPRECATED** Use `recordVideo` instead."}],"required":false,"comment":"**DEPRECATED** Use `recordVideo` instead.","deprecated":true,"async":false,"alias":"videosPath"},{"kind":"property","langs":{"only":["js","java"],"aliases":{"java":"viewportSize"},"types":{},"overrides":{}},"name":"viewport","type":{"name":"","union":[{"name":"null"},{"name":"Object","properties":[{"kind":"property","langs":{},"name":"width","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"page width in pixels."}],"required":true,"comment":"page width in pixels.","deprecated":false,"async":false,"alias":"width"},{"kind":"property","langs":{},"name":"height","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"page height in pixels."}],"required":true,"comment":"page height in pixels.","deprecated":false,"async":false,"alias":"height"}]}],"expression":"[null]|[Object]"},"spec":[{"type":"text","text":"Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. `null` disables the default viewport."}],"required":false,"comment":"Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. `null` disables the default viewport.","deprecated":false,"async":false,"alias":"viewport"},{"kind":"property","langs":{"only":["csharp"],"aliases":{"csharp":"viewportSize"},"types":{},"overrides":{}},"name":"viewport","type":{"name":"","union":[{"name":"null"},{"name":"Object","properties":[{"kind":"property","langs":{},"name":"width","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"page width in pixels."}],"required":true,"comment":"page width in pixels.","deprecated":false,"async":false,"alias":"width"},{"kind":"property","langs":{},"name":"height","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"page height in pixels."}],"required":true,"comment":"page height in pixels.","deprecated":false,"async":false,"alias":"height"}]}],"expression":"[null]|[Object]"},"spec":[{"type":"text","text":"Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use `ViewportSize.NoViewport` to disable the default viewport."}],"required":false,"comment":"Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use `ViewportSize.NoViewport` to disable\nthe default viewport.","deprecated":false,"async":false,"alias":"viewport"},{"kind":"property","langs":{"only":["python"],"aliases":{},"types":{},"overrides":{}},"name":"viewport","type":{"name":"","union":[{"name":"null"},{"name":"Object","properties":[{"kind":"property","langs":{},"name":"width","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"page width in pixels."}],"required":true,"comment":"page width in pixels.","deprecated":false,"async":false,"alias":"width"},{"kind":"property","langs":{},"name":"height","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"page height in pixels."}],"required":true,"comment":"page height in pixels.","deprecated":false,"async":false,"alias":"height"}]}],"expression":"[null]|[Object]"},"spec":[{"type":"text","text":"Sets a consistent viewport for each page. Defaults to an 1280x720 viewport. `no_viewport` disables the fixed viewport."}],"required":false,"comment":"Sets a consistent viewport for each page. Defaults to an 1280x720 viewport. `no_viewport` disables the fixed viewport.","deprecated":false,"async":false,"alias":"viewport"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{"only":["java","js","python"],"aliases":{},"types":{},"overrides":{}},"name":"startTracing","type":{"name":"void"},"spec":[{"type":"note","noteType":"note","text":"Tracing is only supported on Chromium-based browsers."},{"type":"text","text":"You can use [`method: Browser.startTracing`] and [`method: Browser.stopTracing`] to create a trace file that can be opened in Chrome DevTools performance panel."},{"type":"code","lines":["await browser.startTracing(page, {path: 'trace.json'});","await page.goto('https://www.google.com');","await browser.stopTracing();"],"codeLang":"js"},{"type":"code","lines":["browser.startTracing(page, new Browser.StartTracingOptions()"," .setPath(Paths.get(\"trace.json\")));","page.goto('https://www.google.com');","browser.stopTracing();"],"codeLang":"java"},{"type":"code","lines":["await browser.start_tracing(page, path=\"trace.json\")","await page.goto(\"https://www.google.com\")","await browser.stop_tracing()"],"codeLang":"python async"},{"type":"code","lines":["browser.start_tracing(page, path=\"trace.json\")","page.goto(\"https://www.google.com\")","browser.stop_tracing()"],"codeLang":"python sync"}],"required":true,"comment":"> NOTE: Tracing is only supported on Chromium-based browsers.\n\nYou can use [`method: Browser.startTracing`] and [`method: Browser.stopTracing`] to create a trace file that can be\nopened in Chrome DevTools performance panel.\n\n```js\nawait browser.startTracing(page, {path: 'trace.json'});\nawait page.goto('https://www.google.com');\nawait browser.stopTracing();\n```\n\n```java\nbrowser.startTracing(page, new Browser.StartTracingOptions()\n .setPath(Paths.get(\"trace.json\")));\npage.goto('https://www.google.com');\nbrowser.stopTracing();\n```\n\n```python async\nawait browser.start_tracing(page, path=\"trace.json\")\nawait page.goto(\"https://www.google.com\")\nawait browser.stop_tracing()\n```\n\n```python sync\nbrowser.start_tracing(page, path=\"trace.json\")\npage.goto(\"https://www.google.com\")\nbrowser.stop_tracing()\n```\n","deprecated":false,"async":true,"alias":"startTracing","args":[{"kind":"property","langs":{},"name":"page","type":{"name":"Page","expression":"[Page]"},"spec":[{"type":"text","text":"Optional, if specified, tracing includes screenshots of the given page."}],"required":false,"comment":"Optional, if specified, tracing includes screenshots of the given page.","deprecated":false,"async":false,"alias":"page"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"categories","type":{"name":"Array","templates":[{"name":"string"}],"expression":"[Array]<[string]>"},"spec":[{"type":"text","text":"specify custom categories to use instead of default."}],"required":false,"comment":"specify custom categories to use instead of default.","deprecated":false,"async":false,"alias":"categories"},{"kind":"property","langs":{},"name":"path","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"A path to write the trace file to."}],"required":false,"comment":"A path to write the trace file to.","deprecated":false,"async":false,"alias":"path"},{"kind":"property","langs":{},"name":"screenshots","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"captures screenshots in the trace."}],"required":false,"comment":"captures screenshots in the trace.","deprecated":false,"async":false,"alias":"screenshots"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{"only":["java","js","python"],"aliases":{},"types":{},"overrides":{}},"name":"stopTracing","type":{"name":"Buffer","expression":"[Buffer]"},"spec":[{"type":"note","noteType":"note","text":"Tracing is only supported on Chromium-based browsers."},{"type":"text","text":"Returns the buffer with trace data."}],"required":true,"comment":"> NOTE: Tracing is only supported on Chromium-based browsers.\n\nReturns the buffer with trace data.","deprecated":false,"async":true,"alias":"stopTracing","args":[]},{"kind":"method","langs":{},"name":"version","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Returns the browser version."}],"required":true,"comment":"Returns the browser version.","deprecated":false,"async":false,"alias":"version","args":[]}]},{"name":"BrowserContext","spec":[{"type":"li","text":"extends: [EventEmitter]","liType":"bullet"},{"type":"text","text":"BrowserContexts provide a way to operate multiple independent browser sessions."},{"type":"text","text":"If a page opens another page, e.g. with a `window.open` call, the popup will belong to the parent page's browser context."},{"type":"text","text":"Playwright allows creation of \"incognito\" browser contexts with `browser.newContext()` method. \"Incognito\" browser contexts don't write any browsing data to disk."},{"type":"code","lines":["// Create a new incognito browser context","const context = await browser.newContext();","// Create a new page inside context.","const page = await context.newPage();","await page.goto('https://example.com');","// Dispose context once it's no longer needed.","await context.close();"],"codeLang":"js"},{"type":"code","lines":["// Create a new incognito browser context","BrowserContext context = browser.newContext();","// Create a new page inside context.","Page page = context.newPage();","page.navigate(\"https://example.com\");","// Dispose context once it is no longer needed.","context.close();"],"codeLang":"java"},{"type":"code","lines":["# create a new incognito browser context","context = await browser.new_context()","# create a new page inside context.","page = await context.new_page()","await page.goto(\"https://example.com\")","# dispose context once it is no longer needed.","await context.close()"],"codeLang":"python async"},{"type":"code","lines":["# create a new incognito browser context","context = browser.new_context()","# create a new page inside context.","page = context.new_page()","page.goto(\"https://example.com\")","# dispose context once it is no longer needed.","context.close()"],"codeLang":"python sync"},{"type":"code","lines":["using var playwright = await Playwright.CreateAsync();","var browser = await playwright.Firefox.LaunchAsync(new BrowserTypeLaunchOptions { Headless = false });","// Create a new incognito browser context","var context = await browser.NewContextAsync();","// Create a new page inside context.","var page = await context.NewPageAsync();","await page.GotoAsync(\"https://bing.com\");","// Dispose context once it is no longer needed.","await context.CloseAsync();"],"codeLang":"csharp"}],"extends":"EventEmitter","langs":{},"comment":"- extends: [EventEmitter]\n\nBrowserContexts provide a way to operate multiple independent browser sessions.\n\nIf a page opens another page, e.g. with a `window.open` call, the popup will belong to the parent page's browser\ncontext.\n\nPlaywright allows creation of \"incognito\" browser contexts with `browser.newContext()` method. \"Incognito\" browser\ncontexts don't write any browsing data to disk.\n\n```js\n// Create a new incognito browser context\nconst context = await browser.newContext();\n// Create a new page inside context.\nconst page = await context.newPage();\nawait page.goto('https://example.com');\n// Dispose context once it's no longer needed.\nawait context.close();\n```\n\n```java\n// Create a new incognito browser context\nBrowserContext context = browser.newContext();\n// Create a new page inside context.\nPage page = context.newPage();\npage.navigate(\"https://example.com\");\n// Dispose context once it is no longer needed.\ncontext.close();\n```\n\n```python async\n# create a new incognito browser context\ncontext = await browser.new_context()\n# create a new page inside context.\npage = await context.new_page()\nawait page.goto(\"https://example.com\")\n# dispose context once it is no longer needed.\nawait context.close()\n```\n\n```python sync\n# create a new incognito browser context\ncontext = browser.new_context()\n# create a new page inside context.\npage = context.new_page()\npage.goto(\"https://example.com\")\n# dispose context once it is no longer needed.\ncontext.close()\n```\n\n```csharp\nusing var playwright = await Playwright.CreateAsync();\nvar browser = await playwright.Firefox.LaunchAsync(new BrowserTypeLaunchOptions { Headless = false });\n// Create a new incognito browser context\nvar context = await browser.NewContextAsync();\n// Create a new page inside context.\nvar page = await context.NewPageAsync();\nawait page.GotoAsync(\"https://bing.com\");\n// Dispose context once it is no longer needed.\nawait context.CloseAsync();\n```\n","members":[{"kind":"event","langs":{"only":["js","python"],"aliases":{},"types":{},"overrides":{}},"name":"backgroundPage","type":{"name":"Page","expression":"[Page]"},"spec":[{"type":"note","noteType":"note","text":"Only works with Chromium browser's persistent context."},{"type":"text","text":"Emitted when new background page is created in the context."},{"type":"code","lines":["const backgroundPage = await context.waitForEvent('backgroundpage');"],"codeLang":"js"},{"type":"code","lines":["background_page = await context.wait_for_event(\"backgroundpage\")"],"codeLang":"python async"},{"type":"code","lines":["background_page = context.wait_for_event(\"backgroundpage\")"],"codeLang":"python sync"}],"required":true,"comment":"> NOTE: Only works with Chromium browser's persistent context.\n\nEmitted when new background page is created in the context.\n\n```js\nconst backgroundPage = await context.waitForEvent('backgroundpage');\n```\n\n```python async\nbackground_page = await context.wait_for_event(\"backgroundpage\")\n```\n\n```python sync\nbackground_page = context.wait_for_event(\"backgroundpage\")\n```\n","deprecated":false,"async":false,"alias":"backgroundPage","args":[]},{"kind":"event","langs":{},"name":"close","type":{"name":"BrowserContext","expression":"[BrowserContext]"},"spec":[{"type":"text","text":"Emitted when Browser context gets closed. This might happen because of one of the following:"},{"type":"li","text":"Browser context is closed.","liType":"bullet"},{"type":"li","text":"Browser application is closed or crashed.","liType":"bullet"},{"type":"li","text":"The [`method: Browser.close`] method was called.","liType":"bullet"}],"required":true,"comment":"Emitted when Browser context gets closed. This might happen because of one of the following:\n- Browser context is closed.\n- Browser application is closed or crashed.\n- The [`method: Browser.close`] method was called.","deprecated":false,"async":false,"alias":"close","args":[]},{"kind":"event","langs":{},"name":"page","type":{"name":"Page","expression":"[Page]"},"spec":[{"type":"text","text":"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 [`event: Page.popup`] to receive events about popups relevant to a specific page."},{"type":"text","text":"The earliest moment that page is available is when it has navigated to the initial url. For example, when opening a popup with `window.open('http://example.com')`, this event will fire when the network request to \"http://example.com\" is done and its response has started loading in the popup."},{"type":"code","lines":["const [newPage] = await Promise.all(["," context.waitForEvent('page'),"," page.click('a[target=_blank]'),","]);","console.log(await newPage.evaluate('location.href'));"],"codeLang":"js"},{"type":"code","lines":["Page newPage = context.waitForPage(() -> {"," page.click(\"a[target=_blank]\");","});","System.out.println(newPage.evaluate(\"location.href\"));"],"codeLang":"java"},{"type":"code","lines":["async with context.expect_page() as page_info:"," await page.click(\"a[target=_blank]\"),","page = await page_info.value","print(await page.evaluate(\"location.href\"))"],"codeLang":"python async"},{"type":"code","lines":["with context.expect_page() as page_info:"," page.click(\"a[target=_blank]\"),","page = page_info.value","print(page.evaluate(\"location.href\"))"],"codeLang":"python sync"},{"type":"code","lines":["var popup = await context.RunAndWaitForPageAsync(async =>","{"," await page.ClickAsync(\"a\");","});","Console.WriteLine(await popup.EvaluateAsync<string>(\"location.href\"));"],"codeLang":"csharp"},{"type":"note","noteType":"note","text":"Use [`method: Page.waitForLoadState`] to wait until the page gets to a particular state (you should not need it in most cases)."}],"required":true,"comment":"The event is emitted when a new Page is created in the BrowserContext. The page may still be loading. The event will\nalso fire for popup pages. See also [`event: Page.popup`] to receive events about popups relevant to a specific page.\n\nThe earliest moment that page is available is when it has navigated to the initial url. For example, when opening a\npopup with `window.open('http://example.com')`, this event will fire when the network request to \"http://example.com\" is\ndone and its response has started loading in the popup.\n\n```js\nconst [newPage] = await Promise.all([\n context.waitForEvent('page'),\n page.click('a[target=_blank]'),\n]);\nconsole.log(await newPage.evaluate('location.href'));\n```\n\n```java\nPage newPage = context.waitForPage(() -> {\n page.click(\"a[target=_blank]\");\n});\nSystem.out.println(newPage.evaluate(\"location.href\"));\n```\n\n```python async\nasync with context.expect_page() as page_info:\n await page.click(\"a[target=_blank]\"),\npage = await page_info.value\nprint(await page.evaluate(\"location.href\"))\n```\n\n```python sync\nwith context.expect_page() as page_info:\n page.click(\"a[target=_blank]\"),\npage = page_info.value\nprint(page.evaluate(\"location.href\"))\n```\n\n```csharp\nvar popup = await context.RunAndWaitForPageAsync(async =>\n{\n await page.ClickAsync(\"a\");\n});\nConsole.WriteLine(await popup.EvaluateAsync<string>(\"location.href\"));\n```\n\n> NOTE: Use [`method: Page.waitForLoadState`] to wait until the page gets to a particular state (you should not need it\nin most cases).","deprecated":false,"async":false,"alias":"page","args":[]},{"kind":"event","langs":{},"name":"request","type":{"name":"Request","expression":"[Request]"},"spec":[{"type":"text","text":"Emitted when a request is issued from any pages created through this context. The [request] object is read-only. To only listen for requests from a particular page, use [`event: Page.request`]."},{"type":"text","text":"In order to intercept and mutate requests, see [`method: BrowserContext.route`] or [`method: Page.route`]."}],"required":true,"comment":"Emitted when a request is issued from any pages created through this context. The [request] object is read-only. To only\nlisten for requests from a particular page, use [`event: Page.request`].\n\nIn order to intercept and mutate requests, see [`method: BrowserContext.route`] or [`method: Page.route`].","deprecated":false,"async":false,"alias":"request","args":[]},{"kind":"event","langs":{},"name":"requestFailed","type":{"name":"Request","expression":"[Request]"},"spec":[{"type":"text","text":"Emitted when a request fails, for example by timing out. To only listen for failed requests from a particular page, use [`event: Page.requestFailed`]."},{"type":"note","noteType":"note","text":"HTTP Error responses, such as 404 or 503, are still successful responses from HTTP standpoint, so request will complete with [`event: BrowserContext.requestFinished`] event and not with [`event: BrowserContext.requestFailed`]."}],"required":true,"comment":"Emitted when a request fails, for example by timing out. To only listen for failed requests from a particular page, use\n[`event: Page.requestFailed`].\n\n> NOTE: HTTP Error responses, such as 404 or 503, are still successful responses from HTTP standpoint, so request will\ncomplete with [`event: BrowserContext.requestFinished`] event and not with [`event: BrowserContext.requestFailed`].","deprecated":false,"async":false,"alias":"requestFailed","args":[]},{"kind":"event","langs":{},"name":"requestFinished","type":{"name":"Request","expression":"[Request]"},"spec":[{"type":"text","text":"Emitted when a request finishes successfully after downloading the response body. For a successful response, the sequence of events is `request`, `response` and `requestfinished`. To listen for successful requests from a particular page, use [`event: Page.requestFinished`]."}],"required":true,"comment":"Emitted when a request finishes successfully after downloading the response body. For a successful response, the\nsequence of events is `request`, `response` and `requestfinished`. To listen for successful requests from a particular\npage, use [`event: Page.requestFinished`].","deprecated":false,"async":false,"alias":"requestFinished","args":[]},{"kind":"event","langs":{},"name":"response","type":{"name":"Response","expression":"[Response]"},"spec":[{"type":"text","text":"Emitted when [response] status and headers are received for a request. For a successful response, the sequence of events is `request`, `response` and `requestfinished`. To listen for response events from a particular page, use [`event: Page.response`]."}],"required":true,"comment":"Emitted when [response] status and headers are received for a request. For a successful response, the sequence of events\nis `request`, `response` and `requestfinished`. To listen for response events from a particular page, use\n[`event: Page.response`].","deprecated":false,"async":false,"alias":"response","args":[]},{"kind":"event","langs":{"only":["js","python"],"aliases":{},"types":{},"overrides":{}},"name":"serviceWorker","type":{"name":"Worker","expression":"[Worker]"},"spec":[{"type":"note","noteType":"note","text":"Service workers are only supported on Chromium-based browsers."},{"type":"text","text":"Emitted when new service worker is created in the context."}],"required":true,"comment":"> NOTE: Service workers are only supported on Chromium-based browsers.\n\nEmitted when new service worker is created in the context.","deprecated":false,"async":false,"alias":"serviceWorker","args":[]},{"kind":"method","langs":{},"name":"addCookies","type":{"name":"void"},"spec":[{"type":"text","text":"Adds cookies into this browser context. All pages within this context will have these cookies installed. Cookies can be obtained via [`method: BrowserContext.cookies`]."},{"type":"code","lines":["await browserContext.addCookies([cookieObject1, cookieObject2]);"],"codeLang":"js"},{"type":"code","lines":["browserContext.addCookies(Arrays.asList(cookieObject1, cookieObject2));"],"codeLang":"java"},{"type":"code","lines":["await browser_context.add_cookies([cookie_object1, cookie_object2])"],"codeLang":"python async"},{"type":"code","lines":["browser_context.add_cookies([cookie_object1, cookie_object2])"],"codeLang":"python sync"},{"type":"code","lines":["await context.AddCookiesAsync(new[] { cookie1, cookie2 });"],"codeLang":"csharp"}],"required":true,"comment":"Adds cookies into this browser context. All pages within this context will have these cookies installed. Cookies can be\nobtained via [`method: BrowserContext.cookies`].\n\n```js\nawait browserContext.addCookies([cookieObject1, cookieObject2]);\n```\n\n```java\nbrowserContext.addCookies(Arrays.asList(cookieObject1, cookieObject2));\n```\n\n```python async\nawait browser_context.add_cookies([cookie_object1, cookie_object2])\n```\n\n```python sync\nbrowser_context.add_cookies([cookie_object1, cookie_object2])\n```\n\n```csharp\nawait context.AddCookiesAsync(new[] { cookie1, cookie2 });\n```\n","deprecated":false,"async":true,"alias":"addCookies","args":[{"kind":"property","langs":{},"name":"cookies","type":{"name":"Array","templates":[{"name":"Object","properties":[{"kind":"property","langs":{},"name":"name","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"name"},{"kind":"property","langs":{},"name":"value","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"value"},{"kind":"property","langs":{},"name":"url","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"either url or domain / path are required. Optional."}],"required":false,"comment":"either url or domain / path are required. Optional.","deprecated":false,"async":false,"alias":"url"},{"kind":"property","langs":{},"name":"domain","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"either url or domain / path are required Optional."}],"required":false,"comment":"either url or domain / path are required Optional.","deprecated":false,"async":false,"alias":"domain"},{"kind":"property","langs":{},"name":"path","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"either url or domain / path are required Optional."}],"required":false,"comment":"either url or domain / path are required Optional.","deprecated":false,"async":false,"alias":"path"},{"kind":"property","langs":{},"name":"expires","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Unix time in seconds. Optional."}],"required":false,"comment":"Unix time in seconds. Optional.","deprecated":false,"async":false,"alias":"expires"},{"kind":"property","langs":{},"name":"httpOnly","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Optional."}],"required":false,"comment":"Optional.","deprecated":false,"async":false,"alias":"httpOnly"},{"kind":"property","langs":{},"name":"secure","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Optional."}],"required":false,"comment":"Optional.","deprecated":false,"async":false,"alias":"secure"},{"kind":"property","langs":{},"name":"sameSite","type":{"name":"SameSiteAttribute","union":[{"name":"\"Strict\""},{"name":"\"Lax\""},{"name":"\"None\""}],"expression":"[SameSiteAttribute]<\"Strict\"|\"Lax\"|\"None\">"},"spec":[{"type":"text","text":"Optional."}],"required":false,"comment":"Optional.","deprecated":false,"async":false,"alias":"sameSite"}]}],"expression":"[Array]<[Object]>"},"spec":[],"required":true,"comment":"","deprecated":false,"async":false,"alias":"cookies"}]},{"kind":"method","langs":{},"name":"addInitScript","type":{"name":"void"},"spec":[{"type":"text","text":"Adds a script which would be evaluated in one of the following scenarios:"},{"type":"li","text":"Whenever a page is created in the browser context or is navigated.","liType":"bullet"},{"type":"li","text":"Whenever a child frame is attached or navigated in any page in the browser context. In this case, the script is evaluated in the context of the newly attached frame.","liType":"bullet"},{"type":"text","text":"The script is evaluated after the document was created but before any of its scripts were run. This is useful to amend the JavaScript environment, e.g. to seed `Math.random`."},{"type":"text","text":"An example of overriding `Math.random` before the page loads:"},{"type":"code","lines":["// preload.js","Math.random = () => 42;"],"codeLang":"js browser"},{"type":"code","lines":["// In your playwright script, assuming the preload.js file is in same directory.","await browserContext.addInitScript({"," path: 'preload.js'","});"],"codeLang":"js"},{"type":"code","lines":["// In your playwright script, assuming the preload.js file is in same directory.","browserContext.addInitScript(Paths.get(\"preload.js\"));"],"codeLang":"java"},{"type":"code","lines":["# in your playwright script, assuming the preload.js file is in same directory.","await browser_context.add_init_script(path=\"preload.js\")"],"codeLang":"python async"},{"type":"code","lines":["# in your playwright script, assuming the preload.js file is in same directory.","browser_context.add_init_script(path=\"preload.js\")"],"codeLang":"python sync"},{"type":"code","lines":["await context.AddInitScriptAsync(new BrowserContextAddInitScriptOptions { ScriptPath = \"preload.js\" });"],"codeLang":"csharp"},{"type":"note","noteType":"note","text":"The order of evaluation of multiple scripts installed via [`method: BrowserContext.addInitScript`] and [`method: Page.addInitScript`] is not defined."}],"required":true,"comment":"Adds a script which would be evaluated in one of the following scenarios:\n- Whenever a page is created in the browser context or is navigated.\n- Whenever a child frame is attached or navigated in any page in the browser context. In this case, the script is\n evaluated in the context of the newly attached frame.\n\nThe script is evaluated after the document was created but before any of its scripts were run. This is useful to amend\nthe JavaScript environment, e.g. to seed `Math.random`.\n\nAn example of overriding `Math.random` before the page loads:\n\n```js browser\n// preload.js\nMath.random = () => 42;\n```\n\n```js\n// In your playwright script, assuming the preload.js file is in same directory.\nawait browserContext.addInitScript({\n path: 'preload.js'\n});\n```\n\n```java\n// In your playwright script, assuming the preload.js file is in same directory.\nbrowserContext.addInitScript(Paths.get(\"preload.js\"));\n```\n\n```python async\n# in your playwright script, assuming the preload.js file is in same directory.\nawait browser_context.add_init_script(path=\"preload.js\")\n```\n\n```python sync\n# in your playwright script, assuming the preload.js file is in same directory.\nbrowser_context.add_init_script(path=\"preload.js\")\n```\n\n```csharp\nawait context.AddInitScriptAsync(new BrowserContextAddInitScriptOptions { ScriptPath = \"preload.js\" });\n```\n\n> NOTE: The order of evaluation of multiple scripts installed via [`method: BrowserContext.addInitScript`] and\n[`method: Page.addInitScript`] is not defined.","deprecated":false,"async":true,"alias":"addInitScript","args":[{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"script","type":{"name":"","union":[{"name":"function"},{"name":"string"},{"name":"Object","properties":[{"kind":"property","langs":{},"name":"path","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the current working directory. Optional."}],"required":false,"comment":"Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the current working\ndirectory. Optional.","deprecated":false,"async":false,"alias":"path"},{"kind":"property","langs":{},"name":"content","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Raw script content. Optional."}],"required":false,"comment":"Raw script content. Optional.","deprecated":false,"async":false,"alias":"content"}]}],"expression":"[function]|[string]|[Object]"},"spec":[{"type":"text","text":"Script to be evaluated in all pages in the browser context."}],"required":true,"comment":"Script to be evaluated in all pages in the browser context.","deprecated":false,"async":false,"alias":"script"},{"kind":"property","langs":{"only":["csharp","java"],"aliases":{},"types":{},"overrides":{}},"name":"script","type":{"name":"","union":[{"name":"string"},{"name":"path"}],"expression":"[string]|[path]"},"spec":[{"type":"text","text":"Script to be evaluated in all pages in the browser context."}],"required":true,"comment":"Script to be evaluated in all pages in the browser context.","deprecated":false,"async":false,"alias":"script"},{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"arg","type":{"name":"Serializable","expression":"[Serializable]"},"spec":[{"type":"text","text":"Optional argument to pass to `script` (only supported when passing a function)."}],"required":false,"comment":"Optional argument to pass to `script` (only supported when passing a function).","deprecated":false,"async":false,"alias":"arg"},{"kind":"property","langs":{"only":["python"],"aliases":{},"types":{},"overrides":{}},"name":"path","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the current working directory. Optional."}],"required":false,"comment":"Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the current working\ndirectory. Optional.","deprecated":false,"async":false,"alias":"path"},{"kind":"property","langs":{"only":["python"],"aliases":{},"types":{},"overrides":{}},"name":"script","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Script to be evaluated in all pages in the browser context. Optional."}],"required":false,"comment":"Script to be evaluated in all pages in the browser context. Optional.","deprecated":false,"async":false,"alias":"script"}]},{"kind":"method","langs":{"only":["js","python"],"aliases":{},"types":{},"overrides":{}},"name":"backgroundPages","type":{"name":"Array","templates":[{"name":"Page"}],"expression":"[Array]<[Page]>"},"spec":[{"type":"note","noteType":"note","text":"Background pages are only supported on Chromium-based browsers."},{"type":"text","text":"All existing background pages in the context."}],"required":true,"comment":"> NOTE: Background pages are only supported on Chromium-based browsers.\n\nAll existing background pages in the context.","deprecated":false,"async":false,"alias":"backgroundPages","args":[]},{"kind":"method","langs":{},"name":"browser","type":{"name":"","union":[{"name":"null"},{"name":"Browser"}],"expression":"[null]|[Browser]"},"spec":[{"type":"text","text":"Returns the browser instance of the context. If it was launched as a persistent context null gets returned."}],"required":true,"comment":"Returns the browser instance of the context. If it was launched as a persistent context null gets returned.","deprecated":false,"async":false,"alias":"browser","args":[]},{"kind":"method","langs":{},"name":"clearCookies","type":{"name":"void"},"spec":[{"type":"text","text":"Clears context cookies."}],"required":true,"comment":"Clears context cookies.","deprecated":false,"async":true,"alias":"clearCookies","args":[]},{"kind":"method","langs":{},"name":"clearPermissions","type":{"name":"void"},"spec":[{"type":"text","text":"Clears all permission overrides for the browser context."},{"type":"code","lines":["const context = await browser.newContext();","await context.grantPermissions(['clipboard-read']);","// do stuff ..","context.clearPermissions();"],"codeLang":"js"},{"type":"code","lines":["BrowserContext context = browser.newContext();","context.grantPermissions(Arrays.asList(\"clipboard-read\"));","// do stuff ..","context.clearPermissions();"],"codeLang":"java"},{"type":"code","lines":["context = await browser.new_context()","await context.grant_permissions([\"clipboard-read\"])","# do stuff ..","context.clear_permissions()"],"codeLang":"python async"},{"type":"code","lines":["context = browser.new_context()","context.grant_permissions([\"clipboard-read\"])","# do stuff ..","context.clear_permissions()"],"codeLang":"python sync"},{"type":"code","lines":["var context = await browser.NewContextAsync();","await context.GrantPermissionsAsync(new[] { \"clipboard-read\" });","// Alternatively, you can use the helper class ContextPermissions ","// to specify the permissions...","// do stuff ...","await context.ClearPermissionsAsync();"],"codeLang":"csharp"}],"required":true,"comment":"Clears all permission overrides for the browser context.\n\n```js\nconst context = await browser.newContext();\nawait context.grantPermissions(['clipboard-read']);\n// do stuff ..\ncontext.clearPermissions();\n```\n\n```java\nBrowserContext context = browser.newContext();\ncontext.grantPermissions(Arrays.asList(\"clipboard-read\"));\n// do stuff ..\ncontext.clearPermissions();\n```\n\n```python async\ncontext = await browser.new_context()\nawait context.grant_permissions([\"clipboard-read\"])\n# do stuff ..\ncontext.clear_permissions()\n```\n\n```python sync\ncontext = browser.new_context()\ncontext.grant_permissions([\"clipboard-read\"])\n# do stuff ..\ncontext.clear_permissions()\n```\n\n```csharp\nvar context = await browser.NewContextAsync();\nawait context.GrantPermissionsAsync(new[] { \"clipboard-read\" });\n// Alternatively, you can use the helper class ContextPermissions \n// to specify the permissions...\n// do stuff ...\nawait context.ClearPermissionsAsync();\n```\n","deprecated":false,"async":true,"alias":"clearPermissions","args":[]},{"kind":"method","langs":{},"name":"close","type":{"name":"void"},"spec":[{"type":"text","text":"Closes the browser context. All the pages that belong to the browser context will be closed."},{"type":"note","noteType":"note","text":"The default browser context cannot be closed."}],"required":true,"comment":"Closes the browser context. All the pages that belong to the browser context will be closed.\n\n> NOTE: The default browser context cannot be closed.","deprecated":false,"async":true,"alias":"close","args":[]},{"kind":"method","langs":{},"name":"cookies","type":{"name":"Array","templates":[{"name":"Object","properties":[{"kind":"property","langs":{},"name":"name","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"name"},{"kind":"property","langs":{},"name":"value","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"value"},{"kind":"property","langs":{},"name":"domain","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"domain"},{"kind":"property","langs":{},"name":"path","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"path"},{"kind":"property","langs":{},"name":"expires","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Unix time in seconds."}],"required":true,"comment":"Unix time in seconds.","deprecated":false,"async":false,"alias":"expires"},{"kind":"property","langs":{},"name":"httpOnly","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"httpOnly"},{"kind":"property","langs":{},"name":"secure","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"secure"},{"kind":"property","langs":{},"name":"sameSite","type":{"name":"SameSiteAttribute","union":[{"name":"\"Strict\""},{"name":"\"Lax\""},{"name":"\"None\""}],"expression":"[SameSiteAttribute]<\"Strict\"|\"Lax\"|\"None\">"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"sameSite"}]}],"expression":"[Array]<[Object]>"},"spec":[{"type":"text","text":"If no URLs are specified, this method returns all cookies. If URLs are specified, only cookies that affect those URLs are returned."}],"required":true,"comment":"If no URLs are specified, this method returns all cookies. If URLs are specified, only cookies that affect those URLs\nare returned.","deprecated":false,"async":true,"alias":"cookies","args":[{"kind":"property","langs":{},"name":"urls","type":{"name":"","union":[{"name":"string"},{"name":"Array","templates":[{"name":"string"}]}],"expression":"[string]|[Array]<[string]>"},"spec":[{"type":"text","text":"Optional list of URLs."}],"required":false,"comment":"Optional list of URLs.","deprecated":false,"async":false,"alias":"urls"}]},{"kind":"method","langs":{},"name":"exposeBinding","type":{"name":"void"},"spec":[{"type":"text","text":"The method adds a function called `name` on the `window` object of every frame in every page in the context. When called, the function executes `callback` and returns a [Promise] which resolves to the return value of `callback`. If the `callback` returns a [Promise], it will be awaited."},{"type":"text","text":"The first argument of the `callback` function contains information about the caller: `{ browserContext: BrowserContext, page: Page, frame: Frame }`."},{"type":"text","text":"See [`method: Page.exposeBinding`] for page-only version."},{"type":"text","text":"An example of exposing page URL to all frames in all pages in the context:"},{"type":"code","lines":["const { webkit } = require('playwright'); // Or 'chromium' or 'firefox'.","","(async () => {"," const browser = await webkit.launch({ headless: false });"," const context = await browser.newContext();"," await context.exposeBinding('pageURL', ({ page }) => page.url());"," const page = await context.newPage();"," await page.setContent(`"," <script>"," async function onClick() {"," document.querySelector('div').textContent = await window.pageURL();"," }"," </script>"," <button onclick=\"onClick()\">Click me</button>"," <div></div>"," `);"," await page.click('button');","})();"],"codeLang":"js"},{"type":"code","lines":["import com.microsoft.playwright.*;","","public class Example {"," public static void main(String[] args) {"," try (Playwright playwright = Playwright.create()) {"," BrowserType webkit = playwright.webkit()"," Browser browser = webkit.launch(new BrowserType.LaunchOptions().setHeadless(false));"," BrowserContext context = browser.newContext();"," context.exposeBinding(\"pageURL\", (source, args) -> source.page().url());"," Page page = context.newPage();"," page.setContent(\"<script>\\n\" +"," \" async function onClick() {\\n\" +"," \" document.querySelector('div').textContent = await window.pageURL();\\n\" +"," \" }\\n\" +"," \"</script>\\n\" +"," \"<button onclick=\\\"onClick()\\\">Click me</button>\\n\" +"," \"<div></div>\");"," page.click(\"button\");"," }"," }","}"],"codeLang":"java"},{"type":"code","lines":["import asyncio","from playwright.async_api import async_playwright","","async def run(playwright):"," webkit = playwright.webkit"," browser = await webkit.launch(headless=false)"," context = await browser.new_context()"," await context.expose_binding(\"pageURL\", lambda source: source[\"page\"].url)"," page = await context.new_page()"," await page.set_content(\"\"\""," <script>"," async function onClick() {"," document.querySelector('div').textContent = await window.pageURL();"," }"," </script>"," <button onclick=\"onClick()\">Click me</button>"," <div></div>"," \"\"\")"," await page.click(\"button\")","","async def main():"," async with async_playwright() as playwright:"," await run(playwright)","asyncio.run(main())"],"codeLang":"python async"},{"type":"code","lines":["from playwright.sync_api import sync_playwright","","def run(playwright):"," webkit = playwright.webkit"," browser = webkit.launch(headless=false)"," context = browser.new_context()"," context.expose_binding(\"pageURL\", lambda source: source[\"page\"].url)"," page = context.new_page()"," page.set_content(\"\"\""," <script>"," async function onClick() {"," document.querySelector('div').textContent = await window.pageURL();"," }"," </script>"," <button onclick=\"onClick()\">Click me</button>"," <div></div>"," \"\"\")"," page.click(\"button\")","","with sync_playwright() as playwright:"," run(playwright)"],"codeLang":"python sync"},{"type":"code","lines":["using Microsoft.Playwright;","using System.Threading.Tasks;","","class Program","{"," public static async Task Main()"," {"," using var playwright = await Playwright.CreateAsync();"," var browser = await playwright.Webkit.LaunchAsync(new BrowserTypeLaunchOptions { Headless = false });"," var context = await browser.NewContextAsync();",""," await context.ExposeBindingAsync(\"pageURL\", source => source.Page.Url);"," var page = await context.NewPageAsync();"," await page.SetContentAsync(\"<script>\\n\" +"," \" async function onClick() {\\n\" +"," \" document.querySelector('div').textContent = await window.pageURL();\\n\" +"," \" }\\n\" +"," \"</script>\\n\" +"," \"<button onclick=\\\"onClick()\\\">Click me</button>\\n\" +"," \"<div></div>\");"," await page.ClickAsync(\"button\");"," }","}"],"codeLang":"csharp"},{"type":"text","text":"An example of passing an element handle:"},{"type":"code","lines":["await context.exposeBinding('clicked', async (source, element) => {"," console.log(await element.textContent());","}, { handle: true });","await page.setContent(`"," <script>"," document.addEventListener('click', event => window.clicked(event.target));"," </script>"," <div>Click me</div>"," <div>Or click me</div>","`);"],"codeLang":"js"},{"type":"code","lines":["context.exposeBinding(\"clicked\", (source, args) -> {"," ElementHandle element = (ElementHandle) args[0];"," System.out.println(element.textContent());"," return null;","}, new BrowserContext.ExposeBindingOptions().setHandle(true));","page.setContent(\"\" +"," \"<script>\\n\" +"," \" document.addEventListener('click', event => window.clicked(event.target));\\n\" +"," \"</script>\\n\" +"," \"<div>Click me</div>\\n\" +"," \"<div>Or click me</div>\\n\");"],"codeLang":"java"},{"type":"code","lines":["async def print(source, element):"," print(await element.text_content())","","await context.expose_binding(\"clicked\", print, handle=true)","await page.set_content(\"\"\""," <script>"," document.addEventListener('click', event => window.clicked(event.target));"," </script>"," <div>Click me</div>"," <div>Or click me</div>","\"\"\")"],"codeLang":"python async"},{"type":"code","lines":["def print(source, element):"," print(element.text_content())","","context.expose_binding(\"clicked\", print, handle=true)","page.set_content(\"\"\""," <script>"," document.addEventListener('click', event => window.clicked(event.target));"," </script>"," <div>Click me</div>"," <div>Or click me</div>","\"\"\")"],"codeLang":"python sync"},{"type":"code","lines":["var result = new TaskCompletionSource<string>();","var page = await Context.NewPageAsync();","await Context.ExposeBindingAsync(\"clicked\", async (BindingSource _, IJSHandle t) =>","{"," return result.TrySetResult(await t.AsElement().TextContentAsync());","});","","await page.SetContentAsync(\"<script>\\n\" +"," \" document.addEventListener('click', event => window.clicked(event.target));\\n\" +"," \"</script>\\n\" +"," \"<div>Click me</div>\\n\" +"," \"<div>Or click me</div>\\n\");","","await page.ClickAsync(\"div\");","// Note: it makes sense to await the result here, because otherwise, the context ","// gets closed and the binding function will throw an exception.","Assert.Equal(\"Click me\", await result.Task);"],"codeLang":"csharp"}],"required":true,"comment":"The method adds a function called `name` on the `window` object of every frame in every page in the context. When\ncalled, the function executes `callback` and returns a [Promise] which resolves to the return value of `callback`. If\nthe `callback` returns a [Promise], it will be awaited.\n\nThe first argument of the `callback` function contains information about the caller: `{ browserContext: BrowserContext,\npage: Page, frame: Frame }`.\n\nSee [`method: Page.exposeBinding`] for page-only version.\n\nAn example of exposing page URL to all frames in all pages in the context:\n\n```js\nconst { webkit } = require('playwright'); // Or 'chromium' or 'firefox'.\n\n(async () => {\n const browser = await webkit.launch({ headless: false });\n const context = await browser.newContext();\n await context.exposeBinding('pageURL', ({ page }) => page.url());\n const page = await context.newPage();\n await page.setContent(`\n <script>\n async function onClick() {\n document.querySelector('div').textContent = await window.pageURL();\n }\n </script>\n <button onclick=\"onClick()\">Click me</button>\n <div></div>\n `);\n await page.click('button');\n})();\n```\n\n```java\nimport com.microsoft.playwright.*;\n\npublic class Example {\n public static void main(String[] args) {\n try (Playwright playwright = Playwright.create()) {\n BrowserType webkit = playwright.webkit()\n Browser browser = webkit.launch(new BrowserType.LaunchOptions().setHeadless(false));\n BrowserContext context = browser.newContext();\n context.exposeBinding(\"pageURL\", (source, args) -> source.page().url());\n Page page = context.newPage();\n page.setContent(\"<script>\\n\" +\n \" async function onClick() {\\n\" +\n \" document.querySelector('div').textContent = await window.pageURL();\\n\" +\n \" }\\n\" +\n \"</script>\\n\" +\n \"<button onclick=\\\"onClick()\\\">Click me</button>\\n\" +\n \"<div></div>\");\n page.click(\"button\");\n }\n }\n}\n```\n\n```python async\nimport asyncio\nfrom playwright.async_api import async_playwright\n\nasync def run(playwright):\n webkit = playwright.webkit\n browser = await webkit.launch(headless=false)\n context = await browser.new_context()\n await context.expose_binding(\"pageURL\", lambda source: source[\"page\"].url)\n page = await context.new_page()\n await page.set_content(\"\"\"\n <script>\n async function onClick() {\n document.querySelector('div').textContent = await window.pageURL();\n }\n </script>\n <button onclick=\"onClick()\">Click me</button>\n <div></div>\n \"\"\")\n await page.click(\"button\")\n\nasync def main():\n async with async_playwright() as playwright:\n await run(playwright)\nasyncio.run(main())\n```\n\n```python sync\nfrom playwright.sync_api import sync_playwright\n\ndef run(playwright):\n webkit = playwright.webkit\n browser = webkit.launch(headless=false)\n context = browser.new_context()\n context.expose_binding(\"pageURL\", lambda source: source[\"page\"].url)\n page = context.new_page()\n page.set_content(\"\"\"\n <script>\n async function onClick() {\n document.querySelector('div').textContent = await window.pageURL();\n }\n </script>\n <button onclick=\"onClick()\">Click me</button>\n <div></div>\n \"\"\")\n page.click(\"button\")\n\nwith sync_playwright() as playwright:\n run(playwright)\n```\n\n```csharp\nusing Microsoft.Playwright;\nusing System.Threading.Tasks;\n\nclass Program\n{\n public static async Task Main()\n {\n using var playwright = await Playwright.CreateAsync();\n var browser = await playwright.Webkit.LaunchAsync(new BrowserTypeLaunchOptions { Headless = false });\n var context = await browser.NewContextAsync();\n\n await context.ExposeBindingAsync(\"pageURL\", source => source.Page.Url);\n var page = await context.NewPageAsync();\n await page.SetContentAsync(\"<script>\\n\" +\n \" async function onClick() {\\n\" +\n \" document.querySelector('div').textContent = await window.pageURL();\\n\" +\n \" }\\n\" +\n \"</script>\\n\" +\n \"<button onclick=\\\"onClick()\\\">Click me</button>\\n\" +\n \"<div></div>\");\n await page.ClickAsync(\"button\");\n }\n}\n```\n\nAn example of passing an element handle:\n\n```js\nawait context.exposeBinding('clicked', async (source, element) => {\n console.log(await element.textContent());\n}, { handle: true });\nawait page.setContent(`\n <script>\n document.addEventListener('click', event => window.clicked(event.target));\n </script>\n <div>Click me</div>\n <div>Or click me</div>\n`);\n```\n\n```java\ncontext.exposeBinding(\"clicked\", (source, args) -> {\n ElementHandle element = (ElementHandle) args[0];\n System.out.println(element.textContent());\n return null;\n}, new BrowserContext.ExposeBindingOptions().setHandle(true));\npage.setContent(\"\" +\n \"<script>\\n\" +\n \" document.addEventListener('click', event => window.clicked(event.target));\\n\" +\n \"</script>\\n\" +\n \"<div>Click me</div>\\n\" +\n \"<div>Or click me</div>\\n\");\n```\n\n```python async\nasync def print(source, element):\n print(await element.text_content())\n\nawait context.expose_binding(\"clicked\", print, handle=true)\nawait page.set_content(\"\"\"\n <script>\n document.addEventListener('click', event => window.clicked(event.target));\n </script>\n <div>Click me</div>\n <div>Or click me</div>\n\"\"\")\n```\n\n```python sync\ndef print(source, element):\n print(element.text_content())\n\ncontext.expose_binding(\"clicked\", print, handle=true)\npage.set_content(\"\"\"\n <script>\n document.addEventListener('click', event => window.clicked(event.target));\n </script>\n <div>Click me</div>\n <div>Or click me</div>\n\"\"\")\n```\n\n```csharp\nvar result = new TaskCompletionSource<string>();\nvar page = await Context.NewPageAsync();\nawait Context.ExposeBindingAsync(\"clicked\", async (BindingSource _, IJSHandle t) =>\n{\n return result.TrySetResult(await t.AsElement().TextContentAsync());\n});\n\nawait page.SetContentAsync(\"<script>\\n\" +\n \" document.addEventListener('click', event => window.clicked(event.target));\\n\" +\n \"</script>\\n\" +\n \"<div>Click me</div>\\n\" +\n \"<div>Or click me</div>\\n\");\n\nawait page.ClickAsync(\"div\");\n// Note: it makes sense to await the result here, because otherwise, the context \n// gets closed and the binding function will throw an exception.\nAssert.Equal(\"Click me\", await result.Task);\n```\n","deprecated":false,"async":true,"alias":"exposeBinding","args":[{"kind":"property","langs":{},"name":"name","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Name of the function on the window object."}],"required":true,"comment":"Name of the function on the window object.","deprecated":false,"async":false,"alias":"name"},{"kind":"property","langs":{},"name":"callback","type":{"name":"function","expression":"[function]"},"spec":[{"type":"text","text":"Callback function that will be called in the Playwright's context."}],"required":true,"comment":"Callback function that will be called in the Playwright's context.","deprecated":false,"async":false,"alias":"callback"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"handle","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether to pass the argument as a handle, instead of passing by value. When passing a handle, only one argument is supported. When passing by value, multiple arguments are supported."}],"required":false,"comment":"Whether to pass the argument as a handle, instead of passing by value. When passing a handle, only one argument is\nsupported. When passing by value, multiple arguments are supported.","deprecated":false,"async":false,"alias":"handle"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"exposeFunction","type":{"name":"void"},"spec":[{"type":"text","text":"The method adds a function called `name` on the `window` object of every frame in every page in the context. When called, the function executes `callback` and returns a [Promise] which resolves to the return value of `callback`."},{"type":"text","text":"If the `callback` returns a [Promise], it will be awaited."},{"type":"text","text":"See [`method: Page.exposeFunction`] for page-only version."},{"type":"text","text":"An example of adding a `sha256` function to all pages in the context:"},{"type":"code","lines":["const { webkit } = require('playwright'); // Or 'chromium' or 'firefox'.","const crypto = require('crypto');","","(async () => {"," const browser = await webkit.launch({ headless: false });"," const context = await browser.newContext();"," await context.exposeFunction('sha256', text => crypto.createHash('sha256').update(text).digest('hex'));"," const page = await context.newPage();"," await page.setContent(`"," <script>"," async function onClick() {"," document.querySelector('div').textContent = await window.sha256('PLAYWRIGHT');"," }"," </script>"," <button onclick=\"onClick()\">Click me</button>"," <div></div>"," `);"," await page.click('button');","})();"],"codeLang":"js"},{"type":"code","lines":["import com.microsoft.playwright.*;","","import java.nio.charset.StandardCharsets;","import java.security.MessageDigest;","import java.security.NoSuchAlgorithmException;","import java.util.Base64;","","public class Example {"," public static void main(String[] args) {"," try (Playwright playwright = Playwright.create()) {"," BrowserType webkit = playwright.webkit()"," Browser browser = webkit.launch(new BrowserType.LaunchOptions().setHeadless(false));"," context.exposeFunction(\"sha256\", args -> {"," String text = (String) args[0];"," MessageDigest crypto;"," try {"," crypto = MessageDigest.getInstance(\"SHA-256\");"," } catch (NoSuchAlgorithmException e) {"," return null;"," }"," byte[] token = crypto.digest(text.getBytes(StandardCharsets.UTF_8));"," return Base64.getEncoder().encodeToString(token);"," });"," Page page = context.newPage();"," page.setContent(\"<script>\\n\" +"," \" async function onClick() {\\n\" +"," \" document.querySelector('div').textContent = await window.sha256('PLAYWRIGHT');\\n\" +"," \" }\\n\" +"," \"</script>\\n\" +"," \"<button onclick=\\\"onClick()\\\">Click me</button>\\n\" +"," \"<div></div>\\n\");"," page.click(\"button\");"," }"," }","}"],"codeLang":"java"},{"type":"code","lines":["import asyncio","import hashlib","from playwright.async_api import async_playwright","","def sha256(text):"," m = hashlib.sha256()"," m.update(bytes(text, \"utf8\"))"," return m.hexdigest()","","","async def run(playwright):"," webkit = playwright.webkit"," browser = await webkit.launch(headless=False)"," context = await browser.new_context()"," await context.expose_function(\"sha256\", sha256)"," page = await context.new_page()"," await page.set_content(\"\"\""," <script>"," async function onClick() {"," document.querySelector('div').textContent = await window.sha256('PLAYWRIGHT');"," }"," </script>"," <button onclick=\"onClick()\">Click me</button>"," <div></div>"," \"\"\")"," await page.click(\"button\")","","async def main():"," async with async_playwright() as playwright:"," await run(playwright)","asyncio.run(main())"],"codeLang":"python async"},{"type":"code","lines":["import hashlib","from playwright.sync_api import sync_playwright","","def sha256(text):"," m = hashlib.sha256()"," m.update(bytes(text, \"utf8\"))"," return m.hexdigest()","","","def run(playwright):"," webkit = playwright.webkit"," browser = webkit.launch(headless=False)"," context = browser.new_context()"," context.expose_function(\"sha256\", sha256)"," page = context.new_page()"," page.set_content(\"\"\""," <script>"," async function onClick() {"," document.querySelector('div').textContent = await window.sha256('PLAYWRIGHT');"," }"," </script>"," <button onclick=\"onClick()\">Click me</button>"," <div></div>"," \"\"\")"," page.click(\"button\")","","with sync_playwright() as playwright:"," run(playwright)"],"codeLang":"python sync"},{"type":"code","lines":["using Microsoft.Playwright;","using System;","using System.Security.Cryptography;","using System.Threading.Tasks;","","class BrowserContextExamples","{"," public static async Task Main()"," {"," using var playwright = await Playwright.CreateAsync();"," var browser = await playwright.Webkit.LaunchAsync(new BrowserTypeLaunchOptions { Headless = false });"," var context = await browser.NewContextAsync();",""," await context.ExposeFunctionAsync(\"sha256\", (string input) =>"," {"," return Convert.ToBase64String("," SHA256.Create().ComputeHash(System.Text.Encoding.UTF8.GetBytes(input)));"," });",""," var page = await context.NewPageAsync();"," await page.SetContentAsync(\"<script>\\n\" +"," \" async function onClick() {\\n\" +"," \" document.querySelector('div').textContent = await window.sha256('PLAYWRIGHT');\\n\" +"," \" }\\n\" +"," \"</script>\\n\" +"," \"<button onclick=\\\"onClick()\\\">Click me</button>\\n\" +"," \"<div></div>\");",""," await page.ClickAsync(\"button\");"," Console.WriteLine(await page.TextContentAsync(\"div\"));"," }","}"],"codeLang":"csharp"}],"required":true,"comment":"The method adds a function called `name` on the `window` object of every frame in every page in the context. When\ncalled, the function executes `callback` and returns a [Promise] which resolves to the return value of `callback`.\n\nIf the `callback` returns a [Promise], it will be awaited.\n\nSee [`method: Page.exposeFunction`] for page-only version.\n\nAn example of adding a `sha256` function to all pages in the context:\n\n```js\nconst { webkit } = require('playwright'); // Or 'chromium' or 'firefox'.\nconst crypto = require('crypto');\n\n(async () => {\n const browser = await webkit.launch({ headless: false });\n const context = await browser.newContext();\n await context.exposeFunction('sha256', text => crypto.createHash('sha256').update(text).digest('hex'));\n const page = await context.newPage();\n await page.setContent(`\n <script>\n async function onClick() {\n document.querySelector('div').textContent = await window.sha256('PLAYWRIGHT');\n }\n </script>\n <button onclick=\"onClick()\">Click me</button>\n <div></div>\n `);\n await page.click('button');\n})();\n```\n\n```java\nimport com.microsoft.playwright.*;\n\nimport java.nio.charset.StandardCharsets;\nimport java.security.MessageDigest;\nimport java.security.NoSuchAlgorithmException;\nimport java.util.Base64;\n\npublic class Example {\n public static void main(String[] args) {\n try (Playwright playwright = Playwright.create()) {\n BrowserType webkit = playwright.webkit()\n Browser browser = webkit.launch(new BrowserType.LaunchOptions().setHeadless(false));\n context.exposeFunction(\"sha256\", args -> {\n String text = (String) args[0];\n MessageDigest crypto;\n try {\n crypto = MessageDigest.getInstance(\"SHA-256\");\n } catch (NoSuchAlgorithmException e) {\n return null;\n }\n byte[] token = crypto.digest(text.getBytes(StandardCharsets.UTF_8));\n return Base64.getEncoder().encodeToString(token);\n });\n Page page = context.newPage();\n page.setContent(\"<script>\\n\" +\n \" async function onClick() {\\n\" +\n \" document.querySelector('div').textContent = await window.sha256('PLAYWRIGHT');\\n\" +\n \" }\\n\" +\n \"</script>\\n\" +\n \"<button onclick=\\\"onClick()\\\">Click me</button>\\n\" +\n \"<div></div>\\n\");\n page.click(\"button\");\n }\n }\n}\n```\n\n```python async\nimport asyncio\nimport hashlib\nfrom playwright.async_api import async_playwright\n\ndef sha256(text):\n m = hashlib.sha256()\n m.update(bytes(text, \"utf8\"))\n return m.hexdigest()\n\n\nasync def run(playwright):\n webkit = playwright.webkit\n browser = await webkit.launch(headless=False)\n context = await browser.new_context()\n await context.expose_function(\"sha256\", sha256)\n page = await context.new_page()\n await page.set_content(\"\"\"\n <script>\n async function onClick() {\n document.querySelector('div').textContent = await window.sha256('PLAYWRIGHT');\n }\n </script>\n <button onclick=\"onClick()\">Click me</button>\n <div></div>\n \"\"\")\n await page.click(\"button\")\n\nasync def main():\n async with async_playwright() as playwright:\n await run(playwright)\nasyncio.run(main())\n```\n\n```python sync\nimport hashlib\nfrom playwright.sync_api import sync_playwright\n\ndef sha256(text):\n m = hashlib.sha256()\n m.update(bytes(text, \"utf8\"))\n return m.hexdigest()\n\n\ndef run(playwright):\n webkit = playwright.webkit\n browser = webkit.launch(headless=False)\n context = browser.new_context()\n context.expose_function(\"sha256\", sha256)\n page = context.new_page()\n page.set_content(\"\"\"\n <script>\n async function onClick() {\n document.querySelector('div').textContent = await window.sha256('PLAYWRIGHT');\n }\n </script>\n <button onclick=\"onClick()\">Click me</button>\n <div></div>\n \"\"\")\n page.click(\"button\")\n\nwith sync_playwright() as playwright:\n run(playwright)\n```\n\n```csharp\nusing Microsoft.Playwright;\nusing System;\nusing System.Security.Cryptography;\nusing System.Threading.Tasks;\n\nclass BrowserContextExamples\n{\n public static async Task Main()\n {\n using var playwright = await Playwright.CreateAsync();\n var browser = await playwright.Webkit.LaunchAsync(new BrowserTypeLaunchOptions { Headless = false });\n var context = await browser.NewContextAsync();\n\n await context.ExposeFunctionAsync(\"sha256\", (string input) =>\n {\n return Convert.ToBase64String(\n SHA256.Create().ComputeHash(System.Text.Encoding.UTF8.GetBytes(input)));\n });\n\n var page = await context.NewPageAsync();\n await page.SetContentAsync(\"<script>\\n\" +\n \" async function onClick() {\\n\" +\n \" document.querySelector('div').textContent = await window.sha256('PLAYWRIGHT');\\n\" +\n \" }\\n\" +\n \"</script>\\n\" +\n \"<button onclick=\\\"onClick()\\\">Click me</button>\\n\" +\n \"<div></div>\");\n\n await page.ClickAsync(\"button\");\n Console.WriteLine(await page.TextContentAsync(\"div\"));\n }\n}\n```\n","deprecated":false,"async":true,"alias":"exposeFunction","args":[{"kind":"property","langs":{},"name":"name","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Name of the function on the window object."}],"required":true,"comment":"Name of the function on the window object.","deprecated":false,"async":false,"alias":"name"},{"kind":"property","langs":{},"name":"callback","type":{"name":"function","expression":"[function]"},"spec":[{"type":"text","text":"Callback function that will be called in the Playwright's context."}],"required":true,"comment":"Callback function that will be called in the Playwright's context.","deprecated":false,"async":false,"alias":"callback"}]},{"kind":"method","langs":{},"name":"grantPermissions","type":{"name":"void"},"spec":[{"type":"text","text":"Grants specified permissions to the browser context. Only grants corresponding permissions to the given origin if specified."}],"required":true,"comment":"Grants specified permissions to the browser context. Only grants corresponding permissions to the given origin if\nspecified.","deprecated":false,"async":true,"alias":"grantPermissions","args":[{"kind":"property","langs":{},"name":"permissions","type":{"name":"Array","templates":[{"name":"string"}],"expression":"[Array]<[string]>"},"spec":[{"type":"text","text":"A permission or an array of permissions to grant. Permissions can be one of the following values:"},{"type":"li","text":"`'geolocation'`","liType":"bullet"},{"type":"li","text":"`'midi'`","liType":"bullet"},{"type":"li","text":"`'midi-sysex'` (system-exclusive midi)","liType":"bullet"},{"type":"li","text":"`'notifications'`","liType":"bullet"},{"type":"li","text":"`'push'`","liType":"bullet"},{"type":"li","text":"`'camera'`","liType":"bullet"},{"type":"li","text":"`'microphone'`","liType":"bullet"},{"type":"li","text":"`'background-sync'`","liType":"bullet"},{"type":"li","text":"`'ambient-light-sensor'`","liType":"bullet"},{"type":"li","text":"`'accelerometer'`","liType":"bullet"},{"type":"li","text":"`'gyroscope'`","liType":"bullet"},{"type":"li","text":"`'magnetometer'`","liType":"bullet"},{"type":"li","text":"`'accessibility-events'`","liType":"bullet"},{"type":"li","text":"`'clipboard-read'`","liType":"bullet"},{"type":"li","text":"`'clipboard-write'`","liType":"bullet"},{"type":"li","text":"`'payment-handler'`","liType":"bullet"}],"required":true,"comment":"A permission or an array of permissions to grant. Permissions can be one of the following values:\n- `'geolocation'`\n- `'midi'`\n- `'midi-sysex'` (system-exclusive midi)\n- `'notifications'`\n- `'push'`\n- `'camera'`\n- `'microphone'`\n- `'background-sync'`\n- `'ambient-light-sensor'`\n- `'accelerometer'`\n- `'gyroscope'`\n- `'magnetometer'`\n- `'accessibility-events'`\n- `'clipboard-read'`\n- `'clipboard-write'`\n- `'payment-handler'`","deprecated":false,"async":false,"alias":"permissions"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"origin","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"The [origin] to grant permissions to, e.g. \"https://example.com\"."}],"required":false,"comment":"The [origin] to grant permissions to, e.g. \"https://example.com\".","deprecated":false,"async":false,"alias":"origin"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{"only":["js","python"],"aliases":{},"types":{},"overrides":{}},"name":"newCDPSession","type":{"name":"CDPSession","expression":"[CDPSession]"},"spec":[{"type":"note","noteType":"note","text":"CDP sessions are only supported on Chromium-based browsers."},{"type":"text","text":"Returns the newly created session."}],"required":true,"comment":"> NOTE: CDP sessions are only supported on Chromium-based browsers.\n\nReturns the newly created session.","deprecated":false,"async":true,"alias":"newCDPSession","args":[{"kind":"property","langs":{},"name":"page","type":{"name":"Page","expression":"[Page]"},"spec":[{"type":"text","text":"Page to create new session for."}],"required":true,"comment":"Page to create new session for.","deprecated":false,"async":false,"alias":"page"}]},{"kind":"method","langs":{},"name":"newPage","type":{"name":"Page","expression":"[Page]"},"spec":[{"type":"text","text":"Creates a new page in the browser context."}],"required":true,"comment":"Creates a new page in the browser context.","deprecated":false,"async":true,"alias":"newPage","args":[]},{"kind":"method","langs":{},"name":"pages","type":{"name":"Array","templates":[{"name":"Page"}],"expression":"[Array]<[Page]>"},"spec":[{"type":"text","text":"Returns all open pages in the context."}],"required":true,"comment":"Returns all open pages in the context.","deprecated":false,"async":false,"alias":"pages","args":[]},{"kind":"method","langs":{},"name":"route","type":{"name":"void"},"spec":[{"type":"text","text":"Routing provides the capability to modify network requests that are made by any page in the browser context. Once route is enabled, every request matching the url pattern will stall unless it's continued, fulfilled or aborted."},{"type":"text","text":"An example of a naive handler that aborts all image requests:"},{"type":"code","lines":["const context = await browser.newContext();","await context.route('**/*.{png,jpg,jpeg}', route => route.abort());","const page = await context.newPage();","await page.goto('https://example.com');","await browser.close();"],"codeLang":"js"},{"type":"code","lines":["BrowserContext context = browser.newContext();","context.route(\"**/*.{png,jpg,jpeg}\", route -> route.abort());","Page page = context.newPage();","page.navigate(\"https://example.com\");","browser.close();"],"codeLang":"java"},{"type":"code","lines":["context = await browser.new_context()","page = await context.new_page()","await context.route(\"**/*.{png,jpg,jpeg}\", lambda route: route.abort())","await page.goto(\"https://example.com\")","await browser.close()"],"codeLang":"python async"},{"type":"code","lines":["context = browser.new_context()","page = context.new_page()","context.route(\"**/*.{png,jpg,jpeg}\", lambda route: route.abort())","page.goto(\"https://example.com\")","browser.close()"],"codeLang":"python sync"},{"type":"code","lines":["var context = await browser.NewContextAsync();","var page = await context.NewPageAsync();","await context.RouteAsync(\"**/*.{png,jpg,jpeg}\", r => r.AbortAsync());","await page.GotoAsync(\"https://theverge.com\");","await browser.CloseAsync();"],"codeLang":"csharp"},{"type":"text","text":"or the same snippet using a regex pattern instead:"},{"type":"code","lines":["const context = await browser.newContext();","await context.route(/(\\.png$)|(\\.jpg$)/, route => route.abort());","const page = await context.newPage();","await page.goto('https://example.com');","await browser.close();"],"codeLang":"js"},{"type":"code","lines":["BrowserContext context = browser.newContext();","context.route(Pattern.compile(\"(\\\\.png$)|(\\\\.jpg$)\"), route -> route.abort());","Page page = context.newPage();","page.navigate(\"https://example.com\");","browser.close();"],"codeLang":"java"},{"type":"code","lines":["context = await browser.new_context()","page = await context.new_page()","await context.route(re.compile(r\"(\\.png$)|(\\.jpg$)\"), lambda route: route.abort())","page = await context.new_page()","await page.goto(\"https://example.com\")","await browser.close()"],"codeLang":"python async"},{"type":"code","lines":["context = browser.new_context()","page = context.new_page()","context.route(re.compile(r\"(\\.png$)|(\\.jpg$)\"), lambda route: route.abort())","page = await context.new_page()","page = context.new_page()","page.goto(\"https://example.com\")","browser.close()"],"codeLang":"python sync"},{"type":"code","lines":["var context = await browser.NewContextAsync();","var page = await context.NewPageAsync();","await context.RouteAsync(new Regex(\"(\\\\.png$)|(\\\\.jpg$)\"), r => r.AbortAsync());","await page.GotoAsync(\"https://theverge.com\");","await browser.CloseAsync();"],"codeLang":"csharp"},{"type":"text","text":"It is possible to examine the request to decide the route action. For example, mocking all requests that contain some post data, and leaving all other requests as is:"},{"type":"code","lines":["await context.route('/api/**', route => {"," if (route.request().postData().includes('my-string'))"," route.fulfill({ body: 'mocked-data' });"," else"," route.continue();","});"],"codeLang":"js"},{"type":"code","lines":["context.route(\"/api/**\", route -> {"," if (route.request().postData().contains(\"my-string\"))"," route.fulfill(new Route.FulfillOptions().setBody(\"mocked-data\"));"," else"," route.resume();","});"],"codeLang":"java"},{"type":"code","lines":["def handle_route(route):"," if (\"my-string\" in route.request.post_data)"," route.fulfill(body=\"mocked-data\")"," else"," route.continue_()","await context.route(\"/api/**\", handle_route)"],"codeLang":"python async"},{"type":"code","lines":["def handle_route(route):"," if (\"my-string\" in route.request.post_data)"," route.fulfill(body=\"mocked-data\")"," else"," route.continue_()","context.route(\"/api/**\", handle_route)"],"codeLang":"python sync"},{"type":"code","lines":["await page.RouteAsync(\"/api/**\", async r =>","{"," if (r.Request.PostData.Contains(\"my-string\"))"," await r.FulfillAsync(body: \"mocked-data\");"," else"," await r.ContinueAsync();","});"],"codeLang":"csharp"},{"type":"text","text":"Page routes (set up with [`method: Page.route`]) take precedence over browser context routes when request matches both handlers."},{"type":"text","text":"To remove a route with its handler you can use [`method: BrowserContext.unroute`]."},{"type":"note","noteType":"note","text":"Enabling routing disables http cache."}],"required":true,"comment":"Routing provides the capability to modify network requests that are made by any page in the browser context. Once route\nis enabled, every request matching the url pattern will stall unless it's continued, fulfilled or aborted.\n\nAn example of a naive handler that aborts all image requests:\n\n```js\nconst context = await browser.newContext();\nawait context.route('**/*.{png,jpg,jpeg}', route => route.abort());\nconst page = await context.newPage();\nawait page.goto('https://example.com');\nawait browser.close();\n```\n\n```java\nBrowserContext context = browser.newContext();\ncontext.route(\"**/*.{png,jpg,jpeg}\", route -> route.abort());\nPage page = context.newPage();\npage.navigate(\"https://example.com\");\nbrowser.close();\n```\n\n```python async\ncontext = await browser.new_context()\npage = await context.new_page()\nawait context.route(\"**/*.{png,jpg,jpeg}\", lambda route: route.abort())\nawait page.goto(\"https://example.com\")\nawait browser.close()\n```\n\n```python sync\ncontext = browser.new_context()\npage = context.new_page()\ncontext.route(\"**/*.{png,jpg,jpeg}\", lambda route: route.abort())\npage.goto(\"https://example.com\")\nbrowser.close()\n```\n\n```csharp\nvar context = await browser.NewContextAsync();\nvar page = await context.NewPageAsync();\nawait context.RouteAsync(\"**/*.{png,jpg,jpeg}\", r => r.AbortAsync());\nawait page.GotoAsync(\"https://theverge.com\");\nawait browser.CloseAsync();\n```\n\nor the same snippet using a regex pattern instead:\n\n```js\nconst context = await browser.newContext();\nawait context.route(/(\\.png$)|(\\.jpg$)/, route => route.abort());\nconst page = await context.newPage();\nawait page.goto('https://example.com');\nawait browser.close();\n```\n\n```java\nBrowserContext context = browser.newContext();\ncontext.route(Pattern.compile(\"(\\\\.png$)|(\\\\.jpg$)\"), route -> route.abort());\nPage page = context.newPage();\npage.navigate(\"https://example.com\");\nbrowser.close();\n```\n\n```python async\ncontext = await browser.new_context()\npage = await context.new_page()\nawait context.route(re.compile(r\"(\\.png$)|(\\.jpg$)\"), lambda route: route.abort())\npage = await context.new_page()\nawait page.goto(\"https://example.com\")\nawait browser.close()\n```\n\n```python sync\ncontext = browser.new_context()\npage = context.new_page()\ncontext.route(re.compile(r\"(\\.png$)|(\\.jpg$)\"), lambda route: route.abort())\npage = await context.new_page()\npage = context.new_page()\npage.goto(\"https://example.com\")\nbrowser.close()\n```\n\n```csharp\nvar context = await browser.NewContextAsync();\nvar page = await context.NewPageAsync();\nawait context.RouteAsync(new Regex(\"(\\\\.png$)|(\\\\.jpg$)\"), r => r.AbortAsync());\nawait page.GotoAsync(\"https://theverge.com\");\nawait browser.CloseAsync();\n```\n\nIt is possible to examine the request to decide the route action. For example, mocking all requests that contain some\npost data, and leaving all other requests as is:\n\n```js\nawait context.route('/api/**', route => {\n if (route.request().postData().includes('my-string'))\n route.fulfill({ body: 'mocked-data' });\n else\n route.continue();\n});\n```\n\n```java\ncontext.route(\"/api/**\", route -> {\n if (route.request().postData().contains(\"my-string\"))\n route.fulfill(new Route.FulfillOptions().setBody(\"mocked-data\"));\n else\n route.resume();\n});\n```\n\n```python async\ndef handle_route(route):\n if (\"my-string\" in route.request.post_data)\n route.fulfill(body=\"mocked-data\")\n else\n route.continue_()\nawait context.route(\"/api/**\", handle_route)\n```\n\n```python sync\ndef handle_route(route):\n if (\"my-string\" in route.request.post_data)\n route.fulfill(body=\"mocked-data\")\n else\n route.continue_()\ncontext.route(\"/api/**\", handle_route)\n```\n\n```csharp\nawait page.RouteAsync(\"/api/**\", async r =>\n{\n if (r.Request.PostData.Contains(\"my-string\"))\n await r.FulfillAsync(body: \"mocked-data\");\n else\n await r.ContinueAsync();\n});\n```\n\nPage routes (set up with [`method: Page.route`]) take precedence over browser context routes when request matches both\nhandlers.\n\nTo remove a route with its handler you can use [`method: BrowserContext.unroute`].\n\n> NOTE: Enabling routing disables http cache.","deprecated":false,"async":true,"alias":"route","args":[{"kind":"property","langs":{},"name":"url","type":{"name":"","union":[{"name":"string"},{"name":"RegExp"},{"name":"function","args":[{"name":"URL"}],"returnType":{"name":"boolean"}}],"expression":"[string]|[RegExp]|[function]([URL]):[boolean]"},"spec":[{"type":"text","text":"A glob pattern, regex pattern or predicate receiving [URL] to match while routing."}],"required":true,"comment":"A glob pattern, regex pattern or predicate receiving [URL] to match while routing.","deprecated":false,"async":false,"alias":"url"},{"kind":"property","langs":{"only":["js","python"],"aliases":{},"types":{},"overrides":{}},"name":"handler","type":{"name":"function","args":[{"name":"Route"},{"name":"Request"}],"returnType":null,"expression":"[function]([Route], [Request])"},"spec":[{"type":"text","text":"handler function to route the request."}],"required":true,"comment":"handler function to route the request.","deprecated":false,"async":false,"alias":"handler"},{"kind":"property","langs":{"only":["csharp","java"],"aliases":{},"types":{},"overrides":{}},"name":"handler","type":{"name":"function","args":[{"name":"Route"}],"returnType":null,"expression":"[function]([Route])"},"spec":[{"type":"text","text":"handler function to route the request."}],"required":true,"comment":"handler function to route the request.","deprecated":false,"async":false,"alias":"handler"}]},{"kind":"method","langs":{"only":["js","python"],"aliases":{},"types":{},"overrides":{}},"name":"serviceWorkers","type":{"name":"Array","templates":[{"name":"Worker"}],"expression":"[Array]<[Worker]>"},"spec":[{"type":"note","noteType":"note","text":"Service workers are only supported on Chromium-based browsers."},{"type":"text","text":"All existing service workers in the context."}],"required":true,"comment":"> NOTE: Service workers are only supported on Chromium-based browsers.\n\nAll existing service workers in the context.","deprecated":false,"async":false,"alias":"serviceWorkers","args":[]},{"kind":"method","langs":{},"name":"setDefaultNavigationTimeout","type":{"name":"void"},"spec":[{"type":"text","text":"This setting will change the default maximum navigation time for the following methods and related shortcuts:"},{"type":"li","text":"[`method: Page.goBack`]","liType":"bullet"},{"type":"li","text":"[`method: Page.goForward`]","liType":"bullet"},{"type":"li","text":"[`method: Page.goto`]","liType":"bullet"},{"type":"li","text":"[`method: Page.reload`]","liType":"bullet"},{"type":"li","text":"[`method: Page.setContent`]","liType":"bullet"},{"type":"li","text":"[`method: Page.waitForNavigation`]","liType":"bullet"},{"type":"note","noteType":"note","text":"[`method: Page.setDefaultNavigationTimeout`] and [`method: Page.setDefaultTimeout`] take priority over [`method: BrowserContext.setDefaultNavigationTimeout`]."}],"required":true,"comment":"This setting will change the default maximum navigation time for the following methods and related shortcuts:\n- [`method: Page.goBack`]\n- [`method: Page.goForward`]\n- [`method: Page.goto`]\n- [`method: Page.reload`]\n- [`method: Page.setContent`]\n- [`method: Page.waitForNavigation`]\n\n> NOTE: [`method: Page.setDefaultNavigationTimeout`] and [`method: Page.setDefaultTimeout`] take priority over\n[`method: BrowserContext.setDefaultNavigationTimeout`].","deprecated":false,"async":false,"alias":"setDefaultNavigationTimeout","args":[{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum navigation time in milliseconds"}],"required":true,"comment":"Maximum navigation time in milliseconds","deprecated":false,"async":false,"alias":"timeout"}]},{"kind":"method","langs":{},"name":"setDefaultTimeout","type":{"name":"void"},"spec":[{"type":"text","text":"This setting will change the default maximum time for all the methods accepting `timeout` option."},{"type":"note","noteType":"note","text":"[`method: Page.setDefaultNavigationTimeout`], [`method: Page.setDefaultTimeout`] and [`method: BrowserContext.setDefaultNavigationTimeout`] take priority over [`method: BrowserContext.setDefaultTimeout`]."}],"required":true,"comment":"This setting will change the default maximum time for all the methods accepting `timeout` option.\n\n> NOTE: [`method: Page.setDefaultNavigationTimeout`], [`method: Page.setDefaultTimeout`] and\n[`method: BrowserContext.setDefaultNavigationTimeout`] take priority over [`method: BrowserContext.setDefaultTimeout`].","deprecated":false,"async":false,"alias":"setDefaultTimeout","args":[{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds"}],"required":true,"comment":"Maximum time in milliseconds","deprecated":false,"async":false,"alias":"timeout"}]},{"kind":"method","langs":{},"name":"setExtraHTTPHeaders","type":{"name":"void"},"spec":[{"type":"text","text":"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 [`method: Page.setExtraHTTPHeaders`]. If page overrides a particular header, page-specific header value will be used instead of the browser context header value."},{"type":"note","noteType":"note","text":"[`method: BrowserContext.setExtraHTTPHeaders`] does not guarantee the order of headers in the outgoing requests."}],"required":true,"comment":"The extra HTTP headers will be sent with every request initiated by any page in the context. These headers are merged\nwith page-specific extra HTTP headers set with [`method: Page.setExtraHTTPHeaders`]. If page overrides a particular\nheader, page-specific header value will be used instead of the browser context header value.\n\n> NOTE: [`method: BrowserContext.setExtraHTTPHeaders`] does not guarantee the order of headers in the outgoing requests.","deprecated":false,"async":true,"alias":"setExtraHTTPHeaders","args":[{"kind":"property","langs":{},"name":"headers","type":{"name":"Object","templates":[{"name":"string"},{"name":"string"}],"expression":"[Object]<[string], [string]>"},"spec":[{"type":"text","text":"An object containing additional HTTP headers to be sent with every request. All header values must be strings."}],"required":true,"comment":"An object containing additional HTTP headers to be sent with every request. All header values must be strings.","deprecated":false,"async":false,"alias":"headers"}]},{"kind":"method","langs":{},"name":"setGeolocation","type":{"name":"void"},"spec":[{"type":"text","text":"Sets the context's geolocation. Passing `null` or `undefined` emulates position unavailable."},{"type":"code","lines":["await browserContext.setGeolocation({latitude: 59.95, longitude: 30.31667});"],"codeLang":"js"},{"type":"code","lines":["browserContext.setGeolocation(new Geolocation(59.95, 30.31667));"],"codeLang":"java"},{"type":"code","lines":["await browser_context.set_geolocation({\"latitude\": 59.95, \"longitude\": 30.31667})"],"codeLang":"python async"},{"type":"code","lines":["browser_context.set_geolocation({\"latitude\": 59.95, \"longitude\": 30.31667})"],"codeLang":"python sync"},{"type":"code","lines":["await context.SetGeolocationAsync(new Geolocation()","{"," Latitude = 59.95f,"," Longitude = 30.31667f","});"],"codeLang":"csharp"},{"type":"note","noteType":"note","text":"Consider using [`method: BrowserContext.grantPermissions`] to grant permissions for the browser context pages to read its geolocation."}],"required":true,"comment":"Sets the context's geolocation. Passing `null` or `undefined` emulates position unavailable.\n\n```js\nawait browserContext.setGeolocation({latitude: 59.95, longitude: 30.31667});\n```\n\n```java\nbrowserContext.setGeolocation(new Geolocation(59.95, 30.31667));\n```\n\n```python async\nawait browser_context.set_geolocation({\"latitude\": 59.95, \"longitude\": 30.31667})\n```\n\n```python sync\nbrowser_context.set_geolocation({\"latitude\": 59.95, \"longitude\": 30.31667})\n```\n\n```csharp\nawait context.SetGeolocationAsync(new Geolocation()\n{\n Latitude = 59.95f,\n Longitude = 30.31667f\n});\n```\n\n> NOTE: Consider using [`method: BrowserContext.grantPermissions`] to grant permissions for the browser context pages to\nread its geolocation.","deprecated":false,"async":true,"alias":"setGeolocation","args":[{"kind":"property","langs":{},"name":"geolocation","type":{"name":"","union":[{"name":"null"},{"name":"Object","properties":[{"kind":"property","langs":{},"name":"latitude","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Latitude between -90 and 90."}],"required":true,"comment":"Latitude between -90 and 90.","deprecated":false,"async":false,"alias":"latitude"},{"kind":"property","langs":{},"name":"longitude","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Longitude between -180 and 180."}],"required":true,"comment":"Longitude between -180 and 180.","deprecated":false,"async":false,"alias":"longitude"},{"kind":"property","langs":{},"name":"accuracy","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Non-negative accuracy value. Defaults to `0`."}],"required":false,"comment":"Non-negative accuracy value. Defaults to `0`.","deprecated":false,"async":false,"alias":"accuracy"}]}],"expression":"[null]|[Object]"},"spec":[],"required":true,"comment":"","deprecated":false,"async":false,"alias":"geolocation"}]},{"kind":"method","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"setHTTPCredentials","type":{"name":"void"},"spec":[{"type":"text","text":"**DEPRECATED** Browsers may cache credentials after successful authentication. Create a new browser context instead."}],"required":true,"comment":"**DEPRECATED** Browsers may cache credentials after successful authentication. Create a new browser context instead.","deprecated":true,"async":true,"alias":"setHTTPCredentials","args":[{"kind":"property","langs":{},"name":"httpCredentials","type":{"name":"","union":[{"name":"null"},{"name":"Object","properties":[{"kind":"property","langs":{},"name":"username","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"username"},{"kind":"property","langs":{},"name":"password","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"password"}]}],"expression":"[null]|[Object]"},"spec":[],"required":true,"comment":"","deprecated":false,"async":false,"alias":"httpCredentials"}]},{"kind":"method","langs":{},"name":"setOffline","type":{"name":"void"},"spec":[],"required":true,"comment":"","deprecated":false,"async":true,"alias":"setOffline","args":[{"kind":"property","langs":{},"name":"offline","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether to emulate network being offline for the browser context."}],"required":true,"comment":"Whether to emulate network being offline for the browser context.","deprecated":false,"async":false,"alias":"offline"}]},{"kind":"method","langs":{"types":{"csharp":{"name":"string","expression":"[string]"},"java":{"name":"string","expression":"[string]"}}},"name":"storageState","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"cookies","type":{"name":"Array","templates":[{"name":"Object","properties":[{"kind":"property","langs":{},"name":"name","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"name"},{"kind":"property","langs":{},"name":"value","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"value"},{"kind":"property","langs":{},"name":"domain","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"domain"},{"kind":"property","langs":{},"name":"path","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"path"},{"kind":"property","langs":{},"name":"expires","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Unix time in seconds."}],"required":true,"comment":"Unix time in seconds.","deprecated":false,"async":false,"alias":"expires"},{"kind":"property","langs":{},"name":"httpOnly","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"httpOnly"},{"kind":"property","langs":{},"name":"secure","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"secure"},{"kind":"property","langs":{},"name":"sameSite","type":{"name":"SameSiteAttribute","union":[{"name":"\"Strict\""},{"name":"\"Lax\""},{"name":"\"None\""}],"expression":"[SameSiteAttribute]<\"Strict\"|\"Lax\"|\"None\">"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"sameSite"}]}],"expression":"[Array]<[Object]>"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"cookies"},{"kind":"property","langs":{},"name":"origins","type":{"name":"Array","templates":[{"name":"Object","properties":[{"kind":"property","langs":{},"name":"origin","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"origin"},{"kind":"property","langs":{},"name":"localStorage","type":{"name":"Array","templates":[{"name":"Object","properties":[{"kind":"property","langs":{},"name":"name","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"name"},{"kind":"property","langs":{},"name":"value","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"value"}]}],"expression":"[Array]<[Object]>"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"localStorage"}]}],"expression":"[Array]<[Object]>"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"origins"}],"expression":"[Object]"},"spec":[{"type":"text","text":"Returns storage state for this browser context, contains current cookies and local storage snapshot."}],"required":true,"comment":"Returns storage state for this browser context, contains current cookies and local storage snapshot.","deprecated":false,"async":true,"alias":"storageState","args":[{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"path","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"The file path to save the storage state to. If `path` is a relative path, then it is resolved relative to current working directory. If no path is provided, storage state is still returned, but won't be saved to the disk."}],"required":false,"comment":"The file path to save the storage state to. If `path` is a relative path, then it is resolved relative to current\nworking directory. If no path is provided, storage state is still returned, but won't be saved to the disk.","deprecated":false,"async":false,"alias":"path"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"property","langs":{},"name":"tracing","type":{"name":"Tracing","expression":"[Tracing]"},"spec":[],"required":true,"comment":"","deprecated":false,"async":false,"alias":"tracing","args":[]},{"kind":"method","langs":{},"name":"unroute","type":{"name":"void"},"spec":[{"type":"text","text":"Removes a route created with [`method: BrowserContext.route`]. When `handler` is not specified, removes all routes for the `url`."}],"required":true,"comment":"Removes a route created with [`method: BrowserContext.route`]. When `handler` is not specified, removes all routes for\nthe `url`.","deprecated":false,"async":true,"alias":"unroute","args":[{"kind":"property","langs":{},"name":"url","type":{"name":"","union":[{"name":"string"},{"name":"RegExp"},{"name":"function","args":[{"name":"URL"}],"returnType":{"name":"boolean"}}],"expression":"[string]|[RegExp]|[function]([URL]):[boolean]"},"spec":[{"type":"text","text":"A glob pattern, regex pattern or predicate receiving [URL] used to register a routing with [`method: BrowserContext.route`]."}],"required":true,"comment":"A glob pattern, regex pattern or predicate receiving [URL] used to register a routing with\n[`method: BrowserContext.route`].","deprecated":false,"async":false,"alias":"url"},{"kind":"property","langs":{"only":["js","python"],"aliases":{},"types":{},"overrides":{}},"name":"handler","type":{"name":"function","args":[{"name":"Route"},{"name":"Request"}],"returnType":null,"expression":"[function]([Route], [Request])"},"spec":[{"type":"text","text":"Optional handler function used to register a routing with [`method: BrowserContext.route`]."}],"required":false,"comment":"Optional handler function used to register a routing with [`method: BrowserContext.route`].","deprecated":false,"async":false,"alias":"handler"},{"kind":"property","langs":{"only":["csharp","java"],"aliases":{},"types":{},"overrides":{}},"name":"handler","type":{"name":"function","args":[{"name":"Route"}],"returnType":null,"expression":"[function]([Route])"},"spec":[{"type":"text","text":"Optional handler function used to register a routing with [`method: BrowserContext.route`]."}],"required":false,"comment":"Optional handler function used to register a routing with [`method: BrowserContext.route`].","deprecated":false,"async":false,"alias":"handler"}]},{"kind":"method","langs":{"only":["js","python"],"aliases":{"python":"expect_event"},"types":{"python":{"name":"EventContextManager","expression":"[EventContextManager]"}},"overrides":{}},"name":"waitForEvent","type":{"name":"any","expression":"[any]"},"spec":[{"type":"text","text":"Waits for event to fire and passes its value into the predicate function. Returns when the predicate returns truthy value. Will throw an error if the context closes before the event is fired. Returns the event data value."},{"type":"code","lines":["const [page, _] = await Promise.all(["," context.waitForEvent('page'),"," page.click('button')","]);"],"codeLang":"js"},{"type":"code","lines":["Page newPage = context.waitForPage(() -> page.click(\"button\"));"],"codeLang":"java"},{"type":"code","lines":["async with context.expect_event(\"page\") as event_info:"," await page.click(\"button\")","page = await event_info.value"],"codeLang":"python async"},{"type":"code","lines":["with context.expect_event(\"page\") as event_info:"," page.click(\"button\")","page = event_info.value"],"codeLang":"python sync"},{"type":"code","lines":["var page = await context.RunAndWaitForPageAsync(async () =>","{"," await page.ClickAsync(\"button\");","});"],"codeLang":"csharp"}],"required":true,"comment":"Waits for event to fire and passes its value into the predicate function. Returns when the predicate returns truthy\nvalue. Will throw an error if the context closes before the event is fired. Returns the event data value.\n\n```js\nconst [page, _] = await Promise.all([\n context.waitForEvent('page'),\n page.click('button')\n]);\n```\n\n```java\nPage newPage = context.waitForPage(() -> page.click(\"button\"));\n```\n\n```python async\nasync with context.expect_event(\"page\") as event_info:\n await page.click(\"button\")\npage = await event_info.value\n```\n\n```python sync\nwith context.expect_event(\"page\") as event_info:\n page.click(\"button\")\npage = event_info.value\n```\n\n```csharp\nvar page = await context.RunAndWaitForPageAsync(async () =>\n{\n await page.ClickAsync(\"button\");\n});\n```\n","deprecated":false,"async":true,"alias":"waitForEvent","args":[{"kind":"property","langs":{},"name":"event","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Event name, same one would pass into `browserContext.on(event)`."}],"required":true,"comment":"Event name, same one would pass into `browserContext.on(event)`.","deprecated":false,"async":false,"alias":"event"},{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"optionsOrPredicate","type":{"name":"","union":[{"name":"function"},{"name":"Object","properties":[{"kind":"property","langs":{},"name":"predicate","type":{"name":"function","expression":"[function]"},"spec":[{"type":"text","text":"receives the event data and resolves to truthy value when the waiting should resolve."}],"required":true,"comment":"receives the event data and resolves to truthy value when the waiting should resolve.","deprecated":false,"async":false,"alias":"predicate"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`]."}],"required":false,"comment":"maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default\nvalue can be changed by using the [`method: BrowserContext.setDefaultTimeout`].","deprecated":false,"async":false,"alias":"timeout"}]}],"expression":"[function]|[Object]"},"spec":[{"type":"text","text":"Either a predicate that receives an event or an options object. Optional."}],"required":false,"comment":"Either a predicate that receives an event or an options object. Optional.","deprecated":false,"async":false,"alias":"optionsOrPredicate"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"predicate","type":{"name":"function","expression":"[function]"},"spec":[{"type":"text","text":"Receives the event data and resolves to truthy value when the waiting should resolve."}],"required":false,"comment":"Receives the event data and resolves to truthy value when the waiting should resolve.","deprecated":false,"async":false,"alias":"predicate"},{"kind":"property","langs":{"only":["csharp","java","python"],"aliases":{},"types":{},"overrides":{}},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`]."}],"required":false,"comment":"Maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default\nvalue can be changed by using the [`method: BrowserContext.setDefaultTimeout`].","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{"only":["java","python","csharp"],"aliases":{"python":"expect_page","csharp":"RunAndWaitForPage"},"types":{"python":{"name":"EventContextManager","templates":[{"name":"Page"}],"expression":"[EventContextManager]<[Page]>"}},"overrides":{}},"name":"waitForPage","type":{"name":"Page","expression":"[Page]"},"spec":[{"type":"text","text":"Performs action and waits for a new `Page` to be created in the context. If predicate is provided, it passes `Page` value into the `predicate` function and waits for `predicate(event)` to return a truthy value. Will throw an error if the context closes before new `Page` is created."}],"required":true,"comment":"Performs action and waits for a new `Page` to be created in the context. If predicate is provided, it passes `Page`\nvalue into the `predicate` function and waits for `predicate(event)` to return a truthy value. Will throw an error if\nthe context closes before new `Page` is created.","deprecated":false,"async":true,"alias":"waitForPage","args":[{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{"only":["csharp","java","python"],"aliases":{},"types":{},"overrides":{}},"name":"predicate","type":{"name":"function","args":[{"name":"Page"}],"returnType":{"name":"boolean"},"expression":"[function]([Page]):[boolean]"},"spec":[{"type":"text","text":"Receives the `Page` object and resolves to truthy value when the waiting should resolve."}],"required":false,"comment":"Receives the `Page` object and resolves to truthy value when the waiting should resolve.","deprecated":false,"async":false,"alias":"predicate"},{"kind":"property","langs":{"only":["csharp","java","python"],"aliases":{},"types":{},"overrides":{}},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`]."}],"required":false,"comment":"Maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default\nvalue can be changed by using the [`method: BrowserContext.setDefaultTimeout`].","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"},{"kind":"property","langs":{"only":["csharp"],"aliases":{},"types":{},"overrides":{}},"name":"action","type":{"name":"Func","templates":[{"name":"Task"}],"expression":"[Func<Task>]"},"spec":[{"type":"text","text":"Action that triggers the event."}],"required":true,"comment":"Action that triggers the event.","deprecated":false,"async":false,"alias":"action"},{"kind":"property","langs":{"only":["java"],"aliases":{},"types":{},"overrides":{}},"name":"callback","type":{"name":"Runnable","expression":"[Runnable]"},"spec":[{"type":"text","text":"Callback that performs the action triggering the event."}],"required":true,"comment":"Callback that performs the action triggering the event.","deprecated":false,"async":false,"alias":"callback"}]},{"kind":"method","langs":{"only":["python"],"aliases":{"python":"wait_for_event"},"types":{},"overrides":{}},"name":"waitForEvent2","type":{"name":"any","expression":"[any]"},"spec":[{"type":"note","noteType":"note","text":"In most cases, you should use [`method: BrowserContext.waitForEvent`]."},{"type":"text","text":"Waits for given `event` to fire. If predicate is provided, it passes event's value into the `predicate` function and waits for `predicate(event)` to return a truthy value. Will throw an error if the browser context is closed before the `event` is fired."}],"required":true,"comment":"> NOTE: In most cases, you should use [`method: BrowserContext.waitForEvent`].\n\nWaits for given `event` to fire. If predicate is provided, it passes event's value into the `predicate` function and\nwaits for `predicate(event)` to return a truthy value. Will throw an error if the browser context is closed before the\n`event` is fired.","deprecated":false,"async":true,"alias":"waitForEvent2","args":[{"kind":"property","langs":{"only":["js","python","java"],"aliases":{},"types":{},"overrides":{}},"name":"event","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Event name, same one typically passed into `*.on(event)`."}],"required":true,"comment":"Event name, same one typically passed into `*.on(event)`.","deprecated":false,"async":false,"alias":"event"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"predicate","type":{"name":"function","expression":"[function]"},"spec":[{"type":"text","text":"Receives the event data and resolves to truthy value when the waiting should resolve."}],"required":false,"comment":"Receives the event data and resolves to truthy value when the waiting should resolve.","deprecated":false,"async":false,"alias":"predicate"},{"kind":"property","langs":{"only":["csharp","java","python"],"aliases":{},"types":{},"overrides":{}},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`]."}],"required":false,"comment":"Maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default\nvalue can be changed by using the [`method: BrowserContext.setDefaultTimeout`].","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]}]},{"name":"BrowserServer","spec":[],"langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"members":[{"kind":"event","langs":{},"name":"close","type":{"name":"void"},"spec":[{"type":"text","text":"Emitted when the browser server closes."}],"required":true,"comment":"Emitted when the browser server closes.","deprecated":false,"async":false,"alias":"close","args":[]},{"kind":"method","langs":{},"name":"close","type":{"name":"void"},"spec":[{"type":"text","text":"Closes the browser gracefully and makes sure the process is terminated."}],"required":true,"comment":"Closes the browser gracefully and makes sure the process is terminated.","deprecated":false,"async":true,"alias":"close","args":[]},{"kind":"method","langs":{},"name":"kill","type":{"name":"void"},"spec":[{"type":"text","text":"Kills the browser process and waits for the process to exit."}],"required":true,"comment":"Kills the browser process and waits for the process to exit.","deprecated":false,"async":true,"alias":"kill","args":[]},{"kind":"method","langs":{},"name":"process","type":{"name":"ChildProcess","expression":"[ChildProcess]"},"spec":[{"type":"text","text":"Spawned browser application process."}],"required":true,"comment":"Spawned browser application process.","deprecated":false,"async":false,"alias":"process","args":[]},{"kind":"method","langs":{},"name":"wsEndpoint","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Browser websocket url."},{"type":"text","text":"Browser websocket endpoint which can be used as an argument to [`method: BrowserType.connect`] to establish connection to the browser."}],"required":true,"comment":"Browser websocket url.\n\nBrowser websocket endpoint which can be used as an argument to [`method: BrowserType.connect`] to establish connection\nto the browser.","deprecated":false,"async":false,"alias":"wsEndpoint","args":[]}]},{"name":"BrowserType","spec":[{"type":"text","text":"BrowserType provides methods to launch a specific browser instance or connect to an existing one. The following is a typical example of using Playwright to drive automation:"},{"type":"code","lines":["const { chromium } = require('playwright'); // Or 'firefox' or 'webkit'.","","(async () => {"," const browser = await chromium.launch();"," const page = await browser.newPage();"," await page.goto('https://example.com');"," // other actions..."," await browser.close();","})();"],"codeLang":"js"},{"type":"code","lines":["import com.microsoft.playwright.*;","","public class Example {"," public static void main(String[] args) {"," try (Playwright playwright = Playwright.create()) {"," BrowserType chromium = playwright.chromium();"," Browser browser = chromium.launch();"," Page page = browser.newPage();"," page.navigate(\"https://example.com\");"," // other actions..."," browser.close();"," }"," }","}"],"codeLang":"java"},{"type":"code","lines":["import asyncio","from playwright.async_api import async_playwright","","async def run(playwright):"," chromium = playwright.chromium"," browser = await chromium.launch()"," page = await browser.new_page()"," await page.goto(\"https://example.com\")"," # other actions..."," await browser.close()","","async def main():"," async with async_playwright() as playwright:"," await run(playwright)","asyncio.run(main())"],"codeLang":"python async"},{"type":"code","lines":["from playwright.sync_api import sync_playwright","","def run(playwright):"," chromium = playwright.chromium"," browser = chromium.launch()"," page = browser.new_page()"," page.goto(\"https://example.com\")"," # other actions..."," browser.close()","","with sync_playwright() as playwright:"," run(playwright)"],"codeLang":"python sync"},{"type":"code","lines":["using Microsoft.Playwright;","using System.Threading.Tasks;","","class BrowserTypeExamples","{"," public static async Task Run()"," {"," using var playwright = await Playwright.CreateAsync();"," var chromium = playwright.Chromium;"," var browser = await chromium.LaunchAsync();"," var page = await browser.NewPageAsync();"," await page.GoToAsync(\"https://www.bing.com\");"," // other actions"," await browser.CloseAsync();"," }","}"],"codeLang":"csharp"}],"langs":{},"comment":"BrowserType provides methods to launch a specific browser instance or connect to an existing one. The following is a\ntypical example of using Playwright to drive automation:\n\n```js\nconst { chromium } = require('playwright'); // Or 'firefox' or 'webkit'.\n\n(async () => {\n const browser = await chromium.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n // other actions...\n await browser.close();\n})();\n```\n\n```java\nimport com.microsoft.playwright.*;\n\npublic class Example {\n public static void main(String[] args) {\n try (Playwright playwright = Playwright.create()) {\n BrowserType chromium = playwright.chromium();\n Browser browser = chromium.launch();\n Page page = browser.newPage();\n page.navigate(\"https://example.com\");\n // other actions...\n browser.close();\n }\n }\n}\n```\n\n```python async\nimport asyncio\nfrom playwright.async_api import async_playwright\n\nasync def run(playwright):\n chromium = playwright.chromium\n browser = await chromium.launch()\n page = await browser.new_page()\n await page.goto(\"https://example.com\")\n # other actions...\n await browser.close()\n\nasync def main():\n async with async_playwright() as playwright:\n await run(playwright)\nasyncio.run(main())\n```\n\n```python sync\nfrom playwright.sync_api import sync_playwright\n\ndef run(playwright):\n chromium = playwright.chromium\n browser = chromium.launch()\n page = browser.new_page()\n page.goto(\"https://example.com\")\n # other actions...\n browser.close()\n\nwith sync_playwright() as playwright:\n run(playwright)\n```\n\n```csharp\nusing Microsoft.Playwright;\nusing System.Threading.Tasks;\n\nclass BrowserTypeExamples\n{\n public static async Task Run()\n {\n using var playwright = await Playwright.CreateAsync();\n var chromium = playwright.Chromium;\n var browser = await chromium.LaunchAsync();\n var page = await browser.NewPageAsync();\n await page.GoToAsync(\"https://www.bing.com\");\n // other actions\n await browser.CloseAsync();\n }\n}\n```\n","members":[{"kind":"method","langs":{"only":["js","python","java"],"aliases":{},"types":{},"overrides":{}},"name":"connect","type":{"name":"Browser","expression":"[Browser]"},"spec":[{"type":"text","text":"This methods attaches Playwright to an existing browser instance."}],"required":true,"comment":"This methods attaches Playwright to an existing browser instance.","deprecated":false,"async":true,"alias":"connect","args":[{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"params","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"wsEndpoint","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A browser websocket endpoint to connect to."}],"required":true,"comment":"A browser websocket endpoint to connect to.","deprecated":false,"async":false,"alias":"wsEndpoint"},{"kind":"property","langs":{},"name":"headers","type":{"name":"Object","templates":[{"name":"string"},{"name":"string"}],"expression":"[Object]<[string], [string]>"},"spec":[{"type":"text","text":"Additional HTTP headers to be sent with web socket connect request. Optional."}],"required":false,"comment":"Additional HTTP headers to be sent with web socket connect request. Optional.","deprecated":false,"async":false,"alias":"headers"},{"kind":"property","langs":{},"name":"slowMo","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Slows down Playwright operations by the specified amount of milliseconds. Useful so that you can see what is going on. Defaults to 0."}],"required":false,"comment":"Slows down Playwright operations by the specified amount of milliseconds. Useful so that you can see what is going on.\nDefaults to 0.","deprecated":false,"async":false,"alias":"slowMo"},{"kind":"property","langs":{},"name":"logger","type":{"name":"Logger","expression":"[Logger]"},"spec":[{"type":"text","text":"Logger sink for Playwright logging. Optional."}],"required":false,"comment":"Logger sink for Playwright logging. Optional.","deprecated":false,"async":false,"alias":"logger"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds to wait for the connection to be established. Defaults to `30000` (30 seconds). Pass `0` to disable timeout."}],"required":false,"comment":"Maximum time in milliseconds to wait for the connection to be established. Defaults to `30000` (30 seconds). Pass `0` to\ndisable timeout.","deprecated":false,"async":false,"alias":"timeout"}],"expression":"[Object]"},"spec":[],"required":true,"comment":"","deprecated":false,"async":false,"alias":"params"},{"kind":"property","langs":{"only":["java","python"],"aliases":{},"types":{},"overrides":{}},"name":"wsEndpoint","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A browser websocket endpoint to connect to."}],"required":true,"comment":"A browser websocket endpoint to connect to.","deprecated":false,"async":false,"alias":"wsEndpoint"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{"only":["java","python"],"aliases":{},"types":{},"overrides":{}},"name":"headers","type":{"name":"Object","templates":[{"name":"string"},{"name":"string"}],"expression":"[Object]<[string], [string]>"},"spec":[{"type":"text","text":"Additional HTTP headers to be sent with web socket connect request. Optional."}],"required":false,"comment":"Additional HTTP headers to be sent with web socket connect request. Optional.","deprecated":false,"async":false,"alias":"headers"},{"kind":"property","langs":{"only":["java","python"],"aliases":{},"types":{},"overrides":{}},"name":"slowMo","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Slows down Playwright operations by the specified amount of milliseconds. Useful so that you can see what is going on. Defaults to 0."}],"required":false,"comment":"Slows down Playwright operations by the specified amount of milliseconds. Useful so that you can see what is going on.\nDefaults to 0.","deprecated":false,"async":false,"alias":"slowMo"},{"kind":"property","langs":{"only":["java","python"],"aliases":{},"types":{},"overrides":{}},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds to wait for the connection to be established. Defaults to `30000` (30 seconds). Pass `0` to disable timeout."}],"required":false,"comment":"Maximum time in milliseconds to wait for the connection to be established. Defaults to `30000` (30 seconds). Pass `0` to\ndisable timeout.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{"only":["java","js","python"],"aliases":{},"types":{},"overrides":{}},"name":"connectOverCDP","type":{"name":"Browser","expression":"[Browser]"},"spec":[{"type":"text","text":"This methods attaches Playwright to an existing browser instance using the Chrome DevTools Protocol."},{"type":"text","text":"The default browser context is accessible via [`method: Browser.contexts`]."},{"type":"note","noteType":"note","text":"Connecting over the Chrome DevTools Protocol is only supported for Chromium-based browsers."}],"required":true,"comment":"This methods attaches Playwright to an existing browser instance using the Chrome DevTools Protocol.\n\nThe default browser context is accessible via [`method: Browser.contexts`].\n\n> NOTE: Connecting over the Chrome DevTools Protocol is only supported for Chromium-based browsers.","deprecated":false,"async":true,"alias":"connectOverCDP","args":[{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"params","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"endpointURL","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A CDP websocket endpoint or http url to connect to. For example `http://localhost:9222/` or `ws://127.0.0.1:9222/devtools/browser/387adf4c-243f-4051-a181-46798f4a46f4`."}],"required":true,"comment":"A CDP websocket endpoint or http url to connect to. For example `http://localhost:9222/` or\n`ws://127.0.0.1:9222/devtools/browser/387adf4c-243f-4051-a181-46798f4a46f4`.","deprecated":false,"async":false,"alias":"endpointURL"},{"kind":"property","langs":{},"name":"headers","type":{"name":"Object","templates":[{"name":"string"},{"name":"string"}],"expression":"[Object]<[string], [string]>"},"spec":[{"type":"text","text":"Additional HTTP headers to be sent with connect request. Optional."}],"required":false,"comment":"Additional HTTP headers to be sent with connect request. Optional.","deprecated":false,"async":false,"alias":"headers"},{"kind":"property","langs":{},"name":"slowMo","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Slows down Playwright operations by the specified amount of milliseconds. Useful so that you can see what is going on. Defaults to 0."}],"required":false,"comment":"Slows down Playwright operations by the specified amount of milliseconds. Useful so that you can see what is going on.\nDefaults to 0.","deprecated":false,"async":false,"alias":"slowMo"},{"kind":"property","langs":{},"name":"logger","type":{"name":"Logger","expression":"[Logger]"},"spec":[{"type":"text","text":"Logger sink for Playwright logging. Optional."}],"required":false,"comment":"Logger sink for Playwright logging. Optional.","deprecated":false,"async":false,"alias":"logger"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds to wait for the connection to be established. Defaults to `30000` (30 seconds). Pass `0` to disable timeout."}],"required":false,"comment":"Maximum time in milliseconds to wait for the connection to be established. Defaults to `30000` (30 seconds). Pass `0` to\ndisable timeout.","deprecated":false,"async":false,"alias":"timeout"}],"expression":"[Object]"},"spec":[],"required":true,"comment":"","deprecated":false,"async":false,"alias":"params"},{"kind":"property","langs":{"only":["java","python"],"aliases":{},"types":{},"overrides":{}},"name":"endpointURL","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A CDP websocket endpoint or http url to connect to. For example `http://localhost:9222/` or `ws://127.0.0.1:9222/devtools/browser/387adf4c-243f-4051-a181-46798f4a46f4`."}],"required":true,"comment":"A CDP websocket endpoint or http url to connect to. For example `http://localhost:9222/` or\n`ws://127.0.0.1:9222/devtools/browser/387adf4c-243f-4051-a181-46798f4a46f4`.","deprecated":false,"async":false,"alias":"endpointURL"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{"only":["java","python"],"aliases":{},"types":{},"overrides":{}},"name":"headers","type":{"name":"Object","templates":[{"name":"string"},{"name":"string"}],"expression":"[Object]<[string], [string]>"},"spec":[{"type":"text","text":"Additional HTTP headers to be sent with connect request. Optional."}],"required":false,"comment":"Additional HTTP headers to be sent with connect request. Optional.","deprecated":false,"async":false,"alias":"headers"},{"kind":"property","langs":{"only":["java","python"],"aliases":{},"types":{},"overrides":{}},"name":"slowMo","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Slows down Playwright operations by the specified amount of milliseconds. Useful so that you can see what is going on. Defaults to 0."}],"required":false,"comment":"Slows down Playwright operations by the specified amount of milliseconds. Useful so that you can see what is going on.\nDefaults to 0.","deprecated":false,"async":false,"alias":"slowMo"},{"kind":"property","langs":{"only":["java","python"],"aliases":{},"types":{},"overrides":{}},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds to wait for the connection to be established. Defaults to `30000` (30 seconds). Pass `0` to disable timeout."}],"required":false,"comment":"Maximum time in milliseconds to wait for the connection to be established. Defaults to `30000` (30 seconds). Pass `0` to\ndisable timeout.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"executablePath","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A path where Playwright expects to find a bundled browser executable."}],"required":true,"comment":"A path where Playwright expects to find a bundled browser executable.","deprecated":false,"async":false,"alias":"executablePath","args":[]},{"kind":"method","langs":{},"name":"launch","type":{"name":"Browser","expression":"[Browser]"},"spec":[{"type":"text","text":"Returns the browser instance."},{"type":"text","text":"You can use `ignoreDefaultArgs` to filter out `--mute-audio` from default arguments:"},{"type":"code","lines":["const browser = await chromium.launch({ // Or 'firefox' or 'webkit'."," ignoreDefaultArgs: ['--mute-audio']","});"],"codeLang":"js"},{"type":"code","lines":["// Or \"firefox\" or \"webkit\".","Browser browser = chromium.launch(new BrowserType.LaunchOptions()"," .setIgnoreDefaultArgs(Arrays.asList(\"--mute-audio\")));"],"codeLang":"java"},{"type":"code","lines":["browser = await playwright.chromium.launch( # or \"firefox\" or \"webkit\"."," ignore_default_args=[\"--mute-audio\"]",")"],"codeLang":"python async"},{"type":"code","lines":["browser = playwright.chromium.launch( # or \"firefox\" or \"webkit\"."," ignore_default_args=[\"--mute-audio\"]",")"],"codeLang":"python sync"},{"type":"code","lines":["var browser = await playwright.Chromium.LaunchAsync(new BrowserTypeLaunchOptions {"," IgnoreDefaultArgs = new[] { \"--mute-audio\" }","})"],"codeLang":"csharp"},{"type":"text","text":"> **Chromium-only** Playwright can also be used to control the Google Chrome or Microsoft Edge browsers, but it works best with the version of Chromium it is bundled with. There is no guarantee it will work with any other version. Use `executablePath` option with extreme caution."},{"type":"text","text":">"},{"type":"text","text":"> If Google Chrome (rather than Chromium) is preferred, a [Chrome Canary](https://www.google.com/chrome/browser/canary.html) or [Dev Channel](https://www.chromium.org/getting-involved/dev-channel) build is suggested."},{"type":"text","text":">"},{"type":"text","text":"> Stock browsers like Google Chrome and Microsoft Edge are suitable for tests that require proprietary media codecs for video playback. See [this article](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for other differences between Chromium and Chrome. [This article](https://chromium.googlesource.com/chromium/src/+/lkgr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users."}],"required":true,"comment":"Returns the browser instance.\n\nYou can use `ignoreDefaultArgs` to filter out `--mute-audio` from default arguments:\n\n```js\nconst browser = await chromium.launch({ // Or 'firefox' or 'webkit'.\n ignoreDefaultArgs: ['--mute-audio']\n});\n```\n\n```java\n// Or \"firefox\" or \"webkit\".\nBrowser browser = chromium.launch(new BrowserType.LaunchOptions()\n .setIgnoreDefaultArgs(Arrays.asList(\"--mute-audio\")));\n```\n\n```python async\nbrowser = await playwright.chromium.launch( # or \"firefox\" or \"webkit\".\n ignore_default_args=[\"--mute-audio\"]\n)\n```\n\n```python sync\nbrowser = playwright.chromium.launch( # or \"firefox\" or \"webkit\".\n ignore_default_args=[\"--mute-audio\"]\n)\n```\n\n```csharp\nvar browser = await playwright.Chromium.LaunchAsync(new BrowserTypeLaunchOptions {\n IgnoreDefaultArgs = new[] { \"--mute-audio\" }\n})\n```\n\n> **Chromium-only** Playwright can also be used to control the Google Chrome or Microsoft Edge browsers, but it works\nbest with the version of Chromium it is bundled with. There is no guarantee it will work with any other version. Use\n`executablePath` option with extreme caution.\n>\n> If Google Chrome (rather than Chromium) is preferred, a\n[Chrome Canary](https://www.google.com/chrome/browser/canary.html) or\n[Dev Channel](https://www.chromium.org/getting-involved/dev-channel) build is suggested.\n>\n> Stock browsers like Google Chrome and Microsoft Edge are suitable for tests that require proprietary media codecs for\nvideo playback. See\n[this article](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for other\ndifferences between Chromium and Chrome.\n[This article](https://chromium.googlesource.com/chromium/src/+/lkgr/docs/chromium_browser_vs_google_chrome.md)\ndescribes some differences for Linux users.","deprecated":false,"async":true,"alias":"launch","args":[{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"args","type":{"name":"Array","templates":[{"name":"string"}],"expression":"[Array]<[string]>"},"spec":[{"type":"text","text":"Additional arguments to pass to the browser instance. The list of Chromium flags can be found [here](http://peter.sh/experiments/chromium-command-line-switches/)."}],"required":false,"comment":"Additional arguments to pass to the browser instance. The list of Chromium flags can be found\n[here](http://peter.sh/experiments/chromium-command-line-switches/).","deprecated":false,"async":false,"alias":"args"},{"kind":"property","langs":{},"name":"channel","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Browser distribution channel. Supported values are \"chrome\", \"chrome-beta\", \"chrome-dev\", \"chrome-canary\", \"msedge\", \"msedge-beta\", \"msedge-dev\", \"msedge-canary\". Read more about using [Google Chrome and Microsoft Edge](./browsers.md#google-chrome--microsoft-edge)."}],"required":false,"comment":"Browser distribution channel. Supported values are \"chrome\", \"chrome-beta\", \"chrome-dev\", \"chrome-canary\", \"msedge\",\n\"msedge-beta\", \"msedge-dev\", \"msedge-canary\". Read more about using\n[Google Chrome and Microsoft Edge](./browsers.md#google-chrome--microsoft-edge).","deprecated":false,"async":false,"alias":"channel"},{"kind":"property","langs":{},"name":"chromiumSandbox","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Enable Chromium sandboxing. Defaults to `false`."}],"required":false,"comment":"Enable Chromium sandboxing. Defaults to `false`.","deprecated":false,"async":false,"alias":"chromiumSandbox"},{"kind":"property","langs":{},"name":"devtools","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"**Chromium-only** Whether to auto-open a Developer Tools panel for each tab. If this option is `true`, the `headless` option will be set `false`."}],"required":false,"comment":"**Chromium-only** Whether to auto-open a Developer Tools panel for each tab. If this option is `true`, the `headless`\noption will be set `false`.","deprecated":false,"async":false,"alias":"devtools"},{"kind":"property","langs":{},"name":"downloadsPath","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"If specified, accepted downloads are downloaded into this directory. Otherwise, temporary directory is created and is deleted when browser is closed."}],"required":false,"comment":"If specified, accepted downloads are downloaded into this directory. Otherwise, temporary directory is created and is\ndeleted when browser is closed.","deprecated":false,"async":false,"alias":"downloadsPath"},{"kind":"property","langs":{"only":["csharp","java"],"aliases":{},"types":{},"overrides":{}},"name":"env","type":{"name":"Object","templates":[{"name":"string"},{"name":"string"}],"expression":"[Object]<[string], [string]>"},"spec":[{"type":"text","text":"Specify environment variables that will be visible to the browser. Defaults to `process.env`."}],"required":false,"comment":"Specify environment variables that will be visible to the browser. Defaults to `process.env`.","deprecated":false,"async":false,"alias":"env"},{"kind":"property","langs":{"only":["js","python"],"aliases":{},"types":{},"overrides":{}},"name":"env","type":{"name":"Object","templates":[{"name":"string"},{"name":"","union":[{"name":"string"},{"name":"float"},{"name":"boolean"}]}],"expression":"[Object]<[string], [string]|[float]|[boolean]>"},"spec":[{"type":"text","text":"Specify environment variables that will be visible to the browser. Defaults to `process.env`."}],"required":false,"comment":"Specify environment variables that will be visible to the browser. Defaults to `process.env`.","deprecated":false,"async":false,"alias":"env"},{"kind":"property","langs":{},"name":"executablePath","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"Path to a browser executable to run instead of the bundled one. If `executablePath` is a relative path, then it is resolved relative to the current working directory. Note that Playwright only works with the bundled Chromium, Firefox or WebKit, use at your own risk."}],"required":false,"comment":"Path to a browser executable to run instead of the bundled one. If `executablePath` is a relative path, then it is\nresolved relative to the current working directory. Note that Playwright only works with the bundled Chromium, Firefox\nor WebKit, use at your own risk.","deprecated":false,"async":false,"alias":"executablePath"},{"kind":"property","langs":{"only":["js","python"],"aliases":{},"types":{},"overrides":{}},"name":"firefoxUserPrefs","type":{"name":"Object","templates":[{"name":"string"},{"name":"","union":[{"name":"string"},{"name":"float"},{"name":"boolean"}]}],"expression":"[Object]<[string], [string]|[float]|[boolean]>"},"spec":[{"type":"text","text":"Firefox user preferences. Learn more about the Firefox user preferences at [`about:config`](https://support.mozilla.org/en-US/kb/about-config-editor-firefox)."}],"required":false,"comment":"Firefox user preferences. Learn more about the Firefox user preferences at\n[`about:config`](https://support.mozilla.org/en-US/kb/about-config-editor-firefox).","deprecated":false,"async":false,"alias":"firefoxUserPrefs"},{"kind":"property","langs":{"only":["csharp","java"],"aliases":{},"types":{},"overrides":{}},"name":"firefoxUserPrefs","type":{"name":"Object","templates":[{"name":"string"},{"name":"any"}],"expression":"[Object]<[string], [any]>"},"spec":[{"type":"text","text":"Firefox user preferences. Learn more about the Firefox user preferences at [`about:config`](https://support.mozilla.org/en-US/kb/about-config-editor-firefox)."}],"required":false,"comment":"Firefox user preferences. Learn more about the Firefox user preferences at\n[`about:config`](https://support.mozilla.org/en-US/kb/about-config-editor-firefox).","deprecated":false,"async":false,"alias":"firefoxUserPrefs"},{"kind":"property","langs":{},"name":"handleSIGHUP","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Close the browser process on SIGHUP. Defaults to `true`."}],"required":false,"comment":"Close the browser process on SIGHUP. Defaults to `true`.","deprecated":false,"async":false,"alias":"handleSIGHUP"},{"kind":"property","langs":{},"name":"handleSIGINT","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Close the browser process on Ctrl-C. Defaults to `true`."}],"required":false,"comment":"Close the browser process on Ctrl-C. Defaults to `true`.","deprecated":false,"async":false,"alias":"handleSIGINT"},{"kind":"property","langs":{},"name":"handleSIGTERM","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Close the browser process on SIGTERM. Defaults to `true`."}],"required":false,"comment":"Close the browser process on SIGTERM. Defaults to `true`.","deprecated":false,"async":false,"alias":"handleSIGTERM"},{"kind":"property","langs":{},"name":"headless","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"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`."}],"required":false,"comment":"Whether to run browser in headless mode. More details for\n[Chromium](https://developers.google.com/web/updates/2017/04/headless-chrome) and\n[Firefox](https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Headless_mode). Defaults to `true` unless the\n`devtools` option is `true`.","deprecated":false,"async":false,"alias":"headless"},{"kind":"property","langs":{"only":["csharp","java"],"aliases":{},"types":{},"overrides":{}},"name":"ignoreAllDefaultArgs","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"If `true`, Playwright does not pass its own configurations args and only uses the ones from `args`. Dangerous option; use with care. Defaults to `false`."}],"required":false,"comment":"If `true`, Playwright does not pass its own configurations args and only uses the ones from `args`. Dangerous option;\nuse with care. Defaults to `false`.","deprecated":false,"async":false,"alias":"ignoreAllDefaultArgs"},{"kind":"property","langs":{"only":["js","python"],"aliases":{},"types":{},"overrides":{}},"name":"ignoreDefaultArgs","type":{"name":"","union":[{"name":"boolean"},{"name":"Array","templates":[{"name":"string"}]}],"expression":"[boolean]|[Array]<[string]>"},"spec":[{"type":"text","text":"If `true`, Playwright does not pass its own configurations args and only uses the ones from `args`. If an array is given, then filters out the given default arguments. Dangerous option; use with care. Defaults to `false`."}],"required":false,"comment":"If `true`, Playwright does not pass its own configurations args and only uses the ones from `args`. If an array is\ngiven, then filters out the given default arguments. Dangerous option; use with care. Defaults to `false`.","deprecated":false,"async":false,"alias":"ignoreDefaultArgs"},{"kind":"property","langs":{"only":["csharp","java"],"aliases":{},"types":{},"overrides":{}},"name":"ignoreDefaultArgs","type":{"name":"Array","templates":[{"name":"string"}],"expression":"[Array]<[string]>"},"spec":[{"type":"text","text":"If `true`, Playwright does not pass its own configurations args and only uses the ones from `args`. Dangerous option; use with care."}],"required":false,"comment":"If `true`, Playwright does not pass its own configurations args and only uses the ones from `args`. Dangerous option;\nuse with care.","deprecated":false,"async":false,"alias":"ignoreDefaultArgs"},{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"logger","type":{"name":"Logger","expression":"[Logger]"},"spec":[{"type":"text","text":"Logger sink for Playwright logging."}],"required":false,"comment":"Logger sink for Playwright logging.","deprecated":false,"async":false,"alias":"logger"},{"kind":"property","langs":{},"name":"proxy","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"server","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Proxy to be used for all requests. HTTP and SOCKS proxies are supported, for example `http://myproxy.com:3128` or `socks5://myproxy.com:3128`. Short form `myproxy.com:3128` is considered an HTTP proxy."}],"required":true,"comment":"Proxy to be used for all requests. HTTP and SOCKS proxies are supported, for example `http://myproxy.com:3128` or\n`socks5://myproxy.com:3128`. Short form `myproxy.com:3128` is considered an HTTP proxy.","deprecated":false,"async":false,"alias":"server"},{"kind":"property","langs":{},"name":"bypass","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Optional coma-separated domains to bypass proxy, for example `\".com, chromium.org, .domain.com\"`."}],"required":false,"comment":"Optional coma-separated domains to bypass proxy, for example `\".com, chromium.org, .domain.com\"`.","deprecated":false,"async":false,"alias":"bypass"},{"kind":"property","langs":{},"name":"username","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Optional username to use if HTTP proxy requires authentication."}],"required":false,"comment":"Optional username to use if HTTP proxy requires authentication.","deprecated":false,"async":false,"alias":"username"},{"kind":"property","langs":{},"name":"password","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Optional password to use if HTTP proxy requires authentication."}],"required":false,"comment":"Optional password to use if HTTP proxy requires authentication.","deprecated":false,"async":false,"alias":"password"}],"expression":"[Object]"},"spec":[{"type":"text","text":"Network proxy settings."}],"required":false,"comment":"Network proxy settings.","deprecated":false,"async":false,"alias":"proxy"},{"kind":"property","langs":{},"name":"slowMo","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Slows down Playwright operations by the specified amount of milliseconds. Useful so that you can see what is going on."}],"required":false,"comment":"Slows down Playwright operations by the specified amount of milliseconds. Useful so that you can see what is going on.","deprecated":false,"async":false,"alias":"slowMo"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds to wait for the browser instance to start. Defaults to `30000` (30 seconds). Pass `0` to disable timeout."}],"required":false,"comment":"Maximum time in milliseconds to wait for the browser instance to start. Defaults to `30000` (30 seconds). Pass `0` to\ndisable timeout.","deprecated":false,"async":false,"alias":"timeout"},{"kind":"property","langs":{},"name":"tracesDir","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"If specified, traces are saved into this directory."}],"required":false,"comment":"If specified, traces are saved into this directory.","deprecated":false,"async":false,"alias":"tracesDir"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"launchPersistentContext","type":{"name":"BrowserContext","expression":"[BrowserContext]"},"spec":[{"type":"text","text":"Returns the persistent browser context instance."},{"type":"text","text":"Launches browser that uses persistent storage located at `userDataDir` and returns the only context. Closing this context will automatically close the browser."}],"required":true,"comment":"Returns the persistent browser context instance.\n\nLaunches browser that uses persistent storage located at `userDataDir` and returns the only context. Closing this\ncontext will automatically close the browser.","deprecated":false,"async":true,"alias":"launchPersistentContext","args":[{"kind":"property","langs":{},"name":"userDataDir","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"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#introduction) and [Firefox](https://developer.mozilla.org/en-US/docs/Mozilla/Command_Line_Options#User_Profile). Note that Chromium's user data directory is the **parent** directory of the \"Profile Path\" seen at `chrome://version`."}],"required":true,"comment":"Path to a User Data Directory, which stores browser session data like cookies and local storage. More details for\n[Chromium](https://chromium.googlesource.com/chromium/src/+/master/docs/user_data_dir.md#introduction) and\n[Firefox](https://developer.mozilla.org/en-US/docs/Mozilla/Command_Line_Options#User_Profile). Note that Chromium's user\ndata directory is the **parent** directory of the \"Profile Path\" seen at `chrome://version`.","deprecated":false,"async":false,"alias":"userDataDir"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"acceptDownloads","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether to automatically download all the attachments. Defaults to `false` where all the downloads are canceled."}],"required":false,"comment":"Whether to automatically download all the attachments. Defaults to `false` where all the downloads are canceled.","deprecated":false,"async":false,"alias":"acceptDownloads"},{"kind":"property","langs":{},"name":"args","type":{"name":"Array","templates":[{"name":"string"}],"expression":"[Array]<[string]>"},"spec":[{"type":"text","text":"Additional arguments to pass to the browser instance. The list of Chromium flags can be found [here](http://peter.sh/experiments/chromium-command-line-switches/)."}],"required":false,"comment":"Additional arguments to pass to the browser instance. The list of Chromium flags can be found\n[here](http://peter.sh/experiments/chromium-command-line-switches/).","deprecated":false,"async":false,"alias":"args"},{"kind":"property","langs":{},"name":"bypassCSP","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Toggles bypassing page's Content-Security-Policy."}],"required":false,"comment":"Toggles bypassing page's Content-Security-Policy.","deprecated":false,"async":false,"alias":"bypassCSP"},{"kind":"property","langs":{},"name":"channel","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Browser distribution channel. Supported values are \"chrome\", \"chrome-beta\", \"chrome-dev\", \"chrome-canary\", \"msedge\", \"msedge-beta\", \"msedge-dev\", \"msedge-canary\". Read more about using [Google Chrome and Microsoft Edge](./browsers.md#google-chrome--microsoft-edge)."}],"required":false,"comment":"Browser distribution channel. Supported values are \"chrome\", \"chrome-beta\", \"chrome-dev\", \"chrome-canary\", \"msedge\",\n\"msedge-beta\", \"msedge-dev\", \"msedge-canary\". Read more about using\n[Google Chrome and Microsoft Edge](./browsers.md#google-chrome--microsoft-edge).","deprecated":false,"async":false,"alias":"channel"},{"kind":"property","langs":{},"name":"chromiumSandbox","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Enable Chromium sandboxing. Defaults to `false`."}],"required":false,"comment":"Enable Chromium sandboxing. Defaults to `false`.","deprecated":false,"async":false,"alias":"chromiumSandbox"},{"kind":"property","langs":{},"name":"colorScheme","type":{"name":"ColorScheme","union":[{"name":"\"light\""},{"name":"\"dark\""},{"name":"\"no-preference\""}],"expression":"[ColorScheme]<\"light\"|\"dark\"|\"no-preference\">"},"spec":[{"type":"text","text":"Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. See [`method: Page.emulateMedia`] for more details. Defaults to `'light'`."}],"required":false,"comment":"Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. See\n[`method: Page.emulateMedia`] for more details. Defaults to `'light'`.","deprecated":false,"async":false,"alias":"colorScheme"},{"kind":"property","langs":{},"name":"deviceScaleFactor","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Specify device scale factor (can be thought of as dpr). Defaults to `1`."}],"required":false,"comment":"Specify device scale factor (can be thought of as dpr). Defaults to `1`.","deprecated":false,"async":false,"alias":"deviceScaleFactor"},{"kind":"property","langs":{},"name":"devtools","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"**Chromium-only** Whether to auto-open a Developer Tools panel for each tab. If this option is `true`, the `headless` option will be set `false`."}],"required":false,"comment":"**Chromium-only** Whether to auto-open a Developer Tools panel for each tab. If this option is `true`, the `headless`\noption will be set `false`.","deprecated":false,"async":false,"alias":"devtools"},{"kind":"property","langs":{},"name":"downloadsPath","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"If specified, accepted downloads are downloaded into this directory. Otherwise, temporary directory is created and is deleted when browser is closed."}],"required":false,"comment":"If specified, accepted downloads are downloaded into this directory. Otherwise, temporary directory is created and is\ndeleted when browser is closed.","deprecated":false,"async":false,"alias":"downloadsPath"},{"kind":"property","langs":{"only":["csharp","java"],"aliases":{},"types":{},"overrides":{}},"name":"env","type":{"name":"Object","templates":[{"name":"string"},{"name":"string"}],"expression":"[Object]<[string], [string]>"},"spec":[{"type":"text","text":"Specify environment variables that will be visible to the browser. Defaults to `process.env`."}],"required":false,"comment":"Specify environment variables that will be visible to the browser. Defaults to `process.env`.","deprecated":false,"async":false,"alias":"env"},{"kind":"property","langs":{"only":["js","python"],"aliases":{},"types":{},"overrides":{}},"name":"env","type":{"name":"Object","templates":[{"name":"string"},{"name":"","union":[{"name":"string"},{"name":"float"},{"name":"boolean"}]}],"expression":"[Object]<[string], [string]|[float]|[boolean]>"},"spec":[{"type":"text","text":"Specify environment variables that will be visible to the browser. Defaults to `process.env`."}],"required":false,"comment":"Specify environment variables that will be visible to the browser. Defaults to `process.env`.","deprecated":false,"async":false,"alias":"env"},{"kind":"property","langs":{},"name":"executablePath","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"Path to a browser executable to run instead of the bundled one. If `executablePath` is a relative path, then it is resolved relative to the current working directory. Note that Playwright only works with the bundled Chromium, Firefox or WebKit, use at your own risk."}],"required":false,"comment":"Path to a browser executable to run instead of the bundled one. If `executablePath` is a relative path, then it is\nresolved relative to the current working directory. Note that Playwright only works with the bundled Chromium, Firefox\nor WebKit, use at your own risk.","deprecated":false,"async":false,"alias":"executablePath"},{"kind":"property","langs":{},"name":"extraHTTPHeaders","type":{"name":"Object","templates":[{"name":"string"},{"name":"string"}],"expression":"[Object]<[string], [string]>"},"spec":[{"type":"text","text":"An object containing additional HTTP headers to be sent with every request. All header values must be strings."}],"required":false,"comment":"An object containing additional HTTP headers to be sent with every request. All header values must be strings.","deprecated":false,"async":false,"alias":"extraHTTPHeaders"},{"kind":"property","langs":{},"name":"geolocation","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"latitude","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Latitude between -90 and 90."}],"required":true,"comment":"Latitude between -90 and 90.","deprecated":false,"async":false,"alias":"latitude"},{"kind":"property","langs":{},"name":"longitude","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Longitude between -180 and 180."}],"required":true,"comment":"Longitude between -180 and 180.","deprecated":false,"async":false,"alias":"longitude"},{"kind":"property","langs":{},"name":"accuracy","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Non-negative accuracy value. Defaults to `0`."}],"required":false,"comment":"Non-negative accuracy value. Defaults to `0`.","deprecated":false,"async":false,"alias":"accuracy"}],"expression":"[Object]"},"spec":[],"required":false,"comment":"","deprecated":false,"async":false,"alias":"geolocation"},{"kind":"property","langs":{},"name":"handleSIGHUP","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Close the browser process on SIGHUP. Defaults to `true`."}],"required":false,"comment":"Close the browser process on SIGHUP. Defaults to `true`.","deprecated":false,"async":false,"alias":"handleSIGHUP"},{"kind":"property","langs":{},"name":"handleSIGINT","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Close the browser process on Ctrl-C. Defaults to `true`."}],"required":false,"comment":"Close the browser process on Ctrl-C. Defaults to `true`.","deprecated":false,"async":false,"alias":"handleSIGINT"},{"kind":"property","langs":{},"name":"handleSIGTERM","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Close the browser process on SIGTERM. Defaults to `true`."}],"required":false,"comment":"Close the browser process on SIGTERM. Defaults to `true`.","deprecated":false,"async":false,"alias":"handleSIGTERM"},{"kind":"property","langs":{},"name":"hasTouch","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Specifies if viewport supports touch events. Defaults to false."}],"required":false,"comment":"Specifies if viewport supports touch events. Defaults to false.","deprecated":false,"async":false,"alias":"hasTouch"},{"kind":"property","langs":{},"name":"headless","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"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`."}],"required":false,"comment":"Whether to run browser in headless mode. More details for\n[Chromium](https://developers.google.com/web/updates/2017/04/headless-chrome) and\n[Firefox](https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Headless_mode). Defaults to `true` unless the\n`devtools` option is `true`.","deprecated":false,"async":false,"alias":"headless"},{"kind":"property","langs":{},"name":"httpCredentials","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"username","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"username"},{"kind":"property","langs":{},"name":"password","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"password"}],"expression":"[Object]"},"spec":[{"type":"text","text":"Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication)."}],"required":false,"comment":"Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication).","deprecated":false,"async":false,"alias":"httpCredentials"},{"kind":"property","langs":{"only":["csharp","java"],"aliases":{},"types":{},"overrides":{}},"name":"ignoreAllDefaultArgs","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"If `true`, Playwright does not pass its own configurations args and only uses the ones from `args`. Dangerous option; use with care. Defaults to `false`."}],"required":false,"comment":"If `true`, Playwright does not pass its own configurations args and only uses the ones from `args`. Dangerous option;\nuse with care. Defaults to `false`.","deprecated":false,"async":false,"alias":"ignoreAllDefaultArgs"},{"kind":"property","langs":{"only":["js","python"],"aliases":{},"types":{},"overrides":{}},"name":"ignoreDefaultArgs","type":{"name":"","union":[{"name":"boolean"},{"name":"Array","templates":[{"name":"string"}]}],"expression":"[boolean]|[Array]<[string]>"},"spec":[{"type":"text","text":"If `true`, Playwright does not pass its own configurations args and only uses the ones from `args`. If an array is given, then filters out the given default arguments. Dangerous option; use with care. Defaults to `false`."}],"required":false,"comment":"If `true`, Playwright does not pass its own configurations args and only uses the ones from `args`. If an array is\ngiven, then filters out the given default arguments. Dangerous option; use with care. Defaults to `false`.","deprecated":false,"async":false,"alias":"ignoreDefaultArgs"},{"kind":"property","langs":{"only":["csharp","java"],"aliases":{},"types":{},"overrides":{}},"name":"ignoreDefaultArgs","type":{"name":"Array","templates":[{"name":"string"}],"expression":"[Array]<[string]>"},"spec":[{"type":"text","text":"If `true`, Playwright does not pass its own configurations args and only uses the ones from `args`. Dangerous option; use with care."}],"required":false,"comment":"If `true`, Playwright does not pass its own configurations args and only uses the ones from `args`. Dangerous option;\nuse with care.","deprecated":false,"async":false,"alias":"ignoreDefaultArgs"},{"kind":"property","langs":{},"name":"ignoreHTTPSErrors","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether to ignore HTTPS errors during navigation. Defaults to `false`."}],"required":false,"comment":"Whether to ignore HTTPS errors during navigation. Defaults to `false`.","deprecated":false,"async":false,"alias":"ignoreHTTPSErrors"},{"kind":"property","langs":{},"name":"isMobile","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether the `meta viewport` tag is taken into account and touch events are enabled. Defaults to `false`. Not supported in Firefox."}],"required":false,"comment":"Whether the `meta viewport` tag is taken into account and touch events are enabled. Defaults to `false`. Not supported\nin Firefox.","deprecated":false,"async":false,"alias":"isMobile"},{"kind":"property","langs":{},"name":"javaScriptEnabled","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether or not to enable JavaScript in the context. Defaults to `true`."}],"required":false,"comment":"Whether or not to enable JavaScript in the context. Defaults to `true`.","deprecated":false,"async":false,"alias":"javaScriptEnabled"},{"kind":"property","langs":{},"name":"locale","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Specify user locale, for example `en-GB`, `de-DE`, etc. Locale will affect `navigator.language` value, `Accept-Language` request header value as well as number and date formatting rules."}],"required":false,"comment":"Specify user locale, for example `en-GB`, `de-DE`, etc. Locale will affect `navigator.language` value, `Accept-Language`\nrequest header value as well as number and date formatting rules.","deprecated":false,"async":false,"alias":"locale"},{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"logger","type":{"name":"Logger","expression":"[Logger]"},"spec":[{"type":"text","text":"Logger sink for Playwright logging."}],"required":false,"comment":"Logger sink for Playwright logging.","deprecated":false,"async":false,"alias":"logger"},{"kind":"property","langs":{"only":["python"],"aliases":{},"types":{},"overrides":{}},"name":"noViewport","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Does not enforce fixed viewport, allows resizing window in the headed mode."}],"required":false,"comment":"Does not enforce fixed viewport, allows resizing window in the headed mode.","deprecated":false,"async":false,"alias":"noViewport"},{"kind":"property","langs":{},"name":"offline","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether to emulate network being offline. Defaults to `false`."}],"required":false,"comment":"Whether to emulate network being offline. Defaults to `false`.","deprecated":false,"async":false,"alias":"offline"},{"kind":"property","langs":{},"name":"permissions","type":{"name":"Array","templates":[{"name":"string"}],"expression":"[Array]<[string]>"},"spec":[{"type":"text","text":"A list of permissions to grant to all pages in this context. See [`method: BrowserContext.grantPermissions`] for more details."}],"required":false,"comment":"A list of permissions to grant to all pages in this context. See [`method: BrowserContext.grantPermissions`] for more\ndetails.","deprecated":false,"async":false,"alias":"permissions"},{"kind":"property","langs":{},"name":"proxy","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"server","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Proxy to be used for all requests. HTTP and SOCKS proxies are supported, for example `http://myproxy.com:3128` or `socks5://myproxy.com:3128`. Short form `myproxy.com:3128` is considered an HTTP proxy."}],"required":true,"comment":"Proxy to be used for all requests. HTTP and SOCKS proxies are supported, for example `http://myproxy.com:3128` or\n`socks5://myproxy.com:3128`. Short form `myproxy.com:3128` is considered an HTTP proxy.","deprecated":false,"async":false,"alias":"server"},{"kind":"property","langs":{},"name":"bypass","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Optional coma-separated domains to bypass proxy, for example `\".com, chromium.org, .domain.com\"`."}],"required":false,"comment":"Optional coma-separated domains to bypass proxy, for example `\".com, chromium.org, .domain.com\"`.","deprecated":false,"async":false,"alias":"bypass"},{"kind":"property","langs":{},"name":"username","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Optional username to use if HTTP proxy requires authentication."}],"required":false,"comment":"Optional username to use if HTTP proxy requires authentication.","deprecated":false,"async":false,"alias":"username"},{"kind":"property","langs":{},"name":"password","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Optional password to use if HTTP proxy requires authentication."}],"required":false,"comment":"Optional password to use if HTTP proxy requires authentication.","deprecated":false,"async":false,"alias":"password"}],"expression":"[Object]"},"spec":[{"type":"text","text":"Network proxy settings."}],"required":false,"comment":"Network proxy settings.","deprecated":false,"async":false,"alias":"proxy"},{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"recordHar","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"omitContent","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Optional setting to control whether to omit request content from the HAR. Defaults to `false`."}],"required":false,"comment":"Optional setting to control whether to omit request content from the HAR. Defaults to `false`.","deprecated":false,"async":false,"alias":"omitContent"},{"kind":"property","langs":{},"name":"path","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"Path on the filesystem to write the HAR file to."}],"required":true,"comment":"Path on the filesystem to write the HAR file to.","deprecated":false,"async":false,"alias":"path"}],"expression":"[Object]"},"spec":[{"type":"text","text":"Enables [HAR](http://www.softwareishard.com/blog/har-12-spec) recording for all pages into `recordHar.path` file. If not specified, the HAR is not recorded. Make sure to await [`method: BrowserContext.close`] for the HAR to be saved."}],"required":false,"comment":"Enables [HAR](http://www.softwareishard.com/blog/har-12-spec) recording for all pages into `recordHar.path` file. If not\nspecified, the HAR is not recorded. Make sure to await [`method: BrowserContext.close`] for the HAR to be saved.","deprecated":false,"async":false,"alias":"recordHar"},{"kind":"property","langs":{"only":["csharp","java","python"],"aliases":{"python":"record_har_omit_content"},"types":{},"overrides":{}},"name":"recordHarOmitContent","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Optional setting to control whether to omit request content from the HAR. Defaults to `false`."}],"required":false,"comment":"Optional setting to control whether to omit request content from the HAR. Defaults to `false`.","deprecated":false,"async":false,"alias":"recordHarOmitContent"},{"kind":"property","langs":{"only":["csharp","java","python"],"aliases":{"python":"record_har_path"},"types":{},"overrides":{}},"name":"recordHarPath","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"Enables [HAR](http://www.softwareishard.com/blog/har-12-spec) recording for all pages into the specified HAR file on the filesystem. If not specified, the HAR is not recorded. Make sure to call [`method: BrowserContext.close`] for the HAR to be saved."}],"required":false,"comment":"Enables [HAR](http://www.softwareishard.com/blog/har-12-spec) recording for all pages into the specified HAR file on the\nfilesystem. If not specified, the HAR is not recorded. Make sure to call [`method: BrowserContext.close`] for the HAR to\nbe saved.","deprecated":false,"async":false,"alias":"recordHarPath"},{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"recordVideo","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"dir","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"Path to the directory to put videos into."}],"required":true,"comment":"Path to the directory to put videos into.","deprecated":false,"async":false,"alias":"dir"},{"kind":"property","langs":{},"name":"size","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"width","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"Video frame width."}],"required":true,"comment":"Video frame width.","deprecated":false,"async":false,"alias":"width"},{"kind":"property","langs":{},"name":"height","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"Video frame height."}],"required":true,"comment":"Video frame height.","deprecated":false,"async":false,"alias":"height"}],"expression":"[Object]"},"spec":[{"type":"text","text":"Optional dimensions of the recorded videos. If not specified the size will be equal to `viewport` scaled down to fit into 800x800. If `viewport` is not configured explicitly the video size defaults to 800x450. Actual picture of each page will be scaled down if necessary to fit the specified size."}],"required":false,"comment":"Optional dimensions of the recorded videos. If not specified the size will be equal to `viewport` scaled down to fit\ninto 800x800. If `viewport` is not configured explicitly the video size defaults to 800x450. Actual picture of each page\nwill be scaled down if necessary to fit the specified size.","deprecated":false,"async":false,"alias":"size"}],"expression":"[Object]"},"spec":[{"type":"text","text":"Enables video recording for all pages into `recordVideo.dir` directory. If not specified videos are not recorded. Make sure to await [`method: BrowserContext.close`] for videos to be saved."}],"required":false,"comment":"Enables video recording for all pages into `recordVideo.dir` directory. If not specified videos are not recorded. Make\nsure to await [`method: BrowserContext.close`] for videos to be saved.","deprecated":false,"async":false,"alias":"recordVideo"},{"kind":"property","langs":{"only":["csharp","java","python"],"aliases":{"python":"record_video_dir"},"types":{},"overrides":{}},"name":"recordVideoDir","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"Enables video recording for all pages into the specified directory. If not specified videos are not recorded. Make sure to call [`method: BrowserContext.close`] for videos to be saved."}],"required":false,"comment":"Enables video recording for all pages into the specified directory. If not specified videos are not recorded. Make sure\nto call [`method: BrowserContext.close`] for videos to be saved.","deprecated":false,"async":false,"alias":"recordVideoDir"},{"kind":"property","langs":{"only":["csharp","java","python"],"aliases":{"python":"record_video_size"},"types":{},"overrides":{}},"name":"recordVideoSize","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"width","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"Video frame width."}],"required":true,"comment":"Video frame width.","deprecated":false,"async":false,"alias":"width"},{"kind":"property","langs":{},"name":"height","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"Video frame height."}],"required":true,"comment":"Video frame height.","deprecated":false,"async":false,"alias":"height"}],"expression":"[Object]"},"spec":[{"type":"text","text":"Dimensions of the recorded videos. If not specified the size will be equal to `viewport` scaled down to fit into 800x800. If `viewport` is not configured explicitly the video size defaults to 800x450. Actual picture of each page will be scaled down if necessary to fit the specified size."}],"required":false,"comment":"Dimensions of the recorded videos. If not specified the size will be equal to `viewport` scaled down to fit into\n800x800. If `viewport` is not configured explicitly the video size defaults to 800x450. Actual picture of each page will\nbe scaled down if necessary to fit the specified size.","deprecated":false,"async":false,"alias":"recordVideoSize"},{"kind":"property","langs":{},"name":"reducedMotion","type":{"name":"ReducedMotion","union":[{"name":"\"reduce\""},{"name":"\"no-preference\""}],"expression":"[ReducedMotion]<\"reduce\"|\"no-preference\">"},"spec":[{"type":"text","text":"Emulates `'prefers-reduced-motion'` media feature, supported values are `'reduce'`, `'no-preference'`. See [`method: Page.emulateMedia`] for more details. Defaults to `'no-preference'`."}],"required":false,"comment":"Emulates `'prefers-reduced-motion'` media feature, supported values are `'reduce'`, `'no-preference'`. See\n[`method: Page.emulateMedia`] for more details. Defaults to `'no-preference'`.","deprecated":false,"async":false,"alias":"reducedMotion"},{"kind":"property","langs":{"aliases":{"java":"screenSize","csharp":"screenSize"},"types":{},"overrides":{}},"name":"screen","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"width","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"page width in pixels."}],"required":true,"comment":"page width in pixels.","deprecated":false,"async":false,"alias":"width"},{"kind":"property","langs":{},"name":"height","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"page height in pixels."}],"required":true,"comment":"page height in pixels.","deprecated":false,"async":false,"alias":"height"}],"expression":"[Object]"},"spec":[{"type":"text","text":"Emulates consistent window screen size available inside web page via `window.screen`. Is only used when the `viewport` is set."}],"required":false,"comment":"Emulates consistent window screen size available inside web page via `window.screen`. Is only used when the `viewport`\nis set.","deprecated":false,"async":false,"alias":"screen"},{"kind":"property","langs":{},"name":"slowMo","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Slows down Playwright operations by the specified amount of milliseconds. Useful so that you can see what is going on."}],"required":false,"comment":"Slows down Playwright operations by the specified amount of milliseconds. Useful so that you can see what is going on.","deprecated":false,"async":false,"alias":"slowMo"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds to wait for the browser instance to start. Defaults to `30000` (30 seconds). Pass `0` to disable timeout."}],"required":false,"comment":"Maximum time in milliseconds to wait for the browser instance to start. Defaults to `30000` (30 seconds). Pass `0` to\ndisable timeout.","deprecated":false,"async":false,"alias":"timeout"},{"kind":"property","langs":{},"name":"timezoneId","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Changes the timezone of the context. See [ICU's metaZones.txt](https://cs.chromium.org/chromium/src/third_party/icu/source/data/misc/metaZones.txt?rcl=faee8bc70570192d82d2978a71e2a615788597d1) for a list of supported timezone IDs."}],"required":false,"comment":"Changes the timezone of the context. See\n[ICU's metaZones.txt](https://cs.chromium.org/chromium/src/third_party/icu/source/data/misc/metaZones.txt?rcl=faee8bc70570192d82d2978a71e2a615788597d1)\nfor a list of supported timezone IDs.","deprecated":false,"async":false,"alias":"timezoneId"},{"kind":"property","langs":{},"name":"tracesDir","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"If specified, traces are saved into this directory."}],"required":false,"comment":"If specified, traces are saved into this directory.","deprecated":false,"async":false,"alias":"tracesDir"},{"kind":"property","langs":{},"name":"userAgent","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Specific user agent to use in this context."}],"required":false,"comment":"Specific user agent to use in this context.","deprecated":false,"async":false,"alias":"userAgent"},{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"videoSize","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"width","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"Video frame width."}],"required":true,"comment":"Video frame width.","deprecated":false,"async":false,"alias":"width"},{"kind":"property","langs":{},"name":"height","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"Video frame height."}],"required":true,"comment":"Video frame height.","deprecated":false,"async":false,"alias":"height"}],"expression":"[Object]"},"spec":[{"type":"text","text":"**DEPRECATED** Use `recordVideo` instead."}],"required":false,"comment":"**DEPRECATED** Use `recordVideo` instead.","deprecated":true,"async":false,"alias":"videoSize"},{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"videosPath","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"**DEPRECATED** Use `recordVideo` instead."}],"required":false,"comment":"**DEPRECATED** Use `recordVideo` instead.","deprecated":true,"async":false,"alias":"videosPath"},{"kind":"property","langs":{"only":["js","java"],"aliases":{"java":"viewportSize"},"types":{},"overrides":{}},"name":"viewport","type":{"name":"","union":[{"name":"null"},{"name":"Object","properties":[{"kind":"property","langs":{},"name":"width","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"page width in pixels."}],"required":true,"comment":"page width in pixels.","deprecated":false,"async":false,"alias":"width"},{"kind":"property","langs":{},"name":"height","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"page height in pixels."}],"required":true,"comment":"page height in pixels.","deprecated":false,"async":false,"alias":"height"}]}],"expression":"[null]|[Object]"},"spec":[{"type":"text","text":"Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. `null` disables the default viewport."}],"required":false,"comment":"Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. `null` disables the default viewport.","deprecated":false,"async":false,"alias":"viewport"},{"kind":"property","langs":{"only":["csharp"],"aliases":{"csharp":"viewportSize"},"types":{},"overrides":{}},"name":"viewport","type":{"name":"","union":[{"name":"null"},{"name":"Object","properties":[{"kind":"property","langs":{},"name":"width","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"page width in pixels."}],"required":true,"comment":"page width in pixels.","deprecated":false,"async":false,"alias":"width"},{"kind":"property","langs":{},"name":"height","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"page height in pixels."}],"required":true,"comment":"page height in pixels.","deprecated":false,"async":false,"alias":"height"}]}],"expression":"[null]|[Object]"},"spec":[{"type":"text","text":"Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use `ViewportSize.NoViewport` to disable the default viewport."}],"required":false,"comment":"Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use `ViewportSize.NoViewport` to disable\nthe default viewport.","deprecated":false,"async":false,"alias":"viewport"},{"kind":"property","langs":{"only":["python"],"aliases":{},"types":{},"overrides":{}},"name":"viewport","type":{"name":"","union":[{"name":"null"},{"name":"Object","properties":[{"kind":"property","langs":{},"name":"width","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"page width in pixels."}],"required":true,"comment":"page width in pixels.","deprecated":false,"async":false,"alias":"width"},{"kind":"property","langs":{},"name":"height","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"page height in pixels."}],"required":true,"comment":"page height in pixels.","deprecated":false,"async":false,"alias":"height"}]}],"expression":"[null]|[Object]"},"spec":[{"type":"text","text":"Sets a consistent viewport for each page. Defaults to an 1280x720 viewport. `no_viewport` disables the fixed viewport."}],"required":false,"comment":"Sets a consistent viewport for each page. Defaults to an 1280x720 viewport. `no_viewport` disables the fixed viewport.","deprecated":false,"async":false,"alias":"viewport"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"launchServer","type":{"name":"BrowserServer","expression":"[BrowserServer]"},"spec":[{"type":"text","text":"Returns the browser app instance."},{"type":"text","text":"Launches browser server that client can connect to. An example of launching a browser executable and connecting to it later:"},{"type":"code","lines":["const { chromium } = require('playwright'); // Or 'webkit' or 'firefox'.","","(async () => {"," const browserServer = await chromium.launchServer();"," const wsEndpoint = browserServer.wsEndpoint();"," // Use web socket endpoint later to establish a connection."," const browser = await chromium.connect({ wsEndpoint });"," // Close browser instance."," await browserServer.close();","})();"],"codeLang":"js"}],"required":true,"comment":"Returns the browser app instance.\n\nLaunches browser server that client can connect to. An example of launching a browser executable and connecting to it\nlater:\n\n```js\nconst { chromium } = require('playwright'); // Or 'webkit' or 'firefox'.\n\n(async () => {\n const browserServer = await chromium.launchServer();\n const wsEndpoint = browserServer.wsEndpoint();\n // Use web socket endpoint later to establish a connection.\n const browser = await chromium.connect({ wsEndpoint });\n // Close browser instance.\n await browserServer.close();\n})();\n```\n","deprecated":false,"async":true,"alias":"launchServer","args":[{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"args","type":{"name":"Array","templates":[{"name":"string"}],"expression":"[Array]<[string]>"},"spec":[{"type":"text","text":"Additional arguments to pass to the browser instance. The list of Chromium flags can be found [here](http://peter.sh/experiments/chromium-command-line-switches/)."}],"required":false,"comment":"Additional arguments to pass to the browser instance. The list of Chromium flags can be found\n[here](http://peter.sh/experiments/chromium-command-line-switches/).","deprecated":false,"async":false,"alias":"args"},{"kind":"property","langs":{},"name":"channel","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Browser distribution channel. Supported values are \"chrome\", \"chrome-beta\", \"chrome-dev\", \"chrome-canary\", \"msedge\", \"msedge-beta\", \"msedge-dev\", \"msedge-canary\". Read more about using [Google Chrome and Microsoft Edge](./browsers.md#google-chrome--microsoft-edge)."}],"required":false,"comment":"Browser distribution channel. Supported values are \"chrome\", \"chrome-beta\", \"chrome-dev\", \"chrome-canary\", \"msedge\",\n\"msedge-beta\", \"msedge-dev\", \"msedge-canary\". Read more about using\n[Google Chrome and Microsoft Edge](./browsers.md#google-chrome--microsoft-edge).","deprecated":false,"async":false,"alias":"channel"},{"kind":"property","langs":{},"name":"chromiumSandbox","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Enable Chromium sandboxing. Defaults to `false`."}],"required":false,"comment":"Enable Chromium sandboxing. Defaults to `false`.","deprecated":false,"async":false,"alias":"chromiumSandbox"},{"kind":"property","langs":{},"name":"devtools","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"**Chromium-only** Whether to auto-open a Developer Tools panel for each tab. If this option is `true`, the `headless` option will be set `false`."}],"required":false,"comment":"**Chromium-only** Whether to auto-open a Developer Tools panel for each tab. If this option is `true`, the `headless`\noption will be set `false`.","deprecated":false,"async":false,"alias":"devtools"},{"kind":"property","langs":{},"name":"downloadsPath","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"If specified, accepted downloads are downloaded into this directory. Otherwise, temporary directory is created and is deleted when browser is closed."}],"required":false,"comment":"If specified, accepted downloads are downloaded into this directory. Otherwise, temporary directory is created and is\ndeleted when browser is closed.","deprecated":false,"async":false,"alias":"downloadsPath"},{"kind":"property","langs":{"only":["csharp","java"],"aliases":{},"types":{},"overrides":{}},"name":"env","type":{"name":"Object","templates":[{"name":"string"},{"name":"string"}],"expression":"[Object]<[string], [string]>"},"spec":[{"type":"text","text":"Specify environment variables that will be visible to the browser. Defaults to `process.env`."}],"required":false,"comment":"Specify environment variables that will be visible to the browser. Defaults to `process.env`.","deprecated":false,"async":false,"alias":"env"},{"kind":"property","langs":{"only":["js","python"],"aliases":{},"types":{},"overrides":{}},"name":"env","type":{"name":"Object","templates":[{"name":"string"},{"name":"","union":[{"name":"string"},{"name":"float"},{"name":"boolean"}]}],"expression":"[Object]<[string], [string]|[float]|[boolean]>"},"spec":[{"type":"text","text":"Specify environment variables that will be visible to the browser. Defaults to `process.env`."}],"required":false,"comment":"Specify environment variables that will be visible to the browser. Defaults to `process.env`.","deprecated":false,"async":false,"alias":"env"},{"kind":"property","langs":{},"name":"executablePath","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"Path to a browser executable to run instead of the bundled one. If `executablePath` is a relative path, then it is resolved relative to the current working directory. Note that Playwright only works with the bundled Chromium, Firefox or WebKit, use at your own risk."}],"required":false,"comment":"Path to a browser executable to run instead of the bundled one. If `executablePath` is a relative path, then it is\nresolved relative to the current working directory. Note that Playwright only works with the bundled Chromium, Firefox\nor WebKit, use at your own risk.","deprecated":false,"async":false,"alias":"executablePath"},{"kind":"property","langs":{"only":["js","python"],"aliases":{},"types":{},"overrides":{}},"name":"firefoxUserPrefs","type":{"name":"Object","templates":[{"name":"string"},{"name":"","union":[{"name":"string"},{"name":"float"},{"name":"boolean"}]}],"expression":"[Object]<[string], [string]|[float]|[boolean]>"},"spec":[{"type":"text","text":"Firefox user preferences. Learn more about the Firefox user preferences at [`about:config`](https://support.mozilla.org/en-US/kb/about-config-editor-firefox)."}],"required":false,"comment":"Firefox user preferences. Learn more about the Firefox user preferences at\n[`about:config`](https://support.mozilla.org/en-US/kb/about-config-editor-firefox).","deprecated":false,"async":false,"alias":"firefoxUserPrefs"},{"kind":"property","langs":{"only":["csharp","java"],"aliases":{},"types":{},"overrides":{}},"name":"firefoxUserPrefs","type":{"name":"Object","templates":[{"name":"string"},{"name":"any"}],"expression":"[Object]<[string], [any]>"},"spec":[{"type":"text","text":"Firefox user preferences. Learn more about the Firefox user preferences at [`about:config`](https://support.mozilla.org/en-US/kb/about-config-editor-firefox)."}],"required":false,"comment":"Firefox user preferences. Learn more about the Firefox user preferences at\n[`about:config`](https://support.mozilla.org/en-US/kb/about-config-editor-firefox).","deprecated":false,"async":false,"alias":"firefoxUserPrefs"},{"kind":"property","langs":{},"name":"handleSIGHUP","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Close the browser process on SIGHUP. Defaults to `true`."}],"required":false,"comment":"Close the browser process on SIGHUP. Defaults to `true`.","deprecated":false,"async":false,"alias":"handleSIGHUP"},{"kind":"property","langs":{},"name":"handleSIGINT","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Close the browser process on Ctrl-C. Defaults to `true`."}],"required":false,"comment":"Close the browser process on Ctrl-C. Defaults to `true`.","deprecated":false,"async":false,"alias":"handleSIGINT"},{"kind":"property","langs":{},"name":"handleSIGTERM","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Close the browser process on SIGTERM. Defaults to `true`."}],"required":false,"comment":"Close the browser process on SIGTERM. Defaults to `true`.","deprecated":false,"async":false,"alias":"handleSIGTERM"},{"kind":"property","langs":{},"name":"headless","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"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`."}],"required":false,"comment":"Whether to run browser in headless mode. More details for\n[Chromium](https://developers.google.com/web/updates/2017/04/headless-chrome) and\n[Firefox](https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Headless_mode). Defaults to `true` unless the\n`devtools` option is `true`.","deprecated":false,"async":false,"alias":"headless"},{"kind":"property","langs":{"only":["js","python"],"aliases":{},"types":{},"overrides":{}},"name":"ignoreDefaultArgs","type":{"name":"","union":[{"name":"boolean"},{"name":"Array","templates":[{"name":"string"}]}],"expression":"[boolean]|[Array]<[string]>"},"spec":[{"type":"text","text":"If `true`, Playwright does not pass its own configurations args and only uses the ones from `args`. If an array is given, then filters out the given default arguments. Dangerous option; use with care. Defaults to `false`."}],"required":false,"comment":"If `true`, Playwright does not pass its own configurations args and only uses the ones from `args`. If an array is\ngiven, then filters out the given default arguments. Dangerous option; use with care. Defaults to `false`.","deprecated":false,"async":false,"alias":"ignoreDefaultArgs"},{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"logger","type":{"name":"Logger","expression":"[Logger]"},"spec":[{"type":"text","text":"Logger sink for Playwright logging."}],"required":false,"comment":"Logger sink for Playwright logging.","deprecated":false,"async":false,"alias":"logger"},{"kind":"property","langs":{},"name":"port","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"Port to use for the web socket. Defaults to 0 that picks any available port."}],"required":false,"comment":"Port to use for the web socket. Defaults to 0 that picks any available port.","deprecated":false,"async":false,"alias":"port"},{"kind":"property","langs":{},"name":"proxy","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"server","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Proxy to be used for all requests. HTTP and SOCKS proxies are supported, for example `http://myproxy.com:3128` or `socks5://myproxy.com:3128`. Short form `myproxy.com:3128` is considered an HTTP proxy."}],"required":true,"comment":"Proxy to be used for all requests. HTTP and SOCKS proxies are supported, for example `http://myproxy.com:3128` or\n`socks5://myproxy.com:3128`. Short form `myproxy.com:3128` is considered an HTTP proxy.","deprecated":false,"async":false,"alias":"server"},{"kind":"property","langs":{},"name":"bypass","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Optional coma-separated domains to bypass proxy, for example `\".com, chromium.org, .domain.com\"`."}],"required":false,"comment":"Optional coma-separated domains to bypass proxy, for example `\".com, chromium.org, .domain.com\"`.","deprecated":false,"async":false,"alias":"bypass"},{"kind":"property","langs":{},"name":"username","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Optional username to use if HTTP proxy requires authentication."}],"required":false,"comment":"Optional username to use if HTTP proxy requires authentication.","deprecated":false,"async":false,"alias":"username"},{"kind":"property","langs":{},"name":"password","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Optional password to use if HTTP proxy requires authentication."}],"required":false,"comment":"Optional password to use if HTTP proxy requires authentication.","deprecated":false,"async":false,"alias":"password"}],"expression":"[Object]"},"spec":[{"type":"text","text":"Network proxy settings."}],"required":false,"comment":"Network proxy settings.","deprecated":false,"async":false,"alias":"proxy"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds to wait for the browser instance to start. Defaults to `30000` (30 seconds). Pass `0` to disable timeout."}],"required":false,"comment":"Maximum time in milliseconds to wait for the browser instance to start. Defaults to `30000` (30 seconds). Pass `0` to\ndisable timeout.","deprecated":false,"async":false,"alias":"timeout"},{"kind":"property","langs":{},"name":"tracesDir","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"If specified, traces are saved into this directory."}],"required":false,"comment":"If specified, traces are saved into this directory.","deprecated":false,"async":false,"alias":"tracesDir"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"name","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Returns browser name. For example: `'chromium'`, `'webkit'` or `'firefox'`."}],"required":true,"comment":"Returns browser name. For example: `'chromium'`, `'webkit'` or `'firefox'`.","deprecated":false,"async":false,"alias":"name","args":[]}]},{"name":"CDPSession","spec":[{"type":"li","text":"extends: [EventEmitter]","liType":"bullet"},{"type":"text","text":"The `CDPSession` instances are used to talk raw Chrome Devtools Protocol:"},{"type":"li","text":"protocol methods can be called with `session.send` method.","liType":"bullet"},{"type":"li","text":"protocol events can be subscribed to with `session.on` method.","liType":"bullet"},{"type":"text","text":"Useful links:"},{"type":"li","text":"Documentation on DevTools Protocol can be found here: [DevTools Protocol Viewer](https://chromedevtools.github.io/devtools-protocol/).","liType":"bullet"},{"type":"li","text":"Getting Started with DevTools Protocol: https://github.com/aslushnikov/getting-started-with-cdp/blob/master/README.md","liType":"bullet"},{"type":"code","lines":["const client = await page.context().newCDPSession(page);","await client.send('Animation.enable');","client.on('Animation.animationCreated', () => console.log('Animation created!'));","const response = await client.send('Animation.getPlaybackRate');","console.log('playback rate is ' + response.playbackRate);","await client.send('Animation.setPlaybackRate', {"," playbackRate: response.playbackRate / 2","});"],"codeLang":"js"},{"type":"code","lines":["client = await page.context().new_cdp_session(page)","await client.send(\"animation.enable\")","client.on(\"animation.animation_created\", lambda: print(\"animation created!\"))","response = await client.send(\"animation.get_playback_rate\")","print(\"playback rate is \" + response[\"playback_rate\"])","await client.send(\"animation.set_playback_rate\", {"," playback_rate: response[\"playback_rate\"] / 2","})"],"codeLang":"python async"},{"type":"code","lines":["client = page.context().new_cdp_session(page)","client.send(\"animation.enable\")","client.on(\"animation.animation_created\", lambda: print(\"animation created!\"))","response = client.send(\"animation.get_playback_rate\")","print(\"playback rate is \" + response[\"playback_rate\"])","client.send(\"animation.set_playback_rate\", {"," playback_rate: response[\"playback_rate\"] / 2","})"],"codeLang":"python sync"}],"extends":"EventEmitter","langs":{"only":["js","python"],"aliases":{},"types":{},"overrides":{}},"comment":"- extends: [EventEmitter]\n\nThe `CDPSession` instances are used to talk raw Chrome Devtools Protocol:\n- protocol methods can be called with `session.send` method.\n- protocol events can be subscribed to with `session.on` method.\n\nUseful links:\n- Documentation on DevTools Protocol can be found here:\n [DevTools Protocol Viewer](https://chromedevtools.github.io/devtools-protocol/).\n- Getting Started with DevTools Protocol:\n https://github.com/aslushnikov/getting-started-with-cdp/blob/master/README.md\n\n```js\nconst client = await page.context().newCDPSession(page);\nawait client.send('Animation.enable');\nclient.on('Animation.animationCreated', () => console.log('Animation created!'));\nconst response = await client.send('Animation.getPlaybackRate');\nconsole.log('playback rate is ' + response.playbackRate);\nawait client.send('Animation.setPlaybackRate', {\n playbackRate: response.playbackRate / 2\n});\n```\n\n```python async\nclient = await page.context().new_cdp_session(page)\nawait client.send(\"animation.enable\")\nclient.on(\"animation.animation_created\", lambda: print(\"animation created!\"))\nresponse = await client.send(\"animation.get_playback_rate\")\nprint(\"playback rate is \" + response[\"playback_rate\"])\nawait client.send(\"animation.set_playback_rate\", {\n playback_rate: response[\"playback_rate\"] / 2\n})\n```\n\n```python sync\nclient = page.context().new_cdp_session(page)\nclient.send(\"animation.enable\")\nclient.on(\"animation.animation_created\", lambda: print(\"animation created!\"))\nresponse = client.send(\"animation.get_playback_rate\")\nprint(\"playback rate is \" + response[\"playback_rate\"])\nclient.send(\"animation.set_playback_rate\", {\n playback_rate: response[\"playback_rate\"] / 2\n})\n```\n","members":[{"kind":"method","langs":{},"name":"detach","type":{"name":"void"},"spec":[{"type":"text","text":"Detaches the CDPSession from the target. Once detached, the CDPSession object won't emit any events and can't be used to send messages."}],"required":true,"comment":"Detaches the CDPSession from the target. Once detached, the CDPSession object won't emit any events and can't be used to\nsend messages.","deprecated":false,"async":true,"alias":"detach","args":[]},{"kind":"method","langs":{},"name":"send","type":{"name":"Object","expression":"[Object]"},"spec":[],"required":true,"comment":"","deprecated":false,"async":true,"alias":"send","args":[{"kind":"property","langs":{},"name":"method","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"protocol method name"}],"required":true,"comment":"protocol method name","deprecated":false,"async":false,"alias":"method"},{"kind":"property","langs":{},"name":"params","type":{"name":"Object","expression":"[Object]"},"spec":[{"type":"text","text":"Optional method parameters"}],"required":false,"comment":"Optional method parameters","deprecated":false,"async":false,"alias":"params"}]}]},{"name":"ConsoleMessage","spec":[{"type":"text","text":"`ConsoleMessage` objects are dispatched by page via the [`event: Page.console`] event."}],"langs":{},"comment":"`ConsoleMessage` objects are dispatched by page via the [`event: Page.console`] event.","members":[{"kind":"method","langs":{},"name":"args","type":{"name":"Array","templates":[{"name":"JSHandle"}],"expression":"[Array]<[JSHandle]>"},"spec":[{"type":"text","text":"List of arguments passed to a `console` function call. See also [`event: Page.console`]."}],"required":true,"comment":"List of arguments passed to a `console` function call. See also [`event: Page.console`].","deprecated":false,"async":false,"alias":"args","args":[]},{"kind":"method","langs":{"only":["js","python"],"aliases":{},"types":{},"overrides":{}},"name":"location","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"url","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"URL of the resource."}],"required":true,"comment":"URL of the resource.","deprecated":false,"async":false,"alias":"url"},{"kind":"property","langs":{},"name":"lineNumber","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"0-based line number in the resource."}],"required":true,"comment":"0-based line number in the resource.","deprecated":false,"async":false,"alias":"lineNumber"},{"kind":"property","langs":{},"name":"columnNumber","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"0-based column number in the resource."}],"required":true,"comment":"0-based column number in the resource.","deprecated":false,"async":false,"alias":"columnNumber"}],"expression":"[Object]"},"spec":[],"required":true,"comment":"","deprecated":false,"async":false,"alias":"location","args":[]},{"kind":"method","langs":{"only":["csharp","java"],"aliases":{},"types":{},"overrides":{}},"name":"location","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"URL of the resource followed by 0-based line and column numbers in the resource formatted as `URL:line:column`."}],"required":true,"comment":"URL of the resource followed by 0-based line and column numbers in the resource formatted as `URL:line:column`.","deprecated":false,"async":false,"alias":"location","args":[]},{"kind":"method","langs":{},"name":"text","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"The text of the console message."}],"required":true,"comment":"The text of the console message.","deprecated":false,"async":false,"alias":"text","args":[]},{"kind":"method","langs":{},"name":"type","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"One of the following values: `'log'`, `'debug'`, `'info'`, `'error'`, `'warning'`, `'dir'`, `'dirxml'`, `'table'`, `'trace'`, `'clear'`, `'startGroup'`, `'startGroupCollapsed'`, `'endGroup'`, `'assert'`, `'profile'`, `'profileEnd'`, `'count'`, `'timeEnd'`."}],"required":true,"comment":"One of the following values: `'log'`, `'debug'`, `'info'`, `'error'`, `'warning'`, `'dir'`, `'dirxml'`, `'table'`,\n`'trace'`, `'clear'`, `'startGroup'`, `'startGroupCollapsed'`, `'endGroup'`, `'assert'`, `'profile'`, `'profileEnd'`,\n`'count'`, `'timeEnd'`.","deprecated":false,"async":false,"alias":"type","args":[]}]},{"name":"Coverage","spec":[{"type":"text","text":"Coverage gathers information about parts of JavaScript and CSS that were used by the page."},{"type":"text","text":"An example of using JavaScript coverage to produce Istanbul report for page load:"},{"type":"note","noteType":"note","text":"Coverage APIs are only supported on Chromium-based browsers."},{"type":"code","lines":["const { chromium } = require('playwright');","const v8toIstanbul = require('v8-to-istanbul');","","(async() => {"," const browser = await chromium.launch();"," const page = await browser.newPage();"," await page.coverage.startJSCoverage();"," await page.goto('https://chromium.org');"," const coverage = await page.coverage.stopJSCoverage();"," for (const entry of coverage) {"," const converter = new v8toIstanbul('', 0, { source: entry.source });"," await converter.load();"," converter.applyCoverage(entry.functions);"," console.log(JSON.stringify(converter.toIstanbul()));"," }"," await browser.close();","})();"],"codeLang":"js"}],"langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"comment":"Coverage gathers information about parts of JavaScript and CSS that were used by the page.\n\nAn example of using JavaScript coverage to produce Istanbul report for page load:\n\n> NOTE: Coverage APIs are only supported on Chromium-based browsers.\n\n```js\nconst { chromium } = require('playwright');\nconst v8toIstanbul = require('v8-to-istanbul');\n\n(async() => {\n const browser = await chromium.launch();\n const page = await browser.newPage();\n await page.coverage.startJSCoverage();\n await page.goto('https://chromium.org');\n const coverage = await page.coverage.stopJSCoverage();\n for (const entry of coverage) {\n const converter = new v8toIstanbul('', 0, { source: entry.source });\n await converter.load();\n converter.applyCoverage(entry.functions);\n console.log(JSON.stringify(converter.toIstanbul()));\n }\n await browser.close();\n})();\n```\n","members":[{"kind":"method","langs":{},"name":"startCSSCoverage","type":{"name":"void"},"spec":[{"type":"text","text":"Returns coverage is started"}],"required":true,"comment":"Returns coverage is started","deprecated":false,"async":true,"alias":"startCSSCoverage","args":[{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"resetOnNavigation","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether to reset coverage on every navigation. Defaults to `true`."}],"required":false,"comment":"Whether to reset coverage on every navigation. Defaults to `true`.","deprecated":false,"async":false,"alias":"resetOnNavigation"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"startJSCoverage","type":{"name":"void"},"spec":[{"type":"text","text":"Returns coverage is started"},{"type":"note","noteType":"note","text":"Anonymous scripts are ones that don't have an associated url. These are scripts that are dynamically created on the page using `eval` or `new Function`. If `reportAnonymousScripts` is set to `true`, anonymous scripts will have `__playwright_evaluation_script__` as their URL."}],"required":true,"comment":"Returns coverage is started\n\n> NOTE: Anonymous scripts are ones that don't have an associated url. These are scripts that are dynamically created on\nthe page using `eval` or `new Function`. If `reportAnonymousScripts` is set to `true`, anonymous scripts will have\n`__playwright_evaluation_script__` as their URL.","deprecated":false,"async":true,"alias":"startJSCoverage","args":[{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"reportAnonymousScripts","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether anonymous scripts generated by the page should be reported. Defaults to `false`."}],"required":false,"comment":"Whether anonymous scripts generated by the page should be reported. Defaults to `false`.","deprecated":false,"async":false,"alias":"reportAnonymousScripts"},{"kind":"property","langs":{},"name":"resetOnNavigation","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether to reset coverage on every navigation. Defaults to `true`."}],"required":false,"comment":"Whether to reset coverage on every navigation. Defaults to `true`.","deprecated":false,"async":false,"alias":"resetOnNavigation"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"stopCSSCoverage","type":{"name":"Array","templates":[{"name":"Object","properties":[{"kind":"property","langs":{},"name":"url","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"StyleSheet URL"}],"required":true,"comment":"StyleSheet URL","deprecated":false,"async":false,"alias":"url"},{"kind":"property","langs":{},"name":"text","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"StyleSheet content, if available."}],"required":false,"comment":"StyleSheet content, if available.","deprecated":false,"async":false,"alias":"text"},{"kind":"property","langs":{},"name":"ranges","type":{"name":"Array","templates":[{"name":"Object","properties":[{"kind":"property","langs":{},"name":"start","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"A start offset in text, inclusive"}],"required":true,"comment":"A start offset in text, inclusive","deprecated":false,"async":false,"alias":"start"},{"kind":"property","langs":{},"name":"end","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"An end offset in text, exclusive"}],"required":true,"comment":"An end offset in text, exclusive","deprecated":false,"async":false,"alias":"end"}]}],"expression":"[Array]<[Object]>"},"spec":[{"type":"text","text":"StyleSheet ranges that were used. Ranges are sorted and non-overlapping."}],"required":true,"comment":"StyleSheet ranges that were used. Ranges are sorted and non-overlapping.","deprecated":false,"async":false,"alias":"ranges"}]}],"expression":"[Array]<[Object]>"},"spec":[{"type":"text","text":"Returns the array of coverage reports for all stylesheets"},{"type":"note","noteType":"note","text":"CSS Coverage doesn't include dynamically injected style tags without sourceURLs."}],"required":true,"comment":"Returns the array of coverage reports for all stylesheets\n\n> NOTE: CSS Coverage doesn't include dynamically injected style tags without sourceURLs.","deprecated":false,"async":true,"alias":"stopCSSCoverage","args":[]},{"kind":"method","langs":{},"name":"stopJSCoverage","type":{"name":"Array","templates":[{"name":"Object","properties":[{"kind":"property","langs":{},"name":"url","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Script URL"}],"required":true,"comment":"Script URL","deprecated":false,"async":false,"alias":"url"},{"kind":"property","langs":{},"name":"scriptId","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Script ID"}],"required":true,"comment":"Script ID","deprecated":false,"async":false,"alias":"scriptId"},{"kind":"property","langs":{},"name":"source","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Script content, if applicable."}],"required":false,"comment":"Script content, if applicable.","deprecated":false,"async":false,"alias":"source"},{"kind":"property","langs":{},"name":"functions","type":{"name":"Array","templates":[{"name":"Object","properties":[{"kind":"property","langs":{},"name":"functionName","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"functionName"},{"kind":"property","langs":{},"name":"isBlockCoverage","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"isBlockCoverage"},{"kind":"property","langs":{},"name":"ranges","type":{"name":"Array","templates":[{"name":"Object","properties":[{"kind":"property","langs":{},"name":"count","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"count"},{"kind":"property","langs":{},"name":"startOffset","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"startOffset"},{"kind":"property","langs":{},"name":"endOffset","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"endOffset"}]}],"expression":"[Array]<[Object]>"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"ranges"}]}],"expression":"[Array]<[Object]>"},"spec":[{"type":"text","text":"V8-specific coverage format."}],"required":true,"comment":"V8-specific coverage format.","deprecated":false,"async":false,"alias":"functions"}]}],"expression":"[Array]<[Object]>"},"spec":[{"type":"text","text":"Returns the array of coverage reports for all scripts"},{"type":"note","noteType":"note","text":"JavaScript Coverage doesn't include anonymous scripts by default. However, scripts with sourceURLs are reported."}],"required":true,"comment":"Returns the array of coverage reports for all scripts\n\n> NOTE: JavaScript Coverage doesn't include anonymous scripts by default. However, scripts with sourceURLs are reported.","deprecated":false,"async":true,"alias":"stopJSCoverage","args":[]}]},{"name":"Dialog","spec":[{"type":"text","text":"`Dialog` objects are dispatched by page via the [`event: Page.dialog`] event."},{"type":"text","text":"An example of using `Dialog` class:"},{"type":"code","lines":["const { chromium } = require('playwright'); // Or 'firefox' or 'webkit'.","","(async () => {"," const browser = await chromium.launch();"," const page = await browser.newPage();"," page.on('dialog', async dialog => {"," console.log(dialog.message());"," await dialog.dismiss();"," });"," await page.evaluate(() => alert('1'));"," await browser.close();","})();"],"codeLang":"js"},{"type":"code","lines":["import com.microsoft.playwright.*;","","public class Example {"," public static void main(String[] args) {"," try (Playwright playwright = Playwright.create()) {"," BrowserType chromium = playwright.chromium();"," Browser browser = chromium.launch();"," Page page = browser.newPage();"," page.onDialog(dialog -> {"," System.out.println(dialog.message());"," dialog.dismiss();"," });"," page.evaluate(\"alert('1')\");"," browser.close();"," }"," }","}"],"codeLang":"java"},{"type":"code","lines":["import asyncio","from playwright.async_api import async_playwright","","async def handle_dialog(dialog):"," print(dialog.message)"," await dialog.dismiss()","","async def run(playwright):"," chromium = playwright.chromium"," browser = await chromium.launch()"," page = await browser.new_page()"," page.on(\"dialog\", handle_dialog)"," page.evaluate(\"alert('1')\")"," await browser.close()","","async def main():"," async with async_playwright() as playwright:"," await run(playwright)","asyncio.run(main())"],"codeLang":"python async"},{"type":"code","lines":["from playwright.sync_api import sync_playwright","","def handle_dialog(dialog):"," print(dialog.message)"," dialog.dismiss()","","def run(playwright):"," chromium = playwright.chromium"," browser = chromium.launch()"," page = browser.new_page()"," page.on(\"dialog\", handle_dialog)"," page.evaluate(\"alert('1')\")"," browser.close()","","with sync_playwright() as playwright:"," run(playwright)"],"codeLang":"python sync"},{"type":"code","lines":["using Microsoft.Playwright;","using System.Threading.Tasks;","","class DialogExample","{"," public static async Task Run()"," {"," using var playwright = await Playwright.CreateAsync();"," await using var browser = await playwright.Chromium.LaunchAsync();"," var page = await browser.NewPageAsync();",""," page.Dialog += async (_, dialog) =>"," {"," System.Console.WriteLine(dialog.Message);"," await dialog.DismissAsync();"," };",""," await page.EvaluateAsync(\"alert('1');\");"," }","}"],"codeLang":"csharp"},{"type":"note","noteType":"note","text":"Dialogs are dismissed automatically, unless there is a [`event: Page.dialog`] listener. When listener is present, it **must** either [`method: Dialog.accept`] or [`method: Dialog.dismiss`] the dialog - otherwise the page will [freeze](https://developer.mozilla.org/en-US/docs/Web/JavaScript/EventLoop#never_blocking) waiting for the dialog, and actions like click will never finish."}],"langs":{},"comment":"`Dialog` objects are dispatched by page via the [`event: Page.dialog`] event.\n\nAn example of using `Dialog` class:\n\n```js\nconst { chromium } = require('playwright'); // Or 'firefox' or 'webkit'.\n\n(async () => {\n const browser = await chromium.launch();\n const page = await browser.newPage();\n page.on('dialog', async dialog => {\n console.log(dialog.message());\n await dialog.dismiss();\n });\n await page.evaluate(() => alert('1'));\n await browser.close();\n})();\n```\n\n```java\nimport com.microsoft.playwright.*;\n\npublic class Example {\n public static void main(String[] args) {\n try (Playwright playwright = Playwright.create()) {\n BrowserType chromium = playwright.chromium();\n Browser browser = chromium.launch();\n Page page = browser.newPage();\n page.onDialog(dialog -> {\n System.out.println(dialog.message());\n dialog.dismiss();\n });\n page.evaluate(\"alert('1')\");\n browser.close();\n }\n }\n}\n```\n\n```python async\nimport asyncio\nfrom playwright.async_api import async_playwright\n\nasync def handle_dialog(dialog):\n print(dialog.message)\n await dialog.dismiss()\n\nasync def run(playwright):\n chromium = playwright.chromium\n browser = await chromium.launch()\n page = await browser.new_page()\n page.on(\"dialog\", handle_dialog)\n page.evaluate(\"alert('1')\")\n await browser.close()\n\nasync def main():\n async with async_playwright() as playwright:\n await run(playwright)\nasyncio.run(main())\n```\n\n```python sync\nfrom playwright.sync_api import sync_playwright\n\ndef handle_dialog(dialog):\n print(dialog.message)\n dialog.dismiss()\n\ndef run(playwright):\n chromium = playwright.chromium\n browser = chromium.launch()\n page = browser.new_page()\n page.on(\"dialog\", handle_dialog)\n page.evaluate(\"alert('1')\")\n browser.close()\n\nwith sync_playwright() as playwright:\n run(playwright)\n```\n\n```csharp\nusing Microsoft.Playwright;\nusing System.Threading.Tasks;\n\nclass DialogExample\n{\n public static async Task Run()\n {\n using var playwright = await Playwright.CreateAsync();\n await using var browser = await playwright.Chromium.LaunchAsync();\n var page = await browser.NewPageAsync();\n\n page.Dialog += async (_, dialog) =>\n {\n System.Console.WriteLine(dialog.Message);\n await dialog.DismissAsync();\n };\n\n await page.EvaluateAsync(\"alert('1');\");\n }\n}\n```\n\n> NOTE: Dialogs are dismissed automatically, unless there is a [`event: Page.dialog`] listener. When listener is\npresent, it **must** either [`method: Dialog.accept`] or [`method: Dialog.dismiss`] the dialog - otherwise the page will\n[freeze](https://developer.mozilla.org/en-US/docs/Web/JavaScript/EventLoop#never_blocking) waiting for the dialog, and\nactions like click will never finish.","members":[{"kind":"method","langs":{},"name":"accept","type":{"name":"void"},"spec":[{"type":"text","text":"Returns when the dialog has been accepted."}],"required":true,"comment":"Returns when the dialog has been accepted.","deprecated":false,"async":true,"alias":"accept","args":[{"kind":"property","langs":{},"name":"promptText","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A text to enter in prompt. Does not cause any effects if the dialog's `type` is not prompt. Optional."}],"required":false,"comment":"A text to enter in prompt. Does not cause any effects if the dialog's `type` is not prompt. Optional.","deprecated":false,"async":false,"alias":"promptText"}]},{"kind":"method","langs":{},"name":"defaultValue","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"If dialog is prompt, returns default prompt value. Otherwise, returns empty string."}],"required":true,"comment":"If dialog is prompt, returns default prompt value. Otherwise, returns empty string.","deprecated":false,"async":false,"alias":"defaultValue","args":[]},{"kind":"method","langs":{},"name":"dismiss","type":{"name":"void"},"spec":[{"type":"text","text":"Returns when the dialog has been dismissed."}],"required":true,"comment":"Returns when the dialog has been dismissed.","deprecated":false,"async":true,"alias":"dismiss","args":[]},{"kind":"method","langs":{},"name":"message","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A message displayed in the dialog."}],"required":true,"comment":"A message displayed in the dialog.","deprecated":false,"async":false,"alias":"message","args":[]},{"kind":"method","langs":{},"name":"type","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Returns dialog's type, can be one of `alert`, `beforeunload`, `confirm` or `prompt`."}],"required":true,"comment":"Returns dialog's type, can be one of `alert`, `beforeunload`, `confirm` or `prompt`.","deprecated":false,"async":false,"alias":"type","args":[]}]},{"name":"Download","spec":[{"type":"text","text":"`Download` objects are dispatched by page via the [`event: Page.download`] event."},{"type":"text","text":"If `downloadsPath` isn't specified, all the downloaded files belonging to the browser context are deleted when the browser context is closed. And all downloaded files are deleted when the browser closes."},{"type":"text","text":"Download event is emitted once the download starts. Download path becomes available once download completes:"},{"type":"code","lines":["const [ download ] = await Promise.all(["," page.waitForEvent('download'), // wait for download to start"," page.click('a')","]);","// wait for download to complete","const path = await download.path();"],"codeLang":"js"},{"type":"code","lines":["// wait for download to start","Download download = page.waitForDownload(() -> page.click(\"a\"));","// wait for download to complete","Path path = download.path();"],"codeLang":"java"},{"type":"code","lines":["// wait for download to start","Download download = page.waitForDownload(() -> {"," page.click(\"a\");","});","// wait for download to complete","Path path = download.path();"],"codeLang":"java"},{"type":"code","lines":["async with page.expect_download() as download_info:"," await page.click(\"a\")","download = await download_info.value","# waits for download to complete","path = await download.path()"],"codeLang":"python async"},{"type":"code","lines":["with page.expect_download() as download_info:"," page.click(\"a\")","download = download_info.value","# wait for download to complete","path = download.path()"],"codeLang":"python sync"},{"type":"code","lines":["var download = await page.RunAndWaitForDownloadAsync(async () =>","{"," await page.ClickAsync(\"#downloadButton\");","});","Console.WriteLine(await download.PathAsync());"],"codeLang":"csharp"},{"type":"note","noteType":"note","text":"Browser context **must** be created with the `acceptDownloads` set to `true` when user needs access to the downloaded content. If `acceptDownloads` is not set, download events are emitted, but the actual download is not performed and user has no access to the downloaded files."}],"langs":{},"comment":"`Download` objects are dispatched by page via the [`event: Page.download`] event.\n\nIf `downloadsPath` isn't specified, all the downloaded files belonging to the browser context are deleted when the\nbrowser context is closed. And all downloaded files are deleted when the browser closes.\n\nDownload event is emitted once the download starts. Download path becomes available once download completes:\n\n```js\nconst [ download ] = await Promise.all([\n page.waitForEvent('download'), // wait for download to start\n page.click('a')\n]);\n// wait for download to complete\nconst path = await download.path();\n```\n\n```java\n// wait for download to start\nDownload download = page.waitForDownload(() -> page.click(\"a\"));\n// wait for download to complete\nPath path = download.path();\n```\n\n```java\n// wait for download to start\nDownload download = page.waitForDownload(() -> {\n page.click(\"a\");\n});\n// wait for download to complete\nPath path = download.path();\n```\n\n```python async\nasync with page.expect_download() as download_info:\n await page.click(\"a\")\ndownload = await download_info.value\n# waits for download to complete\npath = await download.path()\n```\n\n```python sync\nwith page.expect_download() as download_info:\n page.click(\"a\")\ndownload = download_info.value\n# wait for download to complete\npath = download.path()\n```\n\n```csharp\nvar download = await page.RunAndWaitForDownloadAsync(async () =>\n{\n await page.ClickAsync(\"#downloadButton\");\n});\nConsole.WriteLine(await download.PathAsync());\n```\n\n> NOTE: Browser context **must** be created with the `acceptDownloads` set to `true` when user needs access to the\ndownloaded content. If `acceptDownloads` is not set, download events are emitted, but the actual download is not\nperformed and user has no access to the downloaded files.","members":[{"kind":"method","langs":{},"name":"_cancel","type":{"name":"void"},"spec":[{"type":"text","text":"**Chromium-only** Cancels a download. Will not fail if the download is already finished or canceled. Upon successful cancellations, `download.failure()` would resolve to `'canceled'`."},{"type":"text","text":"Currently **experimental** and may subject to further changes."}],"required":true,"comment":"**Chromium-only** Cancels a download. Will not fail if the download is already finished or canceled. Upon successful\ncancellations, `download.failure()` would resolve to `'canceled'`.\n\nCurrently **experimental** and may subject to further changes.","deprecated":false,"async":true,"alias":"_cancel","args":[]},{"kind":"method","langs":{"only":["java","js","csharp"],"aliases":{},"types":{},"overrides":{}},"name":"createReadStream","type":{"name":"","union":[{"name":"null"},{"name":"Readable"}],"expression":"[null]|[Readable]"},"spec":[{"type":"text","text":"Returns readable stream for current download or `null` if download failed."}],"required":true,"comment":"Returns readable stream for current download or `null` if download failed.","deprecated":false,"async":true,"alias":"createReadStream","args":[]},{"kind":"method","langs":{},"name":"delete","type":{"name":"void"},"spec":[{"type":"text","text":"Deletes the downloaded file. Will wait for the download to finish if necessary."}],"required":true,"comment":"Deletes the downloaded file. Will wait for the download to finish if necessary.","deprecated":false,"async":true,"alias":"delete","args":[]},{"kind":"method","langs":{},"name":"failure","type":{"name":"","union":[{"name":"null"},{"name":"string"}],"expression":"[null]|[string]"},"spec":[{"type":"text","text":"Returns download error if any. Will wait for the download to finish if necessary."}],"required":true,"comment":"Returns download error if any. Will wait for the download to finish if necessary.","deprecated":false,"async":true,"alias":"failure","args":[]},{"kind":"method","langs":{},"name":"page","type":{"name":"Page","expression":"[Page]"},"spec":[{"type":"text","text":"Get the page that the download belongs to."}],"required":true,"comment":"Get the page that the download belongs to.","deprecated":false,"async":false,"alias":"page","args":[]},{"kind":"method","langs":{},"name":"path","type":{"name":"","union":[{"name":"null"},{"name":"path"}],"expression":"[null]|[path]"},"spec":[{"type":"text","text":"Returns path to the downloaded file in case of successful download. The method will wait for the download to finish if necessary. The method throws when connected remotely."}],"required":true,"comment":"Returns path to the downloaded file in case of successful download. The method will wait for the download to finish if\nnecessary. The method throws when connected remotely.","deprecated":false,"async":true,"alias":"path","args":[]},{"kind":"method","langs":{},"name":"saveAs","type":{"name":"void"},"spec":[{"type":"text","text":"Copy the download to a user-specified path. It is safe to call this method while the download is still in progress. Will wait for the download to finish if necessary."}],"required":true,"comment":"Copy the download to a user-specified path. It is safe to call this method while the download is still in progress. Will\nwait for the download to finish if necessary.","deprecated":false,"async":true,"alias":"saveAs","args":[{"kind":"property","langs":{},"name":"path","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"Path where the download should be copied."}],"required":true,"comment":"Path where the download should be copied.","deprecated":false,"async":false,"alias":"path"}]},{"kind":"method","langs":{},"name":"suggestedFilename","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Returns suggested filename for this download. It is typically computed by the browser from the [`Content-Disposition`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition) response header or the `download` attribute. See the spec on [whatwg](https://html.spec.whatwg.org/#downloading-resources). Different browsers can use different logic for computing it."}],"required":true,"comment":"Returns suggested filename for this download. It is typically computed by the browser from the\n[`Content-Disposition`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition) response header\nor the `download` attribute. See the spec on [whatwg](https://html.spec.whatwg.org/#downloading-resources). Different\nbrowsers can use different logic for computing it.","deprecated":false,"async":false,"alias":"suggestedFilename","args":[]},{"kind":"method","langs":{},"name":"url","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Returns downloaded url."}],"required":true,"comment":"Returns downloaded url.","deprecated":false,"async":false,"alias":"url","args":[]}]},{"name":"Electron","spec":[{"type":"text","text":"Playwright has **experimental** support for Electron automation. You can access electron namespace via:"},{"type":"code","lines":["const { _electron } = require('playwright');"],"codeLang":"js"},{"type":"text","text":"An example of the Electron automation script would be:"},{"type":"code","lines":["const { _electron: electron } = require('playwright');","","(async () => {"," // Launch Electron app."," const electronApp = await electron.launch({ args: ['main.js'] });",""," // Evaluation expression in the Electron context."," const appPath = await electronApp.evaluate(async ({ app }) => {"," // This runs in the main Electron process, parameter here is always"," // the result of the require('electron') in the main app script."," return app.getAppPath();"," });"," console.log(appPath);",""," // Get the first window that the app opens, wait if necessary."," const window = await electronApp.firstWindow();"," // Print the title."," console.log(await window.title());"," // Capture a screenshot."," await window.screenshot({ path: 'intro.png' });"," // Direct Electron console to Node terminal."," window.on('console', console.log);"," // Click button."," await window.click('text=Click me');"," // Exit app."," await electronApp.close();","})();"],"codeLang":"js"},{"type":"text","text":"Note that since you don't need Playwright to install web browsers when testing Electron, you can omit browser download via setting the following environment variable when installing Playwright:"},{"type":"code","lines":["PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm i -D playwright"],"codeLang":"bash js"}],"langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"comment":"Playwright has **experimental** support for Electron automation. You can access electron namespace via:\n\n```js\nconst { _electron } = require('playwright');\n```\n\nAn example of the Electron automation script would be:\n\n```js\nconst { _electron: electron } = require('playwright');\n\n(async () => {\n // Launch Electron app.\n const electronApp = await electron.launch({ args: ['main.js'] });\n\n // Evaluation expression in the Electron context.\n const appPath = await electronApp.evaluate(async ({ app }) => {\n // This runs in the main Electron process, parameter here is always\n // the result of the require('electron') in the main app script.\n return app.getAppPath();\n });\n console.log(appPath);\n\n // Get the first window that the app opens, wait if necessary.\n const window = await electronApp.firstWindow();\n // Print the title.\n console.log(await window.title());\n // Capture a screenshot.\n await window.screenshot({ path: 'intro.png' });\n // Direct Electron console to Node terminal.\n window.on('console', console.log);\n // Click button.\n await window.click('text=Click me');\n // Exit app.\n await electronApp.close();\n})();\n```\n\nNote that since you don't need Playwright to install web browsers when testing Electron, you can omit browser download\nvia setting the following environment variable when installing Playwright:\n\n```bash js\nPLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm i -D playwright\n```\n","members":[{"kind":"method","langs":{},"name":"launch","type":{"name":"ElectronApplication","expression":"[ElectronApplication]"},"spec":[{"type":"text","text":"Launches electron application specified with the `executablePath`."}],"required":true,"comment":"Launches electron application specified with the `executablePath`.","deprecated":false,"async":true,"alias":"launch","args":[{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"acceptDownloads","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether to automatically download all the attachments. Defaults to `false` where all the downloads are canceled."}],"required":false,"comment":"Whether to automatically download all the attachments. Defaults to `false` where all the downloads are canceled.","deprecated":false,"async":false,"alias":"acceptDownloads"},{"kind":"property","langs":{},"name":"args","type":{"name":"Array","templates":[{"name":"string"}],"expression":"[Array]<[string]>"},"spec":[{"type":"text","text":"Additional arguments to pass to the application when launching. You typically pass the main script name here."}],"required":false,"comment":"Additional arguments to pass to the application when launching. You typically pass the main script name here.","deprecated":false,"async":false,"alias":"args"},{"kind":"property","langs":{},"name":"bypassCSP","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Toggles bypassing page's Content-Security-Policy."}],"required":false,"comment":"Toggles bypassing page's Content-Security-Policy.","deprecated":false,"async":false,"alias":"bypassCSP"},{"kind":"property","langs":{},"name":"colorScheme","type":{"name":"ColorScheme","union":[{"name":"\"light\""},{"name":"\"dark\""},{"name":"\"no-preference\""}],"expression":"[ColorScheme]<\"light\"|\"dark\"|\"no-preference\">"},"spec":[{"type":"text","text":"Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. See [`method: Page.emulateMedia`] for more details. Defaults to `'light'`."}],"required":false,"comment":"Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. See\n[`method: Page.emulateMedia`] for more details. Defaults to `'light'`.","deprecated":false,"async":false,"alias":"colorScheme"},{"kind":"property","langs":{},"name":"cwd","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Current working directory to launch application from."}],"required":false,"comment":"Current working directory to launch application from.","deprecated":false,"async":false,"alias":"cwd"},{"kind":"property","langs":{},"name":"env","type":{"name":"Object","templates":[{"name":"string"},{"name":"string"}],"expression":"[Object]<[string], [string]>"},"spec":[{"type":"text","text":"Specifies environment variables that will be visible to Electron. Defaults to `process.env`."}],"required":false,"comment":"Specifies environment variables that will be visible to Electron. Defaults to `process.env`.","deprecated":false,"async":false,"alias":"env"},{"kind":"property","langs":{},"name":"executablePath","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Launches given Electron application. If not specified, launches the default Electron executable installed in this package, located at `node_modules/.bin/electron`."}],"required":false,"comment":"Launches given Electron application. If not specified, launches the default Electron executable installed in this\npackage, located at `node_modules/.bin/electron`.","deprecated":false,"async":false,"alias":"executablePath"},{"kind":"property","langs":{},"name":"extraHTTPHeaders","type":{"name":"Object","templates":[{"name":"string"},{"name":"string"}],"expression":"[Object]<[string], [string]>"},"spec":[{"type":"text","text":"An object containing additional HTTP headers to be sent with every request. All header values must be strings."}],"required":false,"comment":"An object containing additional HTTP headers to be sent with every request. All header values must be strings.","deprecated":false,"async":false,"alias":"extraHTTPHeaders"},{"kind":"property","langs":{},"name":"geolocation","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"latitude","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Latitude between -90 and 90."}],"required":true,"comment":"Latitude between -90 and 90.","deprecated":false,"async":false,"alias":"latitude"},{"kind":"property","langs":{},"name":"longitude","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Longitude between -180 and 180."}],"required":true,"comment":"Longitude between -180 and 180.","deprecated":false,"async":false,"alias":"longitude"},{"kind":"property","langs":{},"name":"accuracy","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Non-negative accuracy value. Defaults to `0`."}],"required":false,"comment":"Non-negative accuracy value. Defaults to `0`.","deprecated":false,"async":false,"alias":"accuracy"}],"expression":"[Object]"},"spec":[],"required":false,"comment":"","deprecated":false,"async":false,"alias":"geolocation"},{"kind":"property","langs":{},"name":"httpCredentials","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"username","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"username"},{"kind":"property","langs":{},"name":"password","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"password"}],"expression":"[Object]"},"spec":[{"type":"text","text":"Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication)."}],"required":false,"comment":"Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication).","deprecated":false,"async":false,"alias":"httpCredentials"},{"kind":"property","langs":{},"name":"ignoreHTTPSErrors","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether to ignore HTTPS errors during navigation. Defaults to `false`."}],"required":false,"comment":"Whether to ignore HTTPS errors during navigation. Defaults to `false`.","deprecated":false,"async":false,"alias":"ignoreHTTPSErrors"},{"kind":"property","langs":{},"name":"locale","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Specify user locale, for example `en-GB`, `de-DE`, etc. Locale will affect `navigator.language` value, `Accept-Language` request header value as well as number and date formatting rules."}],"required":false,"comment":"Specify user locale, for example `en-GB`, `de-DE`, etc. Locale will affect `navigator.language` value, `Accept-Language`\nrequest header value as well as number and date formatting rules.","deprecated":false,"async":false,"alias":"locale"},{"kind":"property","langs":{},"name":"offline","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether to emulate network being offline. Defaults to `false`."}],"required":false,"comment":"Whether to emulate network being offline. Defaults to `false`.","deprecated":false,"async":false,"alias":"offline"},{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"recordHar","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"omitContent","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Optional setting to control whether to omit request content from the HAR. Defaults to `false`."}],"required":false,"comment":"Optional setting to control whether to omit request content from the HAR. Defaults to `false`.","deprecated":false,"async":false,"alias":"omitContent"},{"kind":"property","langs":{},"name":"path","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"Path on the filesystem to write the HAR file to."}],"required":true,"comment":"Path on the filesystem to write the HAR file to.","deprecated":false,"async":false,"alias":"path"}],"expression":"[Object]"},"spec":[{"type":"text","text":"Enables [HAR](http://www.softwareishard.com/blog/har-12-spec) recording for all pages into `recordHar.path` file. If not specified, the HAR is not recorded. Make sure to await [`method: BrowserContext.close`] for the HAR to be saved."}],"required":false,"comment":"Enables [HAR](http://www.softwareishard.com/blog/har-12-spec) recording for all pages into `recordHar.path` file. If not\nspecified, the HAR is not recorded. Make sure to await [`method: BrowserContext.close`] for the HAR to be saved.","deprecated":false,"async":false,"alias":"recordHar"},{"kind":"property","langs":{"only":["csharp","java","python"],"aliases":{"python":"record_har_omit_content"},"types":{},"overrides":{}},"name":"recordHarOmitContent","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Optional setting to control whether to omit request content from the HAR. Defaults to `false`."}],"required":false,"comment":"Optional setting to control whether to omit request content from the HAR. Defaults to `false`.","deprecated":false,"async":false,"alias":"recordHarOmitContent"},{"kind":"property","langs":{"only":["csharp","java","python"],"aliases":{"python":"record_har_path"},"types":{},"overrides":{}},"name":"recordHarPath","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"Enables [HAR](http://www.softwareishard.com/blog/har-12-spec) recording for all pages into the specified HAR file on the filesystem. If not specified, the HAR is not recorded. Make sure to call [`method: BrowserContext.close`] for the HAR to be saved."}],"required":false,"comment":"Enables [HAR](http://www.softwareishard.com/blog/har-12-spec) recording for all pages into the specified HAR file on the\nfilesystem. If not specified, the HAR is not recorded. Make sure to call [`method: BrowserContext.close`] for the HAR to\nbe saved.","deprecated":false,"async":false,"alias":"recordHarPath"},{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"recordVideo","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"dir","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"Path to the directory to put videos into."}],"required":true,"comment":"Path to the directory to put videos into.","deprecated":false,"async":false,"alias":"dir"},{"kind":"property","langs":{},"name":"size","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"width","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"Video frame width."}],"required":true,"comment":"Video frame width.","deprecated":false,"async":false,"alias":"width"},{"kind":"property","langs":{},"name":"height","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"Video frame height."}],"required":true,"comment":"Video frame height.","deprecated":false,"async":false,"alias":"height"}],"expression":"[Object]"},"spec":[{"type":"text","text":"Optional dimensions of the recorded videos. If not specified the size will be equal to `viewport` scaled down to fit into 800x800. If `viewport` is not configured explicitly the video size defaults to 800x450. Actual picture of each page will be scaled down if necessary to fit the specified size."}],"required":false,"comment":"Optional dimensions of the recorded videos. If not specified the size will be equal to `viewport` scaled down to fit\ninto 800x800. If `viewport` is not configured explicitly the video size defaults to 800x450. Actual picture of each page\nwill be scaled down if necessary to fit the specified size.","deprecated":false,"async":false,"alias":"size"}],"expression":"[Object]"},"spec":[{"type":"text","text":"Enables video recording for all pages into `recordVideo.dir` directory. If not specified videos are not recorded. Make sure to await [`method: BrowserContext.close`] for videos to be saved."}],"required":false,"comment":"Enables video recording for all pages into `recordVideo.dir` directory. If not specified videos are not recorded. Make\nsure to await [`method: BrowserContext.close`] for videos to be saved.","deprecated":false,"async":false,"alias":"recordVideo"},{"kind":"property","langs":{"only":["csharp","java","python"],"aliases":{"python":"record_video_dir"},"types":{},"overrides":{}},"name":"recordVideoDir","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"Enables video recording for all pages into the specified directory. If not specified videos are not recorded. Make sure to call [`method: BrowserContext.close`] for videos to be saved."}],"required":false,"comment":"Enables video recording for all pages into the specified directory. If not specified videos are not recorded. Make sure\nto call [`method: BrowserContext.close`] for videos to be saved.","deprecated":false,"async":false,"alias":"recordVideoDir"},{"kind":"property","langs":{"only":["csharp","java","python"],"aliases":{"python":"record_video_size"},"types":{},"overrides":{}},"name":"recordVideoSize","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"width","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"Video frame width."}],"required":true,"comment":"Video frame width.","deprecated":false,"async":false,"alias":"width"},{"kind":"property","langs":{},"name":"height","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"Video frame height."}],"required":true,"comment":"Video frame height.","deprecated":false,"async":false,"alias":"height"}],"expression":"[Object]"},"spec":[{"type":"text","text":"Dimensions of the recorded videos. If not specified the size will be equal to `viewport` scaled down to fit into 800x800. If `viewport` is not configured explicitly the video size defaults to 800x450. Actual picture of each page will be scaled down if necessary to fit the specified size."}],"required":false,"comment":"Dimensions of the recorded videos. If not specified the size will be equal to `viewport` scaled down to fit into\n800x800. If `viewport` is not configured explicitly the video size defaults to 800x450. Actual picture of each page will\nbe scaled down if necessary to fit the specified size.","deprecated":false,"async":false,"alias":"recordVideoSize"},{"kind":"property","langs":{},"name":"timezoneId","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Changes the timezone of the context. See [ICU's metaZones.txt](https://cs.chromium.org/chromium/src/third_party/icu/source/data/misc/metaZones.txt?rcl=faee8bc70570192d82d2978a71e2a615788597d1) for a list of supported timezone IDs."}],"required":false,"comment":"Changes the timezone of the context. See\n[ICU's metaZones.txt](https://cs.chromium.org/chromium/src/third_party/icu/source/data/misc/metaZones.txt?rcl=faee8bc70570192d82d2978a71e2a615788597d1)\nfor a list of supported timezone IDs.","deprecated":false,"async":false,"alias":"timezoneId"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]}]},{"name":"ElectronApplication","spec":[{"type":"text","text":"Electron application representation. You can use [`method: Electron.launch`] to obtain the application instance. This instance you can control main electron process as well as work with Electron windows:"},{"type":"code","lines":["const { _electron: electron } = require('playwright');","","(async () => {"," // Launch Electron app."," const electronApp = await electron.launch({ args: ['main.js'] });",""," // Evaluation expression in the Electron context."," const appPath = await electronApp.evaluate(async ({ app }) => {"," // This runs in the main Electron process, parameter here is always"," // the result of the require('electron') in the main app script."," return app.getAppPath();"," });"," console.log(appPath);",""," // Get the first window that the app opens, wait if necessary."," const window = await electronApp.firstWindow();"," // Print the title."," console.log(await window.title());"," // Capture a screenshot."," await window.screenshot({ path: 'intro.png' });"," // Direct Electron console to Node terminal."," window.on('console', console.log);"," // Click button."," await window.click('text=Click me');"," // Exit app."," await electronApp.close();","})();"],"codeLang":"js"}],"langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"comment":"Electron application representation. You can use [`method: Electron.launch`] to obtain the application instance. This\ninstance you can control main electron process as well as work with Electron windows:\n\n```js\nconst { _electron: electron } = require('playwright');\n\n(async () => {\n // Launch Electron app.\n const electronApp = await electron.launch({ args: ['main.js'] });\n\n // Evaluation expression in the Electron context.\n const appPath = await electronApp.evaluate(async ({ app }) => {\n // This runs in the main Electron process, parameter here is always\n // the result of the require('electron') in the main app script.\n return app.getAppPath();\n });\n console.log(appPath);\n\n // Get the first window that the app opens, wait if necessary.\n const window = await electronApp.firstWindow();\n // Print the title.\n console.log(await window.title());\n // Capture a screenshot.\n await window.screenshot({ path: 'intro.png' });\n // Direct Electron console to Node terminal.\n window.on('console', console.log);\n // Click button.\n await window.click('text=Click me');\n // Exit app.\n await electronApp.close();\n})();\n```\n","members":[{"kind":"event","langs":{},"name":"close","type":{"name":"void"},"spec":[{"type":"text","text":"This event is issued when the application closes."}],"required":true,"comment":"This event is issued when the application closes.","deprecated":false,"async":false,"alias":"close","args":[]},{"kind":"event","langs":{},"name":"window","type":{"name":"Page","expression":"[Page]"},"spec":[{"type":"text","text":"This event is issued for every window that is created **and loaded** in Electron. It contains a `Page` that can be used for Playwright automation."}],"required":true,"comment":"This event is issued for every window that is created **and loaded** in Electron. It contains a `Page` that can be used\nfor Playwright automation.","deprecated":false,"async":false,"alias":"window","args":[]},{"kind":"method","langs":{},"name":"browserWindow","type":{"name":"JSHandle","expression":"[JSHandle]"},"spec":[{"type":"text","text":"Returns the BrowserWindow object that corresponds to the given Playwright page."}],"required":true,"comment":"Returns the BrowserWindow object that corresponds to the given Playwright page.","deprecated":false,"async":true,"alias":"browserWindow","args":[{"kind":"property","langs":{},"name":"page","type":{"name":"Page","expression":"[Page]"},"spec":[{"type":"text","text":"Page to retrieve the window for."}],"required":true,"comment":"Page to retrieve the window for.","deprecated":false,"async":false,"alias":"page"}]},{"kind":"method","langs":{},"name":"close","type":{"name":"void"},"spec":[{"type":"text","text":"Closes Electron application."}],"required":true,"comment":"Closes Electron application.","deprecated":false,"async":true,"alias":"close","args":[]},{"kind":"method","langs":{},"name":"context","type":{"name":"BrowserContext","expression":"[BrowserContext]"},"spec":[{"type":"text","text":"This method returns browser context that can be used for setting up context-wide routing, etc."}],"required":true,"comment":"This method returns browser context that can be used for setting up context-wide routing, etc.","deprecated":false,"async":false,"alias":"context","args":[]},{"kind":"method","langs":{},"name":"evaluate","type":{"name":"Serializable","expression":"[Serializable]"},"spec":[{"type":"text","text":"Returns the return value of `expression`."},{"type":"text","text":"If the function passed to the [`method: ElectronApplication.evaluate`] returns a [Promise], then [`method: ElectronApplication.evaluate`] would wait for the promise to resolve and return its value."},{"type":"text","text":"If the function passed to the [`method: ElectronApplication.evaluate`] returns a non-[Serializable] value, then [`method: ElectronApplication.evaluate`] returns `undefined`. Playwright also supports transferring some additional values that are not serializable by `JSON`: `-0`, `NaN`, `Infinity`, `-Infinity`."}],"required":true,"comment":"Returns the return value of `expression`.\n\nIf the function passed to the [`method: ElectronApplication.evaluate`] returns a [Promise], then\n[`method: ElectronApplication.evaluate`] would wait for the promise to resolve and return its value.\n\nIf the function passed to the [`method: ElectronApplication.evaluate`] returns a non-[Serializable] value, then\n[`method: ElectronApplication.evaluate`] returns `undefined`. Playwright also supports transferring some additional\nvalues that are not serializable by `JSON`: `-0`, `NaN`, `Infinity`, `-Infinity`.","deprecated":false,"async":true,"alias":"evaluate","args":[{"kind":"property","langs":{"overrides":{"js":{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"expression","type":{"name":"","union":[{"name":"function"},{"name":"Electron"}],"expression":"[function]|[Electron]"},"spec":[{"type":"text","text":"Function to be evaluated in the worker context."}],"argsArray":[],"required":true,"comment":"","args":{},"clazz":null,"deprecated":false,"async":false,"alias":"pageFunction"}}},"name":"expression","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted as a function. Otherwise, evaluated as an expression."}],"required":true,"comment":"JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted\nas a function. Otherwise, evaluated as an expression.","deprecated":false,"async":false,"alias":"expression"},{"kind":"property","langs":{},"name":"arg","type":{"name":"EvaluationArgument","expression":"[EvaluationArgument]"},"spec":[{"type":"text","text":"Optional argument to pass to `expression`."}],"required":false,"comment":"Optional argument to pass to `expression`.","deprecated":false,"async":false,"alias":"arg"}]},{"kind":"method","langs":{},"name":"evaluateHandle","type":{"name":"JSHandle","expression":"[JSHandle]"},"spec":[{"type":"text","text":"Returns the return value of `expression` as a `JSHandle`."},{"type":"text","text":"The only difference between [`method: ElectronApplication.evaluate`] and [`method: ElectronApplication.evaluateHandle`] is that [`method: ElectronApplication.evaluateHandle`] returns `JSHandle`."},{"type":"text","text":"If the function passed to the [`method: ElectronApplication.evaluateHandle`] returns a [Promise], then [`method: ElectronApplication.evaluateHandle`] would wait for the promise to resolve and return its value."}],"required":true,"comment":"Returns the return value of `expression` as a `JSHandle`.\n\nThe only difference between [`method: ElectronApplication.evaluate`] and [`method: ElectronApplication.evaluateHandle`]\nis that [`method: ElectronApplication.evaluateHandle`] returns `JSHandle`.\n\nIf the function passed to the [`method: ElectronApplication.evaluateHandle`] returns a [Promise], then\n[`method: ElectronApplication.evaluateHandle`] would wait for the promise to resolve and return its value.","deprecated":false,"async":true,"alias":"evaluateHandle","args":[{"kind":"property","langs":{"overrides":{"js":{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"expression","type":{"name":"","union":[{"name":"function"},{"name":"Electron"}],"expression":"[function]|[Electron]"},"spec":[{"type":"text","text":"Function to be evaluated in the worker context."}],"argsArray":[],"required":true,"comment":"","args":{},"clazz":null,"deprecated":false,"async":false,"alias":"pageFunction"}}},"name":"expression","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted as a function. Otherwise, evaluated as an expression."}],"required":true,"comment":"JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted\nas a function. Otherwise, evaluated as an expression.","deprecated":false,"async":false,"alias":"expression"},{"kind":"property","langs":{},"name":"arg","type":{"name":"EvaluationArgument","expression":"[EvaluationArgument]"},"spec":[],"required":true,"comment":"","deprecated":false,"async":false,"alias":"arg"}]},{"kind":"method","langs":{},"name":"firstWindow","type":{"name":"Page","expression":"[Page]"},"spec":[{"type":"text","text":"Convenience method that waits for the first application window to be opened. Typically your script will start with:"},{"type":"code","lines":[" const electronApp = await electron.launch({"," args: ['main.js']"," });"," const window = await electronApp.firstWindow();"," // ..."],"codeLang":"js"}],"required":true,"comment":"Convenience method that waits for the first application window to be opened. Typically your script will start with:\n\n```js\n const electronApp = await electron.launch({\n args: ['main.js']\n });\n const window = await electronApp.firstWindow();\n // ...\n```\n","deprecated":false,"async":true,"alias":"firstWindow","args":[]},{"kind":"method","langs":{},"name":"waitForEvent","type":{"name":"any","expression":"[any]"},"spec":[{"type":"text","text":"Waits for event to fire and passes its value into the predicate function. Returns when the predicate returns truthy value. Will throw an error if the application is closed before the event is fired. Returns the event data value."},{"type":"code","lines":["const [window] = await Promise.all(["," electronApp.waitForEvent('window'),"," mainWindow.click('button')","]);"],"codeLang":"js"}],"required":true,"comment":"Waits for event to fire and passes its value into the predicate function. Returns when the predicate returns truthy\nvalue. Will throw an error if the application is closed before the event is fired. Returns the event data value.\n\n```js\nconst [window] = await Promise.all([\n electronApp.waitForEvent('window'),\n mainWindow.click('button')\n]);\n```\n","deprecated":false,"async":true,"alias":"waitForEvent","args":[{"kind":"property","langs":{"only":["js","python","java"],"aliases":{},"types":{},"overrides":{}},"name":"event","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Event name, same one typically passed into `*.on(event)`."}],"required":true,"comment":"Event name, same one typically passed into `*.on(event)`.","deprecated":false,"async":false,"alias":"event"},{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"optionsOrPredicate","type":{"name":"","union":[{"name":"function"},{"name":"Object","properties":[{"kind":"property","langs":{},"name":"predicate","type":{"name":"function","expression":"[function]"},"spec":[{"type":"text","text":"receives the event data and resolves to truthy value when the waiting should resolve."}],"required":true,"comment":"receives the event data and resolves to truthy value when the waiting should resolve.","deprecated":false,"async":false,"alias":"predicate"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`]."}],"required":false,"comment":"maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default\nvalue can be changed by using the [`method: BrowserContext.setDefaultTimeout`].","deprecated":false,"async":false,"alias":"timeout"}]}],"expression":"[function]|[Object]"},"spec":[{"type":"text","text":"Either a predicate that receives an event or an options object. Optional."}],"required":false,"comment":"Either a predicate that receives an event or an options object. Optional.","deprecated":false,"async":false,"alias":"optionsOrPredicate"}]},{"kind":"method","langs":{},"name":"windows","type":{"name":"Array","templates":[{"name":"Page"}],"expression":"[Array]<[Page]>"},"spec":[{"type":"text","text":"Convenience method that returns all the opened windows."}],"required":true,"comment":"Convenience method that returns all the opened windows.","deprecated":false,"async":false,"alias":"windows","args":[]}]},{"name":"ElementHandle","spec":[{"type":"li","text":"extends: `JSHandle`","liType":"bullet"},{"type":"text","text":"ElementHandle represents an in-page DOM element. ElementHandles can be created with the [`method: Page.querySelector`] method."},{"type":"code","lines":["const { chromium } = require('playwright'); // Or 'firefox' or 'webkit'.","","(async () => {"," const browser = await chromium.launch();"," const page = await browser.newPage();"," await page.goto('https://example.com');"," const hrefElement = await page.$('a');"," await hrefElement.click();"," // ...","})();"],"codeLang":"js"},{"type":"code","lines":["import com.microsoft.playwright.*;","","public class Example {"," public static void main(String[] args) {"," try (Playwright playwright = Playwright.create()) {"," BrowserType chromium = playwright.chromium();"," Browser browser = chromium.launch();"," Page page = browser.newPage();"," page.navigate(\"https://example.com\");"," ElementHandle hrefElement = page.querySelector(\"a\");"," hrefElement.click();"," // ..."," }"," }","}"],"codeLang":"java"},{"type":"code","lines":["import asyncio","from playwright.async_api import async_playwright","","async def run(playwright):"," chromium = playwright.chromium"," browser = await chromium.launch()"," page = await browser.new_page()"," await page.goto(\"https://example.com\")"," href_element = await page.query_selector(\"a\")"," await href_element.click()"," # ...","","async def main():"," async with async_playwright() as playwright:"," await run(playwright)","asyncio.run(main())"],"codeLang":"python async"},{"type":"code","lines":["from playwright.sync_api import sync_playwright","","def run(playwright):"," chromium = playwright.chromium"," browser = chromium.launch()"," page = browser.new_page()"," page.goto(\"https://example.com\")"," href_element = page.query_selector(\"a\")"," href_element.click()"," # ...","","with sync_playwright() as playwright:"," run(playwright)"],"codeLang":"python sync"},{"type":"code","lines":["using Microsoft.Playwright;","using System.Threading.Tasks;","","class HandleExamples","{"," public static async Task Run()"," {"," using var playwright = await Playwright.CreateAsync();"," var browser = await playwright.Chromium.LaunchAsync();"," var page = await browser.NewPageAsync();"," await page.GotoAsync(\"https://www.bing.com\");"," var handle = await page.QuerySelectorAsync(\"a\");"," await handle.ClickAsync();"," }","}"],"codeLang":"csharp"},{"type":"text","text":"ElementHandle prevents DOM element from garbage collection unless the handle is disposed with [`method: JSHandle.dispose`]. ElementHandles are auto-disposed when their origin frame gets navigated."},{"type":"text","text":"ElementHandle instances can be used as an argument in [`method: Page.evalOnSelector`] and [`method: Page.evaluate`] methods."}],"extends":"JSHandle","langs":{},"comment":"- extends: `JSHandle`\n\nElementHandle represents an in-page DOM element. ElementHandles can be created with the [`method: Page.querySelector`]\nmethod.\n\n```js\nconst { chromium } = require('playwright'); // Or 'firefox' or 'webkit'.\n\n(async () => {\n const browser = await chromium.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n const hrefElement = await page.$('a');\n await hrefElement.click();\n // ...\n})();\n```\n\n```java\nimport com.microsoft.playwright.*;\n\npublic class Example {\n public static void main(String[] args) {\n try (Playwright playwright = Playwright.create()) {\n BrowserType chromium = playwright.chromium();\n Browser browser = chromium.launch();\n Page page = browser.newPage();\n page.navigate(\"https://example.com\");\n ElementHandle hrefElement = page.querySelector(\"a\");\n hrefElement.click();\n // ...\n }\n }\n}\n```\n\n```python async\nimport asyncio\nfrom playwright.async_api import async_playwright\n\nasync def run(playwright):\n chromium = playwright.chromium\n browser = await chromium.launch()\n page = await browser.new_page()\n await page.goto(\"https://example.com\")\n href_element = await page.query_selector(\"a\")\n await href_element.click()\n # ...\n\nasync def main():\n async with async_playwright() as playwright:\n await run(playwright)\nasyncio.run(main())\n```\n\n```python sync\nfrom playwright.sync_api import sync_playwright\n\ndef run(playwright):\n chromium = playwright.chromium\n browser = chromium.launch()\n page = browser.new_page()\n page.goto(\"https://example.com\")\n href_element = page.query_selector(\"a\")\n href_element.click()\n # ...\n\nwith sync_playwright() as playwright:\n run(playwright)\n```\n\n```csharp\nusing Microsoft.Playwright;\nusing System.Threading.Tasks;\n\nclass HandleExamples\n{\n public static async Task Run()\n {\n using var playwright = await Playwright.CreateAsync();\n var browser = await playwright.Chromium.LaunchAsync();\n var page = await browser.NewPageAsync();\n await page.GotoAsync(\"https://www.bing.com\");\n var handle = await page.QuerySelectorAsync(\"a\");\n await handle.ClickAsync();\n }\n}\n```\n\nElementHandle prevents DOM element from garbage collection unless the handle is disposed with\n[`method: JSHandle.dispose`]. ElementHandles are auto-disposed when their origin frame gets navigated.\n\nElementHandle instances can be used as an argument in [`method: Page.evalOnSelector`] and [`method: Page.evaluate`]\nmethods.","members":[{"kind":"method","langs":{},"name":"boundingBox","type":{"name":"","union":[{"name":"null"},{"name":"Object","properties":[{"kind":"property","langs":{},"name":"x","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"the x coordinate of the element in pixels."}],"required":true,"comment":"the x coordinate of the element in pixels.","deprecated":false,"async":false,"alias":"x"},{"kind":"property","langs":{},"name":"y","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"the y coordinate of the element in pixels."}],"required":true,"comment":"the y coordinate of the element in pixels.","deprecated":false,"async":false,"alias":"y"},{"kind":"property","langs":{},"name":"width","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"the width of the element in pixels."}],"required":true,"comment":"the width of the element in pixels.","deprecated":false,"async":false,"alias":"width"},{"kind":"property","langs":{},"name":"height","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"the height of the element in pixels."}],"required":true,"comment":"the height of the element in pixels.","deprecated":false,"async":false,"alias":"height"}]}],"expression":"[null]|[Object]"},"spec":[{"type":"text","text":"This method returns the bounding box of the element, or `null` if the element is not visible. The bounding box is calculated relative to the main frame viewport - which is usually the same as the browser window."},{"type":"text","text":"Scrolling affects the returned bonding box, similarly to [Element.getBoundingClientRect](https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect). That means `x` and/or `y` may be negative."},{"type":"text","text":"Elements from child frames return the bounding box relative to the main frame, unlike the [Element.getBoundingClientRect](https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect)."},{"type":"text","text":"Assuming the page is static, it is safe to use bounding box coordinates to perform input. For example, the following snippet should click the center of the element."},{"type":"code","lines":["const box = await elementHandle.boundingBox();","await page.mouse.click(box.x + box.width / 2, box.y + box.height / 2);"],"codeLang":"js"},{"type":"code","lines":["BoundingBox box = elementHandle.boundingBox();","page.mouse().click(box.x + box.width / 2, box.y + box.height / 2);"],"codeLang":"java"},{"type":"code","lines":["box = await element_handle.bounding_box()","await page.mouse.click(box[\"x\"] + box[\"width\"] / 2, box[\"y\"] + box[\"height\"] / 2)"],"codeLang":"python async"},{"type":"code","lines":["box = element_handle.bounding_box()","page.mouse.click(box[\"x\"] + box[\"width\"] / 2, box[\"y\"] + box[\"height\"] / 2)"],"codeLang":"python sync"},{"type":"code","lines":["var box = await elementHandle.BoundingBoxAsync();","await page.Mouse.ClickAsync(box.X + box.Width / 2, box.Y + box.Height / 2);"],"codeLang":"csharp"}],"required":true,"comment":"This method returns the bounding box of the element, or `null` if the element is not visible. The bounding box is\ncalculated relative to the main frame viewport - which is usually the same as the browser window.\n\nScrolling affects the returned bonding box, similarly to\n[Element.getBoundingClientRect](https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect). That\nmeans `x` and/or `y` may be negative.\n\nElements from child frames return the bounding box relative to the main frame, unlike the\n[Element.getBoundingClientRect](https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect).\n\nAssuming the page is static, it is safe to use bounding box coordinates to perform input. For example, the following\nsnippet should click the center of the element.\n\n```js\nconst box = await elementHandle.boundingBox();\nawait page.mouse.click(box.x + box.width / 2, box.y + box.height / 2);\n```\n\n```java\nBoundingBox box = elementHandle.boundingBox();\npage.mouse().click(box.x + box.width / 2, box.y + box.height / 2);\n```\n\n```python async\nbox = await element_handle.bounding_box()\nawait page.mouse.click(box[\"x\"] + box[\"width\"] / 2, box[\"y\"] + box[\"height\"] / 2)\n```\n\n```python sync\nbox = element_handle.bounding_box()\npage.mouse.click(box[\"x\"] + box[\"width\"] / 2, box[\"y\"] + box[\"height\"] / 2)\n```\n\n```csharp\nvar box = await elementHandle.BoundingBoxAsync();\nawait page.Mouse.ClickAsync(box.X + box.Width / 2, box.Y + box.Height / 2);\n```\n","deprecated":false,"async":true,"alias":"boundingBox","args":[]},{"kind":"method","langs":{},"name":"check","type":{"name":"void"},"spec":[{"type":"text","text":"This method checks the element by performing the following steps:"},{"type":"li","text":"Ensure that element is a checkbox or a radio input. If not, this method throws. If the element is already checked, this method returns immediately.","liType":"ordinal"},{"type":"li","text":"Wait for [actionability](./actionability.md) checks on the element, unless `force` option is set.","liType":"ordinal"},{"type":"li","text":"Scroll the element into view if needed.","liType":"ordinal"},{"type":"li","text":"Use [`property: Page.mouse`] to click in the center of the element.","liType":"ordinal"},{"type":"li","text":"Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.","liType":"ordinal"},{"type":"li","text":"Ensure that the element is now checked. If not, this method throws.","liType":"ordinal"},{"type":"text","text":"If the element is detached from the DOM at any moment during the action, this method throws."},{"type":"text","text":"When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing zero timeout disables this."}],"required":true,"comment":"This method checks the element by performing the following steps:\n1. Ensure that element is a checkbox or a radio input. If not, this method throws. If the element is already checked,\n this method returns immediately.\n1. Wait for [actionability](./actionability.md) checks on the element, unless `force` option is set.\n1. Scroll the element into view if needed.\n1. Use [`property: Page.mouse`] to click in the center of the element.\n1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.\n1. Ensure that the element is now checked. If not, this method throws.\n\nIf the element is detached from the DOM at any moment during the action, this method throws.\n\nWhen all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing\nzero timeout disables this.","deprecated":false,"async":true,"alias":"check","args":[{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"force","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`."}],"required":false,"comment":"Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.","deprecated":false,"async":false,"alias":"force"},{"kind":"property","langs":{},"name":"noWaitAfter","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`."}],"required":false,"comment":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can\nopt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to\ninaccessible pages. Defaults to `false`.","deprecated":false,"async":false,"alias":"noWaitAfter"},{"kind":"property","langs":{},"name":"position","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"x","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"x"},{"kind":"property","langs":{},"name":"y","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"y"}],"expression":"[Object]"},"spec":[{"type":"text","text":"A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element."}],"required":false,"comment":"A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the\nelement.","deprecated":false,"async":false,"alias":"position"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"},{"kind":"property","langs":{},"name":"trial","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it."}],"required":false,"comment":"When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to\n`false`. Useful to wait until the element is ready for the action without performing it.","deprecated":false,"async":false,"alias":"trial"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"click","type":{"name":"void"},"spec":[{"type":"text","text":"This method clicks the element by performing the following steps:"},{"type":"li","text":"Wait for [actionability](./actionability.md) checks on the element, unless `force` option is set.","liType":"ordinal"},{"type":"li","text":"Scroll the element into view if needed.","liType":"ordinal"},{"type":"li","text":"Use [`property: Page.mouse`] to click in the center of the element, or the specified `position`.","liType":"ordinal"},{"type":"li","text":"Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.","liType":"ordinal"},{"type":"text","text":"If the element is detached from the DOM at any moment during the action, this method throws."},{"type":"text","text":"When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing zero timeout disables this."}],"required":true,"comment":"This method clicks the element by performing the following steps:\n1. Wait for [actionability](./actionability.md) checks on the element, unless `force` option is set.\n1. Scroll the element into view if needed.\n1. Use [`property: Page.mouse`] to click in the center of the element, or the specified `position`.\n1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.\n\nIf the element is detached from the DOM at any moment during the action, this method throws.\n\nWhen all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing\nzero timeout disables this.","deprecated":false,"async":true,"alias":"click","args":[{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"button","type":{"name":"MouseButton","union":[{"name":"\"left\""},{"name":"\"right\""},{"name":"\"middle\""}],"expression":"[MouseButton]<\"left\"|\"right\"|\"middle\">"},"spec":[{"type":"text","text":"Defaults to `left`."}],"required":false,"comment":"Defaults to `left`.","deprecated":false,"async":false,"alias":"button"},{"kind":"property","langs":{},"name":"clickCount","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"defaults to 1. See [UIEvent.detail]."}],"required":false,"comment":"defaults to 1. See [UIEvent.detail].","deprecated":false,"async":false,"alias":"clickCount"},{"kind":"property","langs":{},"name":"delay","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0."}],"required":false,"comment":"Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0.","deprecated":false,"async":false,"alias":"delay"},{"kind":"property","langs":{},"name":"force","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`."}],"required":false,"comment":"Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.","deprecated":false,"async":false,"alias":"force"},{"kind":"property","langs":{},"name":"modifiers","type":{"name":"Array","templates":[{"name":"KeyboardModifier","union":[{"name":"\"Alt\""},{"name":"\"Control\""},{"name":"\"Meta\""},{"name":"\"Shift\""}]}],"expression":"[Array]<[KeyboardModifier]<\"Alt\"|\"Control\"|\"Meta\"|\"Shift\">>"},"spec":[{"type":"text","text":"Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current modifiers back. If not specified, currently pressed modifiers are used."}],"required":false,"comment":"Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current\nmodifiers back. If not specified, currently pressed modifiers are used.","deprecated":false,"async":false,"alias":"modifiers"},{"kind":"property","langs":{},"name":"noWaitAfter","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`."}],"required":false,"comment":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can\nopt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to\ninaccessible pages. Defaults to `false`.","deprecated":false,"async":false,"alias":"noWaitAfter"},{"kind":"property","langs":{},"name":"position","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"x","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"x"},{"kind":"property","langs":{},"name":"y","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"y"}],"expression":"[Object]"},"spec":[{"type":"text","text":"A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element."}],"required":false,"comment":"A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the\nelement.","deprecated":false,"async":false,"alias":"position"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"},{"kind":"property","langs":{},"name":"trial","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it."}],"required":false,"comment":"When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to\n`false`. Useful to wait until the element is ready for the action without performing it.","deprecated":false,"async":false,"alias":"trial"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"contentFrame","type":{"name":"","union":[{"name":"null"},{"name":"Frame"}],"expression":"[null]|[Frame]"},"spec":[{"type":"text","text":"Returns the content frame for element handles referencing iframe nodes, or `null` otherwise"}],"required":true,"comment":"Returns the content frame for element handles referencing iframe nodes, or `null` otherwise","deprecated":false,"async":true,"alias":"contentFrame","args":[]},{"kind":"method","langs":{"aliases":{"csharp":"DblClickAsync"},"types":{},"overrides":{}},"name":"dblclick","type":{"name":"void"},"spec":[{"type":"text","text":"This method double clicks the element by performing the following steps:"},{"type":"li","text":"Wait for [actionability](./actionability.md) checks on the element, unless `force` option is set.","liType":"ordinal"},{"type":"li","text":"Scroll the element into view if needed.","liType":"ordinal"},{"type":"li","text":"Use [`property: Page.mouse`] to double click in the center of the element, or the specified `position`.","liType":"ordinal"},{"type":"li","text":"Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set. Note that if the first click of the `dblclick()` triggers a navigation event, this method will throw.","liType":"ordinal"},{"type":"text","text":"If the element is detached from the DOM at any moment during the action, this method throws."},{"type":"text","text":"When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing zero timeout disables this."},{"type":"note","noteType":"note","text":"`elementHandle.dblclick()` dispatches two `click` events and a single `dblclick` event."}],"required":true,"comment":"This method double clicks the element by performing the following steps:\n1. Wait for [actionability](./actionability.md) checks on the element, unless `force` option is set.\n1. Scroll the element into view if needed.\n1. Use [`property: Page.mouse`] to double click in the center of the element, or the specified `position`.\n1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set. Note that if the\n first click of the `dblclick()` triggers a navigation event, this method will throw.\n\nIf the element is detached from the DOM at any moment during the action, this method throws.\n\nWhen all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing\nzero timeout disables this.\n\n> NOTE: `elementHandle.dblclick()` dispatches two `click` events and a single `dblclick` event.","deprecated":false,"async":true,"alias":"dblclick","args":[{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"button","type":{"name":"MouseButton","union":[{"name":"\"left\""},{"name":"\"right\""},{"name":"\"middle\""}],"expression":"[MouseButton]<\"left\"|\"right\"|\"middle\">"},"spec":[{"type":"text","text":"Defaults to `left`."}],"required":false,"comment":"Defaults to `left`.","deprecated":false,"async":false,"alias":"button"},{"kind":"property","langs":{},"name":"delay","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0."}],"required":false,"comment":"Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0.","deprecated":false,"async":false,"alias":"delay"},{"kind":"property","langs":{},"name":"force","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`."}],"required":false,"comment":"Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.","deprecated":false,"async":false,"alias":"force"},{"kind":"property","langs":{},"name":"modifiers","type":{"name":"Array","templates":[{"name":"KeyboardModifier","union":[{"name":"\"Alt\""},{"name":"\"Control\""},{"name":"\"Meta\""},{"name":"\"Shift\""}]}],"expression":"[Array]<[KeyboardModifier]<\"Alt\"|\"Control\"|\"Meta\"|\"Shift\">>"},"spec":[{"type":"text","text":"Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current modifiers back. If not specified, currently pressed modifiers are used."}],"required":false,"comment":"Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current\nmodifiers back. If not specified, currently pressed modifiers are used.","deprecated":false,"async":false,"alias":"modifiers"},{"kind":"property","langs":{},"name":"noWaitAfter","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`."}],"required":false,"comment":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can\nopt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to\ninaccessible pages. Defaults to `false`.","deprecated":false,"async":false,"alias":"noWaitAfter"},{"kind":"property","langs":{},"name":"position","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"x","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"x"},{"kind":"property","langs":{},"name":"y","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"y"}],"expression":"[Object]"},"spec":[{"type":"text","text":"A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element."}],"required":false,"comment":"A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the\nelement.","deprecated":false,"async":false,"alias":"position"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"},{"kind":"property","langs":{},"name":"trial","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it."}],"required":false,"comment":"When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to\n`false`. Useful to wait until the element is ready for the action without performing it.","deprecated":false,"async":false,"alias":"trial"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"dispatchEvent","type":{"name":"void"},"spec":[{"type":"text","text":"The snippet below dispatches the `click` event on the element. Regardless of the visibility state of the element, `click` is dispatched. This is equivalent to calling [element.click()](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/click)."},{"type":"code","lines":["await elementHandle.dispatchEvent('click');"],"codeLang":"js"},{"type":"code","lines":["elementHandle.dispatchEvent(\"click\");"],"codeLang":"java"},{"type":"code","lines":["await element_handle.dispatch_event(\"click\")"],"codeLang":"python async"},{"type":"code","lines":["element_handle.dispatch_event(\"click\")"],"codeLang":"python sync"},{"type":"code","lines":["await elementHandle.DispatchEventAsync(\"click\");"],"codeLang":"csharp"},{"type":"text","text":"Under the hood, it creates an instance of an event based on the given `type`, initializes it with `eventInit` properties and dispatches it on the element. Events are `composed`, `cancelable` and bubble by default."},{"type":"text","text":"Since `eventInit` is event-specific, please refer to the events documentation for the lists of initial properties:"},{"type":"li","text":"[DragEvent](https://developer.mozilla.org/en-US/docs/Web/API/DragEvent/DragEvent)","liType":"bullet"},{"type":"li","text":"[FocusEvent](https://developer.mozilla.org/en-US/docs/Web/API/FocusEvent/FocusEvent)","liType":"bullet"},{"type":"li","text":"[KeyboardEvent](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/KeyboardEvent)","liType":"bullet"},{"type":"li","text":"[MouseEvent](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/MouseEvent)","liType":"bullet"},{"type":"li","text":"[PointerEvent](https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/PointerEvent)","liType":"bullet"},{"type":"li","text":"[TouchEvent](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/TouchEvent)","liType":"bullet"},{"type":"li","text":"[Event](https://developer.mozilla.org/en-US/docs/Web/API/Event/Event)","liType":"bullet"},{"type":"text","text":"You can also specify `JSHandle` as the property value if you want live objects to be passed into the event:"},{"type":"code","lines":["// Note you can only create DataTransfer in Chromium and Firefox","const dataTransfer = await page.evaluateHandle(() => new DataTransfer());","await elementHandle.dispatchEvent('dragstart', { dataTransfer });"],"codeLang":"js"},{"type":"code","lines":["// Note you can only create DataTransfer in Chromium and Firefox","JSHandle dataTransfer = page.evaluateHandle(\"() => new DataTransfer()\");","Map<String, Object> arg = new HashMap<>();","arg.put(\"dataTransfer\", dataTransfer);","elementHandle.dispatchEvent(\"dragstart\", arg);"],"codeLang":"java"},{"type":"code","lines":["# note you can only create data_transfer in chromium and firefox","data_transfer = await page.evaluate_handle(\"new DataTransfer()\")","await element_handle.dispatch_event(\"#source\", \"dragstart\", {\"dataTransfer\": data_transfer})"],"codeLang":"python async"},{"type":"code","lines":["# note you can only create data_transfer in chromium and firefox","data_transfer = page.evaluate_handle(\"new DataTransfer()\")","element_handle.dispatch_event(\"#source\", \"dragstart\", {\"dataTransfer\": data_transfer})"],"codeLang":"python sync"},{"type":"code","lines":["var handle = await page.EvaluateHandleAsync(\"() => new DataTransfer()\");","await handle.AsElement().DispatchEventAsync(\"dragstart\", new Dictionary<string, object>","{"," { \"dataTransfer\", dataTransfer }","});"],"codeLang":"csharp"}],"required":true,"comment":"The snippet below dispatches the `click` event on the element. Regardless of the visibility state of the element,\n`click` is dispatched. This is equivalent to calling\n[element.click()](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/click).\n\n```js\nawait elementHandle.dispatchEvent('click');\n```\n\n```java\nelementHandle.dispatchEvent(\"click\");\n```\n\n```python async\nawait element_handle.dispatch_event(\"click\")\n```\n\n```python sync\nelement_handle.dispatch_event(\"click\")\n```\n\n```csharp\nawait elementHandle.DispatchEventAsync(\"click\");\n```\n\nUnder the hood, it creates an instance of an event based on the given `type`, initializes it with `eventInit` properties\nand dispatches it on the element. Events are `composed`, `cancelable` and bubble by default.\n\nSince `eventInit` is event-specific, please refer to the events documentation for the lists of initial properties:\n- [DragEvent](https://developer.mozilla.org/en-US/docs/Web/API/DragEvent/DragEvent)\n- [FocusEvent](https://developer.mozilla.org/en-US/docs/Web/API/FocusEvent/FocusEvent)\n- [KeyboardEvent](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/KeyboardEvent)\n- [MouseEvent](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/MouseEvent)\n- [PointerEvent](https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/PointerEvent)\n- [TouchEvent](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/TouchEvent)\n- [Event](https://developer.mozilla.org/en-US/docs/Web/API/Event/Event)\n\nYou can also specify `JSHandle` as the property value if you want live objects to be passed into the event:\n\n```js\n// Note you can only create DataTransfer in Chromium and Firefox\nconst dataTransfer = await page.evaluateHandle(() => new DataTransfer());\nawait elementHandle.dispatchEvent('dragstart', { dataTransfer });\n```\n\n```java\n// Note you can only create DataTransfer in Chromium and Firefox\nJSHandle dataTransfer = page.evaluateHandle(\"() => new DataTransfer()\");\nMap<String, Object> arg = new HashMap<>();\narg.put(\"dataTransfer\", dataTransfer);\nelementHandle.dispatchEvent(\"dragstart\", arg);\n```\n\n```python async\n# note you can only create data_transfer in chromium and firefox\ndata_transfer = await page.evaluate_handle(\"new DataTransfer()\")\nawait element_handle.dispatch_event(\"#source\", \"dragstart\", {\"dataTransfer\": data_transfer})\n```\n\n```python sync\n# note you can only create data_transfer in chromium and firefox\ndata_transfer = page.evaluate_handle(\"new DataTransfer()\")\nelement_handle.dispatch_event(\"#source\", \"dragstart\", {\"dataTransfer\": data_transfer})\n```\n\n```csharp\nvar handle = await page.EvaluateHandleAsync(\"() => new DataTransfer()\");\nawait handle.AsElement().DispatchEventAsync(\"dragstart\", new Dictionary<string, object>\n{\n { \"dataTransfer\", dataTransfer }\n});\n```\n","deprecated":false,"async":true,"alias":"dispatchEvent","args":[{"kind":"property","langs":{},"name":"type","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"DOM event type: `\"click\"`, `\"dragstart\"`, etc."}],"required":true,"comment":"DOM event type: `\"click\"`, `\"dragstart\"`, etc.","deprecated":false,"async":false,"alias":"type"},{"kind":"property","langs":{},"name":"eventInit","type":{"name":"EvaluationArgument","expression":"[EvaluationArgument]"},"spec":[{"type":"text","text":"Optional event-specific initialization properties."}],"required":false,"comment":"Optional event-specific initialization properties.","deprecated":false,"async":false,"alias":"eventInit"}]},{"kind":"method","langs":{"aliases":{"python":"eval_on_selector","js":"$eval"},"types":{},"overrides":{}},"name":"evalOnSelector","type":{"name":"Serializable","expression":"[Serializable]"},"spec":[{"type":"text","text":"Returns the return value of `expression`."},{"type":"text","text":"The method finds an element matching the specified selector in the `ElementHandle`s subtree and passes it as a first argument to `expression`. See [Working with selectors](./selectors.md) for more details. If no elements match the selector, the method throws an error."},{"type":"text","text":"If `expression` returns a [Promise], then [`method: ElementHandle.evalOnSelector`] would wait for the promise to resolve and return its value."},{"type":"text","text":"Examples:"},{"type":"code","lines":["const tweetHandle = await page.$('.tweet');","expect(await tweetHandle.$eval('.like', node => node.innerText)).toBe('100');","expect(await tweetHandle.$eval('.retweets', node => node.innerText)).toBe('10');"],"codeLang":"js"},{"type":"code","lines":["ElementHandle tweetHandle = page.querySelector(\".tweet\");","assertEquals(\"100\", tweetHandle.evalOnSelector(\".like\", \"node => node.innerText\"));","assertEquals(\"10\", tweetHandle.evalOnSelector(\".retweets\", \"node => node.innerText\"));"],"codeLang":"java"},{"type":"code","lines":["tweet_handle = await page.query_selector(\".tweet\")","assert await tweet_handle.eval_on_selector(\".like\", \"node => node.innerText\") == \"100\"","assert await tweet_handle.eval_on_selector(\".retweets\", \"node => node.innerText\") = \"10\""],"codeLang":"python async"},{"type":"code","lines":["tweet_handle = page.query_selector(\".tweet\")","assert tweet_handle.eval_on_selector(\".like\", \"node => node.innerText\") == \"100\"","assert tweet_handle.eval_on_selector(\".retweets\", \"node => node.innerText\") = \"10\""],"codeLang":"python sync"},{"type":"code","lines":["var tweetHandle = await page.QuerySelectorAsync(\".tweet\");","Assert.Equals(\"100\", await tweetHandle.EvalOnSelectorAsync(\".like\", \"node => node.innerText\"));","Assert.Equals(\"10\", await tweetHandle.EvalOnSelectorAsync(\".retweets\", \"node => node.innerText\"));"],"codeLang":"csharp"}],"required":true,"comment":"Returns the return value of `expression`.\n\nThe method finds an element matching the specified selector in the `ElementHandle`s subtree and passes it as a first\nargument to `expression`. See [Working with selectors](./selectors.md) for more details. If no elements match the\nselector, the method throws an error.\n\nIf `expression` returns a [Promise], then [`method: ElementHandle.evalOnSelector`] would wait for the promise to resolve\nand return its value.\n\nExamples:\n\n```js\nconst tweetHandle = await page.$('.tweet');\nexpect(await tweetHandle.$eval('.like', node => node.innerText)).toBe('100');\nexpect(await tweetHandle.$eval('.retweets', node => node.innerText)).toBe('10');\n```\n\n```java\nElementHandle tweetHandle = page.querySelector(\".tweet\");\nassertEquals(\"100\", tweetHandle.evalOnSelector(\".like\", \"node => node.innerText\"));\nassertEquals(\"10\", tweetHandle.evalOnSelector(\".retweets\", \"node => node.innerText\"));\n```\n\n```python async\ntweet_handle = await page.query_selector(\".tweet\")\nassert await tweet_handle.eval_on_selector(\".like\", \"node => node.innerText\") == \"100\"\nassert await tweet_handle.eval_on_selector(\".retweets\", \"node => node.innerText\") = \"10\"\n```\n\n```python sync\ntweet_handle = page.query_selector(\".tweet\")\nassert tweet_handle.eval_on_selector(\".like\", \"node => node.innerText\") == \"100\"\nassert tweet_handle.eval_on_selector(\".retweets\", \"node => node.innerText\") = \"10\"\n```\n\n```csharp\nvar tweetHandle = await page.QuerySelectorAsync(\".tweet\");\nAssert.Equals(\"100\", await tweetHandle.EvalOnSelectorAsync(\".like\", \"node => node.innerText\"));\nAssert.Equals(\"10\", await tweetHandle.EvalOnSelectorAsync(\".retweets\", \"node => node.innerText\"));\n```\n","deprecated":false,"async":true,"alias":"evalOnSelector","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to query for. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to query for. See [working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{"overrides":{"js":{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"expression","type":{"name":"function","args":[{"name":"Element"}],"returnType":null,"expression":"[function]([Element])"},"spec":[{"type":"text","text":"Function to be evaluated in the page context."}],"argsArray":[],"required":true,"comment":"","args":{},"clazz":null,"deprecated":false,"async":false,"alias":"pageFunction"}}},"name":"expression","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted as a function. Otherwise, evaluated as an expression."}],"required":true,"comment":"JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted\nas a function. Otherwise, evaluated as an expression.","deprecated":false,"async":false,"alias":"expression"},{"kind":"property","langs":{},"name":"arg","type":{"name":"EvaluationArgument","expression":"[EvaluationArgument]"},"spec":[{"type":"text","text":"Optional argument to pass to `expression`."}],"required":false,"comment":"Optional argument to pass to `expression`.","deprecated":false,"async":false,"alias":"arg"}]},{"kind":"method","langs":{"aliases":{"python":"eval_on_selector_all","js":"$$eval"},"types":{},"overrides":{}},"name":"evalOnSelectorAll","type":{"name":"Serializable","expression":"[Serializable]"},"spec":[{"type":"text","text":"Returns the return value of `expression`."},{"type":"text","text":"The method finds all elements matching the specified selector in the `ElementHandle`'s subtree and passes an array of matched elements as a first argument to `expression`. See [Working with selectors](./selectors.md) for more details."},{"type":"text","text":"If `expression` returns a [Promise], then [`method: ElementHandle.evalOnSelectorAll`] would wait for the promise to resolve and return its value."},{"type":"text","text":"Examples:"},{"type":"code","lines":["<div class=\"feed\">"," <div class=\"tweet\">Hello!</div>"," <div class=\"tweet\">Hi!</div>","</div>"],"codeLang":"html"},{"type":"code","lines":["const feedHandle = await page.$('.feed');","expect(await feedHandle.$$eval('.tweet', nodes => nodes.map(n => n.innerText))).toEqual(['Hello!', 'Hi!']);"],"codeLang":"js"},{"type":"code","lines":["ElementHandle feedHandle = page.querySelector(\".feed\");","assertEquals(Arrays.asList(\"Hello!\", \"Hi!\"), feedHandle.evalOnSelectorAll(\".tweet\", \"nodes => nodes.map(n => n.innerText)\"));"],"codeLang":"java"},{"type":"code","lines":["feed_handle = await page.query_selector(\".feed\")","assert await feed_handle.eval_on_selector_all(\".tweet\", \"nodes => nodes.map(n => n.innerText)\") == [\"hello!\", \"hi!\"]"],"codeLang":"python async"},{"type":"code","lines":["feed_handle = page.query_selector(\".feed\")","assert feed_handle.eval_on_selector_all(\".tweet\", \"nodes => nodes.map(n => n.innerText)\") == [\"hello!\", \"hi!\"]"],"codeLang":"python sync"},{"type":"code","lines":["var feedHandle = await page.QuerySelectorAsync(\".feed\");","Assert.Equals(new [] { \"Hello!\", \"Hi!\" }, await feedHandle.EvalOnSelectorAllAsync<string[]>(\".tweet\", \"nodes => nodes.map(n => n.innerText)\"));"],"codeLang":"csharp"}],"required":true,"comment":"Returns the return value of `expression`.\n\nThe method finds all elements matching the specified selector in the `ElementHandle`'s subtree and passes an array of\nmatched elements as a first argument to `expression`. See [Working with selectors](./selectors.md) for more details.\n\nIf `expression` returns a [Promise], then [`method: ElementHandle.evalOnSelectorAll`] would wait for the promise to\nresolve and return its value.\n\nExamples:\n\n```html\n<div class=\"feed\">\n <div class=\"tweet\">Hello!</div>\n <div class=\"tweet\">Hi!</div>\n</div>\n```\n\n```js\nconst feedHandle = await page.$('.feed');\nexpect(await feedHandle.$$eval('.tweet', nodes => nodes.map(n => n.innerText))).toEqual(['Hello!', 'Hi!']);\n```\n\n```java\nElementHandle feedHandle = page.querySelector(\".feed\");\nassertEquals(Arrays.asList(\"Hello!\", \"Hi!\"), feedHandle.evalOnSelectorAll(\".tweet\", \"nodes => nodes.map(n => n.innerText)\"));\n```\n\n```python async\nfeed_handle = await page.query_selector(\".feed\")\nassert await feed_handle.eval_on_selector_all(\".tweet\", \"nodes => nodes.map(n => n.innerText)\") == [\"hello!\", \"hi!\"]\n```\n\n```python sync\nfeed_handle = page.query_selector(\".feed\")\nassert feed_handle.eval_on_selector_all(\".tweet\", \"nodes => nodes.map(n => n.innerText)\") == [\"hello!\", \"hi!\"]\n```\n\n```csharp\nvar feedHandle = await page.QuerySelectorAsync(\".feed\");\nAssert.Equals(new [] { \"Hello!\", \"Hi!\" }, await feedHandle.EvalOnSelectorAllAsync<string[]>(\".tweet\", \"nodes => nodes.map(n => n.innerText)\"));\n```\n","deprecated":false,"async":true,"alias":"evalOnSelectorAll","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to query for. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to query for. See [working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{"overrides":{"js":{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"expression","type":{"name":"function","args":[{"name":"Array","templates":[{"name":"Element"}]}],"returnType":null,"expression":"[function]([Array]<[Element]>)"},"spec":[{"type":"text","text":"Function to be evaluated in the page context."}],"argsArray":[],"required":true,"comment":"","args":{},"clazz":null,"deprecated":false,"async":false,"alias":"pageFunction"}}},"name":"expression","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted as a function. Otherwise, evaluated as an expression."}],"required":true,"comment":"JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted\nas a function. Otherwise, evaluated as an expression.","deprecated":false,"async":false,"alias":"expression"},{"kind":"property","langs":{},"name":"arg","type":{"name":"EvaluationArgument","expression":"[EvaluationArgument]"},"spec":[{"type":"text","text":"Optional argument to pass to `expression`."}],"required":false,"comment":"Optional argument to pass to `expression`.","deprecated":false,"async":false,"alias":"arg"}]},{"kind":"method","langs":{},"name":"fill","type":{"name":"void"},"spec":[{"type":"text","text":"This method waits for [actionability](./actionability.md) checks, focuses the element, fills it and triggers an `input` event after filling. Note that you can pass an empty string to clear the input field."},{"type":"text","text":"If the target element is not an `<input>`, `<textarea>` or `[contenteditable]` element, this method throws an error. However, if the element is inside the `<label>` element that has an associated [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), the control will be filled instead."},{"type":"text","text":"To send fine-grained keyboard events, use [`method: ElementHandle.type`]."}],"required":true,"comment":"This method waits for [actionability](./actionability.md) checks, focuses the element, fills it and triggers an `input`\nevent after filling. Note that you can pass an empty string to clear the input field.\n\nIf the target element is not an `<input>`, `<textarea>` or `[contenteditable]` element, this method throws an error.\nHowever, if the element is inside the `<label>` element that has an associated\n[control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), the control will be filled\ninstead.\n\nTo send fine-grained keyboard events, use [`method: ElementHandle.type`].","deprecated":false,"async":true,"alias":"fill","args":[{"kind":"property","langs":{},"name":"value","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Value to set for the `<input>`, `<textarea>` or `[contenteditable]` element."}],"required":true,"comment":"Value to set for the `<input>`, `<textarea>` or `[contenteditable]` element.","deprecated":false,"async":false,"alias":"value"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"noWaitAfter","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`."}],"required":false,"comment":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can\nopt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to\ninaccessible pages. Defaults to `false`.","deprecated":false,"async":false,"alias":"noWaitAfter"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"focus","type":{"name":"void"},"spec":[{"type":"text","text":"Calls [focus](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus) on the element."}],"required":true,"comment":"Calls [focus](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus) on the element.","deprecated":false,"async":true,"alias":"focus","args":[]},{"kind":"method","langs":{},"name":"getAttribute","type":{"name":"","union":[{"name":"null"},{"name":"string"}],"expression":"[null]|[string]"},"spec":[{"type":"text","text":"Returns element attribute value."}],"required":true,"comment":"Returns element attribute value.","deprecated":false,"async":true,"alias":"getAttribute","args":[{"kind":"property","langs":{},"name":"name","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Attribute name to get the value for."}],"required":true,"comment":"Attribute name to get the value for.","deprecated":false,"async":false,"alias":"name"}]},{"kind":"method","langs":{},"name":"hover","type":{"name":"void"},"spec":[{"type":"text","text":"This method hovers over the element by performing the following steps:"},{"type":"li","text":"Wait for [actionability](./actionability.md) checks on the element, unless `force` option is set.","liType":"ordinal"},{"type":"li","text":"Scroll the element into view if needed.","liType":"ordinal"},{"type":"li","text":"Use [`property: Page.mouse`] to hover over the center of the element, or the specified `position`.","liType":"ordinal"},{"type":"li","text":"Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.","liType":"ordinal"},{"type":"text","text":"If the element is detached from the DOM at any moment during the action, this method throws."},{"type":"text","text":"When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing zero timeout disables this."}],"required":true,"comment":"This method hovers over the element by performing the following steps:\n1. Wait for [actionability](./actionability.md) checks on the element, unless `force` option is set.\n1. Scroll the element into view if needed.\n1. Use [`property: Page.mouse`] to hover over the center of the element, or the specified `position`.\n1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.\n\nIf the element is detached from the DOM at any moment during the action, this method throws.\n\nWhen all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing\nzero timeout disables this.","deprecated":false,"async":true,"alias":"hover","args":[{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"force","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`."}],"required":false,"comment":"Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.","deprecated":false,"async":false,"alias":"force"},{"kind":"property","langs":{},"name":"modifiers","type":{"name":"Array","templates":[{"name":"KeyboardModifier","union":[{"name":"\"Alt\""},{"name":"\"Control\""},{"name":"\"Meta\""},{"name":"\"Shift\""}]}],"expression":"[Array]<[KeyboardModifier]<\"Alt\"|\"Control\"|\"Meta\"|\"Shift\">>"},"spec":[{"type":"text","text":"Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current modifiers back. If not specified, currently pressed modifiers are used."}],"required":false,"comment":"Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current\nmodifiers back. If not specified, currently pressed modifiers are used.","deprecated":false,"async":false,"alias":"modifiers"},{"kind":"property","langs":{},"name":"position","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"x","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"x"},{"kind":"property","langs":{},"name":"y","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"y"}],"expression":"[Object]"},"spec":[{"type":"text","text":"A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element."}],"required":false,"comment":"A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the\nelement.","deprecated":false,"async":false,"alias":"position"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"},{"kind":"property","langs":{},"name":"trial","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it."}],"required":false,"comment":"When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to\n`false`. Useful to wait until the element is ready for the action without performing it.","deprecated":false,"async":false,"alias":"trial"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"innerHTML","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Returns the `element.innerHTML`."}],"required":true,"comment":"Returns the `element.innerHTML`.","deprecated":false,"async":true,"alias":"innerHTML","args":[]},{"kind":"method","langs":{},"name":"innerText","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Returns the `element.innerText`."}],"required":true,"comment":"Returns the `element.innerText`.","deprecated":false,"async":true,"alias":"innerText","args":[]},{"kind":"method","langs":{},"name":"isChecked","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Returns whether the element is checked. Throws if the element is not a checkbox or radio input."}],"required":true,"comment":"Returns whether the element is checked. Throws if the element is not a checkbox or radio input.","deprecated":false,"async":true,"alias":"isChecked","args":[]},{"kind":"method","langs":{},"name":"isDisabled","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Returns whether the element is disabled, the opposite of [enabled](./actionability.md#enabled)."}],"required":true,"comment":"Returns whether the element is disabled, the opposite of [enabled](./actionability.md#enabled).","deprecated":false,"async":true,"alias":"isDisabled","args":[]},{"kind":"method","langs":{},"name":"isEditable","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Returns whether the element is [editable](./actionability.md#editable)."}],"required":true,"comment":"Returns whether the element is [editable](./actionability.md#editable).","deprecated":false,"async":true,"alias":"isEditable","args":[]},{"kind":"method","langs":{},"name":"isEnabled","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Returns whether the element is [enabled](./actionability.md#enabled)."}],"required":true,"comment":"Returns whether the element is [enabled](./actionability.md#enabled).","deprecated":false,"async":true,"alias":"isEnabled","args":[]},{"kind":"method","langs":{},"name":"isHidden","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Returns whether the element is hidden, the opposite of [visible](./actionability.md#visible)."}],"required":true,"comment":"Returns whether the element is hidden, the opposite of [visible](./actionability.md#visible).","deprecated":false,"async":true,"alias":"isHidden","args":[]},{"kind":"method","langs":{},"name":"isVisible","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Returns whether the element is [visible](./actionability.md#visible)."}],"required":true,"comment":"Returns whether the element is [visible](./actionability.md#visible).","deprecated":false,"async":true,"alias":"isVisible","args":[]},{"kind":"method","langs":{},"name":"ownerFrame","type":{"name":"","union":[{"name":"null"},{"name":"Frame"}],"expression":"[null]|[Frame]"},"spec":[{"type":"text","text":"Returns the frame containing the given element."}],"required":true,"comment":"Returns the frame containing the given element.","deprecated":false,"async":true,"alias":"ownerFrame","args":[]},{"kind":"method","langs":{},"name":"press","type":{"name":"void"},"spec":[{"type":"text","text":"Focuses the element, and then uses [`method: Keyboard.down`] and [`method: Keyboard.up`]."},{"type":"text","text":"`key` can specify the intended [keyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key) value or a single character to generate the text for. A superset of the `key` values can be found [here](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values). Examples of the keys are:"},{"type":"text","text":"`F1` - `F12`, `Digit0`- `Digit9`, `KeyA`- `KeyZ`, `Backquote`, `Minus`, `Equal`, `Backslash`, `Backspace`, `Tab`, `Delete`, `Escape`, `ArrowDown`, `End`, `Enter`, `Home`, `Insert`, `PageDown`, `PageUp`, `ArrowRight`, `ArrowUp`, etc."},{"type":"text","text":"Following modification shortcuts are also supported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`."},{"type":"text","text":"Holding down `Shift` will type the text that corresponds to the `key` in the upper case."},{"type":"text","text":"If `key` is a single character, it is case-sensitive, so the values `a` and `A` will generate different respective texts."},{"type":"text","text":"Shortcuts such as `key: \"Control+o\"` or `key: \"Control+Shift+T\"` are supported as well. When specified with the modifier, modifier is pressed and being held while the subsequent key is being pressed."}],"required":true,"comment":"Focuses the element, and then uses [`method: Keyboard.down`] and [`method: Keyboard.up`].\n\n`key` can specify the intended [keyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key)\nvalue or a single character to generate the text for. A superset of the `key` values can be found\n[here](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values). Examples of the keys are:\n\n`F1` - `F12`, `Digit0`- `Digit9`, `KeyA`- `KeyZ`, `Backquote`, `Minus`, `Equal`, `Backslash`, `Backspace`, `Tab`,\n`Delete`, `Escape`, `ArrowDown`, `End`, `Enter`, `Home`, `Insert`, `PageDown`, `PageUp`, `ArrowRight`, `ArrowUp`, etc.\n\nFollowing modification shortcuts are also supported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`.\n\nHolding down `Shift` will type the text that corresponds to the `key` in the upper case.\n\nIf `key` is a single character, it is case-sensitive, so the values `a` and `A` will generate different respective\ntexts.\n\nShortcuts such as `key: \"Control+o\"` or `key: \"Control+Shift+T\"` are supported as well. When specified with the\nmodifier, modifier is pressed and being held while the subsequent key is being pressed.","deprecated":false,"async":true,"alias":"press","args":[{"kind":"property","langs":{},"name":"key","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Name of the key to press or a character to generate, such as `ArrowLeft` or `a`."}],"required":true,"comment":"Name of the key to press or a character to generate, such as `ArrowLeft` or `a`.","deprecated":false,"async":false,"alias":"key"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"delay","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Time to wait between `keydown` and `keyup` in milliseconds. Defaults to 0."}],"required":false,"comment":"Time to wait between `keydown` and `keyup` in milliseconds. Defaults to 0.","deprecated":false,"async":false,"alias":"delay"},{"kind":"property","langs":{},"name":"noWaitAfter","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`."}],"required":false,"comment":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can\nopt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to\ninaccessible pages. Defaults to `false`.","deprecated":false,"async":false,"alias":"noWaitAfter"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{"aliases":{"python":"query_selector","js":"$"},"types":{},"overrides":{}},"name":"querySelector","type":{"name":"","union":[{"name":"null"},{"name":"ElementHandle"}],"expression":"[null]|[ElementHandle]"},"spec":[{"type":"text","text":"The method finds an element matching the specified selector in the `ElementHandle`'s subtree. See [Working with selectors](./selectors.md) for more details. If no elements match the selector, returns `null`."}],"required":true,"comment":"The method finds an element matching the specified selector in the `ElementHandle`'s subtree. See\n[Working with selectors](./selectors.md) for more details. If no elements match the selector, returns `null`.","deprecated":false,"async":true,"alias":"querySelector","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to query for. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to query for. See [working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"}]},{"kind":"method","langs":{"aliases":{"python":"query_selector_all","js":"$$"},"types":{},"overrides":{}},"name":"querySelectorAll","type":{"name":"Array","templates":[{"name":"ElementHandle"}],"expression":"[Array]<[ElementHandle]>"},"spec":[{"type":"text","text":"The method finds all elements matching the specified selector in the `ElementHandle`s subtree. See [Working with selectors](./selectors.md) for more details. If no elements match the selector, returns empty array."}],"required":true,"comment":"The method finds all elements matching the specified selector in the `ElementHandle`s subtree. See\n[Working with selectors](./selectors.md) for more details. If no elements match the selector, returns empty array.","deprecated":false,"async":true,"alias":"querySelectorAll","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to query for. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to query for. See [working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"}]},{"kind":"method","langs":{},"name":"screenshot","type":{"name":"Buffer","expression":"[Buffer]"},"spec":[{"type":"text","text":"Returns the buffer with the captured screenshot."},{"type":"text","text":"This method waits for the [actionability](./actionability.md) checks, then scrolls element into view before taking a screenshot. If the element is detached from DOM, the method throws an error."}],"required":true,"comment":"Returns the buffer with the captured screenshot.\n\nThis method waits for the [actionability](./actionability.md) checks, then scrolls element into view before taking a\nscreenshot. If the element is detached from DOM, the method throws an error.","deprecated":false,"async":true,"alias":"screenshot","args":[{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"omitBackground","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Hides default white background and allows capturing screenshots with transparency. Not applicable to `jpeg` images. Defaults to `false`."}],"required":false,"comment":"Hides default white background and allows capturing screenshots with transparency. Not applicable to `jpeg` images.\nDefaults to `false`.","deprecated":false,"async":false,"alias":"omitBackground"},{"kind":"property","langs":{},"name":"path","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"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 the current working directory. If no path is provided, the image won't be saved to the disk."}],"required":false,"comment":"The file path to save the image to. The screenshot type will be inferred from file extension. If `path` is a relative\npath, then it is resolved relative to the current working directory. If no path is provided, the image won't be saved to\nthe disk.","deprecated":false,"async":false,"alias":"path"},{"kind":"property","langs":{},"name":"quality","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"The quality of the image, between 0-100. Not applicable to `png` images."}],"required":false,"comment":"The quality of the image, between 0-100. Not applicable to `png` images.","deprecated":false,"async":false,"alias":"quality"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"},{"kind":"property","langs":{},"name":"type","type":{"name":"ScreenshotType","union":[{"name":"\"png\""},{"name":"\"jpeg\""}],"expression":"[ScreenshotType]<\"png\"|\"jpeg\">"},"spec":[{"type":"text","text":"Specify screenshot type, defaults to `png`."}],"required":false,"comment":"Specify screenshot type, defaults to `png`.","deprecated":false,"async":false,"alias":"type"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"scrollIntoViewIfNeeded","type":{"name":"void"},"spec":[{"type":"text","text":"This method waits for [actionability](./actionability.md) checks, then tries to scroll element into view, unless it is completely visible as defined by [IntersectionObserver](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API)'s `ratio`."},{"type":"text","text":"Throws when `elementHandle` does not point to an element [connected](https://developer.mozilla.org/en-US/docs/Web/API/Node/isConnected) to a Document or a ShadowRoot."}],"required":true,"comment":"This method waits for [actionability](./actionability.md) checks, then tries to scroll element into view, unless it is\ncompletely visible as defined by\n[IntersectionObserver](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API)'s `ratio`.\n\nThrows when `elementHandle` does not point to an element\n[connected](https://developer.mozilla.org/en-US/docs/Web/API/Node/isConnected) to a Document or a ShadowRoot.","deprecated":false,"async":true,"alias":"scrollIntoViewIfNeeded","args":[{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"selectOption","type":{"name":"Array","templates":[{"name":"string"}],"expression":"[Array]<[string]>"},"spec":[{"type":"text","text":"This method waits for [actionability](./actionability.md) checks, waits until all specified options are present in the `<select>` element and selects these options."},{"type":"text","text":"If the target element is not a `<select>` element, this method throws an error. However, if the element is inside the `<label>` element that has an associated [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), the control will be used instead."},{"type":"text","text":"Returns the array of option values that have been successfully selected."},{"type":"text","text":"Triggers a `change` and `input` event once all the provided options have been selected."},{"type":"code","lines":["// single selection matching the value","handle.selectOption('blue');","","// single selection matching the label","handle.selectOption({ label: 'Blue' });","","// multiple selection","handle.selectOption(['red', 'green', 'blue']);"],"codeLang":"js"},{"type":"code","lines":["// single selection matching the value","handle.selectOption(\"blue\");","// single selection matching the label","handle.selectOption(new SelectOption().setLabel(\"Blue\"));","// multiple selection","handle.selectOption(new String[] {\"red\", \"green\", \"blue\"});"],"codeLang":"java"},{"type":"code","lines":["# single selection matching the value","await handle.select_option(\"blue\")","# single selection matching the label","await handle.select_option(label=\"blue\")","# multiple selection","await handle.select_option(value=[\"red\", \"green\", \"blue\"])"],"codeLang":"python async"},{"type":"code","lines":["# single selection matching the value","handle.select_option(\"blue\")","# single selection matching both the label","handle.select_option(label=\"blue\")","# multiple selection","handle.select_option(value=[\"red\", \"green\", \"blue\"])"],"codeLang":"python sync"},{"type":"code","lines":["# single selection matching the value","handle.select_option(\"blue\")","# single selection matching both the value and the label","handle.select_option(label=\"blue\")","# multiple selection","handle.select_option(\"red\", \"green\", \"blue\")","# multiple selection for blue, red and second option","handle.select_option(value=\"blue\", { index: 2 }, \"red\")"],"codeLang":"python sync"},{"type":"code","lines":["// single selection matching the value","await handle.SelectOptionAsync(new[] { \"blue\" });","// single selection matching the label","await handle.SelectOptionAsync(new[] { new SelectOptionValue() { Label = \"blue\" } });","// multiple selection","await handle.SelectOptionAsync(new[] { \"red\", \"green\", \"blue\" });","// multiple selection for blue, red and second option","await handle.SelectOptionAsync(new[] {"," new SelectOptionValue() { Label = \"blue\" },"," new SelectOptionValue() { Index = 2 },"," new SelectOptionValue() { Value = \"red\" }});"],"codeLang":"csharp"}],"required":true,"comment":"This method waits for [actionability](./actionability.md) checks, waits until all specified options are present in the\n`<select>` element and selects these options.\n\nIf the target element is not a `<select>` element, this method throws an error. However, if the element is inside the\n`<label>` element that has an associated\n[control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), the control will be used instead.\n\nReturns the array of option values that have been successfully selected.\n\nTriggers a `change` and `input` event once all the provided options have been selected.\n\n```js\n// single selection matching the value\nhandle.selectOption('blue');\n\n// single selection matching the label\nhandle.selectOption({ label: 'Blue' });\n\n// multiple selection\nhandle.selectOption(['red', 'green', 'blue']);\n```\n\n```java\n// single selection matching the value\nhandle.selectOption(\"blue\");\n// single selection matching the label\nhandle.selectOption(new SelectOption().setLabel(\"Blue\"));\n// multiple selection\nhandle.selectOption(new String[] {\"red\", \"green\", \"blue\"});\n```\n\n```python async\n# single selection matching the value\nawait handle.select_option(\"blue\")\n# single selection matching the label\nawait handle.select_option(label=\"blue\")\n# multiple selection\nawait handle.select_option(value=[\"red\", \"green\", \"blue\"])\n```\n\n```python sync\n# single selection matching the value\nhandle.select_option(\"blue\")\n# single selection matching both the label\nhandle.select_option(label=\"blue\")\n# multiple selection\nhandle.select_option(value=[\"red\", \"green\", \"blue\"])\n```\n\n```python sync\n# single selection matching the value\nhandle.select_option(\"blue\")\n# single selection matching both the value and the label\nhandle.select_option(label=\"blue\")\n# multiple selection\nhandle.select_option(\"red\", \"green\", \"blue\")\n# multiple selection for blue, red and second option\nhandle.select_option(value=\"blue\", { index: 2 }, \"red\")\n```\n\n```csharp\n// single selection matching the value\nawait handle.SelectOptionAsync(new[] { \"blue\" });\n// single selection matching the label\nawait handle.SelectOptionAsync(new[] { new SelectOptionValue() { Label = \"blue\" } });\n// multiple selection\nawait handle.SelectOptionAsync(new[] { \"red\", \"green\", \"blue\" });\n// multiple selection for blue, red and second option\nawait handle.SelectOptionAsync(new[] {\n new SelectOptionValue() { Label = \"blue\" },\n new SelectOptionValue() { Index = 2 },\n new SelectOptionValue() { Value = \"red\" }});\n```\n","deprecated":false,"async":true,"alias":"selectOption","args":[{"kind":"property","langs":{"only":["java","js","csharp"],"aliases":{},"types":{},"overrides":{}},"name":"values","type":{"name":"","union":[{"name":"null"},{"name":"string"},{"name":"ElementHandle"},{"name":"Array","templates":[{"name":"string"}]},{"name":"Object","properties":[{"kind":"property","langs":{},"name":"value","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Matches by `option.value`. Optional."}],"required":false,"comment":"Matches by `option.value`. Optional.","deprecated":false,"async":false,"alias":"value"},{"kind":"property","langs":{},"name":"label","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Matches by `option.label`. Optional."}],"required":false,"comment":"Matches by `option.label`. Optional.","deprecated":false,"async":false,"alias":"label"},{"kind":"property","langs":{},"name":"index","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"Matches by the index. Optional."}],"required":false,"comment":"Matches by the index. Optional.","deprecated":false,"async":false,"alias":"index"}]},{"name":"Array","templates":[{"name":"ElementHandle"}]},{"name":"Array","templates":[{"name":"Object","properties":[{"kind":"property","langs":{},"name":"value","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Matches by `option.value`. Optional."}],"required":false,"comment":"Matches by `option.value`. Optional.","deprecated":false,"async":false,"alias":"value"},{"kind":"property","langs":{},"name":"label","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Matches by `option.label`. Optional."}],"required":false,"comment":"Matches by `option.label`. Optional.","deprecated":false,"async":false,"alias":"label"},{"kind":"property","langs":{},"name":"index","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"Matches by the index. Optional."}],"required":false,"comment":"Matches by the index. Optional.","deprecated":false,"async":false,"alias":"index"}]}]}],"expression":"[null]|[string]|[ElementHandle]|[Array]<[string]>|[Object]|[Array]<[ElementHandle]>|[Array]<[Object]>"},"spec":[{"type":"text","text":"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."}],"required":true,"comment":"Options to select. If the `<select>` has the `multiple` attribute, all matching options are selected, otherwise only the\nfirst option matching one of the passed options is selected. String values are equivalent to `{value:'string'}`. Option\nis considered matching if all specified properties match.","deprecated":false,"async":false,"alias":"values"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"noWaitAfter","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`."}],"required":false,"comment":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can\nopt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to\ninaccessible pages. Defaults to `false`.","deprecated":false,"async":false,"alias":"noWaitAfter"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"},{"kind":"property","langs":{"only":["python"],"aliases":{},"types":{},"overrides":{}},"name":"element","type":{"name":"","union":[{"name":"ElementHandle"},{"name":"Array","templates":[{"name":"ElementHandle"}]}],"expression":"[ElementHandle]|[Array]<[ElementHandle]>"},"spec":[{"type":"text","text":"Option elements to select. Optional."}],"required":false,"comment":"Option elements to select. Optional.","deprecated":false,"async":false,"alias":"element"},{"kind":"property","langs":{"only":["python"],"aliases":{},"types":{},"overrides":{}},"name":"index","type":{"name":"","union":[{"name":"int"},{"name":"Array","templates":[{"name":"int"}]}],"expression":"[int]|[Array]<[int]>"},"spec":[{"type":"text","text":"Options to select by index. Optional."}],"required":false,"comment":"Options to select by index. Optional.","deprecated":false,"async":false,"alias":"index"},{"kind":"property","langs":{"only":["python"],"aliases":{},"types":{},"overrides":{}},"name":"value","type":{"name":"","union":[{"name":"string"},{"name":"Array","templates":[{"name":"string"}]}],"expression":"[string]|[Array]<[string]>"},"spec":[{"type":"text","text":"Options to select by value. If the `<select>` has the `multiple` attribute, all given options are selected, otherwise only the first option matching one of the passed options is selected. Optional."}],"required":false,"comment":"Options to select by value. If the `<select>` has the `multiple` attribute, all given options are selected, otherwise\nonly the first option matching one of the passed options is selected. Optional.","deprecated":false,"async":false,"alias":"value"},{"kind":"property","langs":{"only":["python"],"aliases":{},"types":{},"overrides":{}},"name":"label","type":{"name":"","union":[{"name":"string"},{"name":"Array","templates":[{"name":"string"}]}],"expression":"[string]|[Array]<[string]>"},"spec":[{"type":"text","text":"Options to select by label. If the `<select>` has the `multiple` attribute, all given options are selected, otherwise only the first option matching one of the passed options is selected. Optional."}],"required":false,"comment":"Options to select by label. If the `<select>` has the `multiple` attribute, all given options are selected, otherwise\nonly the first option matching one of the passed options is selected. Optional.","deprecated":false,"async":false,"alias":"label"}]},{"kind":"method","langs":{},"name":"selectText","type":{"name":"void"},"spec":[{"type":"text","text":"This method waits for [actionability](./actionability.md) checks, then focuses the element and selects all its text content."}],"required":true,"comment":"This method waits for [actionability](./actionability.md) checks, then focuses the element and selects all its text\ncontent.","deprecated":false,"async":true,"alias":"selectText","args":[{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"setInputFiles","type":{"name":"void"},"spec":[{"type":"text","text":"This method expects `elementHandle` to point to an [input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input)."},{"type":"text","text":"Sets the value of the file input to these file paths or files. If some of the `filePaths` are relative paths, then they are resolved relative to the the current working directory. For empty array, clears the selected files."}],"required":true,"comment":"This method expects `elementHandle` to point to an\n[input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input).\n\nSets the value of the file input to these file paths or files. If some of the `filePaths` are relative paths, then they\nare resolved relative to the the current working directory. For empty array, clears the selected files.","deprecated":false,"async":true,"alias":"setInputFiles","args":[{"kind":"property","langs":{},"name":"files","type":{"name":"","union":[{"name":"path"},{"name":"Array","templates":[{"name":"path"}]},{"name":"Object","properties":[{"kind":"property","langs":{},"name":"name","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"File name"}],"required":true,"comment":"File name","deprecated":false,"async":false,"alias":"name"},{"kind":"property","langs":{},"name":"mimeType","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"File type"}],"required":true,"comment":"File type","deprecated":false,"async":false,"alias":"mimeType"},{"kind":"property","langs":{},"name":"buffer","type":{"name":"Buffer","expression":"[Buffer]"},"spec":[{"type":"text","text":"File content"}],"required":true,"comment":"File content","deprecated":false,"async":false,"alias":"buffer"}]},{"name":"Array","templates":[{"name":"Object","properties":[{"kind":"property","langs":{},"name":"name","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"File name"}],"required":true,"comment":"File name","deprecated":false,"async":false,"alias":"name"},{"kind":"property","langs":{},"name":"mimeType","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"File type"}],"required":true,"comment":"File type","deprecated":false,"async":false,"alias":"mimeType"},{"kind":"property","langs":{},"name":"buffer","type":{"name":"Buffer","expression":"[Buffer]"},"spec":[{"type":"text","text":"File content"}],"required":true,"comment":"File content","deprecated":false,"async":false,"alias":"buffer"}]}]}],"expression":"[path]|[Array]<[path]>|[Object]|[Array]<[Object]>"},"spec":[],"required":true,"comment":"","deprecated":false,"async":false,"alias":"files"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"noWaitAfter","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`."}],"required":false,"comment":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can\nopt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to\ninaccessible pages. Defaults to `false`.","deprecated":false,"async":false,"alias":"noWaitAfter"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"tap","type":{"name":"void"},"spec":[{"type":"text","text":"This method taps the element by performing the following steps:"},{"type":"li","text":"Wait for [actionability](./actionability.md) checks on the element, unless `force` option is set.","liType":"ordinal"},{"type":"li","text":"Scroll the element into view if needed.","liType":"ordinal"},{"type":"li","text":"Use [`property: Page.touchscreen`] to tap the center of the element, or the specified `position`.","liType":"ordinal"},{"type":"li","text":"Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.","liType":"ordinal"},{"type":"text","text":"If the element is detached from the DOM at any moment during the action, this method throws."},{"type":"text","text":"When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing zero timeout disables this."},{"type":"note","noteType":"note","text":"`elementHandle.tap()` requires that the `hasTouch` option of the browser context be set to true."}],"required":true,"comment":"This method taps the element by performing the following steps:\n1. Wait for [actionability](./actionability.md) checks on the element, unless `force` option is set.\n1. Scroll the element into view if needed.\n1. Use [`property: Page.touchscreen`] to tap the center of the element, or the specified `position`.\n1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.\n\nIf the element is detached from the DOM at any moment during the action, this method throws.\n\nWhen all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing\nzero timeout disables this.\n\n> NOTE: `elementHandle.tap()` requires that the `hasTouch` option of the browser context be set to true.","deprecated":false,"async":true,"alias":"tap","args":[{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"force","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`."}],"required":false,"comment":"Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.","deprecated":false,"async":false,"alias":"force"},{"kind":"property","langs":{},"name":"modifiers","type":{"name":"Array","templates":[{"name":"KeyboardModifier","union":[{"name":"\"Alt\""},{"name":"\"Control\""},{"name":"\"Meta\""},{"name":"\"Shift\""}]}],"expression":"[Array]<[KeyboardModifier]<\"Alt\"|\"Control\"|\"Meta\"|\"Shift\">>"},"spec":[{"type":"text","text":"Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current modifiers back. If not specified, currently pressed modifiers are used."}],"required":false,"comment":"Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current\nmodifiers back. If not specified, currently pressed modifiers are used.","deprecated":false,"async":false,"alias":"modifiers"},{"kind":"property","langs":{},"name":"noWaitAfter","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`."}],"required":false,"comment":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can\nopt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to\ninaccessible pages. Defaults to `false`.","deprecated":false,"async":false,"alias":"noWaitAfter"},{"kind":"property","langs":{},"name":"position","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"x","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"x"},{"kind":"property","langs":{},"name":"y","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"y"}],"expression":"[Object]"},"spec":[{"type":"text","text":"A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element."}],"required":false,"comment":"A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the\nelement.","deprecated":false,"async":false,"alias":"position"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"},{"kind":"property","langs":{},"name":"trial","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it."}],"required":false,"comment":"When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to\n`false`. Useful to wait until the element is ready for the action without performing it.","deprecated":false,"async":false,"alias":"trial"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"textContent","type":{"name":"","union":[{"name":"null"},{"name":"string"}],"expression":"[null]|[string]"},"spec":[{"type":"text","text":"Returns the `node.textContent`."}],"required":true,"comment":"Returns the `node.textContent`.","deprecated":false,"async":true,"alias":"textContent","args":[]},{"kind":"method","langs":{},"name":"type","type":{"name":"void"},"spec":[{"type":"text","text":"Focuses the element, and then sends a `keydown`, `keypress`/`input`, and `keyup` event for each character in the text."},{"type":"text","text":"To press a special key, like `Control` or `ArrowDown`, use [`method: ElementHandle.press`]."},{"type":"code","lines":["await elementHandle.type('Hello'); // Types instantly","await elementHandle.type('World', {delay: 100}); // Types slower, like a user"],"codeLang":"js"},{"type":"code","lines":["elementHandle.type(\"Hello\"); // Types instantly","elementHandle.type(\"World\", new ElementHandle.TypeOptions().setDelay(100)); // Types slower, like a user"],"codeLang":"java"},{"type":"code","lines":["await element_handle.type(\"hello\") # types instantly","await element_handle.type(\"world\", delay=100) # types slower, like a user"],"codeLang":"python async"},{"type":"code","lines":["element_handle.type(\"hello\") # types instantly","element_handle.type(\"world\", delay=100) # types slower, like a user"],"codeLang":"python sync"},{"type":"code","lines":["await elementHandle.TypeAsync(\"Hello\"); // Types instantly","await elementHandle.TypeAsync(\"World\", delay: 100); // Types slower, like a user"],"codeLang":"csharp"},{"type":"text","text":"An example of typing into a text field and then submitting the form:"},{"type":"code","lines":["const elementHandle = await page.$('input');","await elementHandle.type('some text');","await elementHandle.press('Enter');"],"codeLang":"js"},{"type":"code","lines":["ElementHandle elementHandle = page.querySelector(\"input\");","elementHandle.type(\"some text\");","elementHandle.press(\"Enter\");"],"codeLang":"java"},{"type":"code","lines":["element_handle = await page.query_selector(\"input\")","await element_handle.type(\"some text\")","await element_handle.press(\"Enter\")"],"codeLang":"python async"},{"type":"code","lines":["element_handle = page.query_selector(\"input\")","element_handle.type(\"some text\")","element_handle.press(\"Enter\")"],"codeLang":"python sync"},{"type":"code","lines":["var elementHandle = await page.QuerySelectorAsync(\"input\");","await elementHandle.TypeAsync(\"some text\");","await elementHandle.PressAsync(\"Enter\");"],"codeLang":"csharp"}],"required":true,"comment":"Focuses the element, and then sends a `keydown`, `keypress`/`input`, and `keyup` event for each character in the text.\n\nTo press a special key, like `Control` or `ArrowDown`, use [`method: ElementHandle.press`].\n\n```js\nawait elementHandle.type('Hello'); // Types instantly\nawait elementHandle.type('World', {delay: 100}); // Types slower, like a user\n```\n\n```java\nelementHandle.type(\"Hello\"); // Types instantly\nelementHandle.type(\"World\", new ElementHandle.TypeOptions().setDelay(100)); // Types slower, like a user\n```\n\n```python async\nawait element_handle.type(\"hello\") # types instantly\nawait element_handle.type(\"world\", delay=100) # types slower, like a user\n```\n\n```python sync\nelement_handle.type(\"hello\") # types instantly\nelement_handle.type(\"world\", delay=100) # types slower, like a user\n```\n\n```csharp\nawait elementHandle.TypeAsync(\"Hello\"); // Types instantly\nawait elementHandle.TypeAsync(\"World\", delay: 100); // Types slower, like a user\n```\n\nAn example of typing into a text field and then submitting the form:\n\n```js\nconst elementHandle = await page.$('input');\nawait elementHandle.type('some text');\nawait elementHandle.press('Enter');\n```\n\n```java\nElementHandle elementHandle = page.querySelector(\"input\");\nelementHandle.type(\"some text\");\nelementHandle.press(\"Enter\");\n```\n\n```python async\nelement_handle = await page.query_selector(\"input\")\nawait element_handle.type(\"some text\")\nawait element_handle.press(\"Enter\")\n```\n\n```python sync\nelement_handle = page.query_selector(\"input\")\nelement_handle.type(\"some text\")\nelement_handle.press(\"Enter\")\n```\n\n```csharp\nvar elementHandle = await page.QuerySelectorAsync(\"input\");\nawait elementHandle.TypeAsync(\"some text\");\nawait elementHandle.PressAsync(\"Enter\");\n```\n","deprecated":false,"async":true,"alias":"type","args":[{"kind":"property","langs":{},"name":"text","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A text to type into a focused element."}],"required":true,"comment":"A text to type into a focused element.","deprecated":false,"async":false,"alias":"text"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"delay","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Time to wait between key presses in milliseconds. Defaults to 0."}],"required":false,"comment":"Time to wait between key presses in milliseconds. Defaults to 0.","deprecated":false,"async":false,"alias":"delay"},{"kind":"property","langs":{},"name":"noWaitAfter","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`."}],"required":false,"comment":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can\nopt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to\ninaccessible pages. Defaults to `false`.","deprecated":false,"async":false,"alias":"noWaitAfter"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"uncheck","type":{"name":"void"},"spec":[{"type":"text","text":"This method checks the element by performing the following steps:"},{"type":"li","text":"Ensure that element is a checkbox or a radio input. If not, this method throws. If the element is already unchecked, this method returns immediately.","liType":"ordinal"},{"type":"li","text":"Wait for [actionability](./actionability.md) checks on the element, unless `force` option is set.","liType":"ordinal"},{"type":"li","text":"Scroll the element into view if needed.","liType":"ordinal"},{"type":"li","text":"Use [`property: Page.mouse`] to click in the center of the element.","liType":"ordinal"},{"type":"li","text":"Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.","liType":"ordinal"},{"type":"li","text":"Ensure that the element is now unchecked. If not, this method throws.","liType":"ordinal"},{"type":"text","text":"If the element is detached from the DOM at any moment during the action, this method throws."},{"type":"text","text":"When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing zero timeout disables this."}],"required":true,"comment":"This method checks the element by performing the following steps:\n1. Ensure that element is a checkbox or a radio input. If not, this method throws. If the element is already\n unchecked, this method returns immediately.\n1. Wait for [actionability](./actionability.md) checks on the element, unless `force` option is set.\n1. Scroll the element into view if needed.\n1. Use [`property: Page.mouse`] to click in the center of the element.\n1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.\n1. Ensure that the element is now unchecked. If not, this method throws.\n\nIf the element is detached from the DOM at any moment during the action, this method throws.\n\nWhen all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing\nzero timeout disables this.","deprecated":false,"async":true,"alias":"uncheck","args":[{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"force","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`."}],"required":false,"comment":"Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.","deprecated":false,"async":false,"alias":"force"},{"kind":"property","langs":{},"name":"noWaitAfter","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`."}],"required":false,"comment":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can\nopt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to\ninaccessible pages. Defaults to `false`.","deprecated":false,"async":false,"alias":"noWaitAfter"},{"kind":"property","langs":{},"name":"position","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"x","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"x"},{"kind":"property","langs":{},"name":"y","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"y"}],"expression":"[Object]"},"spec":[{"type":"text","text":"A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element."}],"required":false,"comment":"A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the\nelement.","deprecated":false,"async":false,"alias":"position"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"},{"kind":"property","langs":{},"name":"trial","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it."}],"required":false,"comment":"When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to\n`false`. Useful to wait until the element is ready for the action without performing it.","deprecated":false,"async":false,"alias":"trial"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"waitForElementState","type":{"name":"void"},"spec":[{"type":"text","text":"Returns when the element satisfies the `state`."},{"type":"text","text":"Depending on the `state` parameter, this method waits for one of the [actionability](./actionability.md) checks to pass. This method throws when the element is detached while waiting, unless waiting for the `\"hidden\"` state."},{"type":"li","text":"`\"visible\"` Wait until the element is [visible](./actionability.md#visible).","liType":"bullet"},{"type":"li","text":"`\"hidden\"` Wait until the element is [not visible](./actionability.md#visible) or [not attached](./actionability.md#attached). Note that waiting for hidden does not throw when the element detaches.","liType":"bullet"},{"type":"li","text":"`\"stable\"` Wait until the element is both [visible](./actionability.md#visible) and [stable](./actionability.md#stable).","liType":"bullet"},{"type":"li","text":"`\"enabled\"` Wait until the element is [enabled](./actionability.md#enabled).","liType":"bullet"},{"type":"li","text":"`\"disabled\"` Wait until the element is [not enabled](./actionability.md#enabled).","liType":"bullet"},{"type":"li","text":"`\"editable\"` Wait until the element is [editable](./actionability.md#editable).","liType":"bullet"},{"type":"text","text":"If the element does not satisfy the condition for the `timeout` milliseconds, this method will throw."}],"required":true,"comment":"Returns when the element satisfies the `state`.\n\nDepending on the `state` parameter, this method waits for one of the [actionability](./actionability.md) checks to pass.\nThis method throws when the element is detached while waiting, unless waiting for the `\"hidden\"` state.\n- `\"visible\"` Wait until the element is [visible](./actionability.md#visible).\n- `\"hidden\"` Wait until the element is [not visible](./actionability.md#visible) or\n [not attached](./actionability.md#attached). Note that waiting for hidden does not throw when the element detaches.\n- `\"stable\"` Wait until the element is both [visible](./actionability.md#visible) and\n [stable](./actionability.md#stable).\n- `\"enabled\"` Wait until the element is [enabled](./actionability.md#enabled).\n- `\"disabled\"` Wait until the element is [not enabled](./actionability.md#enabled).\n- `\"editable\"` Wait until the element is [editable](./actionability.md#editable).\n\nIf the element does not satisfy the condition for the `timeout` milliseconds, this method will throw.","deprecated":false,"async":true,"alias":"waitForElementState","args":[{"kind":"property","langs":{},"name":"state","type":{"name":"ElementState","union":[{"name":"\"visible\""},{"name":"\"hidden\""},{"name":"\"stable\""},{"name":"\"enabled\""},{"name":"\"disabled\""},{"name":"\"editable\""}],"expression":"[ElementState]<\"visible\"|\"hidden\"|\"stable\"|\"enabled\"|\"disabled\"|\"editable\">"},"spec":[{"type":"text","text":"A state to wait for, see below for more details."}],"required":true,"comment":"A state to wait for, see below for more details.","deprecated":false,"async":false,"alias":"state"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"waitForSelector","type":{"name":"","union":[{"name":"null"},{"name":"ElementHandle"}],"expression":"[null]|[ElementHandle]"},"spec":[{"type":"text","text":"Returns element specified by selector when it satisfies `state` option. Returns `null` if waiting for `hidden` or `detached`."},{"type":"text","text":"Wait for the `selector` relative to the element handle to satisfy `state` option (either appear/disappear from dom, or become visible/hidden). If at the moment of calling the method `selector` already satisfies the condition, the method will return immediately. If the selector doesn't satisfy the condition for the `timeout` milliseconds, the function will throw."},{"type":"code","lines":["await page.setContent(`<div><span></span></div>`);","const div = await page.$('div');","// Waiting for the 'span' selector relative to the div.","const span = await div.waitForSelector('span', { state: 'attached' });"],"codeLang":"js"},{"type":"code","lines":["page.setContent(\"<div><span></span></div>\");","ElementHandle div = page.querySelector(\"div\");","// Waiting for the \"span\" selector relative to the div.","ElementHandle span = div.waitForSelector(\"span\", new ElementHandle.WaitForSelectorOptions()"," .setState(WaitForSelectorState.ATTACHED));"],"codeLang":"java"},{"type":"code","lines":["await page.set_content(\"<div><span></span></div>\")","div = await page.query_selector(\"div\")","# waiting for the \"span\" selector relative to the div.","span = await div.wait_for_selector(\"span\", state=\"attached\")"],"codeLang":"python async"},{"type":"code","lines":["page.set_content(\"<div><span></span></div>\")","div = page.query_selector(\"div\")","# waiting for the \"span\" selector relative to the div.","span = div.wait_for_selector(\"span\", state=\"attached\")"],"codeLang":"python sync"},{"type":"code","lines":["await page.SetContentAsync(\"<div><span></span></div>\");","var div = await page.QuerySelectorAsync(\"div\");","// Waiting for the \"span\" selector relative to the div.","var span = await page.WaitForSelectorAsync(\"span\", WaitForSelectorState.Attached);"],"codeLang":"csharp"},{"type":"note","noteType":"note","text":"This method does not work across navigations, use [`method: Page.waitForSelector`] instead."}],"required":true,"comment":"Returns element specified by selector when it satisfies `state` option. Returns `null` if waiting for `hidden` or\n`detached`.\n\nWait for the `selector` relative to the element handle to satisfy `state` option (either appear/disappear from dom, or\nbecome visible/hidden). If at the moment of calling the method `selector` already satisfies the condition, the method\nwill return immediately. If the selector doesn't satisfy the condition for the `timeout` milliseconds, the function will\nthrow.\n\n```js\nawait page.setContent(`<div><span></span></div>`);\nconst div = await page.$('div');\n// Waiting for the 'span' selector relative to the div.\nconst span = await div.waitForSelector('span', { state: 'attached' });\n```\n\n```java\npage.setContent(\"<div><span></span></div>\");\nElementHandle div = page.querySelector(\"div\");\n// Waiting for the \"span\" selector relative to the div.\nElementHandle span = div.waitForSelector(\"span\", new ElementHandle.WaitForSelectorOptions()\n .setState(WaitForSelectorState.ATTACHED));\n```\n\n```python async\nawait page.set_content(\"<div><span></span></div>\")\ndiv = await page.query_selector(\"div\")\n# waiting for the \"span\" selector relative to the div.\nspan = await div.wait_for_selector(\"span\", state=\"attached\")\n```\n\n```python sync\npage.set_content(\"<div><span></span></div>\")\ndiv = page.query_selector(\"div\")\n# waiting for the \"span\" selector relative to the div.\nspan = div.wait_for_selector(\"span\", state=\"attached\")\n```\n\n```csharp\nawait page.SetContentAsync(\"<div><span></span></div>\");\nvar div = await page.QuerySelectorAsync(\"div\");\n// Waiting for the \"span\" selector relative to the div.\nvar span = await page.WaitForSelectorAsync(\"span\", WaitForSelectorState.Attached);\n```\n\n> NOTE: This method does not work across navigations, use [`method: Page.waitForSelector`] instead.","deprecated":false,"async":true,"alias":"waitForSelector","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to query for. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to query for. See [working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"state","type":{"name":"WaitForSelectorState","union":[{"name":"\"attached\""},{"name":"\"detached\""},{"name":"\"visible\""},{"name":"\"hidden\""}],"expression":"[WaitForSelectorState]<\"attached\"|\"detached\"|\"visible\"|\"hidden\">"},"spec":[{"type":"text","text":"Defaults to `'visible'`. Can be either:"},{"type":"li","text":"`'attached'` - wait for element to be present in DOM.","liType":"bullet"},{"type":"li","text":"`'detached'` - wait for element to not be present in DOM.","liType":"bullet"},{"type":"li","text":"`'visible'` - wait for element to have non-empty bounding box and no `visibility:hidden`. Note that element without any content or with `display:none` has an empty bounding box and is not considered visible.","liType":"bullet"},{"type":"li","text":"`'hidden'` - wait for element to be either detached from DOM, or have an empty bounding box or `visibility:hidden`. This is opposite to the `'visible'` option.","liType":"bullet"}],"required":false,"comment":"Defaults to `'visible'`. Can be either:\n- `'attached'` - wait for element to be present in DOM.\n- `'detached'` - wait for element to not be present in DOM.\n- `'visible'` - wait for element to have non-empty bounding box and no `visibility:hidden`. Note that element without\n any content or with `display:none` has an empty bounding box and is not considered visible.\n- `'hidden'` - wait for element to be either detached from DOM, or have an empty bounding box or `visibility:hidden`.\n This is opposite to the `'visible'` option.","deprecated":false,"async":false,"alias":"state"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]}]},{"name":"Error","spec":[{"type":"li","text":"extends: [Exception]","liType":"bullet"},{"type":"text","text":"Error is raised whenever certain operations are terminated abnormally, e.g. browser closes while [`method: Page.evaluate`] is running. All Playwright exceptions inherit from this class."}],"extends":"Exception","langs":{"only":["python"],"aliases":{},"types":{},"overrides":{}},"comment":"- extends: [Exception]\n\nError is raised whenever certain operations are terminated abnormally, e.g. browser closes while\n[`method: Page.evaluate`] is running. All Playwright exceptions inherit from this class.","members":[{"kind":"property","langs":{},"name":"message","type":{"name":"str","expression":"[str]"},"spec":[{"type":"text","text":"Message of the error."}],"required":true,"comment":"Message of the error.","deprecated":false,"async":false,"alias":"message","args":[]},{"kind":"property","langs":{},"name":"name","type":{"name":"str","expression":"[str]"},"spec":[{"type":"text","text":"Name of the error which got thrown inside the browser. Optional."}],"required":true,"comment":"Name of the error which got thrown inside the browser. Optional.","deprecated":false,"async":false,"alias":"name","args":[]},{"kind":"property","langs":{},"name":"stack","type":{"name":"str","expression":"[str]"},"spec":[{"type":"text","text":"Stack of the error which got thrown inside the browser. Optional."}],"required":true,"comment":"Stack of the error which got thrown inside the browser. Optional.","deprecated":false,"async":false,"alias":"stack","args":[]}]},{"name":"FileChooser","spec":[{"type":"text","text":"`FileChooser` objects are dispatched by the page in the [`event: Page.fileChooser`] event."},{"type":"code","lines":["const [fileChooser] = await Promise.all(["," page.waitForEvent('filechooser'),"," page.click('upload')","]);","await fileChooser.setFiles('myfile.pdf');"],"codeLang":"js"},{"type":"code","lines":["FileChooser fileChooser = page.waitForFileChooser(() -> page.click(\"upload\"));","fileChooser.setFiles(Paths.get(\"myfile.pdf\"));"],"codeLang":"java"},{"type":"code","lines":["async with page.expect_file_chooser() as fc_info:"," await page.click(\"upload\")","file_chooser = await fc_info.value","await file_chooser.set_files(\"myfile.pdf\")"],"codeLang":"python async"},{"type":"code","lines":["with page.expect_file_chooser() as fc_info:"," page.click(\"upload\")","file_chooser = fc_info.value","file_chooser.set_files(\"myfile.pdf\")"],"codeLang":"python sync"},{"type":"code","lines":["var fileChooser = await page.RunAndWaitForFileChooserAsync(async () =>","{"," await page.ClickAsync(\"upload\");","});","await fileChooser.SetFilesAsync(\"temp.txt\");"],"codeLang":"csharp"}],"langs":{},"comment":"`FileChooser` objects are dispatched by the page in the [`event: Page.fileChooser`] event.\n\n```js\nconst [fileChooser] = await Promise.all([\n page.waitForEvent('filechooser'),\n page.click('upload')\n]);\nawait fileChooser.setFiles('myfile.pdf');\n```\n\n```java\nFileChooser fileChooser = page.waitForFileChooser(() -> page.click(\"upload\"));\nfileChooser.setFiles(Paths.get(\"myfile.pdf\"));\n```\n\n```python async\nasync with page.expect_file_chooser() as fc_info:\n await page.click(\"upload\")\nfile_chooser = await fc_info.value\nawait file_chooser.set_files(\"myfile.pdf\")\n```\n\n```python sync\nwith page.expect_file_chooser() as fc_info:\n page.click(\"upload\")\nfile_chooser = fc_info.value\nfile_chooser.set_files(\"myfile.pdf\")\n```\n\n```csharp\nvar fileChooser = await page.RunAndWaitForFileChooserAsync(async () =>\n{\n await page.ClickAsync(\"upload\");\n});\nawait fileChooser.SetFilesAsync(\"temp.txt\");\n```\n","members":[{"kind":"method","langs":{},"name":"element","type":{"name":"ElementHandle","expression":"[ElementHandle]"},"spec":[{"type":"text","text":"Returns input element associated with this file chooser."}],"required":true,"comment":"Returns input element associated with this file chooser.","deprecated":false,"async":false,"alias":"element","args":[]},{"kind":"method","langs":{},"name":"isMultiple","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Returns whether this file chooser accepts multiple files."}],"required":true,"comment":"Returns whether this file chooser accepts multiple files.","deprecated":false,"async":false,"alias":"isMultiple","args":[]},{"kind":"method","langs":{},"name":"page","type":{"name":"Page","expression":"[Page]"},"spec":[{"type":"text","text":"Returns page this file chooser belongs to."}],"required":true,"comment":"Returns page this file chooser belongs to.","deprecated":false,"async":false,"alias":"page","args":[]},{"kind":"method","langs":{},"name":"setFiles","type":{"name":"void"},"spec":[{"type":"text","text":"Sets the value of the file input this chooser is associated with. If some of the `filePaths` are relative paths, then they are resolved relative to the the current working directory. For empty array, clears the selected files."}],"required":true,"comment":"Sets the value of the file input this chooser is associated with. If some of the `filePaths` are relative paths, then\nthey are resolved relative to the the current working directory. For empty array, clears the selected files.","deprecated":false,"async":true,"alias":"setFiles","args":[{"kind":"property","langs":{},"name":"files","type":{"name":"","union":[{"name":"path"},{"name":"Array","templates":[{"name":"path"}]},{"name":"Object","properties":[{"kind":"property","langs":{},"name":"name","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"File name"}],"required":true,"comment":"File name","deprecated":false,"async":false,"alias":"name"},{"kind":"property","langs":{},"name":"mimeType","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"File type"}],"required":true,"comment":"File type","deprecated":false,"async":false,"alias":"mimeType"},{"kind":"property","langs":{},"name":"buffer","type":{"name":"Buffer","expression":"[Buffer]"},"spec":[{"type":"text","text":"File content"}],"required":true,"comment":"File content","deprecated":false,"async":false,"alias":"buffer"}]},{"name":"Array","templates":[{"name":"Object","properties":[{"kind":"property","langs":{},"name":"name","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"File name"}],"required":true,"comment":"File name","deprecated":false,"async":false,"alias":"name"},{"kind":"property","langs":{},"name":"mimeType","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"File type"}],"required":true,"comment":"File type","deprecated":false,"async":false,"alias":"mimeType"},{"kind":"property","langs":{},"name":"buffer","type":{"name":"Buffer","expression":"[Buffer]"},"spec":[{"type":"text","text":"File content"}],"required":true,"comment":"File content","deprecated":false,"async":false,"alias":"buffer"}]}]}],"expression":"[path]|[Array]<[path]>|[Object]|[Array]<[Object]>"},"spec":[],"required":true,"comment":"","deprecated":false,"async":false,"alias":"files"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"noWaitAfter","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`."}],"required":false,"comment":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can\nopt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to\ninaccessible pages. Defaults to `false`.","deprecated":false,"async":false,"alias":"noWaitAfter"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]}]},{"name":"Frame","spec":[{"type":"text","text":"At every point of time, page exposes its current frame tree via the [`method: Page.mainFrame`] and [`method: Frame.childFrames`] methods."},{"type":"text","text":"`Frame` object's lifecycle is controlled by three events, dispatched on the page object:"},{"type":"li","text":"[`event: Page.frameAttached`] - fired when the frame gets attached to the page. A Frame can be attached to the page only once.","liType":"bullet"},{"type":"li","text":"[`event: Page.frameNavigated`] - fired when the frame commits navigation to a different URL.","liType":"bullet"},{"type":"li","text":"[`event: Page.frameDetached`] - fired when the frame gets detached from the page. A Frame can be detached from the page only once.","liType":"bullet"},{"type":"text","text":"An example of dumping frame tree:"},{"type":"code","lines":["const { firefox } = require('playwright'); // Or 'chromium' or 'webkit'.","","(async () => {"," const browser = await firefox.launch();"," const page = await browser.newPage();"," await page.goto('https://www.google.com/chrome/browser/canary.html');"," dumpFrameTree(page.mainFrame(), '');"," await browser.close();",""," function dumpFrameTree(frame, indent) {"," console.log(indent + frame.url());"," for (const child of frame.childFrames()) {"," dumpFrameTree(child, indent + ' ');"," }"," }","})();"],"codeLang":"js"},{"type":"code","lines":["import com.microsoft.playwright.*;","","public class Example {"," public static void main(String[] args) {"," try (Playwright playwright = Playwright.create()) {"," BrowserType firefox = playwright.firefox();"," Browser browser = firefox.launch();"," Page page = browser.newPage();"," page.navigate(\"https://www.google.com/chrome/browser/canary.html\");"," dumpFrameTree(page.mainFrame(), \"\");"," browser.close();"," }"," }"," static void dumpFrameTree(Frame frame, String indent) {"," System.out.println(indent + frame.url());"," for (Frame child : frame.childFrames()) {"," dumpFrameTree(child, indent + \" \");"," }"," }","}"],"codeLang":"java"},{"type":"code","lines":["import asyncio","from playwright.async_api import async_playwright","","async def run(playwright):"," firefox = playwright.firefox"," browser = await firefox.launch()"," page = await browser.new_page()"," await page.goto(\"https://www.theverge.com\")"," dump_frame_tree(page.main_frame, \"\")"," await browser.close()","","def dump_frame_tree(frame, indent):"," print(indent + frame.name + '@' + frame.url)"," for child in frame.child_frames:"," dump_frame_tree(child, indent + \" \")","","async def main():"," async with async_playwright() as playwright:"," await run(playwright)","asyncio.run(main())"],"codeLang":"python async"},{"type":"code","lines":["from playwright.sync_api import sync_playwright","","def run(playwright):"," firefox = playwright.firefox"," browser = firefox.launch()"," page = browser.new_page()"," page.goto(\"https://www.theverge.com\")"," dump_frame_tree(page.main_frame, \"\")"," browser.close()","","def dump_frame_tree(frame, indent):"," print(indent + frame.name + '@' + frame.url)"," for child in frame.child_frames:"," dump_frame_tree(child, indent + \" \")","","with sync_playwright() as playwright:"," run(playwright)"],"codeLang":"python sync"},{"type":"code","lines":["using Microsoft.Playwright;","using System;","using System.Threading.Tasks;","","class FrameExamples","{"," public static async Task Main()"," {"," using var playwright = await Playwright.CreateAsync();"," await using var browser = await playwright.Firefox.LaunchAsync();"," var page = await browser.NewPageAsync();",""," await page.GotoAsync(\"https://www.bing.com\");"," DumpFrameTree(page.MainFrame, string.Empty);"," }",""," private static void DumpFrameTree(IFrame frame, string indent)"," {"," Console.WriteLine($\"{indent}{frame.Url}\");"," foreach (var child in frame.ChildFrames)"," DumpFrameTree(child, indent + \" \");"," }","}"],"codeLang":"csharp"}],"langs":{},"comment":"At every point of time, page exposes its current frame tree via the [`method: Page.mainFrame`] and\n[`method: Frame.childFrames`] methods.\n\n`Frame` object's lifecycle is controlled by three events, dispatched on the page object:\n- [`event: Page.frameAttached`] - fired when the frame gets attached to the page. A Frame can be attached to the page\n only once.\n- [`event: Page.frameNavigated`] - fired when the frame commits navigation to a different URL.\n- [`event: Page.frameDetached`] - fired when the frame gets detached from the page. A Frame can be detached from the\n page only once.\n\nAn example of dumping frame tree:\n\n```js\nconst { firefox } = require('playwright'); // Or 'chromium' or 'webkit'.\n\n(async () => {\n const browser = await firefox.launch();\n const page = await browser.newPage();\n await page.goto('https://www.google.com/chrome/browser/canary.html');\n dumpFrameTree(page.mainFrame(), '');\n await browser.close();\n\n function dumpFrameTree(frame, indent) {\n console.log(indent + frame.url());\n for (const child of frame.childFrames()) {\n dumpFrameTree(child, indent + ' ');\n }\n }\n})();\n```\n\n```java\nimport com.microsoft.playwright.*;\n\npublic class Example {\n public static void main(String[] args) {\n try (Playwright playwright = Playwright.create()) {\n BrowserType firefox = playwright.firefox();\n Browser browser = firefox.launch();\n Page page = browser.newPage();\n page.navigate(\"https://www.google.com/chrome/browser/canary.html\");\n dumpFrameTree(page.mainFrame(), \"\");\n browser.close();\n }\n }\n static void dumpFrameTree(Frame frame, String indent) {\n System.out.println(indent + frame.url());\n for (Frame child : frame.childFrames()) {\n dumpFrameTree(child, indent + \" \");\n }\n }\n}\n```\n\n```python async\nimport asyncio\nfrom playwright.async_api import async_playwright\n\nasync def run(playwright):\n firefox = playwright.firefox\n browser = await firefox.launch()\n page = await browser.new_page()\n await page.goto(\"https://www.theverge.com\")\n dump_frame_tree(page.main_frame, \"\")\n await browser.close()\n\ndef dump_frame_tree(frame, indent):\n print(indent + frame.name + '@' + frame.url)\n for child in frame.child_frames:\n dump_frame_tree(child, indent + \" \")\n\nasync def main():\n async with async_playwright() as playwright:\n await run(playwright)\nasyncio.run(main())\n```\n\n```python sync\nfrom playwright.sync_api import sync_playwright\n\ndef run(playwright):\n firefox = playwright.firefox\n browser = firefox.launch()\n page = browser.new_page()\n page.goto(\"https://www.theverge.com\")\n dump_frame_tree(page.main_frame, \"\")\n browser.close()\n\ndef dump_frame_tree(frame, indent):\n print(indent + frame.name + '@' + frame.url)\n for child in frame.child_frames:\n dump_frame_tree(child, indent + \" \")\n\nwith sync_playwright() as playwright:\n run(playwright)\n```\n\n```csharp\nusing Microsoft.Playwright;\nusing System;\nusing System.Threading.Tasks;\n\nclass FrameExamples\n{\n public static async Task Main()\n {\n using var playwright = await Playwright.CreateAsync();\n await using var browser = await playwright.Firefox.LaunchAsync();\n var page = await browser.NewPageAsync();\n\n await page.GotoAsync(\"https://www.bing.com\");\n DumpFrameTree(page.MainFrame, string.Empty);\n }\n\n private static void DumpFrameTree(IFrame frame, string indent)\n {\n Console.WriteLine($\"{indent}{frame.Url}\");\n foreach (var child in frame.ChildFrames)\n DumpFrameTree(child, indent + \" \");\n }\n}\n```\n","members":[{"kind":"method","langs":{},"name":"addScriptTag","type":{"name":"ElementHandle","expression":"[ElementHandle]"},"spec":[{"type":"text","text":"Returns the added tag when the script's onload fires or when the script content was injected into frame."},{"type":"text","text":"Adds a `<script>` tag into the page with the desired url or content."}],"required":true,"comment":"Returns the added tag when the script's onload fires or when the script content was injected into frame.\n\nAdds a `<script>` tag into the page with the desired url or content.","deprecated":false,"async":true,"alias":"addScriptTag","args":[{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"content","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Raw JavaScript content to be injected into frame."}],"required":false,"comment":"Raw JavaScript content to be injected into frame.","deprecated":false,"async":false,"alias":"content"},{"kind":"property","langs":{},"name":"path","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"Path to the JavaScript file to be injected into frame. If `path` is a relative path, then it is resolved relative to the current working directory."}],"required":false,"comment":"Path to the JavaScript file to be injected into frame. If `path` is a relative path, then it is resolved relative to the\ncurrent working directory.","deprecated":false,"async":false,"alias":"path"},{"kind":"property","langs":{},"name":"type","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Script type. Use 'module' in order to load a Javascript ES6 module. See [script](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script) for more details."}],"required":false,"comment":"Script type. Use 'module' in order to load a Javascript ES6 module. See\n[script](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script) for more details.","deprecated":false,"async":false,"alias":"type"},{"kind":"property","langs":{},"name":"url","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"URL of a script to be added."}],"required":false,"comment":"URL of a script to be added.","deprecated":false,"async":false,"alias":"url"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"addStyleTag","type":{"name":"ElementHandle","expression":"[ElementHandle]"},"spec":[{"type":"text","text":"Returns the added tag when the stylesheet's onload fires or when the CSS content was injected into frame."},{"type":"text","text":"Adds a `<link rel=\"stylesheet\">` tag into the page with the desired url or a `<style type=\"text/css\">` tag with the content."}],"required":true,"comment":"Returns the added tag when the stylesheet's onload fires or when the CSS content was injected into frame.\n\nAdds a `<link rel=\"stylesheet\">` tag into the page with the desired url or a `<style type=\"text/css\">` tag with the\ncontent.","deprecated":false,"async":true,"alias":"addStyleTag","args":[{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"content","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Raw CSS content to be injected into frame."}],"required":false,"comment":"Raw CSS content to be injected into frame.","deprecated":false,"async":false,"alias":"content"},{"kind":"property","langs":{},"name":"path","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"Path to the CSS file to be injected into frame. If `path` is a relative path, then it is resolved relative to the current working directory."}],"required":false,"comment":"Path to the CSS file to be injected into frame. If `path` is a relative path, then it is resolved relative to the\ncurrent working directory.","deprecated":false,"async":false,"alias":"path"},{"kind":"property","langs":{},"name":"url","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"URL of the `<link>` tag."}],"required":false,"comment":"URL of the `<link>` tag.","deprecated":false,"async":false,"alias":"url"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"check","type":{"name":"void"},"spec":[{"type":"text","text":"This method checks an element matching `selector` by performing the following steps:"},{"type":"li","text":"Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.","liType":"ordinal"},{"type":"li","text":"Ensure that matched element is a checkbox or a radio input. If not, this method throws. If the element is already checked, this method returns immediately.","liType":"ordinal"},{"type":"li","text":"Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried.","liType":"ordinal"},{"type":"li","text":"Scroll the element into view if needed.","liType":"ordinal"},{"type":"li","text":"Use [`property: Page.mouse`] to click in the center of the element.","liType":"ordinal"},{"type":"li","text":"Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.","liType":"ordinal"},{"type":"li","text":"Ensure that the element is now checked. If not, this method throws.","liType":"ordinal"},{"type":"text","text":"When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing zero timeout disables this."}],"required":true,"comment":"This method checks an element matching `selector` by performing the following steps:\n1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.\n1. Ensure that matched element is a checkbox or a radio input. If not, this method throws. If the element is already\n checked, this method returns immediately.\n1. Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the\n element is detached during the checks, the whole action is retried.\n1. Scroll the element into view if needed.\n1. Use [`property: Page.mouse`] to click in the center of the element.\n1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.\n1. Ensure that the element is now checked. If not, this method throws.\n\nWhen all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing\nzero timeout disables this.","deprecated":false,"async":true,"alias":"check","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See\n[working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"force","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`."}],"required":false,"comment":"Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.","deprecated":false,"async":false,"alias":"force"},{"kind":"property","langs":{},"name":"noWaitAfter","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`."}],"required":false,"comment":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can\nopt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to\ninaccessible pages. Defaults to `false`.","deprecated":false,"async":false,"alias":"noWaitAfter"},{"kind":"property","langs":{},"name":"position","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"x","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"x"},{"kind":"property","langs":{},"name":"y","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"y"}],"expression":"[Object]"},"spec":[{"type":"text","text":"A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element."}],"required":false,"comment":"A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the\nelement.","deprecated":false,"async":false,"alias":"position"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"},{"kind":"property","langs":{},"name":"trial","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it."}],"required":false,"comment":"When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to\n`false`. Useful to wait until the element is ready for the action without performing it.","deprecated":false,"async":false,"alias":"trial"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"childFrames","type":{"name":"Array","templates":[{"name":"Frame"}],"expression":"[Array]<[Frame]>"},"spec":[],"required":true,"comment":"","deprecated":false,"async":false,"alias":"childFrames","args":[]},{"kind":"method","langs":{},"name":"click","type":{"name":"void"},"spec":[{"type":"text","text":"This method clicks an element matching `selector` by performing the following steps:"},{"type":"li","text":"Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.","liType":"ordinal"},{"type":"li","text":"Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried.","liType":"ordinal"},{"type":"li","text":"Scroll the element into view if needed.","liType":"ordinal"},{"type":"li","text":"Use [`property: Page.mouse`] to click in the center of the element, or the specified `position`.","liType":"ordinal"},{"type":"li","text":"Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.","liType":"ordinal"},{"type":"text","text":"When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing zero timeout disables this."}],"required":true,"comment":"This method clicks an element matching `selector` by performing the following steps:\n1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.\n1. Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the\n element is detached during the checks, the whole action is retried.\n1. Scroll the element into view if needed.\n1. Use [`property: Page.mouse`] to click in the center of the element, or the specified `position`.\n1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.\n\nWhen all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing\nzero timeout disables this.","deprecated":false,"async":true,"alias":"click","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See\n[working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"button","type":{"name":"MouseButton","union":[{"name":"\"left\""},{"name":"\"right\""},{"name":"\"middle\""}],"expression":"[MouseButton]<\"left\"|\"right\"|\"middle\">"},"spec":[{"type":"text","text":"Defaults to `left`."}],"required":false,"comment":"Defaults to `left`.","deprecated":false,"async":false,"alias":"button"},{"kind":"property","langs":{},"name":"clickCount","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"defaults to 1. See [UIEvent.detail]."}],"required":false,"comment":"defaults to 1. See [UIEvent.detail].","deprecated":false,"async":false,"alias":"clickCount"},{"kind":"property","langs":{},"name":"delay","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0."}],"required":false,"comment":"Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0.","deprecated":false,"async":false,"alias":"delay"},{"kind":"property","langs":{},"name":"force","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`."}],"required":false,"comment":"Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.","deprecated":false,"async":false,"alias":"force"},{"kind":"property","langs":{},"name":"modifiers","type":{"name":"Array","templates":[{"name":"KeyboardModifier","union":[{"name":"\"Alt\""},{"name":"\"Control\""},{"name":"\"Meta\""},{"name":"\"Shift\""}]}],"expression":"[Array]<[KeyboardModifier]<\"Alt\"|\"Control\"|\"Meta\"|\"Shift\">>"},"spec":[{"type":"text","text":"Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current modifiers back. If not specified, currently pressed modifiers are used."}],"required":false,"comment":"Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current\nmodifiers back. If not specified, currently pressed modifiers are used.","deprecated":false,"async":false,"alias":"modifiers"},{"kind":"property","langs":{},"name":"noWaitAfter","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`."}],"required":false,"comment":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can\nopt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to\ninaccessible pages. Defaults to `false`.","deprecated":false,"async":false,"alias":"noWaitAfter"},{"kind":"property","langs":{},"name":"position","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"x","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"x"},{"kind":"property","langs":{},"name":"y","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"y"}],"expression":"[Object]"},"spec":[{"type":"text","text":"A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element."}],"required":false,"comment":"A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the\nelement.","deprecated":false,"async":false,"alias":"position"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"},{"kind":"property","langs":{},"name":"trial","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it."}],"required":false,"comment":"When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to\n`false`. Useful to wait until the element is ready for the action without performing it.","deprecated":false,"async":false,"alias":"trial"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"content","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Gets the full HTML contents of the frame, including the doctype."}],"required":true,"comment":"Gets the full HTML contents of the frame, including the doctype.","deprecated":false,"async":true,"alias":"content","args":[]},{"kind":"method","langs":{"aliases":{"csharp":"DblClickAsync"},"types":{},"overrides":{}},"name":"dblclick","type":{"name":"void"},"spec":[{"type":"text","text":"This method double clicks an element matching `selector` by performing the following steps:"},{"type":"li","text":"Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.","liType":"ordinal"},{"type":"li","text":"Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried.","liType":"ordinal"},{"type":"li","text":"Scroll the element into view if needed.","liType":"ordinal"},{"type":"li","text":"Use [`property: Page.mouse`] to double click in the center of the element, or the specified `position`.","liType":"ordinal"},{"type":"li","text":"Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set. Note that if the first click of the `dblclick()` triggers a navigation event, this method will throw.","liType":"ordinal"},{"type":"text","text":"When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing zero timeout disables this."},{"type":"note","noteType":"note","text":"`frame.dblclick()` dispatches two `click` events and a single `dblclick` event."}],"required":true,"comment":"This method double clicks an element matching `selector` by performing the following steps:\n1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.\n1. Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the\n element is detached during the checks, the whole action is retried.\n1. Scroll the element into view if needed.\n1. Use [`property: Page.mouse`] to double click in the center of the element, or the specified `position`.\n1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set. Note that if the\n first click of the `dblclick()` triggers a navigation event, this method will throw.\n\nWhen all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing\nzero timeout disables this.\n\n> NOTE: `frame.dblclick()` dispatches two `click` events and a single `dblclick` event.","deprecated":false,"async":true,"alias":"dblclick","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See\n[working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"button","type":{"name":"MouseButton","union":[{"name":"\"left\""},{"name":"\"right\""},{"name":"\"middle\""}],"expression":"[MouseButton]<\"left\"|\"right\"|\"middle\">"},"spec":[{"type":"text","text":"Defaults to `left`."}],"required":false,"comment":"Defaults to `left`.","deprecated":false,"async":false,"alias":"button"},{"kind":"property","langs":{},"name":"delay","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0."}],"required":false,"comment":"Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0.","deprecated":false,"async":false,"alias":"delay"},{"kind":"property","langs":{},"name":"force","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`."}],"required":false,"comment":"Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.","deprecated":false,"async":false,"alias":"force"},{"kind":"property","langs":{},"name":"modifiers","type":{"name":"Array","templates":[{"name":"KeyboardModifier","union":[{"name":"\"Alt\""},{"name":"\"Control\""},{"name":"\"Meta\""},{"name":"\"Shift\""}]}],"expression":"[Array]<[KeyboardModifier]<\"Alt\"|\"Control\"|\"Meta\"|\"Shift\">>"},"spec":[{"type":"text","text":"Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current modifiers back. If not specified, currently pressed modifiers are used."}],"required":false,"comment":"Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current\nmodifiers back. If not specified, currently pressed modifiers are used.","deprecated":false,"async":false,"alias":"modifiers"},{"kind":"property","langs":{},"name":"noWaitAfter","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`."}],"required":false,"comment":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can\nopt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to\ninaccessible pages. Defaults to `false`.","deprecated":false,"async":false,"alias":"noWaitAfter"},{"kind":"property","langs":{},"name":"position","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"x","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"x"},{"kind":"property","langs":{},"name":"y","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"y"}],"expression":"[Object]"},"spec":[{"type":"text","text":"A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element."}],"required":false,"comment":"A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the\nelement.","deprecated":false,"async":false,"alias":"position"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"},{"kind":"property","langs":{},"name":"trial","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it."}],"required":false,"comment":"When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to\n`false`. Useful to wait until the element is ready for the action without performing it.","deprecated":false,"async":false,"alias":"trial"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"dispatchEvent","type":{"name":"void"},"spec":[{"type":"text","text":"The snippet below dispatches the `click` event on the element. Regardless of the visibility state of the element, `click` is dispatched. This is equivalent to calling [element.click()](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/click)."},{"type":"code","lines":["await frame.dispatchEvent('button#submit', 'click');"],"codeLang":"js"},{"type":"code","lines":["frame.dispatchEvent(\"button#submit\", \"click\");"],"codeLang":"java"},{"type":"code","lines":["await frame.dispatch_event(\"button#submit\", \"click\")"],"codeLang":"python async"},{"type":"code","lines":["frame.dispatch_event(\"button#submit\", \"click\")"],"codeLang":"python sync"},{"type":"code","lines":["await frame.DispatchEventAsync(\"button#submit\", \"click\");"],"codeLang":"csharp"},{"type":"text","text":"Under the hood, it creates an instance of an event based on the given `type`, initializes it with `eventInit` properties and dispatches it on the element. Events are `composed`, `cancelable` and bubble by default."},{"type":"text","text":"Since `eventInit` is event-specific, please refer to the events documentation for the lists of initial properties:"},{"type":"li","text":"[DragEvent](https://developer.mozilla.org/en-US/docs/Web/API/DragEvent/DragEvent)","liType":"bullet"},{"type":"li","text":"[FocusEvent](https://developer.mozilla.org/en-US/docs/Web/API/FocusEvent/FocusEvent)","liType":"bullet"},{"type":"li","text":"[KeyboardEvent](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/KeyboardEvent)","liType":"bullet"},{"type":"li","text":"[MouseEvent](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/MouseEvent)","liType":"bullet"},{"type":"li","text":"[PointerEvent](https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/PointerEvent)","liType":"bullet"},{"type":"li","text":"[TouchEvent](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/TouchEvent)","liType":"bullet"},{"type":"li","text":"[Event](https://developer.mozilla.org/en-US/docs/Web/API/Event/Event)","liType":"bullet"},{"type":"text","text":"You can also specify `JSHandle` as the property value if you want live objects to be passed into the event:"},{"type":"code","lines":["// Note you can only create DataTransfer in Chromium and Firefox","const dataTransfer = await frame.evaluateHandle(() => new DataTransfer());","await frame.dispatchEvent('#source', 'dragstart', { dataTransfer });"],"codeLang":"js"},{"type":"code","lines":["// Note you can only create DataTransfer in Chromium and Firefox","JSHandle dataTransfer = frame.evaluateHandle(\"() => new DataTransfer()\");","Map<String, Object> arg = new HashMap<>();","arg.put(\"dataTransfer\", dataTransfer);","frame.dispatchEvent(\"#source\", \"dragstart\", arg);"],"codeLang":"java"},{"type":"code","lines":["# note you can only create data_transfer in chromium and firefox","data_transfer = await frame.evaluate_handle(\"new DataTransfer()\")","await frame.dispatch_event(\"#source\", \"dragstart\", { \"dataTransfer\": data_transfer })"],"codeLang":"python async"},{"type":"code","lines":["# note you can only create data_transfer in chromium and firefox","data_transfer = frame.evaluate_handle(\"new DataTransfer()\")","frame.dispatch_event(\"#source\", \"dragstart\", { \"dataTransfer\": data_transfer })"],"codeLang":"python sync"},{"type":"code","lines":["// Note you can only create DataTransfer in Chromium and Firefox","var dataTransfer = await frame.EvaluateHandleAsync(\"() => new DataTransfer()\");","await frame.DispatchEventAsync(\"#source\", \"dragstart\", new { dataTransfer });"],"codeLang":"csharp"}],"required":true,"comment":"The snippet below dispatches the `click` event on the element. Regardless of the visibility state of the element,\n`click` is dispatched. This is equivalent to calling\n[element.click()](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/click).\n\n```js\nawait frame.dispatchEvent('button#submit', 'click');\n```\n\n```java\nframe.dispatchEvent(\"button#submit\", \"click\");\n```\n\n```python async\nawait frame.dispatch_event(\"button#submit\", \"click\")\n```\n\n```python sync\nframe.dispatch_event(\"button#submit\", \"click\")\n```\n\n```csharp\nawait frame.DispatchEventAsync(\"button#submit\", \"click\");\n```\n\nUnder the hood, it creates an instance of an event based on the given `type`, initializes it with `eventInit` properties\nand dispatches it on the element. Events are `composed`, `cancelable` and bubble by default.\n\nSince `eventInit` is event-specific, please refer to the events documentation for the lists of initial properties:\n- [DragEvent](https://developer.mozilla.org/en-US/docs/Web/API/DragEvent/DragEvent)\n- [FocusEvent](https://developer.mozilla.org/en-US/docs/Web/API/FocusEvent/FocusEvent)\n- [KeyboardEvent](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/KeyboardEvent)\n- [MouseEvent](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/MouseEvent)\n- [PointerEvent](https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/PointerEvent)\n- [TouchEvent](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/TouchEvent)\n- [Event](https://developer.mozilla.org/en-US/docs/Web/API/Event/Event)\n\nYou can also specify `JSHandle` as the property value if you want live objects to be passed into the event:\n\n```js\n// Note you can only create DataTransfer in Chromium and Firefox\nconst dataTransfer = await frame.evaluateHandle(() => new DataTransfer());\nawait frame.dispatchEvent('#source', 'dragstart', { dataTransfer });\n```\n\n```java\n// Note you can only create DataTransfer in Chromium and Firefox\nJSHandle dataTransfer = frame.evaluateHandle(\"() => new DataTransfer()\");\nMap<String, Object> arg = new HashMap<>();\narg.put(\"dataTransfer\", dataTransfer);\nframe.dispatchEvent(\"#source\", \"dragstart\", arg);\n```\n\n```python async\n# note you can only create data_transfer in chromium and firefox\ndata_transfer = await frame.evaluate_handle(\"new DataTransfer()\")\nawait frame.dispatch_event(\"#source\", \"dragstart\", { \"dataTransfer\": data_transfer })\n```\n\n```python sync\n# note you can only create data_transfer in chromium and firefox\ndata_transfer = frame.evaluate_handle(\"new DataTransfer()\")\nframe.dispatch_event(\"#source\", \"dragstart\", { \"dataTransfer\": data_transfer })\n```\n\n```csharp\n// Note you can only create DataTransfer in Chromium and Firefox\nvar dataTransfer = await frame.EvaluateHandleAsync(\"() => new DataTransfer()\");\nawait frame.DispatchEventAsync(\"#source\", \"dragstart\", new { dataTransfer });\n```\n","deprecated":false,"async":true,"alias":"dispatchEvent","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See\n[working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"type","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"DOM event type: `\"click\"`, `\"dragstart\"`, etc."}],"required":true,"comment":"DOM event type: `\"click\"`, `\"dragstart\"`, etc.","deprecated":false,"async":false,"alias":"type"},{"kind":"property","langs":{},"name":"eventInit","type":{"name":"EvaluationArgument","expression":"[EvaluationArgument]"},"spec":[{"type":"text","text":"Optional event-specific initialization properties."}],"required":false,"comment":"Optional event-specific initialization properties.","deprecated":false,"async":false,"alias":"eventInit"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{"aliases":{"python":"eval_on_selector","js":"$eval"},"types":{},"overrides":{}},"name":"evalOnSelector","type":{"name":"Serializable","expression":"[Serializable]"},"spec":[{"type":"text","text":"Returns the return value of `expression`."},{"type":"text","text":"The method finds an element matching the specified selector within the frame and passes it as a first argument to `expression`. See [Working with selectors](./selectors.md) for more details. If no elements match the selector, the method throws an error."},{"type":"text","text":"If `expression` returns a [Promise], then [`method: Frame.evalOnSelector`] would wait for the promise to resolve and return its value."},{"type":"text","text":"Examples:"},{"type":"code","lines":["const searchValue = await frame.$eval('#search', el => el.value);","const preloadHref = await frame.$eval('link[rel=preload]', el => el.href);","const html = await frame.$eval('.main-container', (e, suffix) => e.outerHTML + suffix, 'hello');"],"codeLang":"js"},{"type":"code","lines":["String searchValue = (String) frame.evalOnSelector(\"#search\", \"el => el.value\");","String preloadHref = (String) frame.evalOnSelector(\"link[rel=preload]\", \"el => el.href\");","String html = (String) frame.evalOnSelector(\".main-container\", \"(e, suffix) => e.outerHTML + suffix\", \"hello\");"],"codeLang":"java"},{"type":"code","lines":["search_value = await frame.eval_on_selector(\"#search\", \"el => el.value\")","preload_href = await frame.eval_on_selector(\"link[rel=preload]\", \"el => el.href\")","html = await frame.eval_on_selector(\".main-container\", \"(e, suffix) => e.outerHTML + suffix\", \"hello\")"],"codeLang":"python async"},{"type":"code","lines":["search_value = frame.eval_on_selector(\"#search\", \"el => el.value\")","preload_href = frame.eval_on_selector(\"link[rel=preload]\", \"el => el.href\")","html = frame.eval_on_selector(\".main-container\", \"(e, suffix) => e.outerHTML + suffix\", \"hello\")"],"codeLang":"python sync"},{"type":"code","lines":["var searchValue = await frame.EvalOnSelectorAsync<string>(\"#search\", \"el => el.value\");","var preloadHref = await frame.EvalOnSelectorAsync<string>(\"link[rel=preload]\", \"el => el.href\");","var html = await frame.EvalOnSelectorAsync(\".main-container\", \"(e, suffix) => e.outerHTML + suffix\", \"hello\");"],"codeLang":"csharp"}],"required":true,"comment":"Returns the return value of `expression`.\n\nThe method finds an element matching the specified selector within the frame and passes it as a first argument to\n`expression`. See [Working with selectors](./selectors.md) for more details. If no elements match the selector, the\nmethod throws an error.\n\nIf `expression` returns a [Promise], then [`method: Frame.evalOnSelector`] would wait for the promise to resolve and\nreturn its value.\n\nExamples:\n\n```js\nconst searchValue = await frame.$eval('#search', el => el.value);\nconst preloadHref = await frame.$eval('link[rel=preload]', el => el.href);\nconst html = await frame.$eval('.main-container', (e, suffix) => e.outerHTML + suffix, 'hello');\n```\n\n```java\nString searchValue = (String) frame.evalOnSelector(\"#search\", \"el => el.value\");\nString preloadHref = (String) frame.evalOnSelector(\"link[rel=preload]\", \"el => el.href\");\nString html = (String) frame.evalOnSelector(\".main-container\", \"(e, suffix) => e.outerHTML + suffix\", \"hello\");\n```\n\n```python async\nsearch_value = await frame.eval_on_selector(\"#search\", \"el => el.value\")\npreload_href = await frame.eval_on_selector(\"link[rel=preload]\", \"el => el.href\")\nhtml = await frame.eval_on_selector(\".main-container\", \"(e, suffix) => e.outerHTML + suffix\", \"hello\")\n```\n\n```python sync\nsearch_value = frame.eval_on_selector(\"#search\", \"el => el.value\")\npreload_href = frame.eval_on_selector(\"link[rel=preload]\", \"el => el.href\")\nhtml = frame.eval_on_selector(\".main-container\", \"(e, suffix) => e.outerHTML + suffix\", \"hello\")\n```\n\n```csharp\nvar searchValue = await frame.EvalOnSelectorAsync<string>(\"#search\", \"el => el.value\");\nvar preloadHref = await frame.EvalOnSelectorAsync<string>(\"link[rel=preload]\", \"el => el.href\");\nvar html = await frame.EvalOnSelectorAsync(\".main-container\", \"(e, suffix) => e.outerHTML + suffix\", \"hello\");\n```\n","deprecated":false,"async":true,"alias":"evalOnSelector","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to query for. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to query for. See [working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{"overrides":{"js":{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"expression","type":{"name":"function","args":[{"name":"Element"}],"returnType":null,"expression":"[function]([Element])"},"spec":[{"type":"text","text":"Function to be evaluated in the page context."}],"argsArray":[],"required":true,"comment":"","args":{},"clazz":null,"deprecated":false,"async":false,"alias":"pageFunction"}}},"name":"expression","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted as a function. Otherwise, evaluated as an expression."}],"required":true,"comment":"JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted\nas a function. Otherwise, evaluated as an expression.","deprecated":false,"async":false,"alias":"expression"},{"kind":"property","langs":{},"name":"arg","type":{"name":"EvaluationArgument","expression":"[EvaluationArgument]"},"spec":[{"type":"text","text":"Optional argument to pass to `expression`."}],"required":false,"comment":"Optional argument to pass to `expression`.","deprecated":false,"async":false,"alias":"arg"}]},{"kind":"method","langs":{"aliases":{"python":"eval_on_selector_all","js":"$$eval"},"types":{},"overrides":{}},"name":"evalOnSelectorAll","type":{"name":"Serializable","expression":"[Serializable]"},"spec":[{"type":"text","text":"Returns the return value of `expression`."},{"type":"text","text":"The method finds all elements matching the specified selector within the frame and passes an array of matched elements as a first argument to `expression`. See [Working with selectors](./selectors.md) for more details."},{"type":"text","text":"If `expression` returns a [Promise], then [`method: Frame.evalOnSelectorAll`] would wait for the promise to resolve and return its value."},{"type":"text","text":"Examples:"},{"type":"code","lines":["const divsCounts = await frame.$$eval('div', (divs, min) => divs.length >= min, 10);"],"codeLang":"js"},{"type":"code","lines":["boolean divsCounts = (boolean) page.evalOnSelectorAll(\"div\", \"(divs, min) => divs.length >= min\", 10);"],"codeLang":"java"},{"type":"code","lines":["divs_counts = await frame.eval_on_selector_all(\"div\", \"(divs, min) => divs.length >= min\", 10)"],"codeLang":"python async"},{"type":"code","lines":["divs_counts = frame.eval_on_selector_all(\"div\", \"(divs, min) => divs.length >= min\", 10)"],"codeLang":"python sync"},{"type":"code","lines":["var divsCount = await frame.EvalOnSelectorAllAsync<bool>(\"div\", \"(divs, min) => divs.length >= min\", 10);"],"codeLang":"csharp"}],"required":true,"comment":"Returns the return value of `expression`.\n\nThe method finds all elements matching the specified selector within the frame and passes an array of matched elements\nas a first argument to `expression`. See [Working with selectors](./selectors.md) for more details.\n\nIf `expression` returns a [Promise], then [`method: Frame.evalOnSelectorAll`] would wait for the promise to resolve and\nreturn its value.\n\nExamples:\n\n```js\nconst divsCounts = await frame.$$eval('div', (divs, min) => divs.length >= min, 10);\n```\n\n```java\nboolean divsCounts = (boolean) page.evalOnSelectorAll(\"div\", \"(divs, min) => divs.length >= min\", 10);\n```\n\n```python async\ndivs_counts = await frame.eval_on_selector_all(\"div\", \"(divs, min) => divs.length >= min\", 10)\n```\n\n```python sync\ndivs_counts = frame.eval_on_selector_all(\"div\", \"(divs, min) => divs.length >= min\", 10)\n```\n\n```csharp\nvar divsCount = await frame.EvalOnSelectorAllAsync<bool>(\"div\", \"(divs, min) => divs.length >= min\", 10);\n```\n","deprecated":false,"async":true,"alias":"evalOnSelectorAll","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to query for. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to query for. See [working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{"overrides":{"js":{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"expression","type":{"name":"function","args":[{"name":"Array","templates":[{"name":"Element"}]}],"returnType":null,"expression":"[function]([Array]<[Element]>)"},"spec":[{"type":"text","text":"Function to be evaluated in the page context."}],"argsArray":[],"required":true,"comment":"","args":{},"clazz":null,"deprecated":false,"async":false,"alias":"pageFunction"}}},"name":"expression","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted as a function. Otherwise, evaluated as an expression."}],"required":true,"comment":"JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted\nas a function. Otherwise, evaluated as an expression.","deprecated":false,"async":false,"alias":"expression"},{"kind":"property","langs":{},"name":"arg","type":{"name":"EvaluationArgument","expression":"[EvaluationArgument]"},"spec":[{"type":"text","text":"Optional argument to pass to `expression`."}],"required":false,"comment":"Optional argument to pass to `expression`.","deprecated":false,"async":false,"alias":"arg"}]},{"kind":"method","langs":{},"name":"evaluate","type":{"name":"Serializable","expression":"[Serializable]"},"spec":[{"type":"text","text":"Returns the return value of `expression`."},{"type":"text","text":"If the function passed to the [`method: Frame.evaluate`] returns a [Promise], then [`method: Frame.evaluate`] would wait for the promise to resolve and return its value."},{"type":"text","text":"If the function passed to the [`method: Frame.evaluate`] returns a non-[Serializable] value, then [`method: Frame.evaluate`] returns `undefined`. Playwright also supports transferring some additional values that are not serializable by `JSON`: `-0`, `NaN`, `Infinity`, `-Infinity`."},{"type":"code","lines":["const result = await frame.evaluate(([x, y]) => {"," return Promise.resolve(x * y);","}, [7, 8]);","console.log(result); // prints \"56\""],"codeLang":"js"},{"type":"code","lines":["Object result = frame.evaluate(\"([x, y]) => {\\n\" +"," \" return Promise.resolve(x * y);\\n\" +"," \"}\", Arrays.asList(7, 8));","System.out.println(result); // prints \"56\""],"codeLang":"java"},{"type":"code","lines":["result = await frame.evaluate(\"([x, y]) => Promise.resolve(x * y)\", [7, 8])","print(result) # prints \"56\""],"codeLang":"python async"},{"type":"code","lines":["result = frame.evaluate(\"([x, y]) => Promise.resolve(x * y)\", [7, 8])","print(result) # prints \"56\""],"codeLang":"python sync"},{"type":"code","lines":["var result = await frame.EvaluateAsync<int>(\"([x, y]) => Promise.resolve(x * y)\", new[] { 7, 8 });","Console.WriteLine(result);"],"codeLang":"csharp"},{"type":"text","text":"A string can also be passed in instead of a function."},{"type":"code","lines":["console.log(await frame.evaluate('1 + 2')); // prints \"3\""],"codeLang":"js"},{"type":"code","lines":["System.out.println(frame.evaluate(\"1 + 2\")); // prints \"3\""],"codeLang":"java"},{"type":"code","lines":["print(await frame.evaluate(\"1 + 2\")) # prints \"3\"","x = 10","print(await frame.evaluate(f\"1 + {x}\")) # prints \"11\""],"codeLang":"python async"},{"type":"code","lines":["print(frame.evaluate(\"1 + 2\")) # prints \"3\"","x = 10","print(frame.evaluate(f\"1 + {x}\")) # prints \"11\""],"codeLang":"python sync"},{"type":"code","lines":["Console.WriteLine(await frame.EvaluateAsync<int>(\"1 + 2\")); // prints \"3\""],"codeLang":"csharp"},{"type":"text","text":"`ElementHandle` instances can be passed as an argument to the [`method: Frame.evaluate`]:"},{"type":"code","lines":["const bodyHandle = await frame.$('body');","const html = await frame.evaluate(([body, suffix]) => body.innerHTML + suffix, [bodyHandle, 'hello']);","await bodyHandle.dispose();"],"codeLang":"js"},{"type":"code","lines":["ElementHandle bodyHandle = frame.querySelector(\"body\");","String html = (String) frame.evaluate(\"([body, suffix]) => body.innerHTML + suffix\", Arrays.asList(bodyHandle, \"hello\"));","bodyHandle.dispose();"],"codeLang":"java"},{"type":"code","lines":["body_handle = await frame.query_selector(\"body\")","html = await frame.evaluate(\"([body, suffix]) => body.innerHTML + suffix\", [body_handle, \"hello\"])","await body_handle.dispose()"],"codeLang":"python async"},{"type":"code","lines":["body_handle = frame.query_selector(\"body\")","html = frame.evaluate(\"([body, suffix]) => body.innerHTML + suffix\", [body_handle, \"hello\"])","body_handle.dispose()"],"codeLang":"python sync"},{"type":"code","lines":["var bodyHandle = await frame.QuerySelectorAsync(\"body\");","var html = await frame.EvaluateAsync<string>(\"([body, suffix]) => body.innerHTML + suffix\", new object [] { bodyHandle, \"hello\" });","await bodyHandle.DisposeAsync();"],"codeLang":"csharp"}],"required":true,"comment":"Returns the return value of `expression`.\n\nIf the function passed to the [`method: Frame.evaluate`] returns a [Promise], then [`method: Frame.evaluate`] would wait\nfor the promise to resolve and return its value.\n\nIf the function passed to the [`method: Frame.evaluate`] returns a non-[Serializable] value, then\n[`method: Frame.evaluate`] returns `undefined`. Playwright also supports transferring some additional values that are\nnot serializable by `JSON`: `-0`, `NaN`, `Infinity`, `-Infinity`.\n\n```js\nconst result = await frame.evaluate(([x, y]) => {\n return Promise.resolve(x * y);\n}, [7, 8]);\nconsole.log(result); // prints \"56\"\n```\n\n```java\nObject result = frame.evaluate(\"([x, y]) => {\\n\" +\n \" return Promise.resolve(x * y);\\n\" +\n \"}\", Arrays.asList(7, 8));\nSystem.out.println(result); // prints \"56\"\n```\n\n```python async\nresult = await frame.evaluate(\"([x, y]) => Promise.resolve(x * y)\", [7, 8])\nprint(result) # prints \"56\"\n```\n\n```python sync\nresult = frame.evaluate(\"([x, y]) => Promise.resolve(x * y)\", [7, 8])\nprint(result) # prints \"56\"\n```\n\n```csharp\nvar result = await frame.EvaluateAsync<int>(\"([x, y]) => Promise.resolve(x * y)\", new[] { 7, 8 });\nConsole.WriteLine(result);\n```\n\nA string can also be passed in instead of a function.\n\n```js\nconsole.log(await frame.evaluate('1 + 2')); // prints \"3\"\n```\n\n```java\nSystem.out.println(frame.evaluate(\"1 + 2\")); // prints \"3\"\n```\n\n```python async\nprint(await frame.evaluate(\"1 + 2\")) # prints \"3\"\nx = 10\nprint(await frame.evaluate(f\"1 + {x}\")) # prints \"11\"\n```\n\n```python sync\nprint(frame.evaluate(\"1 + 2\")) # prints \"3\"\nx = 10\nprint(frame.evaluate(f\"1 + {x}\")) # prints \"11\"\n```\n\n```csharp\nConsole.WriteLine(await frame.EvaluateAsync<int>(\"1 + 2\")); // prints \"3\"\n```\n\n`ElementHandle` instances can be passed as an argument to the [`method: Frame.evaluate`]:\n\n```js\nconst bodyHandle = await frame.$('body');\nconst html = await frame.evaluate(([body, suffix]) => body.innerHTML + suffix, [bodyHandle, 'hello']);\nawait bodyHandle.dispose();\n```\n\n```java\nElementHandle bodyHandle = frame.querySelector(\"body\");\nString html = (String) frame.evaluate(\"([body, suffix]) => body.innerHTML + suffix\", Arrays.asList(bodyHandle, \"hello\"));\nbodyHandle.dispose();\n```\n\n```python async\nbody_handle = await frame.query_selector(\"body\")\nhtml = await frame.evaluate(\"([body, suffix]) => body.innerHTML + suffix\", [body_handle, \"hello\"])\nawait body_handle.dispose()\n```\n\n```python sync\nbody_handle = frame.query_selector(\"body\")\nhtml = frame.evaluate(\"([body, suffix]) => body.innerHTML + suffix\", [body_handle, \"hello\"])\nbody_handle.dispose()\n```\n\n```csharp\nvar bodyHandle = await frame.QuerySelectorAsync(\"body\");\nvar html = await frame.EvaluateAsync<string>(\"([body, suffix]) => body.innerHTML + suffix\", new object [] { bodyHandle, \"hello\" });\nawait bodyHandle.DisposeAsync();\n```\n","deprecated":false,"async":true,"alias":"evaluate","args":[{"kind":"property","langs":{"overrides":{"js":{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"expression","type":{"name":"","union":[{"name":"function"},{"name":"string"}],"expression":"[function]|[string]"},"spec":[{"type":"text","text":"Function to be evaluated in the page context."}],"argsArray":[],"required":true,"comment":"","args":{},"clazz":null,"deprecated":false,"async":false,"alias":"pageFunction"}}},"name":"expression","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted as a function. Otherwise, evaluated as an expression."}],"required":true,"comment":"JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted\nas a function. Otherwise, evaluated as an expression.","deprecated":false,"async":false,"alias":"expression"},{"kind":"property","langs":{},"name":"arg","type":{"name":"EvaluationArgument","expression":"[EvaluationArgument]"},"spec":[{"type":"text","text":"Optional argument to pass to `expression`."}],"required":false,"comment":"Optional argument to pass to `expression`.","deprecated":false,"async":false,"alias":"arg"}]},{"kind":"method","langs":{},"name":"evaluateHandle","type":{"name":"JSHandle","expression":"[JSHandle]"},"spec":[{"type":"text","text":"Returns the return value of `expression` as a `JSHandle`."},{"type":"text","text":"The only difference between [`method: Frame.evaluate`] and [`method: Frame.evaluateHandle`] is that [`method: Frame.evaluateHandle`] returns `JSHandle`."},{"type":"text","text":"If the function, passed to the [`method: Frame.evaluateHandle`], returns a [Promise], then [`method: Frame.evaluateHandle`] would wait for the promise to resolve and return its value."},{"type":"code","lines":["const aWindowHandle = await frame.evaluateHandle(() => Promise.resolve(window));","aWindowHandle; // Handle for the window object."],"codeLang":"js"},{"type":"code","lines":["// Handle for the window object.","JSHandle aWindowHandle = frame.evaluateHandle(\"() => Promise.resolve(window)\");"],"codeLang":"java"},{"type":"code","lines":["a_window_handle = await frame.evaluate_handle(\"Promise.resolve(window)\")","a_window_handle # handle for the window object."],"codeLang":"python async"},{"type":"code","lines":["a_window_handle = frame.evaluate_handle(\"Promise.resolve(window)\")","a_window_handle # handle for the window object."],"codeLang":"python sync"},{"type":"code","lines":["// Handle for the window object.","var aWindowHandle = await frame.EvaluateHandleAsync(\"() => Promise.resolve(window)\");"],"codeLang":"csharp"},{"type":"text","text":"A string can also be passed in instead of a function."},{"type":"code","lines":["const aHandle = await frame.evaluateHandle('document'); // Handle for the 'document'."],"codeLang":"js"},{"type":"code","lines":["JSHandle aHandle = frame.evaluateHandle(\"document\"); // Handle for the \"document\"."],"codeLang":"java"},{"type":"code","lines":["a_handle = await page.evaluate_handle(\"document\") # handle for the \"document\""],"codeLang":"python async"},{"type":"code","lines":["a_handle = page.evaluate_handle(\"document\") # handle for the \"document\""],"codeLang":"python sync"},{"type":"code","lines":["var docHandle = await frame.EvalueHandleAsync(\"document\"); // Handle for the `document`"],"codeLang":"csharp"},{"type":"text","text":"`JSHandle` instances can be passed as an argument to the [`method: Frame.evaluateHandle`]:"},{"type":"code","lines":["const aHandle = await frame.evaluateHandle(() => document.body);","const resultHandle = await frame.evaluateHandle(([body, suffix]) => body.innerHTML + suffix, [aHandle, 'hello']);","console.log(await resultHandle.jsonValue());","await resultHandle.dispose();"],"codeLang":"js"},{"type":"code","lines":["JSHandle aHandle = frame.evaluateHandle(\"() => document.body\");","JSHandle resultHandle = frame.evaluateHandle(\"([body, suffix]) => body.innerHTML + suffix\", Arrays.asList(aHandle, \"hello\"));","System.out.println(resultHandle.jsonValue());","resultHandle.dispose();"],"codeLang":"java"},{"type":"code","lines":["a_handle = await page.evaluate_handle(\"document.body\")","result_handle = await page.evaluate_handle(\"body => body.innerHTML\", a_handle)","print(await result_handle.json_value())","await result_handle.dispose()"],"codeLang":"python async"},{"type":"code","lines":["a_handle = page.evaluate_handle(\"document.body\")","result_handle = page.evaluate_handle(\"body => body.innerHTML\", a_handle)","print(result_handle.json_value())","result_handle.dispose()"],"codeLang":"python sync"},{"type":"code","lines":["var handle = await frame.EvaluateHandleAsync(\"() => document.body\");","var resultHandle = await frame.EvaluateHandleAsync(\"([body, suffix]) => body.innerHTML + suffix\", new object[] { handle, \"hello\" });","Console.WriteLine(await resultHandle.JsonValueAsync<string>());","await resultHandle.DisposeAsync();"],"codeLang":"csharp"}],"required":true,"comment":"Returns the return value of `expression` as a `JSHandle`.\n\nThe only difference between [`method: Frame.evaluate`] and [`method: Frame.evaluateHandle`] is that\n[`method: Frame.evaluateHandle`] returns `JSHandle`.\n\nIf the function, passed to the [`method: Frame.evaluateHandle`], returns a [Promise], then\n[`method: Frame.evaluateHandle`] would wait for the promise to resolve and return its value.\n\n```js\nconst aWindowHandle = await frame.evaluateHandle(() => Promise.resolve(window));\naWindowHandle; // Handle for the window object.\n```\n\n```java\n// Handle for the window object.\nJSHandle aWindowHandle = frame.evaluateHandle(\"() => Promise.resolve(window)\");\n```\n\n```python async\na_window_handle = await frame.evaluate_handle(\"Promise.resolve(window)\")\na_window_handle # handle for the window object.\n```\n\n```python sync\na_window_handle = frame.evaluate_handle(\"Promise.resolve(window)\")\na_window_handle # handle for the window object.\n```\n\n```csharp\n// Handle for the window object.\nvar aWindowHandle = await frame.EvaluateHandleAsync(\"() => Promise.resolve(window)\");\n```\n\nA string can also be passed in instead of a function.\n\n```js\nconst aHandle = await frame.evaluateHandle('document'); // Handle for the 'document'.\n```\n\n```java\nJSHandle aHandle = frame.evaluateHandle(\"document\"); // Handle for the \"document\".\n```\n\n```python async\na_handle = await page.evaluate_handle(\"document\") # handle for the \"document\"\n```\n\n```python sync\na_handle = page.evaluate_handle(\"document\") # handle for the \"document\"\n```\n\n```csharp\nvar docHandle = await frame.EvalueHandleAsync(\"document\"); // Handle for the `document`\n```\n\n`JSHandle` instances can be passed as an argument to the [`method: Frame.evaluateHandle`]:\n\n```js\nconst aHandle = await frame.evaluateHandle(() => document.body);\nconst resultHandle = await frame.evaluateHandle(([body, suffix]) => body.innerHTML + suffix, [aHandle, 'hello']);\nconsole.log(await resultHandle.jsonValue());\nawait resultHandle.dispose();\n```\n\n```java\nJSHandle aHandle = frame.evaluateHandle(\"() => document.body\");\nJSHandle resultHandle = frame.evaluateHandle(\"([body, suffix]) => body.innerHTML + suffix\", Arrays.asList(aHandle, \"hello\"));\nSystem.out.println(resultHandle.jsonValue());\nresultHandle.dispose();\n```\n\n```python async\na_handle = await page.evaluate_handle(\"document.body\")\nresult_handle = await page.evaluate_handle(\"body => body.innerHTML\", a_handle)\nprint(await result_handle.json_value())\nawait result_handle.dispose()\n```\n\n```python sync\na_handle = page.evaluate_handle(\"document.body\")\nresult_handle = page.evaluate_handle(\"body => body.innerHTML\", a_handle)\nprint(result_handle.json_value())\nresult_handle.dispose()\n```\n\n```csharp\nvar handle = await frame.EvaluateHandleAsync(\"() => document.body\");\nvar resultHandle = await frame.EvaluateHandleAsync(\"([body, suffix]) => body.innerHTML + suffix\", new object[] { handle, \"hello\" });\nConsole.WriteLine(await resultHandle.JsonValueAsync<string>());\nawait resultHandle.DisposeAsync();\n```\n","deprecated":false,"async":true,"alias":"evaluateHandle","args":[{"kind":"property","langs":{"overrides":{"js":{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"expression","type":{"name":"","union":[{"name":"function"},{"name":"string"}],"expression":"[function]|[string]"},"spec":[{"type":"text","text":"Function to be evaluated in the page context."}],"argsArray":[],"required":true,"comment":"","args":{},"clazz":null,"deprecated":false,"async":false,"alias":"pageFunction"}}},"name":"expression","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted as a function. Otherwise, evaluated as an expression."}],"required":true,"comment":"JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted\nas a function. Otherwise, evaluated as an expression.","deprecated":false,"async":false,"alias":"expression"},{"kind":"property","langs":{},"name":"arg","type":{"name":"EvaluationArgument","expression":"[EvaluationArgument]"},"spec":[{"type":"text","text":"Optional argument to pass to `expression`."}],"required":false,"comment":"Optional argument to pass to `expression`.","deprecated":false,"async":false,"alias":"arg"}]},{"kind":"method","langs":{},"name":"fill","type":{"name":"void"},"spec":[{"type":"text","text":"This method waits for an element matching `selector`, waits for [actionability](./actionability.md) checks, focuses the element, fills it and triggers an `input` event after filling. Note that you can pass an empty string to clear the input field."},{"type":"text","text":"If the target element is not an `<input>`, `<textarea>` or `[contenteditable]` element, this method throws an error. However, if the element is inside the `<label>` element that has an associated [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), the control will be filled instead."},{"type":"text","text":"To send fine-grained keyboard events, use [`method: Frame.type`]."}],"required":true,"comment":"This method waits for an element matching `selector`, waits for [actionability](./actionability.md) checks, focuses the\nelement, fills it and triggers an `input` event after filling. Note that you can pass an empty string to clear the input\nfield.\n\nIf the target element is not an `<input>`, `<textarea>` or `[contenteditable]` element, this method throws an error.\nHowever, if the element is inside the `<label>` element that has an associated\n[control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), the control will be filled\ninstead.\n\nTo send fine-grained keyboard events, use [`method: Frame.type`].","deprecated":false,"async":true,"alias":"fill","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See\n[working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"value","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Value to fill for the `<input>`, `<textarea>` or `[contenteditable]` element."}],"required":true,"comment":"Value to fill for the `<input>`, `<textarea>` or `[contenteditable]` element.","deprecated":false,"async":false,"alias":"value"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"noWaitAfter","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`."}],"required":false,"comment":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can\nopt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to\ninaccessible pages. Defaults to `false`.","deprecated":false,"async":false,"alias":"noWaitAfter"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"focus","type":{"name":"void"},"spec":[{"type":"text","text":"This method fetches an element with `selector` and focuses it. If there's no element matching `selector`, the method waits until a matching element appears in the DOM."}],"required":true,"comment":"This method fetches an element with `selector` and focuses it. If there's no element matching `selector`, the method\nwaits until a matching element appears in the DOM.","deprecated":false,"async":true,"alias":"focus","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See\n[working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"frameElement","type":{"name":"ElementHandle","expression":"[ElementHandle]"},"spec":[{"type":"text","text":"Returns the `frame` or `iframe` element handle which corresponds to this frame."},{"type":"text","text":"This is an inverse of [`method: ElementHandle.contentFrame`]. Note that returned handle actually belongs to the parent frame."},{"type":"text","text":"This method throws an error if the frame has been detached before `frameElement()` returns."},{"type":"code","lines":["const frameElement = await frame.frameElement();","const contentFrame = await frameElement.contentFrame();","console.log(frame === contentFrame); // -> true"],"codeLang":"js"},{"type":"code","lines":["ElementHandle frameElement = frame.frameElement();","Frame contentFrame = frameElement.contentFrame();","System.out.println(frame == contentFrame); // -> true"],"codeLang":"java"},{"type":"code","lines":["frame_element = await frame.frame_element()","content_frame = await frame_element.content_frame()","assert frame == content_frame"],"codeLang":"python async"},{"type":"code","lines":["frame_element = frame.frame_element()","content_frame = frame_element.content_frame()","assert frame == content_frame"],"codeLang":"python sync"},{"type":"code","lines":["var frameElement = await frame.FrameElementAsync();","var contentFrame = await frameElement.ContentFrameAsync();","Console.WriteLine(frame == contentFrame); // -> True"],"codeLang":"csharp"}],"required":true,"comment":"Returns the `frame` or `iframe` element handle which corresponds to this frame.\n\nThis is an inverse of [`method: ElementHandle.contentFrame`]. Note that returned handle actually belongs to the parent\nframe.\n\nThis method throws an error if the frame has been detached before `frameElement()` returns.\n\n```js\nconst frameElement = await frame.frameElement();\nconst contentFrame = await frameElement.contentFrame();\nconsole.log(frame === contentFrame); // -> true\n```\n\n```java\nElementHandle frameElement = frame.frameElement();\nFrame contentFrame = frameElement.contentFrame();\nSystem.out.println(frame == contentFrame); // -> true\n```\n\n```python async\nframe_element = await frame.frame_element()\ncontent_frame = await frame_element.content_frame()\nassert frame == content_frame\n```\n\n```python sync\nframe_element = frame.frame_element()\ncontent_frame = frame_element.content_frame()\nassert frame == content_frame\n```\n\n```csharp\nvar frameElement = await frame.FrameElementAsync();\nvar contentFrame = await frameElement.ContentFrameAsync();\nConsole.WriteLine(frame == contentFrame); // -> True\n```\n","deprecated":false,"async":true,"alias":"frameElement","args":[]},{"kind":"method","langs":{},"name":"getAttribute","type":{"name":"","union":[{"name":"null"},{"name":"string"}],"expression":"[null]|[string]"},"spec":[{"type":"text","text":"Returns element attribute value."}],"required":true,"comment":"Returns element attribute value.","deprecated":false,"async":true,"alias":"getAttribute","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See\n[working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"name","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Attribute name to get the value for."}],"required":true,"comment":"Attribute name to get the value for.","deprecated":false,"async":false,"alias":"name"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{"aliases":{"java":"navigate"},"types":{},"overrides":{}},"name":"goto","type":{"name":"","union":[{"name":"null"},{"name":"Response"}],"expression":"[null]|[Response]"},"spec":[{"type":"text","text":"Returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of the last redirect."},{"type":"text","text":"`frame.goto` will throw an error if:"},{"type":"li","text":"there's an SSL error (e.g. in case of self-signed certificates).","liType":"bullet"},{"type":"li","text":"target URL is invalid.","liType":"bullet"},{"type":"li","text":"the `timeout` is exceeded during navigation.","liType":"bullet"},{"type":"li","text":"the remote server does not respond or is unreachable.","liType":"bullet"},{"type":"li","text":"the main resource failed to load.","liType":"bullet"},{"type":"text","text":"`frame.goto` will not throw an error when any valid HTTP status code is returned by the remote server, including 404 \"Not Found\" and 500 \"Internal Server Error\". The status code for such responses can be retrieved by calling [`method: Response.status`]."},{"type":"note","noteType":"note","text":"`frame.goto` either throws an error or returns a main resource response. The only exceptions are navigation to `about:blank` or navigation to the same URL with a different hash, which would succeed and return `null`."},{"type":"note","noteType":"note","text":"Headless mode doesn't support navigation to a PDF document. See the [upstream issue](https://bugs.chromium.org/p/chromium/issues/detail?id=761295)."}],"required":true,"comment":"Returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of the\nlast redirect.\n\n`frame.goto` will throw an error if:\n- there's an SSL error (e.g. in case of self-signed certificates).\n- target URL is invalid.\n- the `timeout` is exceeded during navigation.\n- the remote server does not respond or is unreachable.\n- the main resource failed to load.\n\n`frame.goto` will not throw an error when any valid HTTP status code is returned by the remote server, including 404\n\"Not Found\" and 500 \"Internal Server Error\". The status code for such responses can be retrieved by calling\n[`method: Response.status`].\n\n> NOTE: `frame.goto` either throws an error or returns a main resource response. The only exceptions are navigation to\n`about:blank` or navigation to the same URL with a different hash, which would succeed and return `null`.\n> NOTE: Headless mode doesn't support navigation to a PDF document. See the\n[upstream issue](https://bugs.chromium.org/p/chromium/issues/detail?id=761295).","deprecated":false,"async":true,"alias":"goto","args":[{"kind":"property","langs":{},"name":"url","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"URL to navigate frame to. The url should include scheme, e.g. `https://`."}],"required":true,"comment":"URL to navigate frame to. The url should include scheme, e.g. `https://`.","deprecated":false,"async":false,"alias":"url"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"referer","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Referer header value. If provided it will take preference over the referer header value set by [`method: Page.setExtraHTTPHeaders`]."}],"required":false,"comment":"Referer header value. If provided it will take preference over the referer header value set by\n[`method: Page.setExtraHTTPHeaders`].","deprecated":false,"async":false,"alias":"referer"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultNavigationTimeout`], [`method: BrowserContext.setDefaultTimeout`], [`method: Page.setDefaultNavigationTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be\nchanged by using the [`method: BrowserContext.setDefaultNavigationTimeout`],\n[`method: BrowserContext.setDefaultTimeout`], [`method: Page.setDefaultNavigationTimeout`] or\n[`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"},{"kind":"property","langs":{},"name":"waitUntil","type":{"name":"WaitUntilState","union":[{"name":"\"load\""},{"name":"\"domcontentloaded\""},{"name":"\"networkidle\""}],"expression":"[WaitUntilState]<\"load\"|\"domcontentloaded\"|\"networkidle\">"},"spec":[{"type":"text","text":"When to consider operation succeeded, defaults to `load`. Events can be either:"},{"type":"li","text":"`'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.","liType":"bullet"},{"type":"li","text":"`'load'` - consider operation to be finished when the `load` event is fired.","liType":"bullet"},{"type":"li","text":"`'networkidle'` - consider operation to be finished when there are no network connections for at least `500` ms.","liType":"bullet"}],"required":false,"comment":"When to consider operation succeeded, defaults to `load`. Events can be either:\n- `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.\n- `'load'` - consider operation to be finished when the `load` event is fired.\n- `'networkidle'` - consider operation to be finished when there are no network connections for at least `500` ms.","deprecated":false,"async":false,"alias":"waitUntil"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"hover","type":{"name":"void"},"spec":[{"type":"text","text":"This method hovers over an element matching `selector` by performing the following steps:"},{"type":"li","text":"Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.","liType":"ordinal"},{"type":"li","text":"Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried.","liType":"ordinal"},{"type":"li","text":"Scroll the element into view if needed.","liType":"ordinal"},{"type":"li","text":"Use [`property: Page.mouse`] to hover over the center of the element, or the specified `position`.","liType":"ordinal"},{"type":"li","text":"Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.","liType":"ordinal"},{"type":"text","text":"When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing zero timeout disables this."}],"required":true,"comment":"This method hovers over an element matching `selector` by performing the following steps:\n1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.\n1. Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the\n element is detached during the checks, the whole action is retried.\n1. Scroll the element into view if needed.\n1. Use [`property: Page.mouse`] to hover over the center of the element, or the specified `position`.\n1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.\n\nWhen all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing\nzero timeout disables this.","deprecated":false,"async":true,"alias":"hover","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See\n[working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"force","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`."}],"required":false,"comment":"Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.","deprecated":false,"async":false,"alias":"force"},{"kind":"property","langs":{},"name":"modifiers","type":{"name":"Array","templates":[{"name":"KeyboardModifier","union":[{"name":"\"Alt\""},{"name":"\"Control\""},{"name":"\"Meta\""},{"name":"\"Shift\""}]}],"expression":"[Array]<[KeyboardModifier]<\"Alt\"|\"Control\"|\"Meta\"|\"Shift\">>"},"spec":[{"type":"text","text":"Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current modifiers back. If not specified, currently pressed modifiers are used."}],"required":false,"comment":"Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current\nmodifiers back. If not specified, currently pressed modifiers are used.","deprecated":false,"async":false,"alias":"modifiers"},{"kind":"property","langs":{},"name":"position","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"x","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"x"},{"kind":"property","langs":{},"name":"y","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"y"}],"expression":"[Object]"},"spec":[{"type":"text","text":"A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element."}],"required":false,"comment":"A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the\nelement.","deprecated":false,"async":false,"alias":"position"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"},{"kind":"property","langs":{},"name":"trial","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it."}],"required":false,"comment":"When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to\n`false`. Useful to wait until the element is ready for the action without performing it.","deprecated":false,"async":false,"alias":"trial"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"innerHTML","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Returns `element.innerHTML`."}],"required":true,"comment":"Returns `element.innerHTML`.","deprecated":false,"async":true,"alias":"innerHTML","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See\n[working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"innerText","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Returns `element.innerText`."}],"required":true,"comment":"Returns `element.innerText`.","deprecated":false,"async":true,"alias":"innerText","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See\n[working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"isChecked","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Returns whether the element is checked. Throws if the element is not a checkbox or radio input."}],"required":true,"comment":"Returns whether the element is checked. Throws if the element is not a checkbox or radio input.","deprecated":false,"async":true,"alias":"isChecked","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See\n[working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"isDetached","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Returns `true` if the frame has been detached, or `false` otherwise."}],"required":true,"comment":"Returns `true` if the frame has been detached, or `false` otherwise.","deprecated":false,"async":false,"alias":"isDetached","args":[]},{"kind":"method","langs":{},"name":"isDisabled","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Returns whether the element is disabled, the opposite of [enabled](./actionability.md#enabled)."}],"required":true,"comment":"Returns whether the element is disabled, the opposite of [enabled](./actionability.md#enabled).","deprecated":false,"async":true,"alias":"isDisabled","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See\n[working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"isEditable","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Returns whether the element is [editable](./actionability.md#editable)."}],"required":true,"comment":"Returns whether the element is [editable](./actionability.md#editable).","deprecated":false,"async":true,"alias":"isEditable","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See\n[working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"isEnabled","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Returns whether the element is [enabled](./actionability.md#enabled)."}],"required":true,"comment":"Returns whether the element is [enabled](./actionability.md#enabled).","deprecated":false,"async":true,"alias":"isEnabled","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See\n[working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"isHidden","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Returns whether the element is hidden, the opposite of [visible](./actionability.md#visible). `selector` that does not match any elements is considered hidden."}],"required":true,"comment":"Returns whether the element is hidden, the opposite of [visible](./actionability.md#visible). `selector` that does not\nmatch any elements is considered hidden.","deprecated":false,"async":true,"alias":"isHidden","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See\n[working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"isVisible","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Returns whether the element is [visible](./actionability.md#visible). `selector` that does not match any elements is considered not visible."}],"required":true,"comment":"Returns whether the element is [visible](./actionability.md#visible). `selector` that does not match any elements is\nconsidered not visible.","deprecated":false,"async":true,"alias":"isVisible","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See\n[working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"name","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Returns frame's name attribute as specified in the tag."},{"type":"text","text":"If the name is empty, returns the id attribute instead."},{"type":"note","noteType":"note","text":"This value is calculated once when the frame is created, and will not update if the attribute is changed later."}],"required":true,"comment":"Returns frame's name attribute as specified in the tag.\n\nIf the name is empty, returns the id attribute instead.\n\n> NOTE: This value is calculated once when the frame is created, and will not update if the attribute is changed later.","deprecated":false,"async":false,"alias":"name","args":[]},{"kind":"method","langs":{},"name":"page","type":{"name":"Page","expression":"[Page]"},"spec":[{"type":"text","text":"Returns the page containing this frame."}],"required":true,"comment":"Returns the page containing this frame.","deprecated":false,"async":false,"alias":"page","args":[]},{"kind":"method","langs":{},"name":"parentFrame","type":{"name":"","union":[{"name":"null"},{"name":"Frame"}],"expression":"[null]|[Frame]"},"spec":[{"type":"text","text":"Parent frame, if any. Detached frames and main frames return `null`."}],"required":true,"comment":"Parent frame, if any. Detached frames and main frames return `null`.","deprecated":false,"async":false,"alias":"parentFrame","args":[]},{"kind":"method","langs":{},"name":"press","type":{"name":"void"},"spec":[{"type":"text","text":"`key` can specify the intended [keyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key) value or a single character to generate the text for. A superset of the `key` values can be found [here](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values). Examples of the keys are:"},{"type":"text","text":"`F1` - `F12`, `Digit0`- `Digit9`, `KeyA`- `KeyZ`, `Backquote`, `Minus`, `Equal`, `Backslash`, `Backspace`, `Tab`, `Delete`, `Escape`, `ArrowDown`, `End`, `Enter`, `Home`, `Insert`, `PageDown`, `PageUp`, `ArrowRight`, `ArrowUp`, etc."},{"type":"text","text":"Following modification shortcuts are also supported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`."},{"type":"text","text":"Holding down `Shift` will type the text that corresponds to the `key` in the upper case."},{"type":"text","text":"If `key` is a single character, it is case-sensitive, so the values `a` and `A` will generate different respective texts."},{"type":"text","text":"Shortcuts such as `key: \"Control+o\"` or `key: \"Control+Shift+T\"` are supported as well. When specified with the modifier, modifier is pressed and being held while the subsequent key is being pressed."}],"required":true,"comment":"`key` can specify the intended [keyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key)\nvalue or a single character to generate the text for. A superset of the `key` values can be found\n[here](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values). Examples of the keys are:\n\n`F1` - `F12`, `Digit0`- `Digit9`, `KeyA`- `KeyZ`, `Backquote`, `Minus`, `Equal`, `Backslash`, `Backspace`, `Tab`,\n`Delete`, `Escape`, `ArrowDown`, `End`, `Enter`, `Home`, `Insert`, `PageDown`, `PageUp`, `ArrowRight`, `ArrowUp`, etc.\n\nFollowing modification shortcuts are also supported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`.\n\nHolding down `Shift` will type the text that corresponds to the `key` in the upper case.\n\nIf `key` is a single character, it is case-sensitive, so the values `a` and `A` will generate different respective\ntexts.\n\nShortcuts such as `key: \"Control+o\"` or `key: \"Control+Shift+T\"` are supported as well. When specified with the\nmodifier, modifier is pressed and being held while the subsequent key is being pressed.","deprecated":false,"async":true,"alias":"press","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See\n[working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"key","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Name of the key to press or a character to generate, such as `ArrowLeft` or `a`."}],"required":true,"comment":"Name of the key to press or a character to generate, such as `ArrowLeft` or `a`.","deprecated":false,"async":false,"alias":"key"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"delay","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Time to wait between `keydown` and `keyup` in milliseconds. Defaults to 0."}],"required":false,"comment":"Time to wait between `keydown` and `keyup` in milliseconds. Defaults to 0.","deprecated":false,"async":false,"alias":"delay"},{"kind":"property","langs":{},"name":"noWaitAfter","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`."}],"required":false,"comment":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can\nopt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to\ninaccessible pages. Defaults to `false`.","deprecated":false,"async":false,"alias":"noWaitAfter"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{"aliases":{"python":"query_selector","js":"$"},"types":{},"overrides":{}},"name":"querySelector","type":{"name":"","union":[{"name":"null"},{"name":"ElementHandle"}],"expression":"[null]|[ElementHandle]"},"spec":[{"type":"text","text":"Returns the ElementHandle pointing to the frame element."},{"type":"text","text":"The method finds an element matching the specified selector within the frame. See [Working with selectors](./selectors.md) for more details. If no elements match the selector, returns `null`."}],"required":true,"comment":"Returns the ElementHandle pointing to the frame element.\n\nThe method finds an element matching the specified selector within the frame. See\n[Working with selectors](./selectors.md) for more details. If no elements match the selector, returns `null`.","deprecated":false,"async":true,"alias":"querySelector","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to query for. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to query for. See [working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"}]},{"kind":"method","langs":{"aliases":{"python":"query_selector_all","js":"$$"},"types":{},"overrides":{}},"name":"querySelectorAll","type":{"name":"Array","templates":[{"name":"ElementHandle"}],"expression":"[Array]<[ElementHandle]>"},"spec":[{"type":"text","text":"Returns the ElementHandles pointing to the frame elements."},{"type":"text","text":"The method finds all elements matching the specified selector within the frame. See [Working with selectors](./selectors.md) for more details. If no elements match the selector, returns empty array."}],"required":true,"comment":"Returns the ElementHandles pointing to the frame elements.\n\nThe method finds all elements matching the specified selector within the frame. See\n[Working with selectors](./selectors.md) for more details. If no elements match the selector, returns empty array.","deprecated":false,"async":true,"alias":"querySelectorAll","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to query for. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to query for. See [working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"}]},{"kind":"method","langs":{},"name":"selectOption","type":{"name":"Array","templates":[{"name":"string"}],"expression":"[Array]<[string]>"},"spec":[{"type":"text","text":"This method waits for an element matching `selector`, waits for [actionability](./actionability.md) checks, waits until all specified options are present in the `<select>` element and selects these options."},{"type":"text","text":"If the target element is not a `<select>` element, this method throws an error. However, if the element is inside the `<label>` element that has an associated [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), the control will be used instead."},{"type":"text","text":"Returns the array of option values that have been successfully selected."},{"type":"text","text":"Triggers a `change` and `input` event once all the provided options have been selected."},{"type":"code","lines":["// single selection matching the value","frame.selectOption('select#colors', 'blue');","","// single selection matching both the value and the label","frame.selectOption('select#colors', { label: 'Blue' });","","// multiple selection","frame.selectOption('select#colors', 'red', 'green', 'blue');"],"codeLang":"js"},{"type":"code","lines":["// single selection matching the value","frame.selectOption(\"select#colors\", \"blue\");","// single selection matching both the value and the label","frame.selectOption(\"select#colors\", new SelectOption().setLabel(\"Blue\"));","// multiple selection","frame.selectOption(\"select#colors\", new String[] {\"red\", \"green\", \"blue\"});"],"codeLang":"java"},{"type":"code","lines":["# single selection matching the value","await frame.select_option(\"select#colors\", \"blue\")","# single selection matching the label","await frame.select_option(\"select#colors\", label=\"blue\")","# multiple selection","await frame.select_option(\"select#colors\", value=[\"red\", \"green\", \"blue\"])"],"codeLang":"python async"},{"type":"code","lines":["# single selection matching the value","frame.select_option(\"select#colors\", \"blue\")","# single selection matching both the label","frame.select_option(\"select#colors\", label=\"blue\")","# multiple selection","frame.select_option(\"select#colors\", value=[\"red\", \"green\", \"blue\"])"],"codeLang":"python sync"},{"type":"code","lines":["// single selection matching the value","await frame.SelectOptionAsync(\"select#colors\", new[] { \"blue\" });","// single selection matching both the value and the label","await frame.SelectOptionAsync(\"select#colors\", new[] { new SelectOptionValue() { Label = \"blue\" } });","// multiple selection","await frame.SelectOptionAsync(\"select#colors\", new[] { \"red\", \"green\", \"blue\" });"],"codeLang":"csharp"}],"required":true,"comment":"This method waits for an element matching `selector`, waits for [actionability](./actionability.md) checks, waits until\nall specified options are present in the `<select>` element and selects these options.\n\nIf the target element is not a `<select>` element, this method throws an error. However, if the element is inside the\n`<label>` element that has an associated\n[control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), the control will be used instead.\n\nReturns the array of option values that have been successfully selected.\n\nTriggers a `change` and `input` event once all the provided options have been selected.\n\n```js\n// single selection matching the value\nframe.selectOption('select#colors', 'blue');\n\n// single selection matching both the value and the label\nframe.selectOption('select#colors', { label: 'Blue' });\n\n// multiple selection\nframe.selectOption('select#colors', 'red', 'green', 'blue');\n```\n\n```java\n// single selection matching the value\nframe.selectOption(\"select#colors\", \"blue\");\n// single selection matching both the value and the label\nframe.selectOption(\"select#colors\", new SelectOption().setLabel(\"Blue\"));\n// multiple selection\nframe.selectOption(\"select#colors\", new String[] {\"red\", \"green\", \"blue\"});\n```\n\n```python async\n# single selection matching the value\nawait frame.select_option(\"select#colors\", \"blue\")\n# single selection matching the label\nawait frame.select_option(\"select#colors\", label=\"blue\")\n# multiple selection\nawait frame.select_option(\"select#colors\", value=[\"red\", \"green\", \"blue\"])\n```\n\n```python sync\n# single selection matching the value\nframe.select_option(\"select#colors\", \"blue\")\n# single selection matching both the label\nframe.select_option(\"select#colors\", label=\"blue\")\n# multiple selection\nframe.select_option(\"select#colors\", value=[\"red\", \"green\", \"blue\"])\n```\n\n```csharp\n// single selection matching the value\nawait frame.SelectOptionAsync(\"select#colors\", new[] { \"blue\" });\n// single selection matching both the value and the label\nawait frame.SelectOptionAsync(\"select#colors\", new[] { new SelectOptionValue() { Label = \"blue\" } });\n// multiple selection\nawait frame.SelectOptionAsync(\"select#colors\", new[] { \"red\", \"green\", \"blue\" });\n```\n","deprecated":false,"async":true,"alias":"selectOption","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to query for. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to query for. See [working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{"only":["java","js","csharp"],"aliases":{},"types":{},"overrides":{}},"name":"values","type":{"name":"","union":[{"name":"null"},{"name":"string"},{"name":"ElementHandle"},{"name":"Array","templates":[{"name":"string"}]},{"name":"Object","properties":[{"kind":"property","langs":{},"name":"value","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Matches by `option.value`. Optional."}],"required":false,"comment":"Matches by `option.value`. Optional.","deprecated":false,"async":false,"alias":"value"},{"kind":"property","langs":{},"name":"label","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Matches by `option.label`. Optional."}],"required":false,"comment":"Matches by `option.label`. Optional.","deprecated":false,"async":false,"alias":"label"},{"kind":"property","langs":{},"name":"index","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"Matches by the index. Optional."}],"required":false,"comment":"Matches by the index. Optional.","deprecated":false,"async":false,"alias":"index"}]},{"name":"Array","templates":[{"name":"ElementHandle"}]},{"name":"Array","templates":[{"name":"Object","properties":[{"kind":"property","langs":{},"name":"value","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Matches by `option.value`. Optional."}],"required":false,"comment":"Matches by `option.value`. Optional.","deprecated":false,"async":false,"alias":"value"},{"kind":"property","langs":{},"name":"label","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Matches by `option.label`. Optional."}],"required":false,"comment":"Matches by `option.label`. Optional.","deprecated":false,"async":false,"alias":"label"},{"kind":"property","langs":{},"name":"index","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"Matches by the index. Optional."}],"required":false,"comment":"Matches by the index. Optional.","deprecated":false,"async":false,"alias":"index"}]}]}],"expression":"[null]|[string]|[ElementHandle]|[Array]<[string]>|[Object]|[Array]<[ElementHandle]>|[Array]<[Object]>"},"spec":[{"type":"text","text":"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."}],"required":true,"comment":"Options to select. If the `<select>` has the `multiple` attribute, all matching options are selected, otherwise only the\nfirst option matching one of the passed options is selected. String values are equivalent to `{value:'string'}`. Option\nis considered matching if all specified properties match.","deprecated":false,"async":false,"alias":"values"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"noWaitAfter","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`."}],"required":false,"comment":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can\nopt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to\ninaccessible pages. Defaults to `false`.","deprecated":false,"async":false,"alias":"noWaitAfter"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"},{"kind":"property","langs":{"only":["python"],"aliases":{},"types":{},"overrides":{}},"name":"element","type":{"name":"","union":[{"name":"ElementHandle"},{"name":"Array","templates":[{"name":"ElementHandle"}]}],"expression":"[ElementHandle]|[Array]<[ElementHandle]>"},"spec":[{"type":"text","text":"Option elements to select. Optional."}],"required":false,"comment":"Option elements to select. Optional.","deprecated":false,"async":false,"alias":"element"},{"kind":"property","langs":{"only":["python"],"aliases":{},"types":{},"overrides":{}},"name":"index","type":{"name":"","union":[{"name":"int"},{"name":"Array","templates":[{"name":"int"}]}],"expression":"[int]|[Array]<[int]>"},"spec":[{"type":"text","text":"Options to select by index. Optional."}],"required":false,"comment":"Options to select by index. Optional.","deprecated":false,"async":false,"alias":"index"},{"kind":"property","langs":{"only":["python"],"aliases":{},"types":{},"overrides":{}},"name":"value","type":{"name":"","union":[{"name":"string"},{"name":"Array","templates":[{"name":"string"}]}],"expression":"[string]|[Array]<[string]>"},"spec":[{"type":"text","text":"Options to select by value. If the `<select>` has the `multiple` attribute, all given options are selected, otherwise only the first option matching one of the passed options is selected. Optional."}],"required":false,"comment":"Options to select by value. If the `<select>` has the `multiple` attribute, all given options are selected, otherwise\nonly the first option matching one of the passed options is selected. Optional.","deprecated":false,"async":false,"alias":"value"},{"kind":"property","langs":{"only":["python"],"aliases":{},"types":{},"overrides":{}},"name":"label","type":{"name":"","union":[{"name":"string"},{"name":"Array","templates":[{"name":"string"}]}],"expression":"[string]|[Array]<[string]>"},"spec":[{"type":"text","text":"Options to select by label. If the `<select>` has the `multiple` attribute, all given options are selected, otherwise only the first option matching one of the passed options is selected. Optional."}],"required":false,"comment":"Options to select by label. If the `<select>` has the `multiple` attribute, all given options are selected, otherwise\nonly the first option matching one of the passed options is selected. Optional.","deprecated":false,"async":false,"alias":"label"}]},{"kind":"method","langs":{},"name":"setContent","type":{"name":"void"},"spec":[],"required":true,"comment":"","deprecated":false,"async":true,"alias":"setContent","args":[{"kind":"property","langs":{},"name":"html","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"HTML markup to assign to the page."}],"required":true,"comment":"HTML markup to assign to the page.","deprecated":false,"async":false,"alias":"html"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultNavigationTimeout`], [`method: BrowserContext.setDefaultTimeout`], [`method: Page.setDefaultNavigationTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be\nchanged by using the [`method: BrowserContext.setDefaultNavigationTimeout`],\n[`method: BrowserContext.setDefaultTimeout`], [`method: Page.setDefaultNavigationTimeout`] or\n[`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"},{"kind":"property","langs":{},"name":"waitUntil","type":{"name":"WaitUntilState","union":[{"name":"\"load\""},{"name":"\"domcontentloaded\""},{"name":"\"networkidle\""}],"expression":"[WaitUntilState]<\"load\"|\"domcontentloaded\"|\"networkidle\">"},"spec":[{"type":"text","text":"When to consider operation succeeded, defaults to `load`. Events can be either:"},{"type":"li","text":"`'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.","liType":"bullet"},{"type":"li","text":"`'load'` - consider operation to be finished when the `load` event is fired.","liType":"bullet"},{"type":"li","text":"`'networkidle'` - consider operation to be finished when there are no network connections for at least `500` ms.","liType":"bullet"}],"required":false,"comment":"When to consider operation succeeded, defaults to `load`. Events can be either:\n- `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.\n- `'load'` - consider operation to be finished when the `load` event is fired.\n- `'networkidle'` - consider operation to be finished when there are no network connections for at least `500` ms.","deprecated":false,"async":false,"alias":"waitUntil"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"setInputFiles","type":{"name":"void"},"spec":[{"type":"text","text":"This method expects `selector` to point to an [input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input)."},{"type":"text","text":"Sets the value of the file input to these file paths or files. If some of the `filePaths` are relative paths, then they are resolved relative to the the current working directory. For empty array, clears the selected files."}],"required":true,"comment":"This method expects `selector` to point to an\n[input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input).\n\nSets the value of the file input to these file paths or files. If some of the `filePaths` are relative paths, then they\nare resolved relative to the the current working directory. For empty array, clears the selected files.","deprecated":false,"async":true,"alias":"setInputFiles","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See\n[working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"files","type":{"name":"","union":[{"name":"path"},{"name":"Array","templates":[{"name":"path"}]},{"name":"Object","properties":[{"kind":"property","langs":{},"name":"name","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"File name"}],"required":true,"comment":"File name","deprecated":false,"async":false,"alias":"name"},{"kind":"property","langs":{},"name":"mimeType","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"File type"}],"required":true,"comment":"File type","deprecated":false,"async":false,"alias":"mimeType"},{"kind":"property","langs":{},"name":"buffer","type":{"name":"Buffer","expression":"[Buffer]"},"spec":[{"type":"text","text":"File content"}],"required":true,"comment":"File content","deprecated":false,"async":false,"alias":"buffer"}]},{"name":"Array","templates":[{"name":"Object","properties":[{"kind":"property","langs":{},"name":"name","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"File name"}],"required":true,"comment":"File name","deprecated":false,"async":false,"alias":"name"},{"kind":"property","langs":{},"name":"mimeType","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"File type"}],"required":true,"comment":"File type","deprecated":false,"async":false,"alias":"mimeType"},{"kind":"property","langs":{},"name":"buffer","type":{"name":"Buffer","expression":"[Buffer]"},"spec":[{"type":"text","text":"File content"}],"required":true,"comment":"File content","deprecated":false,"async":false,"alias":"buffer"}]}]}],"expression":"[path]|[Array]<[path]>|[Object]|[Array]<[Object]>"},"spec":[],"required":true,"comment":"","deprecated":false,"async":false,"alias":"files"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"noWaitAfter","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`."}],"required":false,"comment":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can\nopt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to\ninaccessible pages. Defaults to `false`.","deprecated":false,"async":false,"alias":"noWaitAfter"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"tap","type":{"name":"void"},"spec":[{"type":"text","text":"This method taps an element matching `selector` by performing the following steps:"},{"type":"li","text":"Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.","liType":"ordinal"},{"type":"li","text":"Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried.","liType":"ordinal"},{"type":"li","text":"Scroll the element into view if needed.","liType":"ordinal"},{"type":"li","text":"Use [`property: Page.touchscreen`] to tap the center of the element, or the specified `position`.","liType":"ordinal"},{"type":"li","text":"Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.","liType":"ordinal"},{"type":"text","text":"When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing zero timeout disables this."},{"type":"note","noteType":"note","text":"`frame.tap()` requires that the `hasTouch` option of the browser context be set to true."}],"required":true,"comment":"This method taps an element matching `selector` by performing the following steps:\n1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.\n1. Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the\n element is detached during the checks, the whole action is retried.\n1. Scroll the element into view if needed.\n1. Use [`property: Page.touchscreen`] to tap the center of the element, or the specified `position`.\n1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.\n\nWhen all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing\nzero timeout disables this.\n\n> NOTE: `frame.tap()` requires that the `hasTouch` option of the browser context be set to true.","deprecated":false,"async":true,"alias":"tap","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See\n[working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"force","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`."}],"required":false,"comment":"Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.","deprecated":false,"async":false,"alias":"force"},{"kind":"property","langs":{},"name":"modifiers","type":{"name":"Array","templates":[{"name":"KeyboardModifier","union":[{"name":"\"Alt\""},{"name":"\"Control\""},{"name":"\"Meta\""},{"name":"\"Shift\""}]}],"expression":"[Array]<[KeyboardModifier]<\"Alt\"|\"Control\"|\"Meta\"|\"Shift\">>"},"spec":[{"type":"text","text":"Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current modifiers back. If not specified, currently pressed modifiers are used."}],"required":false,"comment":"Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current\nmodifiers back. If not specified, currently pressed modifiers are used.","deprecated":false,"async":false,"alias":"modifiers"},{"kind":"property","langs":{},"name":"noWaitAfter","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`."}],"required":false,"comment":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can\nopt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to\ninaccessible pages. Defaults to `false`.","deprecated":false,"async":false,"alias":"noWaitAfter"},{"kind":"property","langs":{},"name":"position","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"x","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"x"},{"kind":"property","langs":{},"name":"y","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"y"}],"expression":"[Object]"},"spec":[{"type":"text","text":"A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element."}],"required":false,"comment":"A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the\nelement.","deprecated":false,"async":false,"alias":"position"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"},{"kind":"property","langs":{},"name":"trial","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it."}],"required":false,"comment":"When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to\n`false`. Useful to wait until the element is ready for the action without performing it.","deprecated":false,"async":false,"alias":"trial"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"textContent","type":{"name":"","union":[{"name":"null"},{"name":"string"}],"expression":"[null]|[string]"},"spec":[{"type":"text","text":"Returns `element.textContent`."}],"required":true,"comment":"Returns `element.textContent`.","deprecated":false,"async":true,"alias":"textContent","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See\n[working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"title","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Returns the page title."}],"required":true,"comment":"Returns the page title.","deprecated":false,"async":true,"alias":"title","args":[]},{"kind":"method","langs":{},"name":"type","type":{"name":"void"},"spec":[{"type":"text","text":"Sends a `keydown`, `keypress`/`input`, and `keyup` event for each character in the text. `frame.type` can be used to send fine-grained keyboard events. To fill values in form fields, use [`method: Frame.fill`]."},{"type":"text","text":"To press a special key, like `Control` or `ArrowDown`, use [`method: Keyboard.press`]."},{"type":"code","lines":["await frame.type('#mytextarea', 'Hello'); // Types instantly","await frame.type('#mytextarea', 'World', {delay: 100}); // Types slower, like a user"],"codeLang":"js"},{"type":"code","lines":["// Types instantly","frame.type(\"#mytextarea\", \"Hello\");","// Types slower, like a user","frame.type(\"#mytextarea\", \"World\", new Frame.TypeOptions().setDelay(100));"],"codeLang":"java"},{"type":"code","lines":["await frame.type(\"#mytextarea\", \"hello\") # types instantly","await frame.type(\"#mytextarea\", \"world\", delay=100) # types slower, like a user"],"codeLang":"python async"},{"type":"code","lines":["frame.type(\"#mytextarea\", \"hello\") # types instantly","frame.type(\"#mytextarea\", \"world\", delay=100) # types slower, like a user"],"codeLang":"python sync"},{"type":"code","lines":["await frame.TypeAsync(\"#mytextarea\", \"hello\"); // types instantly","await frame.TypeAsync(\"#mytextarea\", \"world\", delay: 100); // types slower, like a user"],"codeLang":"csharp"}],"required":true,"comment":"Sends a `keydown`, `keypress`/`input`, and `keyup` event for each character in the text. `frame.type` can be used to\nsend fine-grained keyboard events. To fill values in form fields, use [`method: Frame.fill`].\n\nTo press a special key, like `Control` or `ArrowDown`, use [`method: Keyboard.press`].\n\n```js\nawait frame.type('#mytextarea', 'Hello'); // Types instantly\nawait frame.type('#mytextarea', 'World', {delay: 100}); // Types slower, like a user\n```\n\n```java\n// Types instantly\nframe.type(\"#mytextarea\", \"Hello\");\n// Types slower, like a user\nframe.type(\"#mytextarea\", \"World\", new Frame.TypeOptions().setDelay(100));\n```\n\n```python async\nawait frame.type(\"#mytextarea\", \"hello\") # types instantly\nawait frame.type(\"#mytextarea\", \"world\", delay=100) # types slower, like a user\n```\n\n```python sync\nframe.type(\"#mytextarea\", \"hello\") # types instantly\nframe.type(\"#mytextarea\", \"world\", delay=100) # types slower, like a user\n```\n\n```csharp\nawait frame.TypeAsync(\"#mytextarea\", \"hello\"); // types instantly\nawait frame.TypeAsync(\"#mytextarea\", \"world\", delay: 100); // types slower, like a user\n```\n","deprecated":false,"async":true,"alias":"type","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See\n[working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"text","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A text to type into a focused element."}],"required":true,"comment":"A text to type into a focused element.","deprecated":false,"async":false,"alias":"text"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"delay","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Time to wait between key presses in milliseconds. Defaults to 0."}],"required":false,"comment":"Time to wait between key presses in milliseconds. Defaults to 0.","deprecated":false,"async":false,"alias":"delay"},{"kind":"property","langs":{},"name":"noWaitAfter","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`."}],"required":false,"comment":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can\nopt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to\ninaccessible pages. Defaults to `false`.","deprecated":false,"async":false,"alias":"noWaitAfter"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"uncheck","type":{"name":"void"},"spec":[{"type":"text","text":"This method checks an element matching `selector` by performing the following steps:"},{"type":"li","text":"Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.","liType":"ordinal"},{"type":"li","text":"Ensure that matched element is a checkbox or a radio input. If not, this method throws. If the element is already unchecked, this method returns immediately.","liType":"ordinal"},{"type":"li","text":"Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried.","liType":"ordinal"},{"type":"li","text":"Scroll the element into view if needed.","liType":"ordinal"},{"type":"li","text":"Use [`property: Page.mouse`] to click in the center of the element.","liType":"ordinal"},{"type":"li","text":"Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.","liType":"ordinal"},{"type":"li","text":"Ensure that the element is now unchecked. If not, this method throws.","liType":"ordinal"},{"type":"text","text":"When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing zero timeout disables this."}],"required":true,"comment":"This method checks an element matching `selector` by performing the following steps:\n1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.\n1. Ensure that matched element is a checkbox or a radio input. If not, this method throws. If the element is already\n unchecked, this method returns immediately.\n1. Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the\n element is detached during the checks, the whole action is retried.\n1. Scroll the element into view if needed.\n1. Use [`property: Page.mouse`] to click in the center of the element.\n1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.\n1. Ensure that the element is now unchecked. If not, this method throws.\n\nWhen all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing\nzero timeout disables this.","deprecated":false,"async":true,"alias":"uncheck","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See\n[working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"force","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`."}],"required":false,"comment":"Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.","deprecated":false,"async":false,"alias":"force"},{"kind":"property","langs":{},"name":"noWaitAfter","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`."}],"required":false,"comment":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can\nopt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to\ninaccessible pages. Defaults to `false`.","deprecated":false,"async":false,"alias":"noWaitAfter"},{"kind":"property","langs":{},"name":"position","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"x","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"x"},{"kind":"property","langs":{},"name":"y","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"y"}],"expression":"[Object]"},"spec":[{"type":"text","text":"A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element."}],"required":false,"comment":"A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the\nelement.","deprecated":false,"async":false,"alias":"position"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"},{"kind":"property","langs":{},"name":"trial","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it."}],"required":false,"comment":"When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to\n`false`. Useful to wait until the element is ready for the action without performing it.","deprecated":false,"async":false,"alias":"trial"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"url","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Returns frame's url."}],"required":true,"comment":"Returns frame's url.","deprecated":false,"async":false,"alias":"url","args":[]},{"kind":"method","langs":{},"name":"waitForFunction","type":{"name":"JSHandle","expression":"[JSHandle]"},"spec":[{"type":"text","text":"Returns when the `expression` returns a truthy value, returns that value."},{"type":"text","text":"The [`method: Frame.waitForFunction`] can be used to observe viewport size change:"},{"type":"code","lines":["const { firefox } = require('playwright'); // Or 'chromium' or 'webkit'.","","(async () => {"," const browser = await firefox.launch();"," const page = await browser.newPage();"," const watchDog = page.mainFrame().waitForFunction('window.innerWidth < 100');"," page.setViewportSize({width: 50, height: 50});"," await watchDog;"," await browser.close();","})();"],"codeLang":"js"},{"type":"code","lines":["import com.microsoft.playwright.*;","","public class Example {"," public static void main(String[] args) {"," try (Playwright playwright = Playwright.create()) {"," BrowserType firefox = playwright.firefox();"," Browser browser = firefox.launch();"," Page page = browser.newPage();"," page.setViewportSize(50, 50);"," page.mainFrame().waitForFunction(\"window.innerWidth < 100\");"," browser.close();"," }"," }","}"],"codeLang":"java"},{"type":"code","lines":["import asyncio","from playwright.async_api import async_playwright","","async def run(playwright):"," webkit = playwright.webkit"," browser = await webkit.launch()"," page = await browser.new_page()"," await page.evaluate(\"window.x = 0; setTimeout(() => { window.x = 100 }, 1000);\")"," await page.main_frame.wait_for_function(\"() => window.x > 0\")"," await browser.close()","","async def main():"," async with async_playwright() as playwright:"," await run(playwright)","asyncio.run(main())"],"codeLang":"python async"},{"type":"code","lines":["from playwright.sync_api import sync_playwright","","def run(playwright):"," webkit = playwright.webkit"," browser = webkit.launch()"," page = browser.new_page()"," page.evaluate(\"window.x = 0; setTimeout(() => { window.x = 100 }, 1000);\")"," page.main_frame.wait_for_function(\"() => window.x > 0\")"," browser.close()","","with sync_playwright() as playwright:"," run(playwright)"],"codeLang":"python sync"},{"type":"code","lines":["using Microsoft.Playwright;","using System.Threading.Tasks;","","class FrameExamples","{"," public static async Task Main()"," {"," using var playwright = await Playwright.CreateAsync();"," await using var browser = await playwright.Firefox.LaunchAsync();"," var page = await browser.NewPageAsync();"," await page.SetViewportSizeAsync(50, 50);"," await page.MainFrame.WaitForFunctionAsync(\"window.innerWidth < 100\");"," }","}"],"codeLang":"csharp"},{"type":"text","text":"To pass an argument to the predicate of `frame.waitForFunction` function:"},{"type":"code","lines":["const selector = '.foo';","await frame.waitForFunction(selector => !!document.querySelector(selector), selector);"],"codeLang":"js"},{"type":"code","lines":["String selector = \".foo\";","frame.waitForFunction(\"selector => !!document.querySelector(selector)\", selector);"],"codeLang":"java"},{"type":"code","lines":["selector = \".foo\"","await frame.wait_for_function(\"selector => !!document.querySelector(selector)\", selector)"],"codeLang":"python async"},{"type":"code","lines":["selector = \".foo\"","frame.wait_for_function(\"selector => !!document.querySelector(selector)\", selector)"],"codeLang":"python sync"},{"type":"code","lines":["var selector = \".foo\";","await page.MainFrame.WaitForFunctionAsync(\"selector => !!document.querySelector(selector)\", selector);"],"codeLang":"csharp"}],"required":true,"comment":"Returns when the `expression` returns a truthy value, returns that value.\n\nThe [`method: Frame.waitForFunction`] can be used to observe viewport size change:\n\n```js\nconst { firefox } = require('playwright'); // Or 'chromium' or 'webkit'.\n\n(async () => {\n const browser = await firefox.launch();\n const page = await browser.newPage();\n const watchDog = page.mainFrame().waitForFunction('window.innerWidth < 100');\n page.setViewportSize({width: 50, height: 50});\n await watchDog;\n await browser.close();\n})();\n```\n\n```java\nimport com.microsoft.playwright.*;\n\npublic class Example {\n public static void main(String[] args) {\n try (Playwright playwright = Playwright.create()) {\n BrowserType firefox = playwright.firefox();\n Browser browser = firefox.launch();\n Page page = browser.newPage();\n page.setViewportSize(50, 50);\n page.mainFrame().waitForFunction(\"window.innerWidth < 100\");\n browser.close();\n }\n }\n}\n```\n\n```python async\nimport asyncio\nfrom playwright.async_api import async_playwright\n\nasync def run(playwright):\n webkit = playwright.webkit\n browser = await webkit.launch()\n page = await browser.new_page()\n await page.evaluate(\"window.x = 0; setTimeout(() => { window.x = 100 }, 1000);\")\n await page.main_frame.wait_for_function(\"() => window.x > 0\")\n await browser.close()\n\nasync def main():\n async with async_playwright() as playwright:\n await run(playwright)\nasyncio.run(main())\n```\n\n```python sync\nfrom playwright.sync_api import sync_playwright\n\ndef run(playwright):\n webkit = playwright.webkit\n browser = webkit.launch()\n page = browser.new_page()\n page.evaluate(\"window.x = 0; setTimeout(() => { window.x = 100 }, 1000);\")\n page.main_frame.wait_for_function(\"() => window.x > 0\")\n browser.close()\n\nwith sync_playwright() as playwright:\n run(playwright)\n```\n\n```csharp\nusing Microsoft.Playwright;\nusing System.Threading.Tasks;\n\nclass FrameExamples\n{\n public static async Task Main()\n {\n using var playwright = await Playwright.CreateAsync();\n await using var browser = await playwright.Firefox.LaunchAsync();\n var page = await browser.NewPageAsync();\n await page.SetViewportSizeAsync(50, 50);\n await page.MainFrame.WaitForFunctionAsync(\"window.innerWidth < 100\");\n }\n}\n```\n\nTo pass an argument to the predicate of `frame.waitForFunction` function:\n\n```js\nconst selector = '.foo';\nawait frame.waitForFunction(selector => !!document.querySelector(selector), selector);\n```\n\n```java\nString selector = \".foo\";\nframe.waitForFunction(\"selector => !!document.querySelector(selector)\", selector);\n```\n\n```python async\nselector = \".foo\"\nawait frame.wait_for_function(\"selector => !!document.querySelector(selector)\", selector)\n```\n\n```python sync\nselector = \".foo\"\nframe.wait_for_function(\"selector => !!document.querySelector(selector)\", selector)\n```\n\n```csharp\nvar selector = \".foo\";\nawait page.MainFrame.WaitForFunctionAsync(\"selector => !!document.querySelector(selector)\", selector);\n```\n","deprecated":false,"async":true,"alias":"waitForFunction","args":[{"kind":"property","langs":{"overrides":{"js":{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"expression","type":{"name":"","union":[{"name":"function"},{"name":"string"}],"expression":"[function]|[string]"},"spec":[{"type":"text","text":"Function to be evaluated in the page context."}],"argsArray":[],"required":true,"comment":"","args":{},"clazz":null,"deprecated":false,"async":false,"alias":"pageFunction"}}},"name":"expression","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted as a function. Otherwise, evaluated as an expression."}],"required":true,"comment":"JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted\nas a function. Otherwise, evaluated as an expression.","deprecated":false,"async":false,"alias":"expression"},{"kind":"property","langs":{},"name":"arg","type":{"name":"EvaluationArgument","expression":"[EvaluationArgument]"},"spec":[{"type":"text","text":"Optional argument to pass to `expression`."}],"required":false,"comment":"Optional argument to pass to `expression`.","deprecated":false,"async":false,"alias":"arg"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{"only":["js","python"],"aliases":{},"types":{},"overrides":{}},"name":"polling","type":{"name":"","union":[{"name":"float"},{"name":"\"raf\""}],"expression":"[float]|\"raf\""},"spec":[{"type":"text","text":"If `polling` is `'raf'`, then `expression` is constantly executed in `requestAnimationFrame` callback. If `polling` is a number, then it is treated as an interval in milliseconds at which the function would be executed. Defaults to `raf`."}],"required":false,"comment":"If `polling` is `'raf'`, then `expression` is constantly executed in `requestAnimationFrame` callback. If `polling` is a\nnumber, then it is treated as an interval in milliseconds at which the function would be executed. Defaults to `raf`.","deprecated":false,"async":false,"alias":"polling"},{"kind":"property","langs":{"only":["csharp","java"],"aliases":{},"types":{},"overrides":{}},"name":"pollingInterval","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"If specified, then it is treated as an interval in milliseconds at which the function would be executed. By default if the option is not specified `expression` is executed in `requestAnimationFrame` callback."}],"required":false,"comment":"If specified, then it is treated as an interval in milliseconds at which the function would be executed. By default if\nthe option is not specified `expression` is executed in `requestAnimationFrame` callback.","deprecated":false,"async":false,"alias":"pollingInterval"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`]."}],"required":false,"comment":"maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default\nvalue can be changed by using the [`method: BrowserContext.setDefaultTimeout`].","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"waitForLoadState","type":{"name":"void"},"spec":[{"type":"text","text":"Waits for the required load state to be reached."},{"type":"text","text":"This returns when the frame reaches a required load state, `load` by default. The navigation must have been committed when this method is called. If current document has already reached the required state, resolves immediately."},{"type":"code","lines":["await frame.click('button'); // Click triggers navigation.","await frame.waitForLoadState(); // Waits for 'load' state by default."],"codeLang":"js"},{"type":"code","lines":["frame.click(\"button\"); // Click triggers navigation.","frame.waitForLoadState(); // Waits for \"load\" state by default."],"codeLang":"java"},{"type":"code","lines":["await frame.click(\"button\") # click triggers navigation.","await frame.wait_for_load_state() # the promise resolves after \"load\" event."],"codeLang":"python async"},{"type":"code","lines":["frame.click(\"button\") # click triggers navigation.","frame.wait_for_load_state() # the promise resolves after \"load\" event."],"codeLang":"python sync"},{"type":"code","lines":["await frame.ClickAsync(\"button\");","await frame.WaitForLoadStateAsync(); // Defaults to LoadState.Load"],"codeLang":"csharp"}],"required":true,"comment":"Waits for the required load state to be reached.\n\nThis returns when the frame reaches a required load state, `load` by default. The navigation must have been committed\nwhen this method is called. If current document has already reached the required state, resolves immediately.\n\n```js\nawait frame.click('button'); // Click triggers navigation.\nawait frame.waitForLoadState(); // Waits for 'load' state by default.\n```\n\n```java\nframe.click(\"button\"); // Click triggers navigation.\nframe.waitForLoadState(); // Waits for \"load\" state by default.\n```\n\n```python async\nawait frame.click(\"button\") # click triggers navigation.\nawait frame.wait_for_load_state() # the promise resolves after \"load\" event.\n```\n\n```python sync\nframe.click(\"button\") # click triggers navigation.\nframe.wait_for_load_state() # the promise resolves after \"load\" event.\n```\n\n```csharp\nawait frame.ClickAsync(\"button\");\nawait frame.WaitForLoadStateAsync(); // Defaults to LoadState.Load\n```\n","deprecated":false,"async":true,"alias":"waitForLoadState","args":[{"kind":"property","langs":{},"name":"state","type":{"name":"LoadState","union":[{"name":"\"load\""},{"name":"\"domcontentloaded\""},{"name":"\"networkidle\""}],"expression":"[LoadState]<\"load\"|\"domcontentloaded\"|\"networkidle\">"},"spec":[{"type":"text","text":"Optional load state to wait for, defaults to `load`. If the state has been already reached while loading current document, the method resolves immediately. Can be one of:"},{"type":"li","text":"`'load'` - wait for the `load` event to be fired.","liType":"bullet"},{"type":"li","text":"`'domcontentloaded'` - wait for the `DOMContentLoaded` event to be fired.","liType":"bullet"},{"type":"li","text":"`'networkidle'` - wait until there are no network connections for at least `500` ms.","liType":"bullet"}],"required":false,"comment":"Optional load state to wait for, defaults to `load`. If the state has been already reached while loading current\ndocument, the method resolves immediately. Can be one of:\n- `'load'` - wait for the `load` event to be fired.\n- `'domcontentloaded'` - wait for the `DOMContentLoaded` event to be fired.\n- `'networkidle'` - wait until there are no network connections for at least `500` ms.","deprecated":false,"async":false,"alias":"state"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultNavigationTimeout`], [`method: BrowserContext.setDefaultTimeout`], [`method: Page.setDefaultNavigationTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be\nchanged by using the [`method: BrowserContext.setDefaultNavigationTimeout`],\n[`method: BrowserContext.setDefaultTimeout`], [`method: Page.setDefaultNavigationTimeout`] or\n[`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{"aliases":{"python":"expect_navigation","csharp":"RunAndWaitForNavigation"},"types":{"python":{"name":"EventContextManager","templates":[{"name":"Response"}],"expression":"[EventContextManager]<[Response]>"}},"overrides":{}},"name":"waitForNavigation","type":{"name":"","union":[{"name":"null"},{"name":"Response"}],"expression":"[null]|[Response]"},"spec":[{"type":"text","text":"Waits for the frame navigation and returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of the last redirect. In case of navigation to a different anchor or navigation due to History API usage, the navigation will resolve with `null`."},{"type":"text","text":"This method waits for the frame to navigate to a new URL. It is useful for when you run code which will indirectly cause the frame to navigate. Consider this example:"},{"type":"code","lines":["const [response] = await Promise.all(["," frame.waitForNavigation(), // The promise resolves after navigation has finished"," frame.click('a.delayed-navigation'), // Clicking the link will indirectly cause a navigation","]);"],"codeLang":"js"},{"type":"code","lines":["// The method returns after navigation has finished","Response response = frame.waitForNavigation(() -> {"," // Clicking the link will indirectly cause a navigation"," frame.click(\"a.delayed-navigation\");","});"],"codeLang":"java"},{"type":"code","lines":["async with frame.expect_navigation():"," await frame.click(\"a.delayed-navigation\") # clicking the link will indirectly cause a navigation","# Resolves after navigation has finished"],"codeLang":"python async"},{"type":"code","lines":["with frame.expect_navigation():"," frame.click(\"a.delayed-navigation\") # clicking the link will indirectly cause a navigation","# Resolves after navigation has finished"],"codeLang":"python sync"},{"type":"code","lines":["await frame.RunAndWaitForNavigationAsync(async () =>","{"," // Clicking the link will indirectly cause a navigation."," await frame.ClickAsync(\"a.delayed-navigation\");","});","","// Resolves after navigation has finished"],"codeLang":"csharp"},{"type":"note","noteType":"note","text":"Usage of the [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) to change the URL is considered a navigation."}],"required":true,"comment":"Waits for the frame navigation and returns the main resource response. In case of multiple redirects, the navigation\nwill resolve with the response of the last redirect. In case of navigation to a different anchor or navigation due to\nHistory API usage, the navigation will resolve with `null`.\n\nThis method waits for the frame to navigate to a new URL. It is useful for when you run code which will indirectly cause\nthe frame to navigate. Consider this example:\n\n```js\nconst [response] = await Promise.all([\n frame.waitForNavigation(), // The promise resolves after navigation has finished\n frame.click('a.delayed-navigation'), // Clicking the link will indirectly cause a navigation\n]);\n```\n\n```java\n// The method returns after navigation has finished\nResponse response = frame.waitForNavigation(() -> {\n // Clicking the link will indirectly cause a navigation\n frame.click(\"a.delayed-navigation\");\n});\n```\n\n```python async\nasync with frame.expect_navigation():\n await frame.click(\"a.delayed-navigation\") # clicking the link will indirectly cause a navigation\n# Resolves after navigation has finished\n```\n\n```python sync\nwith frame.expect_navigation():\n frame.click(\"a.delayed-navigation\") # clicking the link will indirectly cause a navigation\n# Resolves after navigation has finished\n```\n\n```csharp\nawait frame.RunAndWaitForNavigationAsync(async () =>\n{\n // Clicking the link will indirectly cause a navigation.\n await frame.ClickAsync(\"a.delayed-navigation\");\n});\n\n// Resolves after navigation has finished\n```\n\n> NOTE: Usage of the [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) to change the URL is\nconsidered a navigation.","deprecated":false,"async":true,"alias":"waitForNavigation","args":[{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultNavigationTimeout`], [`method: BrowserContext.setDefaultTimeout`], [`method: Page.setDefaultNavigationTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be\nchanged by using the [`method: BrowserContext.setDefaultNavigationTimeout`],\n[`method: BrowserContext.setDefaultTimeout`], [`method: Page.setDefaultNavigationTimeout`] or\n[`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"},{"kind":"property","langs":{},"name":"url","type":{"name":"","union":[{"name":"string"},{"name":"RegExp"},{"name":"function","args":[{"name":"URL"}],"returnType":{"name":"boolean"}}],"expression":"[string]|[RegExp]|[function]([URL]):[boolean]"},"spec":[{"type":"text","text":"A glob pattern, regex pattern or predicate receiving [URL] to match while waiting for the navigation."}],"required":false,"comment":"A glob pattern, regex pattern or predicate receiving [URL] to match while waiting for the navigation.","deprecated":false,"async":false,"alias":"url"},{"kind":"property","langs":{},"name":"waitUntil","type":{"name":"WaitUntilState","union":[{"name":"\"load\""},{"name":"\"domcontentloaded\""},{"name":"\"networkidle\""}],"expression":"[WaitUntilState]<\"load\"|\"domcontentloaded\"|\"networkidle\">"},"spec":[{"type":"text","text":"When to consider operation succeeded, defaults to `load`. Events can be either:"},{"type":"li","text":"`'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.","liType":"bullet"},{"type":"li","text":"`'load'` - consider operation to be finished when the `load` event is fired.","liType":"bullet"},{"type":"li","text":"`'networkidle'` - consider operation to be finished when there are no network connections for at least `500` ms.","liType":"bullet"}],"required":false,"comment":"When to consider operation succeeded, defaults to `load`. Events can be either:\n- `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.\n- `'load'` - consider operation to be finished when the `load` event is fired.\n- `'networkidle'` - consider operation to be finished when there are no network connections for at least `500` ms.","deprecated":false,"async":false,"alias":"waitUntil"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"},{"kind":"property","langs":{"only":["csharp"],"aliases":{},"types":{},"overrides":{}},"name":"action","type":{"name":"Func","templates":[{"name":"Task"}],"expression":"[Func<Task>]"},"spec":[{"type":"text","text":"Action that triggers the event."}],"required":true,"comment":"Action that triggers the event.","deprecated":false,"async":false,"alias":"action"},{"kind":"property","langs":{"only":["java"],"aliases":{},"types":{},"overrides":{}},"name":"callback","type":{"name":"Runnable","expression":"[Runnable]"},"spec":[{"type":"text","text":"Callback that performs the action triggering the event."}],"required":true,"comment":"Callback that performs the action triggering the event.","deprecated":false,"async":false,"alias":"callback"}]},{"kind":"method","langs":{},"name":"waitForSelector","type":{"name":"","union":[{"name":"null"},{"name":"ElementHandle"}],"expression":"[null]|[ElementHandle]"},"spec":[{"type":"text","text":"Returns when element specified by selector satisfies `state` option. Returns `null` if waiting for `hidden` or `detached`."},{"type":"text","text":"Wait for the `selector` to satisfy `state` option (either appear/disappear from dom, or become visible/hidden). If at the moment of calling the method `selector` already satisfies the condition, the method will return immediately. If the selector doesn't satisfy the condition for the `timeout` milliseconds, the function will throw."},{"type":"text","text":"This method works across navigations:"},{"type":"code","lines":["const { chromium } = require('playwright'); // Or 'firefox' or 'webkit'.","","(async () => {"," const browser = await chromium.launch();"," const page = await browser.newPage();"," for (let currentURL of ['https://google.com', 'https://bbc.com']) {"," await page.goto(currentURL);"," const element = await page.mainFrame().waitForSelector('img');"," console.log('Loaded image: ' + await element.getAttribute('src'));"," }"," await browser.close();","})();"],"codeLang":"js"},{"type":"code","lines":["import com.microsoft.playwright.*;","","public class Example {"," public static void main(String[] args) {"," try (Playwright playwright = Playwright.create()) {"," BrowserType chromium = playwright.chromium();"," Browser browser = chromium.launch();"," Page page = browser.newPage();"," for (String currentURL : Arrays.asList(\"https://google.com\", \"https://bbc.com\")) {"," page.navigate(currentURL);"," ElementHandle element = page.mainFrame().waitForSelector(\"img\");"," System.out.println(\"Loaded image: \" + element.getAttribute(\"src\"));"," }"," browser.close();"," }"," }","}"],"codeLang":"java"},{"type":"code","lines":["import asyncio","from playwright.async_api import async_playwright","","async def run(playwright):"," chromium = playwright.chromium"," browser = await chromium.launch()"," page = await browser.new_page()"," for current_url in [\"https://google.com\", \"https://bbc.com\"]:"," await page.goto(current_url, wait_until=\"domcontentloaded\")"," element = await page.main_frame.wait_for_selector(\"img\")"," print(\"Loaded image: \" + str(await element.get_attribute(\"src\")))"," await browser.close()","","async def main():"," async with async_playwright() as playwright:"," await run(playwright)","asyncio.run(main())"],"codeLang":"python async"},{"type":"code","lines":["from playwright.sync_api import sync_playwright","","def run(playwright):"," chromium = playwright.chromium"," browser = chromium.launch()"," page = browser.new_page()"," for current_url in [\"https://google.com\", \"https://bbc.com\"]:"," page.goto(current_url, wait_until=\"domcontentloaded\")"," element = page.main_frame.wait_for_selector(\"img\")"," print(\"Loaded image: \" + str(element.get_attribute(\"src\")))"," browser.close()","","with sync_playwright() as playwright:"," run(playwright)"],"codeLang":"python sync"},{"type":"code","lines":["using Microsoft.Playwright;","using System;","using System.Threading.Tasks;","","class FrameExamples","{"," public static async Task Main()"," {"," using var playwright = await Playwright.CreateAsync();"," await using var browser = await playwright.Chromium.LaunchAsync();"," var page = await browser.NewPageAsync();",""," foreach (var currentUrl in new[] { \"https://www.google.com\", \"https://bbc.com\" })"," {"," await page.GotoAsync(currentUrl);"," element = await page.MainFrame.WaitForSelectorAsync(\"img\");"," Console.WriteLine($\"Loaded image: {await element.GetAttributeAsync(\"src\")}\");"," }"," }","}"],"codeLang":"csharp"}],"required":true,"comment":"Returns when element specified by selector satisfies `state` option. Returns `null` if waiting for `hidden` or\n`detached`.\n\nWait for the `selector` to satisfy `state` option (either appear/disappear from dom, or become visible/hidden). If at\nthe moment of calling the method `selector` already satisfies the condition, the method will return immediately. If the\nselector doesn't satisfy the condition for the `timeout` milliseconds, the function will throw.\n\nThis method works across navigations:\n\n```js\nconst { chromium } = require('playwright'); // Or 'firefox' or 'webkit'.\n\n(async () => {\n const browser = await chromium.launch();\n const page = await browser.newPage();\n for (let currentURL of ['https://google.com', 'https://bbc.com']) {\n await page.goto(currentURL);\n const element = await page.mainFrame().waitForSelector('img');\n console.log('Loaded image: ' + await element.getAttribute('src'));\n }\n await browser.close();\n})();\n```\n\n```java\nimport com.microsoft.playwright.*;\n\npublic class Example {\n public static void main(String[] args) {\n try (Playwright playwright = Playwright.create()) {\n BrowserType chromium = playwright.chromium();\n Browser browser = chromium.launch();\n Page page = browser.newPage();\n for (String currentURL : Arrays.asList(\"https://google.com\", \"https://bbc.com\")) {\n page.navigate(currentURL);\n ElementHandle element = page.mainFrame().waitForSelector(\"img\");\n System.out.println(\"Loaded image: \" + element.getAttribute(\"src\"));\n }\n browser.close();\n }\n }\n}\n```\n\n```python async\nimport asyncio\nfrom playwright.async_api import async_playwright\n\nasync def run(playwright):\n chromium = playwright.chromium\n browser = await chromium.launch()\n page = await browser.new_page()\n for current_url in [\"https://google.com\", \"https://bbc.com\"]:\n await page.goto(current_url, wait_until=\"domcontentloaded\")\n element = await page.main_frame.wait_for_selector(\"img\")\n print(\"Loaded image: \" + str(await element.get_attribute(\"src\")))\n await browser.close()\n\nasync def main():\n async with async_playwright() as playwright:\n await run(playwright)\nasyncio.run(main())\n```\n\n```python sync\nfrom playwright.sync_api import sync_playwright\n\ndef run(playwright):\n chromium = playwright.chromium\n browser = chromium.launch()\n page = browser.new_page()\n for current_url in [\"https://google.com\", \"https://bbc.com\"]:\n page.goto(current_url, wait_until=\"domcontentloaded\")\n element = page.main_frame.wait_for_selector(\"img\")\n print(\"Loaded image: \" + str(element.get_attribute(\"src\")))\n browser.close()\n\nwith sync_playwright() as playwright:\n run(playwright)\n```\n\n```csharp\nusing Microsoft.Playwright;\nusing System;\nusing System.Threading.Tasks;\n\nclass FrameExamples\n{\n public static async Task Main()\n {\n using var playwright = await Playwright.CreateAsync();\n await using var browser = await playwright.Chromium.LaunchAsync();\n var page = await browser.NewPageAsync();\n\n foreach (var currentUrl in new[] { \"https://www.google.com\", \"https://bbc.com\" })\n {\n await page.GotoAsync(currentUrl);\n element = await page.MainFrame.WaitForSelectorAsync(\"img\");\n Console.WriteLine($\"Loaded image: {await element.GetAttributeAsync(\"src\")}\");\n }\n }\n}\n```\n","deprecated":false,"async":true,"alias":"waitForSelector","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to query for. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to query for. See [working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"state","type":{"name":"WaitForSelectorState","union":[{"name":"\"attached\""},{"name":"\"detached\""},{"name":"\"visible\""},{"name":"\"hidden\""}],"expression":"[WaitForSelectorState]<\"attached\"|\"detached\"|\"visible\"|\"hidden\">"},"spec":[{"type":"text","text":"Defaults to `'visible'`. Can be either:"},{"type":"li","text":"`'attached'` - wait for element to be present in DOM.","liType":"bullet"},{"type":"li","text":"`'detached'` - wait for element to not be present in DOM.","liType":"bullet"},{"type":"li","text":"`'visible'` - wait for element to have non-empty bounding box and no `visibility:hidden`. Note that element without any content or with `display:none` has an empty bounding box and is not considered visible.","liType":"bullet"},{"type":"li","text":"`'hidden'` - wait for element to be either detached from DOM, or have an empty bounding box or `visibility:hidden`. This is opposite to the `'visible'` option.","liType":"bullet"}],"required":false,"comment":"Defaults to `'visible'`. Can be either:\n- `'attached'` - wait for element to be present in DOM.\n- `'detached'` - wait for element to not be present in DOM.\n- `'visible'` - wait for element to have non-empty bounding box and no `visibility:hidden`. Note that element without\n any content or with `display:none` has an empty bounding box and is not considered visible.\n- `'hidden'` - wait for element to be either detached from DOM, or have an empty bounding box or `visibility:hidden`.\n This is opposite to the `'visible'` option.","deprecated":false,"async":false,"alias":"state"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"waitForTimeout","type":{"name":"void"},"spec":[{"type":"text","text":"Waits for the given `timeout` in milliseconds."},{"type":"text","text":"Note that `frame.waitForTimeout()` should only be used for debugging. Tests using the timer in production are going to be flaky. Use signals such as network events, selectors becoming visible and others instead."}],"required":true,"comment":"Waits for the given `timeout` in milliseconds.\n\nNote that `frame.waitForTimeout()` should only be used for debugging. Tests using the timer in production are going to\nbe flaky. Use signals such as network events, selectors becoming visible and others instead.","deprecated":false,"async":true,"alias":"waitForTimeout","args":[{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"A timeout to wait for"}],"required":true,"comment":"A timeout to wait for","deprecated":false,"async":false,"alias":"timeout"}]},{"kind":"method","langs":{},"name":"waitForURL","type":{"name":"void"},"spec":[{"type":"text","text":"Waits for the frame to navigate to the given URL."},{"type":"code","lines":["await frame.click('a.delayed-navigation'); // Clicking the link will indirectly cause a navigation","await frame.waitForURL('**/target.html');"],"codeLang":"js"},{"type":"code","lines":["frame.click(\"a.delayed-navigation\"); // Clicking the link will indirectly cause a navigation","frame.waitForURL(\"**/target.html\");"],"codeLang":"java"},{"type":"code","lines":["await frame.click(\"a.delayed-navigation\") # clicking the link will indirectly cause a navigation","await frame.wait_for_url(\"**/target.html\")"],"codeLang":"python async"},{"type":"code","lines":["frame.click(\"a.delayed-navigation\") # clicking the link will indirectly cause a navigation","frame.wait_for_url(\"**/target.html\")"],"codeLang":"python sync"},{"type":"code","lines":["await frame.ClickAsync(\"a.delayed-navigation\"); // clicking the link will indirectly cause a navigation","await frame.WaitForURLAsync(\"**/target.html\");"],"codeLang":"csharp"}],"required":true,"comment":"Waits for the frame to navigate to the given URL.\n\n```js\nawait frame.click('a.delayed-navigation'); // Clicking the link will indirectly cause a navigation\nawait frame.waitForURL('**/target.html');\n```\n\n```java\nframe.click(\"a.delayed-navigation\"); // Clicking the link will indirectly cause a navigation\nframe.waitForURL(\"**/target.html\");\n```\n\n```python async\nawait frame.click(\"a.delayed-navigation\") # clicking the link will indirectly cause a navigation\nawait frame.wait_for_url(\"**/target.html\")\n```\n\n```python sync\nframe.click(\"a.delayed-navigation\") # clicking the link will indirectly cause a navigation\nframe.wait_for_url(\"**/target.html\")\n```\n\n```csharp\nawait frame.ClickAsync(\"a.delayed-navigation\"); // clicking the link will indirectly cause a navigation\nawait frame.WaitForURLAsync(\"**/target.html\");\n```\n","deprecated":false,"async":true,"alias":"waitForURL","args":[{"kind":"property","langs":{},"name":"url","type":{"name":"","union":[{"name":"string"},{"name":"RegExp"},{"name":"function","args":[{"name":"URL"}],"returnType":{"name":"boolean"}}],"expression":"[string]|[RegExp]|[function]([URL]):[boolean]"},"spec":[{"type":"text","text":"A glob pattern, regex pattern or predicate receiving [URL] to match while waiting for the navigation."}],"required":true,"comment":"A glob pattern, regex pattern or predicate receiving [URL] to match while waiting for the navigation.","deprecated":false,"async":false,"alias":"url"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultNavigationTimeout`], [`method: BrowserContext.setDefaultTimeout`], [`method: Page.setDefaultNavigationTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be\nchanged by using the [`method: BrowserContext.setDefaultNavigationTimeout`],\n[`method: BrowserContext.setDefaultTimeout`], [`method: Page.setDefaultNavigationTimeout`] or\n[`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"},{"kind":"property","langs":{},"name":"waitUntil","type":{"name":"WaitUntilState","union":[{"name":"\"load\""},{"name":"\"domcontentloaded\""},{"name":"\"networkidle\""}],"expression":"[WaitUntilState]<\"load\"|\"domcontentloaded\"|\"networkidle\">"},"spec":[{"type":"text","text":"When to consider operation succeeded, defaults to `load`. Events can be either:"},{"type":"li","text":"`'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.","liType":"bullet"},{"type":"li","text":"`'load'` - consider operation to be finished when the `load` event is fired.","liType":"bullet"},{"type":"li","text":"`'networkidle'` - consider operation to be finished when there are no network connections for at least `500` ms.","liType":"bullet"}],"required":false,"comment":"When to consider operation succeeded, defaults to `load`. Events can be either:\n- `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.\n- `'load'` - consider operation to be finished when the `load` event is fired.\n- `'networkidle'` - consider operation to be finished when there are no network connections for at least `500` ms.","deprecated":false,"async":false,"alias":"waitUntil"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]}]},{"name":"JSHandle","spec":[{"type":"text","text":"JSHandle represents an in-page JavaScript object. JSHandles can be created with the [`method: Page.evaluateHandle`] method."},{"type":"code","lines":["const windowHandle = await page.evaluateHandle(() => window);","// ..."],"codeLang":"js"},{"type":"code","lines":["JSHandle windowHandle = page.evaluateHandle(\"() => window\");","// ..."],"codeLang":"java"},{"type":"code","lines":["window_handle = await page.evaluate_handle(\"window\")","# ..."],"codeLang":"python async"},{"type":"code","lines":["window_handle = page.evaluate_handle(\"window\")","# ..."],"codeLang":"python sync"},{"type":"code","lines":["var windowHandle = await page.EvaluateHandleAsync(\"() => window\");"],"codeLang":"csharp"},{"type":"text","text":"JSHandle prevents the referenced JavaScript object being garbage collected unless the handle is exposed with [`method: JSHandle.dispose`]. JSHandles are auto-disposed when their origin frame gets navigated or the parent context gets destroyed."},{"type":"text","text":"JSHandle instances can be used as an argument in [`method: Page.evalOnSelector`], [`method: Page.evaluate`] and [`method: Page.evaluateHandle`] methods."}],"langs":{},"comment":"JSHandle represents an in-page JavaScript object. JSHandles can be created with the [`method: Page.evaluateHandle`]\nmethod.\n\n```js\nconst windowHandle = await page.evaluateHandle(() => window);\n// ...\n```\n\n```java\nJSHandle windowHandle = page.evaluateHandle(\"() => window\");\n// ...\n```\n\n```python async\nwindow_handle = await page.evaluate_handle(\"window\")\n# ...\n```\n\n```python sync\nwindow_handle = page.evaluate_handle(\"window\")\n# ...\n```\n\n```csharp\nvar windowHandle = await page.EvaluateHandleAsync(\"() => window\");\n```\n\nJSHandle prevents the referenced JavaScript object being garbage collected unless the handle is exposed with\n[`method: JSHandle.dispose`]. JSHandles are auto-disposed when their origin frame gets navigated or the parent context\ngets destroyed.\n\nJSHandle instances can be used as an argument in [`method: Page.evalOnSelector`], [`method: Page.evaluate`] and\n[`method: Page.evaluateHandle`] methods.","members":[{"kind":"method","langs":{},"name":"asElement","type":{"name":"","union":[{"name":"null"},{"name":"ElementHandle"}],"expression":"[null]|[ElementHandle]"},"spec":[{"type":"text","text":"Returns either `null` or the object handle itself, if the object handle is an instance of `ElementHandle`."}],"required":true,"comment":"Returns either `null` or the object handle itself, if the object handle is an instance of `ElementHandle`.","deprecated":false,"async":false,"alias":"asElement","args":[]},{"kind":"method","langs":{},"name":"dispose","type":{"name":"void"},"spec":[{"type":"text","text":"The `jsHandle.dispose` method stops referencing the element handle."}],"required":true,"comment":"The `jsHandle.dispose` method stops referencing the element handle.","deprecated":false,"async":true,"alias":"dispose","args":[]},{"kind":"method","langs":{},"name":"evaluate","type":{"name":"Serializable","expression":"[Serializable]"},"spec":[{"type":"text","text":"Returns the return value of `expression`."},{"type":"text","text":"This method passes this handle as the first argument to `expression`."},{"type":"text","text":"If `expression` returns a [Promise], then `handle.evaluate` would wait for the promise to resolve and return its value."},{"type":"text","text":"Examples:"},{"type":"code","lines":["const tweetHandle = await page.$('.tweet .retweets');","expect(await tweetHandle.evaluate(node => node.innerText)).toBe('10 retweets');"],"codeLang":"js"},{"type":"code","lines":["ElementHandle tweetHandle = page.querySelector(\".tweet .retweets\");","assertEquals(\"10 retweets\", tweetHandle.evaluate(\"node => node.innerText\"));"],"codeLang":"java"},{"type":"code","lines":["tweet_handle = await page.query_selector(\".tweet .retweets\")","assert await tweet_handle.evaluate(\"node => node.innerText\") == \"10 retweets\""],"codeLang":"python async"},{"type":"code","lines":["tweet_handle = page.query_selector(\".tweet .retweets\")","assert tweet_handle.evaluate(\"node => node.innerText\") == \"10 retweets\""],"codeLang":"python sync"},{"type":"code","lines":["var tweetHandle = await page.QuerySelectorAsync(\".tweet .retweets\");","Assert.Equals(\"10 retweets\", await tweetHandle.EvaluateAsync(\"node => node.innerText\"));"],"codeLang":"csharp"}],"required":true,"comment":"Returns the return value of `expression`.\n\nThis method passes this handle as the first argument to `expression`.\n\nIf `expression` returns a [Promise], then `handle.evaluate` would wait for the promise to resolve and return its value.\n\nExamples:\n\n```js\nconst tweetHandle = await page.$('.tweet .retweets');\nexpect(await tweetHandle.evaluate(node => node.innerText)).toBe('10 retweets');\n```\n\n```java\nElementHandle tweetHandle = page.querySelector(\".tweet .retweets\");\nassertEquals(\"10 retweets\", tweetHandle.evaluate(\"node => node.innerText\"));\n```\n\n```python async\ntweet_handle = await page.query_selector(\".tweet .retweets\")\nassert await tweet_handle.evaluate(\"node => node.innerText\") == \"10 retweets\"\n```\n\n```python sync\ntweet_handle = page.query_selector(\".tweet .retweets\")\nassert tweet_handle.evaluate(\"node => node.innerText\") == \"10 retweets\"\n```\n\n```csharp\nvar tweetHandle = await page.QuerySelectorAsync(\".tweet .retweets\");\nAssert.Equals(\"10 retweets\", await tweetHandle.EvaluateAsync(\"node => node.innerText\"));\n```\n","deprecated":false,"async":true,"alias":"evaluate","args":[{"kind":"property","langs":{"overrides":{"js":{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"expression","type":{"name":"","union":[{"name":"function"},{"name":"string"}],"expression":"[function]|[string]"},"spec":[{"type":"text","text":"Function to be evaluated in the page context."}],"argsArray":[],"required":true,"comment":"","args":{},"clazz":null,"deprecated":false,"async":false,"alias":"pageFunction"}}},"name":"expression","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted as a function. Otherwise, evaluated as an expression."}],"required":true,"comment":"JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted\nas a function. Otherwise, evaluated as an expression.","deprecated":false,"async":false,"alias":"expression"},{"kind":"property","langs":{},"name":"arg","type":{"name":"EvaluationArgument","expression":"[EvaluationArgument]"},"spec":[{"type":"text","text":"Optional argument to pass to `expression`."}],"required":false,"comment":"Optional argument to pass to `expression`.","deprecated":false,"async":false,"alias":"arg"}]},{"kind":"method","langs":{},"name":"evaluateHandle","type":{"name":"JSHandle","expression":"[JSHandle]"},"spec":[{"type":"text","text":"Returns the return value of `expression` as a `JSHandle`."},{"type":"text","text":"This method passes this handle as the first argument to `expression`."},{"type":"text","text":"The only difference between `jsHandle.evaluate` and `jsHandle.evaluateHandle` is that `jsHandle.evaluateHandle` returns `JSHandle`."},{"type":"text","text":"If the function passed to the `jsHandle.evaluateHandle` returns a [Promise], then `jsHandle.evaluateHandle` would wait for the promise to resolve and return its value."},{"type":"text","text":"See [`method: Page.evaluateHandle`] for more details."}],"required":true,"comment":"Returns the return value of `expression` as a `JSHandle`.\n\nThis method passes this handle as the first argument to `expression`.\n\nThe only difference between `jsHandle.evaluate` and `jsHandle.evaluateHandle` is that `jsHandle.evaluateHandle` returns\n`JSHandle`.\n\nIf the function passed to the `jsHandle.evaluateHandle` returns a [Promise], then `jsHandle.evaluateHandle` would wait\nfor the promise to resolve and return its value.\n\nSee [`method: Page.evaluateHandle`] for more details.","deprecated":false,"async":true,"alias":"evaluateHandle","args":[{"kind":"property","langs":{"overrides":{"js":{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"expression","type":{"name":"","union":[{"name":"function"},{"name":"string"}],"expression":"[function]|[string]"},"spec":[{"type":"text","text":"Function to be evaluated in the page context."}],"argsArray":[],"required":true,"comment":"","args":{},"clazz":null,"deprecated":false,"async":false,"alias":"pageFunction"}}},"name":"expression","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted as a function. Otherwise, evaluated as an expression."}],"required":true,"comment":"JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted\nas a function. Otherwise, evaluated as an expression.","deprecated":false,"async":false,"alias":"expression"},{"kind":"property","langs":{},"name":"arg","type":{"name":"EvaluationArgument","expression":"[EvaluationArgument]"},"spec":[{"type":"text","text":"Optional argument to pass to `expression`."}],"required":false,"comment":"Optional argument to pass to `expression`.","deprecated":false,"async":false,"alias":"arg"}]},{"kind":"method","langs":{},"name":"getProperties","type":{"name":"Map","templates":[{"name":"string"},{"name":"JSHandle"}],"expression":"[Map]<[string], [JSHandle]>"},"spec":[{"type":"text","text":"The method returns a map with **own property names** as keys and JSHandle instances for the property values."},{"type":"code","lines":["const handle = await page.evaluateHandle(() => ({window, document}));","const properties = await handle.getProperties();","const windowHandle = properties.get('window');","const documentHandle = properties.get('document');","await handle.dispose();"],"codeLang":"js"},{"type":"code","lines":["JSHandle handle = page.evaluateHandle(\"() => ({window, document}\"););","Map<String, JSHandle> properties = handle.getProperties();","JSHandle windowHandle = properties.get(\"window\");","JSHandle documentHandle = properties.get(\"document\");","handle.dispose();"],"codeLang":"java"},{"type":"code","lines":["handle = await page.evaluate_handle(\"{window, document}\")","properties = await handle.get_properties()","window_handle = properties.get(\"window\")","document_handle = properties.get(\"document\")","await handle.dispose()"],"codeLang":"python async"},{"type":"code","lines":["handle = page.evaluate_handle(\"{window, document}\")","properties = handle.get_properties()","window_handle = properties.get(\"window\")","document_handle = properties.get(\"document\")","handle.dispose()"],"codeLang":"python sync"},{"type":"code","lines":["var handle = await page.EvaluateHandleAsync(\"() => ({window, document}\");","var properties = await handle.GetPropertiesAsync();","var windowHandle = properties[\"window\"];","var documentHandle = properties[\"document\"];","await handle.DisposeAsync();"],"codeLang":"csharp"}],"required":true,"comment":"The method returns a map with **own property names** as keys and JSHandle instances for the property values.\n\n```js\nconst handle = await page.evaluateHandle(() => ({window, document}));\nconst properties = await handle.getProperties();\nconst windowHandle = properties.get('window');\nconst documentHandle = properties.get('document');\nawait handle.dispose();\n```\n\n```java\nJSHandle handle = page.evaluateHandle(\"() => ({window, document}\"););\nMap<String, JSHandle> properties = handle.getProperties();\nJSHandle windowHandle = properties.get(\"window\");\nJSHandle documentHandle = properties.get(\"document\");\nhandle.dispose();\n```\n\n```python async\nhandle = await page.evaluate_handle(\"{window, document}\")\nproperties = await handle.get_properties()\nwindow_handle = properties.get(\"window\")\ndocument_handle = properties.get(\"document\")\nawait handle.dispose()\n```\n\n```python sync\nhandle = page.evaluate_handle(\"{window, document}\")\nproperties = handle.get_properties()\nwindow_handle = properties.get(\"window\")\ndocument_handle = properties.get(\"document\")\nhandle.dispose()\n```\n\n```csharp\nvar handle = await page.EvaluateHandleAsync(\"() => ({window, document}\");\nvar properties = await handle.GetPropertiesAsync();\nvar windowHandle = properties[\"window\"];\nvar documentHandle = properties[\"document\"];\nawait handle.DisposeAsync();\n```\n","deprecated":false,"async":true,"alias":"getProperties","args":[]},{"kind":"method","langs":{},"name":"getProperty","type":{"name":"JSHandle","expression":"[JSHandle]"},"spec":[{"type":"text","text":"Fetches a single property from the referenced object."}],"required":true,"comment":"Fetches a single property from the referenced object.","deprecated":false,"async":true,"alias":"getProperty","args":[{"kind":"property","langs":{},"name":"propertyName","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"property to get"}],"required":true,"comment":"property to get","deprecated":false,"async":false,"alias":"propertyName"}]},{"kind":"method","langs":{},"name":"jsonValue","type":{"name":"Serializable","expression":"[Serializable]"},"spec":[{"type":"text","text":"Returns a JSON representation of the object. If the object has a `toJSON` function, it **will not be called**."},{"type":"note","noteType":"note","text":"The method will return an empty JSON object if the referenced object is not stringifiable. It will throw an error if the object has circular references."}],"required":true,"comment":"Returns a JSON representation of the object. If the object has a `toJSON` function, it **will not be called**.\n\n> NOTE: The method will return an empty JSON object if the referenced object is not stringifiable. It will throw an\nerror if the object has circular references.","deprecated":false,"async":true,"alias":"jsonValue","args":[]}]},{"name":"Keyboard","spec":[{"type":"text","text":"Keyboard provides an api for managing a virtual keyboard. The high level api is [`method: Keyboard.type`], which takes raw characters and generates proper keydown, keypress/input, and keyup events on your page."},{"type":"text","text":"For finer control, you can use [`method: Keyboard.down`], [`method: Keyboard.up`], and [`method: Keyboard.insertText`] to manually fire events as if they were generated from a real keyboard."},{"type":"text","text":"An example of holding down `Shift` in order to select and delete some text:"},{"type":"code","lines":["await page.keyboard.type('Hello World!');","await page.keyboard.press('ArrowLeft');","","await page.keyboard.down('Shift');","for (let i = 0; i < ' World'.length; i++)"," await page.keyboard.press('ArrowLeft');","await page.keyboard.up('Shift');","","await page.keyboard.press('Backspace');","// Result text will end up saying 'Hello!'"],"codeLang":"js"},{"type":"code","lines":["page.keyboard().type(\"Hello World!\");","page.keyboard().press(\"ArrowLeft\");","page.keyboard().down(\"Shift\");","for (int i = 0; i < \" World\".length(); i++)"," page.keyboard().press(\"ArrowLeft\");","page.keyboard().up(\"Shift\");","page.keyboard().press(\"Backspace\");","// Result text will end up saying \"Hello!\""],"codeLang":"java"},{"type":"code","lines":["await page.keyboard.type(\"Hello World!\")","await page.keyboard.press(\"ArrowLeft\")","await page.keyboard.down(\"Shift\")","for i in range(6):"," await page.keyboard.press(\"ArrowLeft\")","await page.keyboard.up(\"Shift\")","await page.keyboard.press(\"Backspace\")","# result text will end up saying \"Hello!\""],"codeLang":"python async"},{"type":"code","lines":["page.keyboard.type(\"Hello World!\")","page.keyboard.press(\"ArrowLeft\")","page.keyboard.down(\"Shift\")","for i in range(6):"," page.keyboard.press(\"ArrowLeft\")","page.keyboard.up(\"Shift\")","page.keyboard.press(\"Backspace\")","# result text will end up saying \"Hello!\""],"codeLang":"python sync"},{"type":"code","lines":["await page.Keyboard.TypeAsync(\"Hello World!\");","await page.Keyboard.PressAsync(\"ArrowLeft\");","","await page.Keyboard.DownAsync(\"Shift\");","for (int i = 0; i < \" World\".Length; i++)"," await page.Keyboard.PressAsync(\"ArrowLeft\");","","await page.Keyboard.UpAsync(\"Shift\");","","await page.Keyboard.PressAsync(\"Backspace\");","// Result text will end up saying \"Hello!\""],"codeLang":"csharp"},{"type":"text","text":"An example of pressing uppercase `A`"},{"type":"code","lines":["await page.keyboard.press('Shift+KeyA');","// or","await page.keyboard.press('Shift+A');"],"codeLang":"js"},{"type":"code","lines":["page.keyboard().press(\"Shift+KeyA\");","// or","page.keyboard().press(\"Shift+A\");"],"codeLang":"java"},{"type":"code","lines":["await page.keyboard.press(\"Shift+KeyA\")","# or","await page.keyboard.press(\"Shift+A\")"],"codeLang":"python async"},{"type":"code","lines":["page.keyboard.press(\"Shift+KeyA\")","# or","page.keyboard.press(\"Shift+A\")"],"codeLang":"python sync"},{"type":"code","lines":["await page.Keyboard.PressAsync(\"Shift+KeyA\");","// or ","await page.Keyboard.PressAsync(\"Shift+A\");"],"codeLang":"csharp"},{"type":"text","text":"An example to trigger select-all with the keyboard"},{"type":"code","lines":["// on Windows and Linux","await page.keyboard.press('Control+A');","// on macOS","await page.keyboard.press('Meta+A');"],"codeLang":"js"},{"type":"code","lines":["// on Windows and Linux","page.keyboard().press(\"Control+A\");","// on macOS","page.keyboard().press(\"Meta+A\");"],"codeLang":"java"},{"type":"code","lines":["# on windows and linux","await page.keyboard.press(\"Control+A\")","# on mac_os","await page.keyboard.press(\"Meta+A\")"],"codeLang":"python async"},{"type":"code","lines":["# on windows and linux","page.keyboard.press(\"Control+A\")","# on mac_os","page.keyboard.press(\"Meta+A\")"],"codeLang":"python sync"},{"type":"code","lines":["// on Windows and Linux","await page.Keyboard.PressAsync(\"Control+A\");","// on macOS","await page.Keyboard.PressAsync(\"Meta+A\");"],"codeLang":"csharp"}],"langs":{},"comment":"Keyboard provides an api for managing a virtual keyboard. The high level api is [`method: Keyboard.type`], which takes\nraw characters and generates proper keydown, keypress/input, and keyup events on your page.\n\nFor finer control, you can use [`method: Keyboard.down`], [`method: Keyboard.up`], and [`method: Keyboard.insertText`]\nto manually fire events as if they were generated from a real keyboard.\n\nAn example of holding down `Shift` in order to select and delete some text:\n\n```js\nawait page.keyboard.type('Hello World!');\nawait page.keyboard.press('ArrowLeft');\n\nawait page.keyboard.down('Shift');\nfor (let i = 0; i < ' World'.length; i++)\n await page.keyboard.press('ArrowLeft');\nawait page.keyboard.up('Shift');\n\nawait page.keyboard.press('Backspace');\n// Result text will end up saying 'Hello!'\n```\n\n```java\npage.keyboard().type(\"Hello World!\");\npage.keyboard().press(\"ArrowLeft\");\npage.keyboard().down(\"Shift\");\nfor (int i = 0; i < \" World\".length(); i++)\n page.keyboard().press(\"ArrowLeft\");\npage.keyboard().up(\"Shift\");\npage.keyboard().press(\"Backspace\");\n// Result text will end up saying \"Hello!\"\n```\n\n```python async\nawait page.keyboard.type(\"Hello World!\")\nawait page.keyboard.press(\"ArrowLeft\")\nawait page.keyboard.down(\"Shift\")\nfor i in range(6):\n await page.keyboard.press(\"ArrowLeft\")\nawait page.keyboard.up(\"Shift\")\nawait page.keyboard.press(\"Backspace\")\n# result text will end up saying \"Hello!\"\n```\n\n```python sync\npage.keyboard.type(\"Hello World!\")\npage.keyboard.press(\"ArrowLeft\")\npage.keyboard.down(\"Shift\")\nfor i in range(6):\n page.keyboard.press(\"ArrowLeft\")\npage.keyboard.up(\"Shift\")\npage.keyboard.press(\"Backspace\")\n# result text will end up saying \"Hello!\"\n```\n\n```csharp\nawait page.Keyboard.TypeAsync(\"Hello World!\");\nawait page.Keyboard.PressAsync(\"ArrowLeft\");\n\nawait page.Keyboard.DownAsync(\"Shift\");\nfor (int i = 0; i < \" World\".Length; i++)\n await page.Keyboard.PressAsync(\"ArrowLeft\");\n\nawait page.Keyboard.UpAsync(\"Shift\");\n\nawait page.Keyboard.PressAsync(\"Backspace\");\n// Result text will end up saying \"Hello!\"\n```\n\nAn example of pressing uppercase `A`\n\n```js\nawait page.keyboard.press('Shift+KeyA');\n// or\nawait page.keyboard.press('Shift+A');\n```\n\n```java\npage.keyboard().press(\"Shift+KeyA\");\n// or\npage.keyboard().press(\"Shift+A\");\n```\n\n```python async\nawait page.keyboard.press(\"Shift+KeyA\")\n# or\nawait page.keyboard.press(\"Shift+A\")\n```\n\n```python sync\npage.keyboard.press(\"Shift+KeyA\")\n# or\npage.keyboard.press(\"Shift+A\")\n```\n\n```csharp\nawait page.Keyboard.PressAsync(\"Shift+KeyA\");\n// or \nawait page.Keyboard.PressAsync(\"Shift+A\");\n```\n\nAn example to trigger select-all with the keyboard\n\n```js\n// on Windows and Linux\nawait page.keyboard.press('Control+A');\n// on macOS\nawait page.keyboard.press('Meta+A');\n```\n\n```java\n// on Windows and Linux\npage.keyboard().press(\"Control+A\");\n// on macOS\npage.keyboard().press(\"Meta+A\");\n```\n\n```python async\n# on windows and linux\nawait page.keyboard.press(\"Control+A\")\n# on mac_os\nawait page.keyboard.press(\"Meta+A\")\n```\n\n```python sync\n# on windows and linux\npage.keyboard.press(\"Control+A\")\n# on mac_os\npage.keyboard.press(\"Meta+A\")\n```\n\n```csharp\n// on Windows and Linux\nawait page.Keyboard.PressAsync(\"Control+A\");\n// on macOS\nawait page.Keyboard.PressAsync(\"Meta+A\");\n```\n","members":[{"kind":"method","langs":{},"name":"down","type":{"name":"void"},"spec":[{"type":"text","text":"Dispatches a `keydown` event."},{"type":"text","text":"`key` can specify the intended [keyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key) value or a single character to generate the text for. A superset of the `key` values can be found [here](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values). Examples of the keys are:"},{"type":"text","text":"`F1` - `F12`, `Digit0`- `Digit9`, `KeyA`- `KeyZ`, `Backquote`, `Minus`, `Equal`, `Backslash`, `Backspace`, `Tab`, `Delete`, `Escape`, `ArrowDown`, `End`, `Enter`, `Home`, `Insert`, `PageDown`, `PageUp`, `ArrowRight`, `ArrowUp`, etc."},{"type":"text","text":"Following modification shortcuts are also supported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`."},{"type":"text","text":"Holding down `Shift` will type the text that corresponds to the `key` in the upper case."},{"type":"text","text":"If `key` is a single character, it is case-sensitive, so the values `a` and `A` will generate different respective texts."},{"type":"text","text":"If `key` is a modifier key, `Shift`, `Meta`, `Control`, or `Alt`, subsequent key presses will be sent with that modifier active. To release the modifier key, use [`method: Keyboard.up`]."},{"type":"text","text":"After the key is pressed once, subsequent calls to [`method: Keyboard.down`] will have [repeat](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/repeat) set to true. To release the key, use [`method: Keyboard.up`]."},{"type":"note","noteType":"note","text":"Modifier keys DO influence `keyboard.down`. Holding down `Shift` will type the text in upper case."}],"required":true,"comment":"Dispatches a `keydown` event.\n\n`key` can specify the intended [keyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key)\nvalue or a single character to generate the text for. A superset of the `key` values can be found\n[here](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values). Examples of the keys are:\n\n`F1` - `F12`, `Digit0`- `Digit9`, `KeyA`- `KeyZ`, `Backquote`, `Minus`, `Equal`, `Backslash`, `Backspace`, `Tab`,\n`Delete`, `Escape`, `ArrowDown`, `End`, `Enter`, `Home`, `Insert`, `PageDown`, `PageUp`, `ArrowRight`, `ArrowUp`, etc.\n\nFollowing modification shortcuts are also supported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`.\n\nHolding down `Shift` will type the text that corresponds to the `key` in the upper case.\n\nIf `key` is a single character, it is case-sensitive, so the values `a` and `A` will generate different respective\ntexts.\n\nIf `key` is a modifier key, `Shift`, `Meta`, `Control`, or `Alt`, subsequent key presses will be sent with that modifier\nactive. To release the modifier key, use [`method: Keyboard.up`].\n\nAfter the key is pressed once, subsequent calls to [`method: Keyboard.down`] will have\n[repeat](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/repeat) set to true. To release the key, use\n[`method: Keyboard.up`].\n\n> NOTE: Modifier keys DO influence `keyboard.down`. Holding down `Shift` will type the text in upper case.","deprecated":false,"async":true,"alias":"down","args":[{"kind":"property","langs":{},"name":"key","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Name of the key to press or a character to generate, such as `ArrowLeft` or `a`."}],"required":true,"comment":"Name of the key to press or a character to generate, such as `ArrowLeft` or `a`.","deprecated":false,"async":false,"alias":"key"}]},{"kind":"method","langs":{},"name":"insertText","type":{"name":"void"},"spec":[{"type":"text","text":"Dispatches only `input` event, does not emit the `keydown`, `keyup` or `keypress` events."},{"type":"code","lines":["page.keyboard.insertText('嗨');"],"codeLang":"js"},{"type":"code","lines":["page.keyboard().insertText(\"嗨\");"],"codeLang":"java"},{"type":"code","lines":["await page.keyboard.insert_text(\"嗨\")"],"codeLang":"python async"},{"type":"code","lines":["page.keyboard.insert_text(\"嗨\")"],"codeLang":"python sync"},{"type":"code","lines":["await page.Keyboard.PressAsync(\"嗨\");"],"codeLang":"csharp"},{"type":"note","noteType":"note","text":"Modifier keys DO NOT effect `keyboard.insertText`. Holding down `Shift` will not type the text in upper case."}],"required":true,"comment":"Dispatches only `input` event, does not emit the `keydown`, `keyup` or `keypress` events.\n\n```js\npage.keyboard.insertText('嗨');\n```\n\n```java\npage.keyboard().insertText(\"嗨\");\n```\n\n```python async\nawait page.keyboard.insert_text(\"嗨\")\n```\n\n```python sync\npage.keyboard.insert_text(\"嗨\")\n```\n\n```csharp\nawait page.Keyboard.PressAsync(\"嗨\");\n```\n\n> NOTE: Modifier keys DO NOT effect `keyboard.insertText`. Holding down `Shift` will not type the text in upper case.","deprecated":false,"async":true,"alias":"insertText","args":[{"kind":"property","langs":{},"name":"text","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Sets input to the specified text value."}],"required":true,"comment":"Sets input to the specified text value.","deprecated":false,"async":false,"alias":"text"}]},{"kind":"method","langs":{},"name":"press","type":{"name":"void"},"spec":[{"type":"text","text":"`key` can specify the intended [keyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key) value or a single character to generate the text for. A superset of the `key` values can be found [here](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values). Examples of the keys are:"},{"type":"text","text":"`F1` - `F12`, `Digit0`- `Digit9`, `KeyA`- `KeyZ`, `Backquote`, `Minus`, `Equal`, `Backslash`, `Backspace`, `Tab`, `Delete`, `Escape`, `ArrowDown`, `End`, `Enter`, `Home`, `Insert`, `PageDown`, `PageUp`, `ArrowRight`, `ArrowUp`, etc."},{"type":"text","text":"Following modification shortcuts are also supported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`."},{"type":"text","text":"Holding down `Shift` will type the text that corresponds to the `key` in the upper case."},{"type":"text","text":"If `key` is a single character, it is case-sensitive, so the values `a` and `A` will generate different respective texts."},{"type":"text","text":"Shortcuts such as `key: \"Control+o\"` or `key: \"Control+Shift+T\"` are supported as well. When specified with the modifier, modifier is pressed and being held while the subsequent key is being pressed."},{"type":"code","lines":["const page = await browser.newPage();","await page.goto('https://keycode.info');","await page.keyboard.press('A');","await page.screenshot({ path: 'A.png' });","await page.keyboard.press('ArrowLeft');","await page.screenshot({ path: 'ArrowLeft.png' });","await page.keyboard.press('Shift+O');","await page.screenshot({ path: 'O.png' });","await browser.close();"],"codeLang":"js"},{"type":"code","lines":["Page page = browser.newPage();","page.navigate(\"https://keycode.info\");","page.keyboard().press(\"A\");","page.screenshot(new Page.ScreenshotOptions().setPath(Paths.get(\"A.png\"));","page.keyboard().press(\"ArrowLeft\");","page.screenshot(new Page.ScreenshotOptions().setPath(Paths.get(\"ArrowLeft.png\")));","page.keyboard().press(\"Shift+O\");","page.screenshot(new Page.ScreenshotOptions().setPath(Paths.get(\"O.png\")));","browser.close();"],"codeLang":"java"},{"type":"code","lines":["page = await browser.new_page()","await page.goto(\"https://keycode.info\")","await page.keyboard.press(\"a\")","await page.screenshot(path=\"a.png\")","await page.keyboard.press(\"ArrowLeft\")","await page.screenshot(path=\"arrow_left.png\")","await page.keyboard.press(\"Shift+O\")","await page.screenshot(path=\"o.png\")","await browser.close()"],"codeLang":"python async"},{"type":"code","lines":["page = browser.new_page()","page.goto(\"https://keycode.info\")","page.keyboard.press(\"a\")","page.screenshot(path=\"a.png\")","page.keyboard.press(\"ArrowLeft\")","page.screenshot(path=\"arrow_left.png\")","page.keyboard.press(\"Shift+O\")","page.screenshot(path=\"o.png\")","browser.close()"],"codeLang":"python sync"},{"type":"code","lines":["await page.GotoAsync(\"https://keycode.info\");","await page.Keyboard.PressAsync(\"A\");","await page.ScreenshotAsync(new PageScreenshotOptions { Path = \"A.png\" });","await page.Keyboard.PressAsync(\"ArrowLeft\");","await page.ScreenshotAsync(new PageScreenshotOptions { Path = \"ArrowLeft.png\" });","await page.Keyboard.PressAsync(\"Shift+O\");","await page.ScreenshotAsync(new PageScreenshotOptions { Path = \"O.png\" });","await browser.CloseAsync();"],"codeLang":"csharp"},{"type":"text","text":"Shortcut for [`method: Keyboard.down`] and [`method: Keyboard.up`]."}],"required":true,"comment":"`key` can specify the intended [keyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key)\nvalue or a single character to generate the text for. A superset of the `key` values can be found\n[here](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values). Examples of the keys are:\n\n`F1` - `F12`, `Digit0`- `Digit9`, `KeyA`- `KeyZ`, `Backquote`, `Minus`, `Equal`, `Backslash`, `Backspace`, `Tab`,\n`Delete`, `Escape`, `ArrowDown`, `End`, `Enter`, `Home`, `Insert`, `PageDown`, `PageUp`, `ArrowRight`, `ArrowUp`, etc.\n\nFollowing modification shortcuts are also supported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`.\n\nHolding down `Shift` will type the text that corresponds to the `key` in the upper case.\n\nIf `key` is a single character, it is case-sensitive, so the values `a` and `A` will generate different respective\ntexts.\n\nShortcuts such as `key: \"Control+o\"` or `key: \"Control+Shift+T\"` are supported as well. When specified with the\nmodifier, modifier is pressed and being held while the subsequent key is being pressed.\n\n```js\nconst page = await browser.newPage();\nawait page.goto('https://keycode.info');\nawait page.keyboard.press('A');\nawait page.screenshot({ path: 'A.png' });\nawait page.keyboard.press('ArrowLeft');\nawait page.screenshot({ path: 'ArrowLeft.png' });\nawait page.keyboard.press('Shift+O');\nawait page.screenshot({ path: 'O.png' });\nawait browser.close();\n```\n\n```java\nPage page = browser.newPage();\npage.navigate(\"https://keycode.info\");\npage.keyboard().press(\"A\");\npage.screenshot(new Page.ScreenshotOptions().setPath(Paths.get(\"A.png\"));\npage.keyboard().press(\"ArrowLeft\");\npage.screenshot(new Page.ScreenshotOptions().setPath(Paths.get(\"ArrowLeft.png\")));\npage.keyboard().press(\"Shift+O\");\npage.screenshot(new Page.ScreenshotOptions().setPath(Paths.get(\"O.png\")));\nbrowser.close();\n```\n\n```python async\npage = await browser.new_page()\nawait page.goto(\"https://keycode.info\")\nawait page.keyboard.press(\"a\")\nawait page.screenshot(path=\"a.png\")\nawait page.keyboard.press(\"ArrowLeft\")\nawait page.screenshot(path=\"arrow_left.png\")\nawait page.keyboard.press(\"Shift+O\")\nawait page.screenshot(path=\"o.png\")\nawait browser.close()\n```\n\n```python sync\npage = browser.new_page()\npage.goto(\"https://keycode.info\")\npage.keyboard.press(\"a\")\npage.screenshot(path=\"a.png\")\npage.keyboard.press(\"ArrowLeft\")\npage.screenshot(path=\"arrow_left.png\")\npage.keyboard.press(\"Shift+O\")\npage.screenshot(path=\"o.png\")\nbrowser.close()\n```\n\n```csharp\nawait page.GotoAsync(\"https://keycode.info\");\nawait page.Keyboard.PressAsync(\"A\");\nawait page.ScreenshotAsync(new PageScreenshotOptions { Path = \"A.png\" });\nawait page.Keyboard.PressAsync(\"ArrowLeft\");\nawait page.ScreenshotAsync(new PageScreenshotOptions { Path = \"ArrowLeft.png\" });\nawait page.Keyboard.PressAsync(\"Shift+O\");\nawait page.ScreenshotAsync(new PageScreenshotOptions { Path = \"O.png\" });\nawait browser.CloseAsync();\n```\n\nShortcut for [`method: Keyboard.down`] and [`method: Keyboard.up`].","deprecated":false,"async":true,"alias":"press","args":[{"kind":"property","langs":{},"name":"key","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Name of the key to press or a character to generate, such as `ArrowLeft` or `a`."}],"required":true,"comment":"Name of the key to press or a character to generate, such as `ArrowLeft` or `a`.","deprecated":false,"async":false,"alias":"key"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"delay","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Time to wait between `keydown` and `keyup` in milliseconds. Defaults to 0."}],"required":false,"comment":"Time to wait between `keydown` and `keyup` in milliseconds. Defaults to 0.","deprecated":false,"async":false,"alias":"delay"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"type","type":{"name":"void"},"spec":[{"type":"text","text":"Sends a `keydown`, `keypress`/`input`, and `keyup` event for each character in the text."},{"type":"text","text":"To press a special key, like `Control` or `ArrowDown`, use [`method: Keyboard.press`]."},{"type":"code","lines":["await page.keyboard.type('Hello'); // Types instantly","await page.keyboard.type('World', {delay: 100}); // Types slower, like a user"],"codeLang":"js"},{"type":"code","lines":["// Types instantly","page.keyboard().type(\"Hello\");","// Types slower, like a user","page.keyboard().type(\"World\", new Keyboard.TypeOptions().setDelay(100));"],"codeLang":"java"},{"type":"code","lines":["await page.keyboard.type(\"Hello\") # types instantly","await page.keyboard.type(\"World\", delay=100) # types slower, like a user"],"codeLang":"python async"},{"type":"code","lines":["page.keyboard.type(\"Hello\") # types instantly","page.keyboard.type(\"World\", delay=100) # types slower, like a user"],"codeLang":"python sync"},{"type":"code","lines":["await page.Keyboard.TypeAsync(\"Hello\"); // types instantly","await page.Keyboard.TypeAsync(\"World\"); // types slower, like a user"],"codeLang":"csharp"},{"type":"note","noteType":"note","text":"Modifier keys DO NOT effect `keyboard.type`. Holding down `Shift` will not type the text in upper case."},{"type":"note","noteType":"note","text":"For characters that are not on a US keyboard, only an `input` event will be sent."}],"required":true,"comment":"Sends a `keydown`, `keypress`/`input`, and `keyup` event for each character in the text.\n\nTo press a special key, like `Control` or `ArrowDown`, use [`method: Keyboard.press`].\n\n```js\nawait page.keyboard.type('Hello'); // Types instantly\nawait page.keyboard.type('World', {delay: 100}); // Types slower, like a user\n```\n\n```java\n// Types instantly\npage.keyboard().type(\"Hello\");\n// Types slower, like a user\npage.keyboard().type(\"World\", new Keyboard.TypeOptions().setDelay(100));\n```\n\n```python async\nawait page.keyboard.type(\"Hello\") # types instantly\nawait page.keyboard.type(\"World\", delay=100) # types slower, like a user\n```\n\n```python sync\npage.keyboard.type(\"Hello\") # types instantly\npage.keyboard.type(\"World\", delay=100) # types slower, like a user\n```\n\n```csharp\nawait page.Keyboard.TypeAsync(\"Hello\"); // types instantly\nawait page.Keyboard.TypeAsync(\"World\"); // types slower, like a user\n```\n\n> NOTE: Modifier keys DO NOT effect `keyboard.type`. Holding down `Shift` will not type the text in upper case.\n> NOTE: For characters that are not on a US keyboard, only an `input` event will be sent.","deprecated":false,"async":true,"alias":"type","args":[{"kind":"property","langs":{},"name":"text","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A text to type into a focused element."}],"required":true,"comment":"A text to type into a focused element.","deprecated":false,"async":false,"alias":"text"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"delay","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Time to wait between key presses in milliseconds. Defaults to 0."}],"required":false,"comment":"Time to wait between key presses in milliseconds. Defaults to 0.","deprecated":false,"async":false,"alias":"delay"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"up","type":{"name":"void"},"spec":[{"type":"text","text":"Dispatches a `keyup` event."}],"required":true,"comment":"Dispatches a `keyup` event.","deprecated":false,"async":true,"alias":"up","args":[{"kind":"property","langs":{},"name":"key","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Name of the key to press or a character to generate, such as `ArrowLeft` or `a`."}],"required":true,"comment":"Name of the key to press or a character to generate, such as `ArrowLeft` or `a`.","deprecated":false,"async":false,"alias":"key"}]}]},{"name":"Logger","spec":[{"type":"text","text":"Playwright generates a lot of logs and they are accessible via the pluggable logger sink."},{"type":"code","lines":["const { chromium } = require('playwright'); // Or 'firefox' or 'webkit'.","","(async () => {"," const browser = await chromium.launch({"," logger: {"," isEnabled: (name, severity) => name === 'browser',"," log: (name, severity, message, args) => console.log(`${name} ${message}`)"," }"," });"," ...","})();"],"codeLang":"js"}],"langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"comment":"Playwright generates a lot of logs and they are accessible via the pluggable logger sink.\n\n```js\nconst { chromium } = require('playwright'); // Or 'firefox' or 'webkit'.\n\n(async () => {\n const browser = await chromium.launch({\n logger: {\n isEnabled: (name, severity) => name === 'browser',\n log: (name, severity, message, args) => console.log(`${name} ${message}`)\n }\n });\n ...\n})();\n```\n","members":[{"kind":"method","langs":{},"name":"isEnabled","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Determines whether sink is interested in the logger with the given name and severity."}],"required":true,"comment":"Determines whether sink is interested in the logger with the given name and severity.","deprecated":false,"async":false,"alias":"isEnabled","args":[{"kind":"property","langs":{},"name":"name","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"logger name"}],"required":true,"comment":"logger name","deprecated":false,"async":false,"alias":"name"},{"kind":"property","langs":{},"name":"severity","type":{"name":"","union":[{"name":"\"verbose\""},{"name":"\"info\""},{"name":"\"warning\""},{"name":"\"error\""}],"expression":"\"verbose\"|\"info\"|\"warning\"|\"error\""},"spec":[],"required":true,"comment":"","deprecated":false,"async":false,"alias":"severity"}]},{"kind":"method","langs":{},"name":"log","type":{"name":"void"},"spec":[],"required":true,"comment":"","deprecated":false,"async":false,"alias":"log","args":[{"kind":"property","langs":{},"name":"name","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"logger name"}],"required":true,"comment":"logger name","deprecated":false,"async":false,"alias":"name"},{"kind":"property","langs":{},"name":"severity","type":{"name":"","union":[{"name":"\"verbose\""},{"name":"\"info\""},{"name":"\"warning\""},{"name":"\"error\""}],"expression":"\"verbose\"|\"info\"|\"warning\"|\"error\""},"spec":[],"required":true,"comment":"","deprecated":false,"async":false,"alias":"severity"},{"kind":"property","langs":{},"name":"message","type":{"name":"","union":[{"name":"string"},{"name":"Error"}],"expression":"[string]|[Error]"},"spec":[{"type":"text","text":"log message format"}],"required":true,"comment":"log message format","deprecated":false,"async":false,"alias":"message"},{"kind":"property","langs":{},"name":"args","type":{"name":"Array","templates":[{"name":"Object"}],"expression":"[Array]<[Object]>"},"spec":[{"type":"text","text":"message arguments"}],"required":true,"comment":"message arguments","deprecated":false,"async":false,"alias":"args"},{"kind":"property","langs":{},"name":"hints","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"color","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Optional preferred logger color."}],"required":false,"comment":"Optional preferred logger color.","deprecated":false,"async":false,"alias":"color"}],"expression":"[Object]"},"spec":[{"type":"text","text":"optional formatting hints"}],"required":true,"comment":"optional formatting hints","deprecated":false,"async":false,"alias":"hints"}]}]},{"name":"Mouse","spec":[{"type":"text","text":"The Mouse class operates in main-frame CSS pixels relative to the top-left corner of the viewport."},{"type":"text","text":"Every `page` object has its own Mouse, accessible with [`property: Page.mouse`]."},{"type":"code","lines":["// Using ‘page.mouse’ to trace a 100x100 square.","await page.mouse.move(0, 0);","await page.mouse.down();","await page.mouse.move(0, 100);","await page.mouse.move(100, 100);","await page.mouse.move(100, 0);","await page.mouse.move(0, 0);","await page.mouse.up();"],"codeLang":"js"},{"type":"code","lines":["// Using ‘page.mouse’ to trace a 100x100 square.","page.mouse().move(0, 0);","page.mouse().down();","page.mouse().move(0, 100);","page.mouse().move(100, 100);","page.mouse().move(100, 0);","page.mouse().move(0, 0);","page.mouse().up();"],"codeLang":"java"},{"type":"code","lines":["# using ‘page.mouse’ to trace a 100x100 square.","await page.mouse.move(0, 0)","await page.mouse.down()","await page.mouse.move(0, 100)","await page.mouse.move(100, 100)","await page.mouse.move(100, 0)","await page.mouse.move(0, 0)","await page.mouse.up()"],"codeLang":"python async"},{"type":"code","lines":["# using ‘page.mouse’ to trace a 100x100 square.","page.mouse.move(0, 0)","page.mouse.down()","page.mouse.move(0, 100)","page.mouse.move(100, 100)","page.mouse.move(100, 0)","page.mouse.move(0, 0)","page.mouse.up()"],"codeLang":"python sync"},{"type":"code","lines":["await Page.Mouse.MoveAsync(0, 0);","await Page.Mouse.DownAsync();","await Page.Mouse.MoveAsync(0, 100);","await Page.Mouse.MoveAsync(100, 100);","await Page.Mouse.MoveAsync(100, 0);","await Page.Mouse.MoveAsync(0, 0);","await Page.Mouse.UpAsync();"],"codeLang":"csharp"}],"langs":{},"comment":"The Mouse class operates in main-frame CSS pixels relative to the top-left corner of the viewport.\n\nEvery `page` object has its own Mouse, accessible with [`property: Page.mouse`].\n\n```js\n// Using ‘page.mouse’ to trace a 100x100 square.\nawait page.mouse.move(0, 0);\nawait page.mouse.down();\nawait page.mouse.move(0, 100);\nawait page.mouse.move(100, 100);\nawait page.mouse.move(100, 0);\nawait page.mouse.move(0, 0);\nawait page.mouse.up();\n```\n\n```java\n// Using ‘page.mouse’ to trace a 100x100 square.\npage.mouse().move(0, 0);\npage.mouse().down();\npage.mouse().move(0, 100);\npage.mouse().move(100, 100);\npage.mouse().move(100, 0);\npage.mouse().move(0, 0);\npage.mouse().up();\n```\n\n```python async\n# using ‘page.mouse’ to trace a 100x100 square.\nawait page.mouse.move(0, 0)\nawait page.mouse.down()\nawait page.mouse.move(0, 100)\nawait page.mouse.move(100, 100)\nawait page.mouse.move(100, 0)\nawait page.mouse.move(0, 0)\nawait page.mouse.up()\n```\n\n```python sync\n# using ‘page.mouse’ to trace a 100x100 square.\npage.mouse.move(0, 0)\npage.mouse.down()\npage.mouse.move(0, 100)\npage.mouse.move(100, 100)\npage.mouse.move(100, 0)\npage.mouse.move(0, 0)\npage.mouse.up()\n```\n\n```csharp\nawait Page.Mouse.MoveAsync(0, 0);\nawait Page.Mouse.DownAsync();\nawait Page.Mouse.MoveAsync(0, 100);\nawait Page.Mouse.MoveAsync(100, 100);\nawait Page.Mouse.MoveAsync(100, 0);\nawait Page.Mouse.MoveAsync(0, 0);\nawait Page.Mouse.UpAsync();\n```\n","members":[{"kind":"method","langs":{},"name":"click","type":{"name":"void"},"spec":[{"type":"text","text":"Shortcut for [`method: Mouse.move`], [`method: Mouse.down`], [`method: Mouse.up`]."}],"required":true,"comment":"Shortcut for [`method: Mouse.move`], [`method: Mouse.down`], [`method: Mouse.up`].","deprecated":false,"async":true,"alias":"click","args":[{"kind":"property","langs":{},"name":"x","type":{"name":"float","expression":"[float]"},"spec":[],"required":true,"comment":"","deprecated":false,"async":false,"alias":"x"},{"kind":"property","langs":{},"name":"y","type":{"name":"float","expression":"[float]"},"spec":[],"required":true,"comment":"","deprecated":false,"async":false,"alias":"y"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"button","type":{"name":"MouseButton","union":[{"name":"\"left\""},{"name":"\"right\""},{"name":"\"middle\""}],"expression":"[MouseButton]<\"left\"|\"right\"|\"middle\">"},"spec":[{"type":"text","text":"Defaults to `left`."}],"required":false,"comment":"Defaults to `left`.","deprecated":false,"async":false,"alias":"button"},{"kind":"property","langs":{},"name":"clickCount","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"defaults to 1. See [UIEvent.detail]."}],"required":false,"comment":"defaults to 1. See [UIEvent.detail].","deprecated":false,"async":false,"alias":"clickCount"},{"kind":"property","langs":{},"name":"delay","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0."}],"required":false,"comment":"Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0.","deprecated":false,"async":false,"alias":"delay"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{"aliases":{"csharp":"DblClickAsync"},"types":{},"overrides":{}},"name":"dblclick","type":{"name":"void"},"spec":[{"type":"text","text":"Shortcut for [`method: Mouse.move`], [`method: Mouse.down`], [`method: Mouse.up`], [`method: Mouse.down`] and [`method: Mouse.up`]."}],"required":true,"comment":"Shortcut for [`method: Mouse.move`], [`method: Mouse.down`], [`method: Mouse.up`], [`method: Mouse.down`] and\n[`method: Mouse.up`].","deprecated":false,"async":true,"alias":"dblclick","args":[{"kind":"property","langs":{},"name":"x","type":{"name":"float","expression":"[float]"},"spec":[],"required":true,"comment":"","deprecated":false,"async":false,"alias":"x"},{"kind":"property","langs":{},"name":"y","type":{"name":"float","expression":"[float]"},"spec":[],"required":true,"comment":"","deprecated":false,"async":false,"alias":"y"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"button","type":{"name":"MouseButton","union":[{"name":"\"left\""},{"name":"\"right\""},{"name":"\"middle\""}],"expression":"[MouseButton]<\"left\"|\"right\"|\"middle\">"},"spec":[{"type":"text","text":"Defaults to `left`."}],"required":false,"comment":"Defaults to `left`.","deprecated":false,"async":false,"alias":"button"},{"kind":"property","langs":{},"name":"delay","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0."}],"required":false,"comment":"Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0.","deprecated":false,"async":false,"alias":"delay"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"down","type":{"name":"void"},"spec":[{"type":"text","text":"Dispatches a `mousedown` event."}],"required":true,"comment":"Dispatches a `mousedown` event.","deprecated":false,"async":true,"alias":"down","args":[{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"button","type":{"name":"MouseButton","union":[{"name":"\"left\""},{"name":"\"right\""},{"name":"\"middle\""}],"expression":"[MouseButton]<\"left\"|\"right\"|\"middle\">"},"spec":[{"type":"text","text":"Defaults to `left`."}],"required":false,"comment":"Defaults to `left`.","deprecated":false,"async":false,"alias":"button"},{"kind":"property","langs":{},"name":"clickCount","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"defaults to 1. See [UIEvent.detail]."}],"required":false,"comment":"defaults to 1. See [UIEvent.detail].","deprecated":false,"async":false,"alias":"clickCount"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"move","type":{"name":"void"},"spec":[{"type":"text","text":"Dispatches a `mousemove` event."}],"required":true,"comment":"Dispatches a `mousemove` event.","deprecated":false,"async":true,"alias":"move","args":[{"kind":"property","langs":{},"name":"x","type":{"name":"float","expression":"[float]"},"spec":[],"required":true,"comment":"","deprecated":false,"async":false,"alias":"x"},{"kind":"property","langs":{},"name":"y","type":{"name":"float","expression":"[float]"},"spec":[],"required":true,"comment":"","deprecated":false,"async":false,"alias":"y"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"steps","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"defaults to 1. Sends intermediate `mousemove` events."}],"required":false,"comment":"defaults to 1. Sends intermediate `mousemove` events.","deprecated":false,"async":false,"alias":"steps"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"up","type":{"name":"void"},"spec":[{"type":"text","text":"Dispatches a `mouseup` event."}],"required":true,"comment":"Dispatches a `mouseup` event.","deprecated":false,"async":true,"alias":"up","args":[{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"button","type":{"name":"MouseButton","union":[{"name":"\"left\""},{"name":"\"right\""},{"name":"\"middle\""}],"expression":"[MouseButton]<\"left\"|\"right\"|\"middle\">"},"spec":[{"type":"text","text":"Defaults to `left`."}],"required":false,"comment":"Defaults to `left`.","deprecated":false,"async":false,"alias":"button"},{"kind":"property","langs":{},"name":"clickCount","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"defaults to 1. See [UIEvent.detail]."}],"required":false,"comment":"defaults to 1. See [UIEvent.detail].","deprecated":false,"async":false,"alias":"clickCount"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]}]},{"name":"Page","spec":[{"type":"li","text":"extends: [EventEmitter]","liType":"bullet"},{"type":"text","text":"Page provides methods to interact with a single tab in a `Browser`, or an [extension background page](https://developer.chrome.com/extensions/background_pages) in Chromium. One `Browser` instance might have multiple `Page` instances."},{"type":"text","text":"This example creates a page, navigates it to a URL, and then saves a screenshot:"},{"type":"code","lines":["const { webkit } = require('playwright'); // Or 'chromium' or 'firefox'.","","(async () => {"," const browser = await webkit.launch();"," const context = await browser.newContext();"," const page = await context.newPage();"," await page.goto('https://example.com');"," await page.screenshot({path: 'screenshot.png'});"," await browser.close();","})();"],"codeLang":"js"},{"type":"code","lines":["import com.microsoft.playwright.*;","","public class Example {"," public static void main(String[] args) {"," try (Playwright playwright = Playwright.create()) {"," BrowserType webkit = playwright.webkit();"," Browser browser = webkit.launch();"," BrowserContext context = browser.newContext();"," Page page = context.newPage();"," page.navigate(\"https://example.com\");"," page.screenshot(new Page.ScreenshotOptions().setPath(Paths.get(\"screenshot.png\")));"," browser.close();"," }"," }","}"],"codeLang":"java"},{"type":"code","lines":["import asyncio","from playwright.async_api import async_playwright","","async def run(playwright):"," webkit = playwright.webkit"," browser = await webkit.launch()"," context = await browser.new_context()"," page = await context.new_page()"," await page.goto(\"https://example.com\")"," await page.screenshot(path=\"screenshot.png\")"," await browser.close()","","async def main():"," async with async_playwright() as playwright:"," await run(playwright)","asyncio.run(main())"],"codeLang":"python async"},{"type":"code","lines":["from playwright.sync_api import sync_playwright","","def run(playwright):"," webkit = playwright.webkit"," browser = webkit.launch()"," context = browser.new_context()"," page = context.new_page()"," page.goto(\"https://example.com\")"," page.screenshot(path=\"screenshot.png\")"," browser.close()","","with sync_playwright() as playwright:"," run(playwright)"],"codeLang":"python sync"},{"type":"code","lines":["using Microsoft.Playwright;","using System.Threading.Tasks;","","class PageExamples","{"," public static async Task Run()"," {"," using var playwright = await Playwright.CreateAsync();"," await using var browser = await playwright.Webkit.LaunchAsync();"," var page = await browser.NewPageAsync();"," await page.GotoAsync(\"https://www.theverge.com\");"," await page.ScreenshotAsync(new PageScreenshotOptions { Path = \"theverge.png\" });"," }","}"],"codeLang":"csharp"},{"type":"text","text":"The Page class emits various events (described below) which can be handled using any of Node's native [`EventEmitter`](https://nodejs.org/api/events.html#events_class_eventemitter) methods, such as `on`, `once` or `removeListener`."},{"type":"text","text":"This example logs a message for a single page `load` event:"},{"type":"code","lines":["page.once('load', () => console.log('Page loaded!'));"],"codeLang":"js"},{"type":"code","lines":["page.onLoad(p -> System.out.println(\"Page loaded!\"));"],"codeLang":"java"},{"type":"code","lines":["page.once(\"load\", lambda: print(\"page loaded!\"))"],"codeLang":"py"},{"type":"code","lines":["page.Load += (_, _) => Console.WriteLine(\"Page loaded!\");"],"codeLang":"csharp"},{"type":"text","text":"To unsubscribe from events use the `removeListener` method:"},{"type":"code","lines":["function logRequest(interceptedRequest) {"," console.log('A request was made:', interceptedRequest.url());","}","page.on('request', logRequest);","// Sometime later...","page.removeListener('request', logRequest);"],"codeLang":"js"},{"type":"code","lines":["Consumer<Request> logRequest = interceptedRequest -> {"," System.out.println(\"A request was made: \" + interceptedRequest.url());","};","page.onRequest(logRequest);","// Sometime later...","page.offRequest(logRequest);"],"codeLang":"java"},{"type":"code","lines":["def log_request(intercepted_request):"," print(\"a request was made:\", intercepted_request.url)","page.on(\"request\", log_request)","# sometime later...","page.remove_listener(\"request\", log_request)"],"codeLang":"py"},{"type":"code","lines":["void PageLoadHandler(object _, IPage p) {"," Console.WriteLine(\"Page loaded!\");","};","","page.Load += PageLoadHandler;","// Do some work...","page.Load -= PageLoadHandler;"],"codeLang":"csharp"}],"extends":"EventEmitter","langs":{},"comment":"- extends: [EventEmitter]\n\nPage provides methods to interact with a single tab in a `Browser`, or an\n[extension background page](https://developer.chrome.com/extensions/background_pages) in Chromium. One `Browser`\ninstance might have multiple `Page` instances.\n\nThis example creates a page, navigates it to a URL, and then saves a screenshot:\n\n```js\nconst { webkit } = require('playwright'); // Or 'chromium' or 'firefox'.\n\n(async () => {\n const browser = await webkit.launch();\n const context = await browser.newContext();\n const page = await context.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'screenshot.png'});\n await browser.close();\n})();\n```\n\n```java\nimport com.microsoft.playwright.*;\n\npublic class Example {\n public static void main(String[] args) {\n try (Playwright playwright = Playwright.create()) {\n BrowserType webkit = playwright.webkit();\n Browser browser = webkit.launch();\n BrowserContext context = browser.newContext();\n Page page = context.newPage();\n page.navigate(\"https://example.com\");\n page.screenshot(new Page.ScreenshotOptions().setPath(Paths.get(\"screenshot.png\")));\n browser.close();\n }\n }\n}\n```\n\n```python async\nimport asyncio\nfrom playwright.async_api import async_playwright\n\nasync def run(playwright):\n webkit = playwright.webkit\n browser = await webkit.launch()\n context = await browser.new_context()\n page = await context.new_page()\n await page.goto(\"https://example.com\")\n await page.screenshot(path=\"screenshot.png\")\n await browser.close()\n\nasync def main():\n async with async_playwright() as playwright:\n await run(playwright)\nasyncio.run(main())\n```\n\n```python sync\nfrom playwright.sync_api import sync_playwright\n\ndef run(playwright):\n webkit = playwright.webkit\n browser = webkit.launch()\n context = browser.new_context()\n page = context.new_page()\n page.goto(\"https://example.com\")\n page.screenshot(path=\"screenshot.png\")\n browser.close()\n\nwith sync_playwright() as playwright:\n run(playwright)\n```\n\n```csharp\nusing Microsoft.Playwright;\nusing System.Threading.Tasks;\n\nclass PageExamples\n{\n public static async Task Run()\n {\n using var playwright = await Playwright.CreateAsync();\n await using var browser = await playwright.Webkit.LaunchAsync();\n var page = await browser.NewPageAsync();\n await page.GotoAsync(\"https://www.theverge.com\");\n await page.ScreenshotAsync(new PageScreenshotOptions { Path = \"theverge.png\" });\n }\n}\n```\n\nThe Page class emits various events (described below) which can be handled using any of Node's native\n[`EventEmitter`](https://nodejs.org/api/events.html#events_class_eventemitter) methods, such as `on`, `once` or\n`removeListener`.\n\nThis example logs a message for a single page `load` event:\n\n```js\npage.once('load', () => console.log('Page loaded!'));\n```\n\n```java\npage.onLoad(p -> System.out.println(\"Page loaded!\"));\n```\n\n```py\npage.once(\"load\", lambda: print(\"page loaded!\"))\n```\n\n```csharp\npage.Load += (_, _) => Console.WriteLine(\"Page loaded!\");\n```\n\nTo unsubscribe from events use the `removeListener` method:\n\n```js\nfunction logRequest(interceptedRequest) {\n console.log('A request was made:', interceptedRequest.url());\n}\npage.on('request', logRequest);\n// Sometime later...\npage.removeListener('request', logRequest);\n```\n\n```java\nConsumer<Request> logRequest = interceptedRequest -> {\n System.out.println(\"A request was made: \" + interceptedRequest.url());\n};\npage.onRequest(logRequest);\n// Sometime later...\npage.offRequest(logRequest);\n```\n\n```py\ndef log_request(intercepted_request):\n print(\"a request was made:\", intercepted_request.url)\npage.on(\"request\", log_request)\n# sometime later...\npage.remove_listener(\"request\", log_request)\n```\n\n```csharp\nvoid PageLoadHandler(object _, IPage p) {\n Console.WriteLine(\"Page loaded!\");\n};\n\npage.Load += PageLoadHandler;\n// Do some work...\npage.Load -= PageLoadHandler;\n```\n","members":[{"kind":"event","langs":{},"name":"close","type":{"name":"Page","expression":"[Page]"},"spec":[{"type":"text","text":"Emitted when the page closes."}],"required":true,"comment":"Emitted when the page closes.","deprecated":false,"async":false,"alias":"close","args":[]},{"kind":"event","langs":{"aliases":{"java":"consoleMessage"},"types":{},"overrides":{}},"name":"console","type":{"name":"ConsoleMessage","expression":"[ConsoleMessage]"},"spec":[{"type":"text","text":"Emitted when JavaScript within the page calls one of console API methods, e.g. `console.log` or `console.dir`. Also emitted if the page throws an error or a warning."},{"type":"text","text":"The arguments passed into `console.log` appear as arguments on the event handler."},{"type":"text","text":"An example of handling `console` event:"},{"type":"code","lines":["page.on('console', async msg => {"," for (let i = 0; i < msg.args().length; ++i)"," console.log(`${i}: ${await msg.args()[i].jsonValue()}`);","});","await page.evaluate(() => console.log('hello', 5, {foo: 'bar'}));"],"codeLang":"js"},{"type":"code","lines":["page.onConsoleMessage(msg -> {"," for (int i = 0; i < msg.args().size(); ++i)"," System.out.println(i + \": \" + msg.args().get(i).jsonValue());","});","page.evaluate(\"() => console.log('hello', 5, {foo: 'bar'})\");"],"codeLang":"java"},{"type":"code","lines":["async def print_args(msg):"," for arg in msg.args:"," print(await arg.json_value())","","page.on(\"console\", print_args)","await page.evaluate(\"console.log('hello', 5, {foo: 'bar'})\")"],"codeLang":"python async"},{"type":"code","lines":["def print_args(msg):"," for arg in msg.args:"," print(arg.json_value())","","page.on(\"console\", print_args)","page.evaluate(\"console.log('hello', 5, {foo: 'bar'})\")"],"codeLang":"python sync"},{"type":"code","lines":["page.Console += async (_, msg) =>","{"," foreach (var arg in msg.Args)"," Console.WriteLine(await arg.JsonValueAsync<object>());","};","","await page.EvaluateAsync(\"console.log('hello', 5, { foo: 'bar' })\");"],"codeLang":"csharp"}],"required":true,"comment":"Emitted when JavaScript within the page calls one of console API methods, e.g. `console.log` or `console.dir`. Also\nemitted if the page throws an error or a warning.\n\nThe arguments passed into `console.log` appear as arguments on the event handler.\n\nAn example of handling `console` event:\n\n```js\npage.on('console', async msg => {\n for (let i = 0; i < msg.args().length; ++i)\n console.log(`${i}: ${await msg.args()[i].jsonValue()}`);\n});\nawait page.evaluate(() => console.log('hello', 5, {foo: 'bar'}));\n```\n\n```java\npage.onConsoleMessage(msg -> {\n for (int i = 0; i < msg.args().size(); ++i)\n System.out.println(i + \": \" + msg.args().get(i).jsonValue());\n});\npage.evaluate(\"() => console.log('hello', 5, {foo: 'bar'})\");\n```\n\n```python async\nasync def print_args(msg):\n for arg in msg.args:\n print(await arg.json_value())\n\npage.on(\"console\", print_args)\nawait page.evaluate(\"console.log('hello', 5, {foo: 'bar'})\")\n```\n\n```python sync\ndef print_args(msg):\n for arg in msg.args:\n print(arg.json_value())\n\npage.on(\"console\", print_args)\npage.evaluate(\"console.log('hello', 5, {foo: 'bar'})\")\n```\n\n```csharp\npage.Console += async (_, msg) =>\n{\n foreach (var arg in msg.Args)\n Console.WriteLine(await arg.JsonValueAsync<object>());\n};\n\nawait page.EvaluateAsync(\"console.log('hello', 5, { foo: 'bar' })\");\n```\n","deprecated":false,"async":false,"alias":"console","args":[]},{"kind":"event","langs":{},"name":"crash","type":{"name":"Page","expression":"[Page]"},"spec":[{"type":"text","text":"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."},{"type":"text","text":"The most common way to deal with crashes is to catch an exception:"},{"type":"code","lines":["try {"," // Crash might happen during a click."," await page.click('button');"," // Or while waiting for an event."," await page.waitForEvent('popup');","} catch (e) {"," // When the page crashes, exception message contains 'crash'.","}"],"codeLang":"js"},{"type":"code","lines":["try {"," // Crash might happen during a click."," page.click(\"button\");"," // Or while waiting for an event."," page.waitForPopup(() -> {});","} catch (PlaywrightException e) {"," // When the page crashes, exception message contains \"crash\".","}"],"codeLang":"java"},{"type":"code","lines":["try:"," # crash might happen during a click."," await page.click(\"button\")"," # or while waiting for an event."," await page.wait_for_event(\"popup\")","except Error as e:"," # when the page crashes, exception message contains \"crash\"."],"codeLang":"python async"},{"type":"code","lines":["try:"," # crash might happen during a click."," page.click(\"button\")"," # or while waiting for an event."," page.wait_for_event(\"popup\")","except Error as e:"," # when the page crashes, exception message contains \"crash\"."],"codeLang":"python sync"},{"type":"code","lines":["try {"," // Crash might happen during a click."," await page.ClickAsync(\"button\");"," // Or while waiting for an event."," await page.WaitForPopup();","} catch (PlaywrightException e) {"," // When the page crashes, exception message contains \"crash\".","}"],"codeLang":"csharp"}],"required":true,"comment":"Emitted when the page crashes. Browser pages might crash if they try to allocate too much memory. When the page crashes,\nongoing and subsequent operations will throw.\n\nThe most common way to deal with crashes is to catch an exception:\n\n```js\ntry {\n // Crash might happen during a click.\n await page.click('button');\n // Or while waiting for an event.\n await page.waitForEvent('popup');\n} catch (e) {\n // When the page crashes, exception message contains 'crash'.\n}\n```\n\n```java\ntry {\n // Crash might happen during a click.\n page.click(\"button\");\n // Or while waiting for an event.\n page.waitForPopup(() -> {});\n} catch (PlaywrightException e) {\n // When the page crashes, exception message contains \"crash\".\n}\n```\n\n```python async\ntry:\n # crash might happen during a click.\n await page.click(\"button\")\n # or while waiting for an event.\n await page.wait_for_event(\"popup\")\nexcept Error as e:\n # when the page crashes, exception message contains \"crash\".\n```\n\n```python sync\ntry:\n # crash might happen during a click.\n page.click(\"button\")\n # or while waiting for an event.\n page.wait_for_event(\"popup\")\nexcept Error as e:\n # when the page crashes, exception message contains \"crash\".\n```\n\n```csharp\ntry {\n // Crash might happen during a click.\n await page.ClickAsync(\"button\");\n // Or while waiting for an event.\n await page.WaitForPopup();\n} catch (PlaywrightException e) {\n // When the page crashes, exception message contains \"crash\".\n}\n```\n","deprecated":false,"async":false,"alias":"crash","args":[]},{"kind":"event","langs":{},"name":"dialog","type":{"name":"Dialog","expression":"[Dialog]"},"spec":[{"type":"text","text":"Emitted when a JavaScript dialog appears, such as `alert`, `prompt`, `confirm` or `beforeunload`. Listener **must** either [`method: Dialog.accept`] or [`method: Dialog.dismiss`] the dialog - otherwise the page will [freeze](https://developer.mozilla.org/en-US/docs/Web/JavaScript/EventLoop#never_blocking) waiting for the dialog, and actions like click will never finish."},{"type":"note","noteType":"note","text":"When no [`event: Page.dialog`] listeners are present, all dialogs are automatically dismissed."}],"required":true,"comment":"Emitted when a JavaScript dialog appears, such as `alert`, `prompt`, `confirm` or `beforeunload`. Listener **must**\neither [`method: Dialog.accept`] or [`method: Dialog.dismiss`] the dialog - otherwise the page will\n[freeze](https://developer.mozilla.org/en-US/docs/Web/JavaScript/EventLoop#never_blocking) waiting for the dialog, and\nactions like click will never finish.\n\n> NOTE: When no [`event: Page.dialog`] listeners are present, all dialogs are automatically dismissed.","deprecated":false,"async":false,"alias":"dialog","args":[]},{"kind":"event","langs":{},"name":"DOMContentLoaded","type":{"name":"Page","expression":"[Page]"},"spec":[{"type":"text","text":"Emitted when the JavaScript [`DOMContentLoaded`](https://developer.mozilla.org/en-US/docs/Web/Events/DOMContentLoaded) event is dispatched."}],"required":true,"comment":"Emitted when the JavaScript [`DOMContentLoaded`](https://developer.mozilla.org/en-US/docs/Web/Events/DOMContentLoaded)\nevent is dispatched.","deprecated":false,"async":false,"alias":"DOMContentLoaded","args":[]},{"kind":"event","langs":{},"name":"download","type":{"name":"Download","expression":"[Download]"},"spec":[{"type":"text","text":"Emitted when attachment download started. User can access basic file operations on downloaded content via the passed `Download` instance."},{"type":"note","noteType":"note","text":"Browser context **must** be created with the `acceptDownloads` set to `true` when user needs access to the downloaded content. If `acceptDownloads` is not set, download events are emitted, but the actual download is not performed and user has no access to the downloaded files."}],"required":true,"comment":"Emitted when attachment download started. User can access basic file operations on downloaded content via the passed\n`Download` instance.\n\n> NOTE: Browser context **must** be created with the `acceptDownloads` set to `true` when user needs access to the\ndownloaded content. If `acceptDownloads` is not set, download events are emitted, but the actual download is not\nperformed and user has no access to the downloaded files.","deprecated":false,"async":false,"alias":"download","args":[]},{"kind":"event","langs":{},"name":"fileChooser","type":{"name":"FileChooser","expression":"[FileChooser]"},"spec":[{"type":"text","text":"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 [`method: FileChooser.setFiles`] that can be uploaded after that."},{"type":"code","lines":["page.on('filechooser', async (fileChooser) => {"," await fileChooser.setFiles('/tmp/myfile.pdf');","});"],"codeLang":"js"},{"type":"code","lines":["page.onFileChooser(fileChooser -> {"," fileChooser.setFiles(Paths.get(\"/tmp/myfile.pdf\"));","});"],"codeLang":"java"},{"type":"code","lines":["page.on(\"filechooser\", lambda file_chooser: file_chooser.set_files(\"/tmp/myfile.pdf\"))"],"codeLang":"py"},{"type":"code","lines":["page.FileChooser += (_, fileChooser) =>","{"," fileChooser.SetFilesAsync(@\"C:\\temp\\myfile.pdf\");","};"],"codeLang":"csharp"}],"required":true,"comment":"Emitted when a file chooser is supposed to appear, such as after clicking the `<input type=file>`. Playwright can\nrespond to it via setting the input files using [`method: FileChooser.setFiles`] that can be uploaded after that.\n\n```js\npage.on('filechooser', async (fileChooser) => {\n await fileChooser.setFiles('/tmp/myfile.pdf');\n});\n```\n\n```java\npage.onFileChooser(fileChooser -> {\n fileChooser.setFiles(Paths.get(\"/tmp/myfile.pdf\"));\n});\n```\n\n```py\npage.on(\"filechooser\", lambda file_chooser: file_chooser.set_files(\"/tmp/myfile.pdf\"))\n```\n\n```csharp\npage.FileChooser += (_, fileChooser) =>\n{\n fileChooser.SetFilesAsync(@\"C:\\temp\\myfile.pdf\");\n};\n```\n","deprecated":false,"async":false,"alias":"fileChooser","args":[]},{"kind":"event","langs":{},"name":"frameAttached","type":{"name":"Frame","expression":"[Frame]"},"spec":[{"type":"text","text":"Emitted when a frame is attached."}],"required":true,"comment":"Emitted when a frame is attached.","deprecated":false,"async":false,"alias":"frameAttached","args":[]},{"kind":"event","langs":{},"name":"frameDetached","type":{"name":"Frame","expression":"[Frame]"},"spec":[{"type":"text","text":"Emitted when a frame is detached."}],"required":true,"comment":"Emitted when a frame is detached.","deprecated":false,"async":false,"alias":"frameDetached","args":[]},{"kind":"event","langs":{},"name":"frameNavigated","type":{"name":"Frame","expression":"[Frame]"},"spec":[{"type":"text","text":"Emitted when a frame is navigated to a new url."}],"required":true,"comment":"Emitted when a frame is navigated to a new url.","deprecated":false,"async":false,"alias":"frameNavigated","args":[]},{"kind":"event","langs":{},"name":"load","type":{"name":"Page","expression":"[Page]"},"spec":[{"type":"text","text":"Emitted when the JavaScript [`load`](https://developer.mozilla.org/en-US/docs/Web/Events/load) event is dispatched."}],"required":true,"comment":"Emitted when the JavaScript [`load`](https://developer.mozilla.org/en-US/docs/Web/Events/load) event is dispatched.","deprecated":false,"async":false,"alias":"load","args":[]},{"kind":"event","langs":{"types":{"csharp":{"name":"string","expression":"[string]"},"java":{"name":"string","expression":"[string]"}}},"name":"pageError","type":{"name":"Error","expression":"[Error]"},"spec":[{"type":"text","text":"Emitted when an uncaught exception happens within the page."}],"required":true,"comment":"Emitted when an uncaught exception happens within the page.","deprecated":false,"async":false,"alias":"pageError","args":[]},{"kind":"event","langs":{},"name":"popup","type":{"name":"Page","expression":"[Page]"},"spec":[{"type":"text","text":"Emitted when the page opens a new tab or window. This event is emitted in addition to the [`event: BrowserContext.page`], but only for popups relevant to this page."},{"type":"text","text":"The earliest moment that page is available is when it has navigated to the initial url. For example, when opening a popup with `window.open('http://example.com')`, this event will fire when the network request to \"http://example.com\" is done and its response has started loading in the popup."},{"type":"code","lines":["const [popup] = await Promise.all(["," page.waitForEvent('popup'),"," page.evaluate(() => window.open('https://example.com')),","]);","console.log(await popup.evaluate('location.href'));"],"codeLang":"js"},{"type":"code","lines":["Page popup = page.waitForPopup(() -> {"," page.evaluate(\"() => window.open('https://example.com')\");","});","System.out.println(popup.evaluate(\"location.href\"));"],"codeLang":"java"},{"type":"code","lines":["async with page.expect_event(\"popup\") as page_info:"," page.evaluate(\"window.open('https://example.com')\")","popup = await page_info.value","print(await popup.evaluate(\"location.href\"))"],"codeLang":"python async"},{"type":"code","lines":["with page.expect_event(\"popup\") as page_info:"," page.evaluate(\"window.open('https://example.com')\")","popup = page_info.value","print(popup.evaluate(\"location.href\"))"],"codeLang":"python sync"},{"type":"code","lines":["var popup = await page.RunAndWaitForPopupAsync(async () =>","{"," await page.EvaluateAsync(\"() => window.open('https://microsoft.com')\");","});","Console.WriteLine(await popup.EvaluateAsync<string>(\"location.href\"));"],"codeLang":"csharp"},{"type":"note","noteType":"note","text":"Use [`method: Page.waitForLoadState`] to wait until the page gets to a particular state (you should not need it in most cases)."}],"required":true,"comment":"Emitted when the page opens a new tab or window. This event is emitted in addition to the\n[`event: BrowserContext.page`], but only for popups relevant to this page.\n\nThe earliest moment that page is available is when it has navigated to the initial url. For example, when opening a\npopup with `window.open('http://example.com')`, this event will fire when the network request to \"http://example.com\" is\ndone and its response has started loading in the popup.\n\n```js\nconst [popup] = await Promise.all([\n page.waitForEvent('popup'),\n page.evaluate(() => window.open('https://example.com')),\n]);\nconsole.log(await popup.evaluate('location.href'));\n```\n\n```java\nPage popup = page.waitForPopup(() -> {\n page.evaluate(\"() => window.open('https://example.com')\");\n});\nSystem.out.println(popup.evaluate(\"location.href\"));\n```\n\n```python async\nasync with page.expect_event(\"popup\") as page_info:\n page.evaluate(\"window.open('https://example.com')\")\npopup = await page_info.value\nprint(await popup.evaluate(\"location.href\"))\n```\n\n```python sync\nwith page.expect_event(\"popup\") as page_info:\n page.evaluate(\"window.open('https://example.com')\")\npopup = page_info.value\nprint(popup.evaluate(\"location.href\"))\n```\n\n```csharp\nvar popup = await page.RunAndWaitForPopupAsync(async () =>\n{\n await page.EvaluateAsync(\"() => window.open('https://microsoft.com')\");\n});\nConsole.WriteLine(await popup.EvaluateAsync<string>(\"location.href\"));\n```\n\n> NOTE: Use [`method: Page.waitForLoadState`] to wait until the page gets to a particular state (you should not need it\nin most cases).","deprecated":false,"async":false,"alias":"popup","args":[]},{"kind":"event","langs":{},"name":"request","type":{"name":"Request","expression":"[Request]"},"spec":[{"type":"text","text":"Emitted when a page issues a request. The [request] object is read-only. In order to intercept and mutate requests, see [`method: Page.route`] or [`method: BrowserContext.route`]."}],"required":true,"comment":"Emitted when a page issues a request. The [request] object is read-only. In order to intercept and mutate requests, see\n[`method: Page.route`] or [`method: BrowserContext.route`].","deprecated":false,"async":false,"alias":"request","args":[]},{"kind":"event","langs":{},"name":"requestFailed","type":{"name":"Request","expression":"[Request]"},"spec":[{"type":"text","text":"Emitted when a request fails, for example by timing out."},{"type":"note","noteType":"note","text":"HTTP Error responses, such as 404 or 503, are still successful responses from HTTP standpoint, so request will complete with [`event: Page.requestFinished`] event and not with [`event: Page.requestFailed`]. A request will only be considered failed when the client cannot get an HTTP response from the server, e.g. due to network error net::ERR_FAILED."}],"required":true,"comment":"Emitted when a request fails, for example by timing out.\n\n> NOTE: HTTP Error responses, such as 404 or 503, are still successful responses from HTTP standpoint, so request will\ncomplete with [`event: Page.requestFinished`] event and not with [`event: Page.requestFailed`]. A request will only be\nconsidered failed when the client cannot get an HTTP response from the server, e.g. due to network error\nnet::ERR_FAILED.","deprecated":false,"async":false,"alias":"requestFailed","args":[]},{"kind":"event","langs":{},"name":"requestFinished","type":{"name":"Request","expression":"[Request]"},"spec":[{"type":"text","text":"Emitted when a request finishes successfully after downloading the response body. For a successful response, the sequence of events is `request`, `response` and `requestfinished`."}],"required":true,"comment":"Emitted when a request finishes successfully after downloading the response body. For a successful response, the\nsequence of events is `request`, `response` and `requestfinished`.","deprecated":false,"async":false,"alias":"requestFinished","args":[]},{"kind":"event","langs":{},"name":"response","type":{"name":"Response","expression":"[Response]"},"spec":[{"type":"text","text":"Emitted when [response] status and headers are received for a request. For a successful response, the sequence of events is `request`, `response` and `requestfinished`."}],"required":true,"comment":"Emitted when [response] status and headers are received for a request. For a successful response, the sequence of events\nis `request`, `response` and `requestfinished`.","deprecated":false,"async":false,"alias":"response","args":[]},{"kind":"event","langs":{},"name":"webSocket","type":{"name":"WebSocket","expression":"[WebSocket]"},"spec":[{"type":"text","text":"Emitted when `WebSocket` request is sent."}],"required":true,"comment":"Emitted when `WebSocket` request is sent.","deprecated":false,"async":false,"alias":"webSocket","args":[]},{"kind":"event","langs":{},"name":"worker","type":{"name":"Worker","expression":"[Worker]"},"spec":[{"type":"text","text":"Emitted when a dedicated [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) is spawned by the page."}],"required":true,"comment":"Emitted when a dedicated [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) is spawned by the\npage.","deprecated":false,"async":false,"alias":"worker","args":[]},{"kind":"property","langs":{"only":["csharp","js","python"],"aliases":{},"types":{},"overrides":{}},"name":"accessibility","type":{"name":"Accessibility","expression":"[Accessibility]"},"spec":[],"required":true,"comment":"","deprecated":false,"async":false,"alias":"accessibility","args":[]},{"kind":"method","langs":{},"name":"addInitScript","type":{"name":"void"},"spec":[{"type":"text","text":"Adds a script which would be evaluated in one of the following scenarios:"},{"type":"li","text":"Whenever the page is navigated.","liType":"bullet"},{"type":"li","text":"Whenever the child frame is attached or navigated. In this case, the script is evaluated in the context of the newly attached frame.","liType":"bullet"},{"type":"text","text":"The script is evaluated after the document was created but before any of its scripts were run. This is useful to amend the JavaScript environment, e.g. to seed `Math.random`."},{"type":"text","text":"An example of overriding `Math.random` before the page loads:"},{"type":"code","lines":["// preload.js","Math.random = () => 42;"],"codeLang":"js browser"},{"type":"code","lines":["// In your playwright script, assuming the preload.js file is in same directory","await page.addInitScript({ path: './preload.js' });"],"codeLang":"js"},{"type":"code","lines":["// In your playwright script, assuming the preload.js file is in same directory","page.addInitScript(Paths.get(\"./preload.js\"));"],"codeLang":"java"},{"type":"code","lines":["# in your playwright script, assuming the preload.js file is in same directory","await page.add_init_script(path=\"./preload.js\")"],"codeLang":"python async"},{"type":"code","lines":["# in your playwright script, assuming the preload.js file is in same directory","page.add_init_script(path=\"./preload.js\")"],"codeLang":"python sync"},{"type":"code","lines":["await page.AddInitScriptAsync(new PageAddInitScriptOption { ScriptPath = \"./preload.js\" });"],"codeLang":"csharp"},{"type":"note","noteType":"note","text":"The order of evaluation of multiple scripts installed via [`method: BrowserContext.addInitScript`] and [`method: Page.addInitScript`] is not defined."}],"required":true,"comment":"Adds a script which would be evaluated in one of the following scenarios:\n- Whenever the page is navigated.\n- Whenever the child frame is attached or navigated. In this case, the script is evaluated in the context of the newly\n attached frame.\n\nThe script is evaluated after the document was created but before any of its scripts were run. This is useful to amend\nthe JavaScript environment, e.g. to seed `Math.random`.\n\nAn example of overriding `Math.random` before the page loads:\n\n```js browser\n// preload.js\nMath.random = () => 42;\n```\n\n```js\n// In your playwright script, assuming the preload.js file is in same directory\nawait page.addInitScript({ path: './preload.js' });\n```\n\n```java\n// In your playwright script, assuming the preload.js file is in same directory\npage.addInitScript(Paths.get(\"./preload.js\"));\n```\n\n```python async\n# in your playwright script, assuming the preload.js file is in same directory\nawait page.add_init_script(path=\"./preload.js\")\n```\n\n```python sync\n# in your playwright script, assuming the preload.js file is in same directory\npage.add_init_script(path=\"./preload.js\")\n```\n\n```csharp\nawait page.AddInitScriptAsync(new PageAddInitScriptOption { ScriptPath = \"./preload.js\" });\n```\n\n> NOTE: The order of evaluation of multiple scripts installed via [`method: BrowserContext.addInitScript`] and\n[`method: Page.addInitScript`] is not defined.","deprecated":false,"async":true,"alias":"addInitScript","args":[{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"script","type":{"name":"","union":[{"name":"function"},{"name":"string"},{"name":"Object","properties":[{"kind":"property","langs":{},"name":"path","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the current working directory. Optional."}],"required":false,"comment":"Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the current working\ndirectory. Optional.","deprecated":false,"async":false,"alias":"path"},{"kind":"property","langs":{},"name":"content","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Raw script content. Optional."}],"required":false,"comment":"Raw script content. Optional.","deprecated":false,"async":false,"alias":"content"}]}],"expression":"[function]|[string]|[Object]"},"spec":[{"type":"text","text":"Script to be evaluated in the page."}],"required":true,"comment":"Script to be evaluated in the page.","deprecated":false,"async":false,"alias":"script"},{"kind":"property","langs":{"only":["csharp","java"],"aliases":{},"types":{},"overrides":{}},"name":"script","type":{"name":"","union":[{"name":"string"},{"name":"path"}],"expression":"[string]|[path]"},"spec":[{"type":"text","text":"Script to be evaluated in all pages in the browser context."}],"required":true,"comment":"Script to be evaluated in all pages in the browser context.","deprecated":false,"async":false,"alias":"script"},{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"arg","type":{"name":"Serializable","expression":"[Serializable]"},"spec":[{"type":"text","text":"Optional argument to pass to `script` (only supported when passing a function)."}],"required":false,"comment":"Optional argument to pass to `script` (only supported when passing a function).","deprecated":false,"async":false,"alias":"arg"},{"kind":"property","langs":{"only":["python"],"aliases":{},"types":{},"overrides":{}},"name":"path","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the current working directory. Optional."}],"required":false,"comment":"Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the current working\ndirectory. Optional.","deprecated":false,"async":false,"alias":"path"},{"kind":"property","langs":{"only":["python"],"aliases":{},"types":{},"overrides":{}},"name":"script","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Script to be evaluated in all pages in the browser context. Optional."}],"required":false,"comment":"Script to be evaluated in all pages in the browser context. Optional.","deprecated":false,"async":false,"alias":"script"}]},{"kind":"method","langs":{},"name":"addScriptTag","type":{"name":"ElementHandle","expression":"[ElementHandle]"},"spec":[{"type":"text","text":"Adds a `<script>` tag into the page with the desired url or content. Returns the added tag when the script's onload fires or when the script content was injected into frame."},{"type":"text","text":"Shortcut for main frame's [`method: Frame.addScriptTag`]."}],"required":true,"comment":"Adds a `<script>` tag into the page with the desired url or content. Returns the added tag when the script's onload\nfires or when the script content was injected into frame.\n\nShortcut for main frame's [`method: Frame.addScriptTag`].","deprecated":false,"async":true,"alias":"addScriptTag","args":[{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"content","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Raw JavaScript content to be injected into frame."}],"required":false,"comment":"Raw JavaScript content to be injected into frame.","deprecated":false,"async":false,"alias":"content"},{"kind":"property","langs":{},"name":"path","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"Path to the JavaScript file to be injected into frame. If `path` is a relative path, then it is resolved relative to the current working directory."}],"required":false,"comment":"Path to the JavaScript file to be injected into frame. If `path` is a relative path, then it is resolved relative to the\ncurrent working directory.","deprecated":false,"async":false,"alias":"path"},{"kind":"property","langs":{},"name":"type","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Script type. Use 'module' in order to load a Javascript ES6 module. See [script](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script) for more details."}],"required":false,"comment":"Script type. Use 'module' in order to load a Javascript ES6 module. See\n[script](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script) for more details.","deprecated":false,"async":false,"alias":"type"},{"kind":"property","langs":{},"name":"url","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"URL of a script to be added."}],"required":false,"comment":"URL of a script to be added.","deprecated":false,"async":false,"alias":"url"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"addStyleTag","type":{"name":"ElementHandle","expression":"[ElementHandle]"},"spec":[{"type":"text","text":"Adds a `<link rel=\"stylesheet\">` tag into the page with the desired url or a `<style type=\"text/css\">` tag with the content. Returns the added tag when the stylesheet's onload fires or when the CSS content was injected into frame."},{"type":"text","text":"Shortcut for main frame's [`method: Frame.addStyleTag`]."}],"required":true,"comment":"Adds a `<link rel=\"stylesheet\">` tag into the page with the desired url or a `<style type=\"text/css\">` tag with the\ncontent. Returns the added tag when the stylesheet's onload fires or when the CSS content was injected into frame.\n\nShortcut for main frame's [`method: Frame.addStyleTag`].","deprecated":false,"async":true,"alias":"addStyleTag","args":[{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"content","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Raw CSS content to be injected into frame."}],"required":false,"comment":"Raw CSS content to be injected into frame.","deprecated":false,"async":false,"alias":"content"},{"kind":"property","langs":{},"name":"path","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"Path to the CSS file to be injected into frame. If `path` is a relative path, then it is resolved relative to the current working directory."}],"required":false,"comment":"Path to the CSS file to be injected into frame. If `path` is a relative path, then it is resolved relative to the\ncurrent working directory.","deprecated":false,"async":false,"alias":"path"},{"kind":"property","langs":{},"name":"url","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"URL of the `<link>` tag."}],"required":false,"comment":"URL of the `<link>` tag.","deprecated":false,"async":false,"alias":"url"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"bringToFront","type":{"name":"void"},"spec":[{"type":"text","text":"Brings page to front (activates tab)."}],"required":true,"comment":"Brings page to front (activates tab).","deprecated":false,"async":true,"alias":"bringToFront","args":[]},{"kind":"method","langs":{},"name":"check","type":{"name":"void"},"spec":[{"type":"text","text":"This method checks an element matching `selector` by performing the following steps:"},{"type":"li","text":"Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.","liType":"ordinal"},{"type":"li","text":"Ensure that matched element is a checkbox or a radio input. If not, this method throws. If the element is already checked, this method returns immediately.","liType":"ordinal"},{"type":"li","text":"Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried.","liType":"ordinal"},{"type":"li","text":"Scroll the element into view if needed.","liType":"ordinal"},{"type":"li","text":"Use [`property: Page.mouse`] to click in the center of the element.","liType":"ordinal"},{"type":"li","text":"Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.","liType":"ordinal"},{"type":"li","text":"Ensure that the element is now checked. If not, this method throws.","liType":"ordinal"},{"type":"text","text":"When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing zero timeout disables this."},{"type":"text","text":"Shortcut for main frame's [`method: Frame.check`]."}],"required":true,"comment":"This method checks an element matching `selector` by performing the following steps:\n1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.\n1. Ensure that matched element is a checkbox or a radio input. If not, this method throws. If the element is already\n checked, this method returns immediately.\n1. Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the\n element is detached during the checks, the whole action is retried.\n1. Scroll the element into view if needed.\n1. Use [`property: Page.mouse`] to click in the center of the element.\n1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.\n1. Ensure that the element is now checked. If not, this method throws.\n\nWhen all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing\nzero timeout disables this.\n\nShortcut for main frame's [`method: Frame.check`].","deprecated":false,"async":true,"alias":"check","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See\n[working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"force","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`."}],"required":false,"comment":"Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.","deprecated":false,"async":false,"alias":"force"},{"kind":"property","langs":{},"name":"noWaitAfter","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`."}],"required":false,"comment":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can\nopt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to\ninaccessible pages. Defaults to `false`.","deprecated":false,"async":false,"alias":"noWaitAfter"},{"kind":"property","langs":{},"name":"position","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"x","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"x"},{"kind":"property","langs":{},"name":"y","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"y"}],"expression":"[Object]"},"spec":[{"type":"text","text":"A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element."}],"required":false,"comment":"A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the\nelement.","deprecated":false,"async":false,"alias":"position"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"},{"kind":"property","langs":{},"name":"trial","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it."}],"required":false,"comment":"When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to\n`false`. Useful to wait until the element is ready for the action without performing it.","deprecated":false,"async":false,"alias":"trial"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"click","type":{"name":"void"},"spec":[{"type":"text","text":"This method clicks an element matching `selector` by performing the following steps:"},{"type":"li","text":"Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.","liType":"ordinal"},{"type":"li","text":"Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried.","liType":"ordinal"},{"type":"li","text":"Scroll the element into view if needed.","liType":"ordinal"},{"type":"li","text":"Use [`property: Page.mouse`] to click in the center of the element, or the specified `position`.","liType":"ordinal"},{"type":"li","text":"Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.","liType":"ordinal"},{"type":"text","text":"When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing zero timeout disables this."},{"type":"text","text":"Shortcut for main frame's [`method: Frame.click`]."}],"required":true,"comment":"This method clicks an element matching `selector` by performing the following steps:\n1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.\n1. Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the\n element is detached during the checks, the whole action is retried.\n1. Scroll the element into view if needed.\n1. Use [`property: Page.mouse`] to click in the center of the element, or the specified `position`.\n1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.\n\nWhen all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing\nzero timeout disables this.\n\nShortcut for main frame's [`method: Frame.click`].","deprecated":false,"async":true,"alias":"click","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See\n[working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"button","type":{"name":"MouseButton","union":[{"name":"\"left\""},{"name":"\"right\""},{"name":"\"middle\""}],"expression":"[MouseButton]<\"left\"|\"right\"|\"middle\">"},"spec":[{"type":"text","text":"Defaults to `left`."}],"required":false,"comment":"Defaults to `left`.","deprecated":false,"async":false,"alias":"button"},{"kind":"property","langs":{},"name":"clickCount","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"defaults to 1. See [UIEvent.detail]."}],"required":false,"comment":"defaults to 1. See [UIEvent.detail].","deprecated":false,"async":false,"alias":"clickCount"},{"kind":"property","langs":{},"name":"delay","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0."}],"required":false,"comment":"Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0.","deprecated":false,"async":false,"alias":"delay"},{"kind":"property","langs":{},"name":"force","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`."}],"required":false,"comment":"Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.","deprecated":false,"async":false,"alias":"force"},{"kind":"property","langs":{},"name":"modifiers","type":{"name":"Array","templates":[{"name":"KeyboardModifier","union":[{"name":"\"Alt\""},{"name":"\"Control\""},{"name":"\"Meta\""},{"name":"\"Shift\""}]}],"expression":"[Array]<[KeyboardModifier]<\"Alt\"|\"Control\"|\"Meta\"|\"Shift\">>"},"spec":[{"type":"text","text":"Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current modifiers back. If not specified, currently pressed modifiers are used."}],"required":false,"comment":"Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current\nmodifiers back. If not specified, currently pressed modifiers are used.","deprecated":false,"async":false,"alias":"modifiers"},{"kind":"property","langs":{},"name":"noWaitAfter","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`."}],"required":false,"comment":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can\nopt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to\ninaccessible pages. Defaults to `false`.","deprecated":false,"async":false,"alias":"noWaitAfter"},{"kind":"property","langs":{},"name":"position","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"x","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"x"},{"kind":"property","langs":{},"name":"y","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"y"}],"expression":"[Object]"},"spec":[{"type":"text","text":"A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element."}],"required":false,"comment":"A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the\nelement.","deprecated":false,"async":false,"alias":"position"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"},{"kind":"property","langs":{},"name":"trial","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it."}],"required":false,"comment":"When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to\n`false`. Useful to wait until the element is ready for the action without performing it.","deprecated":false,"async":false,"alias":"trial"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"close","type":{"name":"void"},"spec":[{"type":"text","text":"If `runBeforeUnload` is `false`, does not run any unload handlers and waits for the page to be closed. If `runBeforeUnload` is `true` the method will run unload handlers, but will **not** wait for the page to close."},{"type":"text","text":"By default, `page.close()` **does not** run `beforeunload` handlers."},{"type":"note","noteType":"note","text":"if `runBeforeUnload` is passed as true, a `beforeunload` dialog might be summoned and should be handled manually via [`event: Page.dialog`] event."}],"required":true,"comment":"If `runBeforeUnload` is `false`, does not run any unload handlers and waits for the page to be closed. If\n`runBeforeUnload` is `true` the method will run unload handlers, but will **not** wait for the page to close.\n\nBy default, `page.close()` **does not** run `beforeunload` handlers.\n\n> NOTE: if `runBeforeUnload` is passed as true, a `beforeunload` dialog might be summoned and should be handled manually\nvia [`event: Page.dialog`] event.","deprecated":false,"async":true,"alias":"close","args":[{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"runBeforeUnload","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Defaults to `false`. Whether to run the [before unload](https://developer.mozilla.org/en-US/docs/Web/Events/beforeunload) page handlers."}],"required":false,"comment":"Defaults to `false`. Whether to run the\n[before unload](https://developer.mozilla.org/en-US/docs/Web/Events/beforeunload) page handlers.","deprecated":false,"async":false,"alias":"runBeforeUnload"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"content","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Gets the full HTML contents of the page, including the doctype."}],"required":true,"comment":"Gets the full HTML contents of the page, including the doctype.","deprecated":false,"async":true,"alias":"content","args":[]},{"kind":"method","langs":{},"name":"context","type":{"name":"BrowserContext","expression":"[BrowserContext]"},"spec":[{"type":"text","text":"Get the browser context that the page belongs to."}],"required":true,"comment":"Get the browser context that the page belongs to.","deprecated":false,"async":false,"alias":"context","args":[]},{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"coverage","type":{"name":"Coverage","expression":"[Coverage]"},"spec":[{"type":"note","noteType":"note","text":"Only available for Chromium atm."},{"type":"text","text":"Browser-specific Coverage implementation. See `Coverage`(#class-coverage) for more details."}],"required":true,"comment":"> NOTE: Only available for Chromium atm.\n\nBrowser-specific Coverage implementation. See `Coverage`(#class-coverage) for more details.","deprecated":false,"async":false,"alias":"coverage","args":[]},{"kind":"method","langs":{"aliases":{"csharp":"DblClickAsync"},"types":{},"overrides":{}},"name":"dblclick","type":{"name":"void"},"spec":[{"type":"text","text":"This method double clicks an element matching `selector` by performing the following steps:"},{"type":"li","text":"Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.","liType":"ordinal"},{"type":"li","text":"Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried.","liType":"ordinal"},{"type":"li","text":"Scroll the element into view if needed.","liType":"ordinal"},{"type":"li","text":"Use [`property: Page.mouse`] to double click in the center of the element, or the specified `position`.","liType":"ordinal"},{"type":"li","text":"Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set. Note that if the first click of the `dblclick()` triggers a navigation event, this method will throw.","liType":"ordinal"},{"type":"text","text":"When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing zero timeout disables this."},{"type":"note","noteType":"note","text":"`page.dblclick()` dispatches two `click` events and a single `dblclick` event."},{"type":"text","text":"Shortcut for main frame's [`method: Frame.dblclick`]."}],"required":true,"comment":"This method double clicks an element matching `selector` by performing the following steps:\n1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.\n1. Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the\n element is detached during the checks, the whole action is retried.\n1. Scroll the element into view if needed.\n1. Use [`property: Page.mouse`] to double click in the center of the element, or the specified `position`.\n1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set. Note that if the\n first click of the `dblclick()` triggers a navigation event, this method will throw.\n\nWhen all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing\nzero timeout disables this.\n\n> NOTE: `page.dblclick()` dispatches two `click` events and a single `dblclick` event.\n\nShortcut for main frame's [`method: Frame.dblclick`].","deprecated":false,"async":true,"alias":"dblclick","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See\n[working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"button","type":{"name":"MouseButton","union":[{"name":"\"left\""},{"name":"\"right\""},{"name":"\"middle\""}],"expression":"[MouseButton]<\"left\"|\"right\"|\"middle\">"},"spec":[{"type":"text","text":"Defaults to `left`."}],"required":false,"comment":"Defaults to `left`.","deprecated":false,"async":false,"alias":"button"},{"kind":"property","langs":{},"name":"delay","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0."}],"required":false,"comment":"Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0.","deprecated":false,"async":false,"alias":"delay"},{"kind":"property","langs":{},"name":"force","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`."}],"required":false,"comment":"Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.","deprecated":false,"async":false,"alias":"force"},{"kind":"property","langs":{},"name":"modifiers","type":{"name":"Array","templates":[{"name":"KeyboardModifier","union":[{"name":"\"Alt\""},{"name":"\"Control\""},{"name":"\"Meta\""},{"name":"\"Shift\""}]}],"expression":"[Array]<[KeyboardModifier]<\"Alt\"|\"Control\"|\"Meta\"|\"Shift\">>"},"spec":[{"type":"text","text":"Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current modifiers back. If not specified, currently pressed modifiers are used."}],"required":false,"comment":"Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current\nmodifiers back. If not specified, currently pressed modifiers are used.","deprecated":false,"async":false,"alias":"modifiers"},{"kind":"property","langs":{},"name":"noWaitAfter","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`."}],"required":false,"comment":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can\nopt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to\ninaccessible pages. Defaults to `false`.","deprecated":false,"async":false,"alias":"noWaitAfter"},{"kind":"property","langs":{},"name":"position","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"x","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"x"},{"kind":"property","langs":{},"name":"y","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"y"}],"expression":"[Object]"},"spec":[{"type":"text","text":"A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element."}],"required":false,"comment":"A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the\nelement.","deprecated":false,"async":false,"alias":"position"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"},{"kind":"property","langs":{},"name":"trial","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it."}],"required":false,"comment":"When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to\n`false`. Useful to wait until the element is ready for the action without performing it.","deprecated":false,"async":false,"alias":"trial"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"dispatchEvent","type":{"name":"void"},"spec":[{"type":"text","text":"The snippet below dispatches the `click` event on the element. Regardless of the visibility state of the element, `click` is dispatched. This is equivalent to calling [element.click()](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/click)."},{"type":"code","lines":["await page.dispatchEvent('button#submit', 'click');"],"codeLang":"js"},{"type":"code","lines":["page.dispatchEvent(\"button#submit\", \"click\");"],"codeLang":"java"},{"type":"code","lines":["await page.dispatch_event(\"button#submit\", \"click\")"],"codeLang":"python async"},{"type":"code","lines":["page.dispatch_event(\"button#submit\", \"click\")"],"codeLang":"python sync"},{"type":"code","lines":["await page.DispatchEventAsync(\"button#submit\", \"click\");"],"codeLang":"csharp"},{"type":"text","text":"Under the hood, it creates an instance of an event based on the given `type`, initializes it with `eventInit` properties and dispatches it on the element. Events are `composed`, `cancelable` and bubble by default."},{"type":"text","text":"Since `eventInit` is event-specific, please refer to the events documentation for the lists of initial properties:"},{"type":"li","text":"[DragEvent](https://developer.mozilla.org/en-US/docs/Web/API/DragEvent/DragEvent)","liType":"bullet"},{"type":"li","text":"[FocusEvent](https://developer.mozilla.org/en-US/docs/Web/API/FocusEvent/FocusEvent)","liType":"bullet"},{"type":"li","text":"[KeyboardEvent](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/KeyboardEvent)","liType":"bullet"},{"type":"li","text":"[MouseEvent](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/MouseEvent)","liType":"bullet"},{"type":"li","text":"[PointerEvent](https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/PointerEvent)","liType":"bullet"},{"type":"li","text":"[TouchEvent](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/TouchEvent)","liType":"bullet"},{"type":"li","text":"[Event](https://developer.mozilla.org/en-US/docs/Web/API/Event/Event)","liType":"bullet"},{"type":"text","text":"You can also specify `JSHandle` as the property value if you want live objects to be passed into the event:"},{"type":"code","lines":["// Note you can only create DataTransfer in Chromium and Firefox","const dataTransfer = await page.evaluateHandle(() => new DataTransfer());","await page.dispatchEvent('#source', 'dragstart', { dataTransfer });"],"codeLang":"js"},{"type":"code","lines":["// Note you can only create DataTransfer in Chromium and Firefox","JSHandle dataTransfer = page.evaluateHandle(\"() => new DataTransfer()\");","Map<String, Object> arg = new HashMap<>();","arg.put(\"dataTransfer\", dataTransfer);","page.dispatchEvent(\"#source\", \"dragstart\", arg);"],"codeLang":"java"},{"type":"code","lines":["# note you can only create data_transfer in chromium and firefox","data_transfer = await page.evaluate_handle(\"new DataTransfer()\")","await page.dispatch_event(\"#source\", \"dragstart\", { \"dataTransfer\": data_transfer })"],"codeLang":"python async"},{"type":"code","lines":["# note you can only create data_transfer in chromium and firefox","data_transfer = page.evaluate_handle(\"new DataTransfer()\")","page.dispatch_event(\"#source\", \"dragstart\", { \"dataTransfer\": data_transfer })"],"codeLang":"python sync"},{"type":"code","lines":["var dataTransfer = await page.EvaluateHandleAsync(\"() => new DataTransfer()\");","await page.DispatchEventAsync(\"#source\", \"dragstart\", new { dataTransfer });"],"codeLang":"csharp"}],"required":true,"comment":"The snippet below dispatches the `click` event on the element. Regardless of the visibility state of the element,\n`click` is dispatched. This is equivalent to calling\n[element.click()](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/click).\n\n```js\nawait page.dispatchEvent('button#submit', 'click');\n```\n\n```java\npage.dispatchEvent(\"button#submit\", \"click\");\n```\n\n```python async\nawait page.dispatch_event(\"button#submit\", \"click\")\n```\n\n```python sync\npage.dispatch_event(\"button#submit\", \"click\")\n```\n\n```csharp\nawait page.DispatchEventAsync(\"button#submit\", \"click\");\n```\n\nUnder the hood, it creates an instance of an event based on the given `type`, initializes it with `eventInit` properties\nand dispatches it on the element. Events are `composed`, `cancelable` and bubble by default.\n\nSince `eventInit` is event-specific, please refer to the events documentation for the lists of initial properties:\n- [DragEvent](https://developer.mozilla.org/en-US/docs/Web/API/DragEvent/DragEvent)\n- [FocusEvent](https://developer.mozilla.org/en-US/docs/Web/API/FocusEvent/FocusEvent)\n- [KeyboardEvent](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/KeyboardEvent)\n- [MouseEvent](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/MouseEvent)\n- [PointerEvent](https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/PointerEvent)\n- [TouchEvent](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/TouchEvent)\n- [Event](https://developer.mozilla.org/en-US/docs/Web/API/Event/Event)\n\nYou can also specify `JSHandle` as the property value if you want live objects to be passed into the event:\n\n```js\n// Note you can only create DataTransfer in Chromium and Firefox\nconst dataTransfer = await page.evaluateHandle(() => new DataTransfer());\nawait page.dispatchEvent('#source', 'dragstart', { dataTransfer });\n```\n\n```java\n// Note you can only create DataTransfer in Chromium and Firefox\nJSHandle dataTransfer = page.evaluateHandle(\"() => new DataTransfer()\");\nMap<String, Object> arg = new HashMap<>();\narg.put(\"dataTransfer\", dataTransfer);\npage.dispatchEvent(\"#source\", \"dragstart\", arg);\n```\n\n```python async\n# note you can only create data_transfer in chromium and firefox\ndata_transfer = await page.evaluate_handle(\"new DataTransfer()\")\nawait page.dispatch_event(\"#source\", \"dragstart\", { \"dataTransfer\": data_transfer })\n```\n\n```python sync\n# note you can only create data_transfer in chromium and firefox\ndata_transfer = page.evaluate_handle(\"new DataTransfer()\")\npage.dispatch_event(\"#source\", \"dragstart\", { \"dataTransfer\": data_transfer })\n```\n\n```csharp\nvar dataTransfer = await page.EvaluateHandleAsync(\"() => new DataTransfer()\");\nawait page.DispatchEventAsync(\"#source\", \"dragstart\", new { dataTransfer });\n```\n","deprecated":false,"async":true,"alias":"dispatchEvent","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See\n[working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"type","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"DOM event type: `\"click\"`, `\"dragstart\"`, etc."}],"required":true,"comment":"DOM event type: `\"click\"`, `\"dragstart\"`, etc.","deprecated":false,"async":false,"alias":"type"},{"kind":"property","langs":{},"name":"eventInit","type":{"name":"EvaluationArgument","expression":"[EvaluationArgument]"},"spec":[{"type":"text","text":"Optional event-specific initialization properties."}],"required":false,"comment":"Optional event-specific initialization properties.","deprecated":false,"async":false,"alias":"eventInit"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"emulateMedia","type":{"name":"void"},"spec":[{"type":"text","text":"This method changes the `CSS media type` through the `media` argument, and/or the `'prefers-colors-scheme'` media feature, using the `colorScheme` argument."},{"type":"code","lines":["await page.evaluate(() => matchMedia('screen').matches);","// → true","await page.evaluate(() => matchMedia('print').matches);","// → false","","await page.emulateMedia({ media: 'print' });","await page.evaluate(() => matchMedia('screen').matches);","// → false","await page.evaluate(() => matchMedia('print').matches);","// → true","","await page.emulateMedia({});","await page.evaluate(() => matchMedia('screen').matches);","// → true","await page.evaluate(() => matchMedia('print').matches);","// → false"],"codeLang":"js"},{"type":"code","lines":["page.evaluate(\"() => matchMedia('screen').matches\");","// → true","page.evaluate(\"() => matchMedia('print').matches\");","// → false","","page.emulateMedia(new Page.EmulateMediaOptions().setMedia(Media.PRINT));","page.evaluate(\"() => matchMedia('screen').matches\");","// → false","page.evaluate(\"() => matchMedia('print').matches\");","// → true","","page.emulateMedia(new Page.EmulateMediaOptions());","page.evaluate(\"() => matchMedia('screen').matches\");","// → true","page.evaluate(\"() => matchMedia('print').matches\");","// → false"],"codeLang":"java"},{"type":"code","lines":["await page.evaluate(\"matchMedia('screen').matches\")","# → True","await page.evaluate(\"matchMedia('print').matches\")","# → False","","await page.emulate_media(media=\"print\")","await page.evaluate(\"matchMedia('screen').matches\")","# → False","await page.evaluate(\"matchMedia('print').matches\")","# → True","","await page.emulate_media()","await page.evaluate(\"matchMedia('screen').matches\")","# → True","await page.evaluate(\"matchMedia('print').matches\")","# → False"],"codeLang":"python async"},{"type":"code","lines":["page.evaluate(\"matchMedia('screen').matches\")","# → True","page.evaluate(\"matchMedia('print').matches\")","# → False","","page.emulate_media(media=\"print\")","page.evaluate(\"matchMedia('screen').matches\")","# → False","page.evaluate(\"matchMedia('print').matches\")","# → True","","page.emulate_media()","page.evaluate(\"matchMedia('screen').matches\")","# → True","page.evaluate(\"matchMedia('print').matches\")","# → False"],"codeLang":"python sync"},{"type":"code","lines":["await page.EvaluateAsync(\"() => matchMedia('screen').matches\");","// → true","await page.EvaluateAsync(\"() => matchMedia('print').matches\");","// → false","","await page.EmulateMediaAsync(new PageEmulateMediaOptions { Media = Media.Print });","await page.EvaluateAsync(\"() => matchMedia('screen').matches\");","// → false","await page.EvaluateAsync(\"() => matchMedia('print').matches\");","// → true","","await page.EmulateMediaAsync(new PageEmulateMediaOptions { Media = Media.Screen });","await page.EvaluateAsync(\"() => matchMedia('screen').matches\");","// → true","await page.EvaluateAsync(\"() => matchMedia('print').matches\");","// → false"],"codeLang":"csharp"},{"type":"code","lines":["await page.emulateMedia({ colorScheme: 'dark' });","await page.evaluate(() => matchMedia('(prefers-color-scheme: dark)').matches);","// → true","await page.evaluate(() => matchMedia('(prefers-color-scheme: light)').matches);","// → false","await page.evaluate(() => matchMedia('(prefers-color-scheme: no-preference)').matches);","// → false"],"codeLang":"js"},{"type":"code","lines":["page.emulateMedia(new Page.EmulateMediaOptions().setColorScheme(ColorScheme.DARK));","page.evaluate(\"() => matchMedia('(prefers-color-scheme: dark)').matches\");","// → true","page.evaluate(\"() => matchMedia('(prefers-color-scheme: light)').matches\");","// → false","page.evaluate(\"() => matchMedia('(prefers-color-scheme: no-preference)').matches\");","// → false"],"codeLang":"java"},{"type":"code","lines":["await page.emulate_media(color_scheme=\"dark\")","await page.evaluate(\"matchMedia('(prefers-color-scheme: dark)').matches\")","# → True","await page.evaluate(\"matchMedia('(prefers-color-scheme: light)').matches\")","# → False","await page.evaluate(\"matchMedia('(prefers-color-scheme: no-preference)').matches\")","# → False"],"codeLang":"python async"},{"type":"code","lines":["page.emulate_media(color_scheme=\"dark\")","page.evaluate(\"matchMedia('(prefers-color-scheme: dark)').matches\")","# → True","page.evaluate(\"matchMedia('(prefers-color-scheme: light)').matches\")","# → False","page.evaluate(\"matchMedia('(prefers-color-scheme: no-preference)').matches\")"],"codeLang":"python sync"},{"type":"code","lines":["await page.EmulateMediaAsync(new PageEmulateMediaOptions { ColorScheme = ColorScheme.Dark });","await page.EvaluateAsync(\"matchMedia('(prefers-color-scheme: dark)').matches\");","// → true","await page.EvaluateAsync(\"matchMedia('(prefers-color-scheme: light)').matches\");","// → false","await page.EvaluateAsync(\"matchMedia('(prefers-color-scheme: no-preference)').matches\");","// → false"],"codeLang":"csharp"}],"required":true,"comment":"This method changes the `CSS media type` through the `media` argument, and/or the `'prefers-colors-scheme'` media\nfeature, using the `colorScheme` argument.\n\n```js\nawait page.evaluate(() => matchMedia('screen').matches);\n// → true\nawait page.evaluate(() => matchMedia('print').matches);\n// → false\n\nawait page.emulateMedia({ media: 'print' });\nawait page.evaluate(() => matchMedia('screen').matches);\n// → false\nawait page.evaluate(() => matchMedia('print').matches);\n// → true\n\nawait page.emulateMedia({});\nawait page.evaluate(() => matchMedia('screen').matches);\n// → true\nawait page.evaluate(() => matchMedia('print').matches);\n// → false\n```\n\n```java\npage.evaluate(\"() => matchMedia('screen').matches\");\n// → true\npage.evaluate(\"() => matchMedia('print').matches\");\n// → false\n\npage.emulateMedia(new Page.EmulateMediaOptions().setMedia(Media.PRINT));\npage.evaluate(\"() => matchMedia('screen').matches\");\n// → false\npage.evaluate(\"() => matchMedia('print').matches\");\n// → true\n\npage.emulateMedia(new Page.EmulateMediaOptions());\npage.evaluate(\"() => matchMedia('screen').matches\");\n// → true\npage.evaluate(\"() => matchMedia('print').matches\");\n// → false\n```\n\n```python async\nawait page.evaluate(\"matchMedia('screen').matches\")\n# → True\nawait page.evaluate(\"matchMedia('print').matches\")\n# → False\n\nawait page.emulate_media(media=\"print\")\nawait page.evaluate(\"matchMedia('screen').matches\")\n# → False\nawait page.evaluate(\"matchMedia('print').matches\")\n# → True\n\nawait page.emulate_media()\nawait page.evaluate(\"matchMedia('screen').matches\")\n# → True\nawait page.evaluate(\"matchMedia('print').matches\")\n# → False\n```\n\n```python sync\npage.evaluate(\"matchMedia('screen').matches\")\n# → True\npage.evaluate(\"matchMedia('print').matches\")\n# → False\n\npage.emulate_media(media=\"print\")\npage.evaluate(\"matchMedia('screen').matches\")\n# → False\npage.evaluate(\"matchMedia('print').matches\")\n# → True\n\npage.emulate_media()\npage.evaluate(\"matchMedia('screen').matches\")\n# → True\npage.evaluate(\"matchMedia('print').matches\")\n# → False\n```\n\n```csharp\nawait page.EvaluateAsync(\"() => matchMedia('screen').matches\");\n// → true\nawait page.EvaluateAsync(\"() => matchMedia('print').matches\");\n// → false\n\nawait page.EmulateMediaAsync(new PageEmulateMediaOptions { Media = Media.Print });\nawait page.EvaluateAsync(\"() => matchMedia('screen').matches\");\n// → false\nawait page.EvaluateAsync(\"() => matchMedia('print').matches\");\n// → true\n\nawait page.EmulateMediaAsync(new PageEmulateMediaOptions { Media = Media.Screen });\nawait page.EvaluateAsync(\"() => matchMedia('screen').matches\");\n// → true\nawait page.EvaluateAsync(\"() => matchMedia('print').matches\");\n// → false\n```\n\n```js\nawait page.emulateMedia({ colorScheme: 'dark' });\nawait page.evaluate(() => matchMedia('(prefers-color-scheme: dark)').matches);\n// → true\nawait page.evaluate(() => matchMedia('(prefers-color-scheme: light)').matches);\n// → false\nawait page.evaluate(() => matchMedia('(prefers-color-scheme: no-preference)').matches);\n// → false\n```\n\n```java\npage.emulateMedia(new Page.EmulateMediaOptions().setColorScheme(ColorScheme.DARK));\npage.evaluate(\"() => matchMedia('(prefers-color-scheme: dark)').matches\");\n// → true\npage.evaluate(\"() => matchMedia('(prefers-color-scheme: light)').matches\");\n// → false\npage.evaluate(\"() => matchMedia('(prefers-color-scheme: no-preference)').matches\");\n// → false\n```\n\n```python async\nawait page.emulate_media(color_scheme=\"dark\")\nawait page.evaluate(\"matchMedia('(prefers-color-scheme: dark)').matches\")\n# → True\nawait page.evaluate(\"matchMedia('(prefers-color-scheme: light)').matches\")\n# → False\nawait page.evaluate(\"matchMedia('(prefers-color-scheme: no-preference)').matches\")\n# → False\n```\n\n```python sync\npage.emulate_media(color_scheme=\"dark\")\npage.evaluate(\"matchMedia('(prefers-color-scheme: dark)').matches\")\n# → True\npage.evaluate(\"matchMedia('(prefers-color-scheme: light)').matches\")\n# → False\npage.evaluate(\"matchMedia('(prefers-color-scheme: no-preference)').matches\")\n```\n\n```csharp\nawait page.EmulateMediaAsync(new PageEmulateMediaOptions { ColorScheme = ColorScheme.Dark });\nawait page.EvaluateAsync(\"matchMedia('(prefers-color-scheme: dark)').matches\");\n// → true\nawait page.EvaluateAsync(\"matchMedia('(prefers-color-scheme: light)').matches\");\n// → false\nawait page.EvaluateAsync(\"matchMedia('(prefers-color-scheme: no-preference)').matches\");\n// → false\n```\n","deprecated":false,"async":true,"alias":"emulateMedia","args":[{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{"only":["js","python","java"],"aliases":{},"types":{},"overrides":{}},"name":"colorScheme","type":{"name":"","union":[{"name":"null"},{"name":"ColorScheme","union":[{"name":"\"light\""},{"name":"\"dark\""},{"name":"\"no-preference\""}]}],"expression":"null|[ColorScheme]<\"light\"|\"dark\"|\"no-preference\">"},"spec":[{"type":"text","text":"Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. Passing `null` disables color scheme emulation."}],"required":false,"comment":"Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. Passing\n`null` disables color scheme emulation.","deprecated":false,"async":false,"alias":"colorScheme"},{"kind":"property","langs":{"only":["csharp"],"aliases":{},"types":{},"overrides":{}},"name":"colorScheme","type":{"name":"ColorScheme","union":[{"name":"\"light\""},{"name":"\"dark\""},{"name":"\"no-preference\""},{"name":"\"null\""}],"expression":"[ColorScheme]<\"light\"|\"dark\"|\"no-preference\"|\"null\">"},"spec":[{"type":"text","text":"Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. Passing `'Null'` disables color scheme emulation."}],"required":false,"comment":"Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. Passing\n`'Null'` disables color scheme emulation.","deprecated":false,"async":false,"alias":"colorScheme"},{"kind":"property","langs":{"only":["js","python","java"],"aliases":{},"types":{},"overrides":{}},"name":"media","type":{"name":"","union":[{"name":"null"},{"name":"Media","union":[{"name":"\"screen\""},{"name":"\"print\""}]}],"expression":"null|[Media]<\"screen\"|\"print\">"},"spec":[{"type":"text","text":"Changes the CSS media type of the page. The only allowed values are `'screen'`, `'print'` and `null`. Passing `null` disables CSS media emulation."}],"required":false,"comment":"Changes the CSS media type of the page. The only allowed values are `'screen'`, `'print'` and `null`. Passing `null`\ndisables CSS media emulation.","deprecated":false,"async":false,"alias":"media"},{"kind":"property","langs":{"only":["csharp"],"aliases":{},"types":{},"overrides":{}},"name":"media","type":{"name":"Media","union":[{"name":"\"screen\""},{"name":"\"print\""},{"name":"\"null\""}],"expression":"[Media]<\"screen\"|\"print\"|\"null\">"},"spec":[{"type":"text","text":"Changes the CSS media type of the page. The only allowed values are `'Screen'`, `'Print'` and `'Null'`. Passing `'Null'` disables CSS media emulation."}],"required":false,"comment":"Changes the CSS media type of the page. The only allowed values are `'Screen'`, `'Print'` and `'Null'`. Passing `'Null'`\ndisables CSS media emulation.","deprecated":false,"async":false,"alias":"media"},{"kind":"property","langs":{"only":["js","python","java"],"aliases":{},"types":{},"overrides":{}},"name":"reducedMotion","type":{"name":"","union":[{"name":"null"},{"name":"ReducedMotion","union":[{"name":"\"reduce\""},{"name":"\"no-preference\""}]}],"expression":"null|[ReducedMotion]<\"reduce\"|\"no-preference\">"},"spec":[{"type":"text","text":"Emulates `'prefers-reduced-motion'` media feature, supported values are `'reduce'`, `'no-preference'`. Passing `null` disables reduced motion emulation."}],"required":false,"comment":"Emulates `'prefers-reduced-motion'` media feature, supported values are `'reduce'`, `'no-preference'`. Passing `null`\ndisables reduced motion emulation.","deprecated":false,"async":false,"alias":"reducedMotion"},{"kind":"property","langs":{"only":["csharp"],"aliases":{},"types":{},"overrides":{}},"name":"reducedMotion","type":{"name":"ReducedMotion","union":[{"name":"\"reduce\""},{"name":"\"no-preference\""},{"name":"\"null\""}],"expression":"[ReducedMotion]<\"reduce\"|\"no-preference\"|\"null\">"},"spec":[{"type":"text","text":"Emulates `'prefers-reduced-motion'` media feature, supported values are `'reduce'`, `'no-preference'`. Passing `null` disables reduced motion emulation."}],"required":false,"comment":"Emulates `'prefers-reduced-motion'` media feature, supported values are `'reduce'`, `'no-preference'`. Passing `null`\ndisables reduced motion emulation.","deprecated":false,"async":false,"alias":"reducedMotion"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{"aliases":{"python":"eval_on_selector","js":"$eval"},"types":{},"overrides":{}},"name":"evalOnSelector","type":{"name":"Serializable","expression":"[Serializable]"},"spec":[{"type":"text","text":"The method finds an element matching the specified selector within the page and passes it as a first argument to `expression`. If no elements match the selector, the method throws an error. Returns the value of `expression`."},{"type":"text","text":"If `expression` returns a [Promise], then [`method: Page.evalOnSelector`] would wait for the promise to resolve and return its value."},{"type":"text","text":"Examples:"},{"type":"code","lines":["const searchValue = await page.$eval('#search', el => el.value);","const preloadHref = await page.$eval('link[rel=preload]', el => el.href);","const html = await page.$eval('.main-container', (e, suffix) => e.outerHTML + suffix, 'hello');","// In TypeScript, this example requires an explicit type annotation (HTMLLinkElement) on el:","const preloadHrefTS = await page.$eval('link[rel=preload]', (el: HTMLLinkElement) => el.href);"],"codeLang":"js"},{"type":"code","lines":["String searchValue = (String) page.evalOnSelector(\"#search\", \"el => el.value\");","String preloadHref = (String) page.evalOnSelector(\"link[rel=preload]\", \"el => el.href\");","String html = (String) page.evalOnSelector(\".main-container\", \"(e, suffix) => e.outerHTML + suffix\", \"hello\");"],"codeLang":"java"},{"type":"code","lines":["search_value = await page.eval_on_selector(\"#search\", \"el => el.value\")","preload_href = await page.eval_on_selector(\"link[rel=preload]\", \"el => el.href\")","html = await page.eval_on_selector(\".main-container\", \"(e, suffix) => e.outer_html + suffix\", \"hello\")"],"codeLang":"python async"},{"type":"code","lines":["search_value = page.eval_on_selector(\"#search\", \"el => el.value\")","preload_href = page.eval_on_selector(\"link[rel=preload]\", \"el => el.href\")","html = page.eval_on_selector(\".main-container\", \"(e, suffix) => e.outer_html + suffix\", \"hello\")"],"codeLang":"python sync"},{"type":"code","lines":["var searchValue = await page.EvalOnSelectorAsync<string>(\"#search\", \"el => el.value\");","var preloadHref = await page.EvalOnSelectorAsync<string>(\"link[rel=preload]\", \"el => el.href\");","var html = await page.EvalOnSelectorAsync(\".main-container\", \"(e, suffix) => e.outerHTML + suffix\", \"hello\");"],"codeLang":"csharp"},{"type":"text","text":"Shortcut for main frame's [`method: Frame.evalOnSelector`]."}],"required":true,"comment":"The method finds an element matching the specified selector within the page and passes it as a first argument to\n`expression`. If no elements match the selector, the method throws an error. Returns the value of `expression`.\n\nIf `expression` returns a [Promise], then [`method: Page.evalOnSelector`] would wait for the promise to resolve and\nreturn its value.\n\nExamples:\n\n```js\nconst searchValue = await page.$eval('#search', el => el.value);\nconst preloadHref = await page.$eval('link[rel=preload]', el => el.href);\nconst html = await page.$eval('.main-container', (e, suffix) => e.outerHTML + suffix, 'hello');\n// In TypeScript, this example requires an explicit type annotation (HTMLLinkElement) on el:\nconst preloadHrefTS = await page.$eval('link[rel=preload]', (el: HTMLLinkElement) => el.href);\n```\n\n```java\nString searchValue = (String) page.evalOnSelector(\"#search\", \"el => el.value\");\nString preloadHref = (String) page.evalOnSelector(\"link[rel=preload]\", \"el => el.href\");\nString html = (String) page.evalOnSelector(\".main-container\", \"(e, suffix) => e.outerHTML + suffix\", \"hello\");\n```\n\n```python async\nsearch_value = await page.eval_on_selector(\"#search\", \"el => el.value\")\npreload_href = await page.eval_on_selector(\"link[rel=preload]\", \"el => el.href\")\nhtml = await page.eval_on_selector(\".main-container\", \"(e, suffix) => e.outer_html + suffix\", \"hello\")\n```\n\n```python sync\nsearch_value = page.eval_on_selector(\"#search\", \"el => el.value\")\npreload_href = page.eval_on_selector(\"link[rel=preload]\", \"el => el.href\")\nhtml = page.eval_on_selector(\".main-container\", \"(e, suffix) => e.outer_html + suffix\", \"hello\")\n```\n\n```csharp\nvar searchValue = await page.EvalOnSelectorAsync<string>(\"#search\", \"el => el.value\");\nvar preloadHref = await page.EvalOnSelectorAsync<string>(\"link[rel=preload]\", \"el => el.href\");\nvar html = await page.EvalOnSelectorAsync(\".main-container\", \"(e, suffix) => e.outerHTML + suffix\", \"hello\");\n```\n\nShortcut for main frame's [`method: Frame.evalOnSelector`].","deprecated":false,"async":true,"alias":"evalOnSelector","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to query for. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to query for. See [working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{"overrides":{"js":{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"expression","type":{"name":"function","args":[{"name":"Element"}],"returnType":null,"expression":"[function]([Element])"},"spec":[{"type":"text","text":"Function to be evaluated in the page context."}],"argsArray":[],"required":true,"comment":"","args":{},"clazz":null,"deprecated":false,"async":false,"alias":"pageFunction"}}},"name":"expression","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted as a function. Otherwise, evaluated as an expression."}],"required":true,"comment":"JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted\nas a function. Otherwise, evaluated as an expression.","deprecated":false,"async":false,"alias":"expression"},{"kind":"property","langs":{},"name":"arg","type":{"name":"EvaluationArgument","expression":"[EvaluationArgument]"},"spec":[{"type":"text","text":"Optional argument to pass to `expression`."}],"required":false,"comment":"Optional argument to pass to `expression`.","deprecated":false,"async":false,"alias":"arg"}]},{"kind":"method","langs":{"aliases":{"python":"eval_on_selector_all","js":"$$eval"},"types":{},"overrides":{}},"name":"evalOnSelectorAll","type":{"name":"Serializable","expression":"[Serializable]"},"spec":[{"type":"text","text":"The method finds all elements matching the specified selector within the page and passes an array of matched elements as a first argument to `expression`. Returns the result of `expression` invocation."},{"type":"text","text":"If `expression` returns a [Promise], then [`method: Page.evalOnSelectorAll`] would wait for the promise to resolve and return its value."},{"type":"text","text":"Examples:"},{"type":"code","lines":["const divCounts = await page.$$eval('div', (divs, min) => divs.length >= min, 10);"],"codeLang":"js"},{"type":"code","lines":["boolean divCounts = (boolean) page.evalOnSelectorAll(\"div\", \"(divs, min) => divs.length >= min\", 10);"],"codeLang":"java"},{"type":"code","lines":["div_counts = await page.eval_on_selector_all(\"div\", \"(divs, min) => divs.length >= min\", 10)"],"codeLang":"python async"},{"type":"code","lines":["div_counts = page.eval_on_selector_all(\"div\", \"(divs, min) => divs.length >= min\", 10)"],"codeLang":"python sync"},{"type":"code","lines":["var divsCount = await page.EvalOnSelectorAllAsync<bool>(\"div\", \"(divs, min) => divs.length >= min\", 10);"],"codeLang":"csharp"}],"required":true,"comment":"The method finds all elements matching the specified selector within the page and passes an array of matched elements as\na first argument to `expression`. Returns the result of `expression` invocation.\n\nIf `expression` returns a [Promise], then [`method: Page.evalOnSelectorAll`] would wait for the promise to resolve and\nreturn its value.\n\nExamples:\n\n```js\nconst divCounts = await page.$$eval('div', (divs, min) => divs.length >= min, 10);\n```\n\n```java\nboolean divCounts = (boolean) page.evalOnSelectorAll(\"div\", \"(divs, min) => divs.length >= min\", 10);\n```\n\n```python async\ndiv_counts = await page.eval_on_selector_all(\"div\", \"(divs, min) => divs.length >= min\", 10)\n```\n\n```python sync\ndiv_counts = page.eval_on_selector_all(\"div\", \"(divs, min) => divs.length >= min\", 10)\n```\n\n```csharp\nvar divsCount = await page.EvalOnSelectorAllAsync<bool>(\"div\", \"(divs, min) => divs.length >= min\", 10);\n```\n","deprecated":false,"async":true,"alias":"evalOnSelectorAll","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to query for. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to query for. See [working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{"overrides":{"js":{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"expression","type":{"name":"function","args":[{"name":"Array","templates":[{"name":"Element"}]}],"returnType":null,"expression":"[function]([Array]<[Element]>)"},"spec":[{"type":"text","text":"Function to be evaluated in the page context."}],"argsArray":[],"required":true,"comment":"","args":{},"clazz":null,"deprecated":false,"async":false,"alias":"pageFunction"}}},"name":"expression","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted as a function. Otherwise, evaluated as an expression."}],"required":true,"comment":"JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted\nas a function. Otherwise, evaluated as an expression.","deprecated":false,"async":false,"alias":"expression"},{"kind":"property","langs":{},"name":"arg","type":{"name":"EvaluationArgument","expression":"[EvaluationArgument]"},"spec":[{"type":"text","text":"Optional argument to pass to `expression`."}],"required":false,"comment":"Optional argument to pass to `expression`.","deprecated":false,"async":false,"alias":"arg"}]},{"kind":"method","langs":{},"name":"evaluate","type":{"name":"Serializable","expression":"[Serializable]"},"spec":[{"type":"text","text":"Returns the value of the `expression` invocation."},{"type":"text","text":"If the function passed to the [`method: Page.evaluate`] returns a [Promise], then [`method: Page.evaluate`] would wait for the promise to resolve and return its value."},{"type":"text","text":"If the function passed to the [`method: Page.evaluate`] returns a non-[Serializable] value, then [`method: Page.evaluate`] resolves to `undefined`. Playwright also supports transferring some additional values that are not serializable by `JSON`: `-0`, `NaN`, `Infinity`, `-Infinity`."},{"type":"text","text":"Passing argument to `expression`:"},{"type":"code","lines":["const result = await page.evaluate(([x, y]) => {"," return Promise.resolve(x * y);","}, [7, 8]);","console.log(result); // prints \"56\""],"codeLang":"js"},{"type":"code","lines":["Object result = page.evaluate(\"([x, y]) => {\\n\" +"," \" return Promise.resolve(x * y);\\n\" +"," \"}\", Arrays.asList(7, 8));","System.out.println(result); // prints \"56\""],"codeLang":"java"},{"type":"code","lines":["result = await page.evaluate(\"([x, y]) => Promise.resolve(x * y)\", [7, 8])","print(result) # prints \"56\""],"codeLang":"python async"},{"type":"code","lines":["result = page.evaluate(\"([x, y]) => Promise.resolve(x * y)\", [7, 8])","print(result) # prints \"56\""],"codeLang":"python sync"},{"type":"code","lines":["var result = await page.EvaluateAsync<int>(\"([x, y]) => Promise.resolve(x * y)\", new[] { 7, 8 });","Console.WriteLine(result);"],"codeLang":"csharp"},{"type":"text","text":"A string can also be passed in instead of a function:"},{"type":"code","lines":["console.log(await page.evaluate('1 + 2')); // prints \"3\"","const x = 10;","console.log(await page.evaluate(`1 + ${x}`)); // prints \"11\""],"codeLang":"js"},{"type":"code","lines":["System.out.println(page.evaluate(\"1 + 2\")); // prints \"3\""],"codeLang":"java"},{"type":"code","lines":["print(await page.evaluate(\"1 + 2\")) # prints \"3\"","x = 10","print(await page.evaluate(f\"1 + {x}\")) # prints \"11\""],"codeLang":"python async"},{"type":"code","lines":["print(page.evaluate(\"1 + 2\")) # prints \"3\"","x = 10","print(page.evaluate(f\"1 + {x}\")) # prints \"11\""],"codeLang":"python sync"},{"type":"code","lines":["Console.WriteLine(await page.EvaluateAsync<int>(\"1 + 2\")); // prints \"3\""],"codeLang":"csharp"},{"type":"text","text":"`ElementHandle` instances can be passed as an argument to the [`method: Page.evaluate`]:"},{"type":"code","lines":["const bodyHandle = await page.$('body');","const html = await page.evaluate(([body, suffix]) => body.innerHTML + suffix, [bodyHandle, 'hello']);","await bodyHandle.dispose();"],"codeLang":"js"},{"type":"code","lines":["ElementHandle bodyHandle = page.querySelector(\"body\");","String html = (String) page.evaluate(\"([body, suffix]) => body.innerHTML + suffix\", Arrays.asList(bodyHandle, \"hello\"));","bodyHandle.dispose();"],"codeLang":"java"},{"type":"code","lines":["body_handle = await page.query_selector(\"body\")","html = await page.evaluate(\"([body, suffix]) => body.innerHTML + suffix\", [body_handle, \"hello\"])","await body_handle.dispose()"],"codeLang":"python async"},{"type":"code","lines":["body_handle = page.query_selector(\"body\")","html = page.evaluate(\"([body, suffix]) => body.innerHTML + suffix\", [body_handle, \"hello\"])","body_handle.dispose()"],"codeLang":"python sync"},{"type":"code","lines":["var bodyHandle = await page.QuerySelectorAsync(\"body\");","var html = await page.EvaluateAsync<string>(\"([body, suffix]) => body.innerHTML + suffix\", new object [] { bodyHandle, \"hello\" });","await bodyHandle.DisposeAsync();"],"codeLang":"csharp"},{"type":"text","text":"Shortcut for main frame's [`method: Frame.evaluate`]."}],"required":true,"comment":"Returns the value of the `expression` invocation.\n\nIf the function passed to the [`method: Page.evaluate`] returns a [Promise], then [`method: Page.evaluate`] would wait\nfor the promise to resolve and return its value.\n\nIf the function passed to the [`method: Page.evaluate`] returns a non-[Serializable] value, then\n[`method: Page.evaluate`] resolves to `undefined`. Playwright also supports transferring some additional values that are\nnot serializable by `JSON`: `-0`, `NaN`, `Infinity`, `-Infinity`.\n\nPassing argument to `expression`:\n\n```js\nconst result = await page.evaluate(([x, y]) => {\n return Promise.resolve(x * y);\n}, [7, 8]);\nconsole.log(result); // prints \"56\"\n```\n\n```java\nObject result = page.evaluate(\"([x, y]) => {\\n\" +\n \" return Promise.resolve(x * y);\\n\" +\n \"}\", Arrays.asList(7, 8));\nSystem.out.println(result); // prints \"56\"\n```\n\n```python async\nresult = await page.evaluate(\"([x, y]) => Promise.resolve(x * y)\", [7, 8])\nprint(result) # prints \"56\"\n```\n\n```python sync\nresult = page.evaluate(\"([x, y]) => Promise.resolve(x * y)\", [7, 8])\nprint(result) # prints \"56\"\n```\n\n```csharp\nvar result = await page.EvaluateAsync<int>(\"([x, y]) => Promise.resolve(x * y)\", new[] { 7, 8 });\nConsole.WriteLine(result);\n```\n\nA string can also be passed in instead of a function:\n\n```js\nconsole.log(await page.evaluate('1 + 2')); // prints \"3\"\nconst x = 10;\nconsole.log(await page.evaluate(`1 + ${x}`)); // prints \"11\"\n```\n\n```java\nSystem.out.println(page.evaluate(\"1 + 2\")); // prints \"3\"\n```\n\n```python async\nprint(await page.evaluate(\"1 + 2\")) # prints \"3\"\nx = 10\nprint(await page.evaluate(f\"1 + {x}\")) # prints \"11\"\n```\n\n```python sync\nprint(page.evaluate(\"1 + 2\")) # prints \"3\"\nx = 10\nprint(page.evaluate(f\"1 + {x}\")) # prints \"11\"\n```\n\n```csharp\nConsole.WriteLine(await page.EvaluateAsync<int>(\"1 + 2\")); // prints \"3\"\n```\n\n`ElementHandle` instances can be passed as an argument to the [`method: Page.evaluate`]:\n\n```js\nconst bodyHandle = await page.$('body');\nconst html = await page.evaluate(([body, suffix]) => body.innerHTML + suffix, [bodyHandle, 'hello']);\nawait bodyHandle.dispose();\n```\n\n```java\nElementHandle bodyHandle = page.querySelector(\"body\");\nString html = (String) page.evaluate(\"([body, suffix]) => body.innerHTML + suffix\", Arrays.asList(bodyHandle, \"hello\"));\nbodyHandle.dispose();\n```\n\n```python async\nbody_handle = await page.query_selector(\"body\")\nhtml = await page.evaluate(\"([body, suffix]) => body.innerHTML + suffix\", [body_handle, \"hello\"])\nawait body_handle.dispose()\n```\n\n```python sync\nbody_handle = page.query_selector(\"body\")\nhtml = page.evaluate(\"([body, suffix]) => body.innerHTML + suffix\", [body_handle, \"hello\"])\nbody_handle.dispose()\n```\n\n```csharp\nvar bodyHandle = await page.QuerySelectorAsync(\"body\");\nvar html = await page.EvaluateAsync<string>(\"([body, suffix]) => body.innerHTML + suffix\", new object [] { bodyHandle, \"hello\" });\nawait bodyHandle.DisposeAsync();\n```\n\nShortcut for main frame's [`method: Frame.evaluate`].","deprecated":false,"async":true,"alias":"evaluate","args":[{"kind":"property","langs":{"overrides":{"js":{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"expression","type":{"name":"","union":[{"name":"function"},{"name":"string"}],"expression":"[function]|[string]"},"spec":[{"type":"text","text":"Function to be evaluated in the page context."}],"argsArray":[],"required":true,"comment":"","args":{},"clazz":null,"deprecated":false,"async":false,"alias":"pageFunction"}}},"name":"expression","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted as a function. Otherwise, evaluated as an expression."}],"required":true,"comment":"JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted\nas a function. Otherwise, evaluated as an expression.","deprecated":false,"async":false,"alias":"expression"},{"kind":"property","langs":{},"name":"arg","type":{"name":"EvaluationArgument","expression":"[EvaluationArgument]"},"spec":[{"type":"text","text":"Optional argument to pass to `expression`."}],"required":false,"comment":"Optional argument to pass to `expression`.","deprecated":false,"async":false,"alias":"arg"}]},{"kind":"method","langs":{},"name":"evaluateHandle","type":{"name":"JSHandle","expression":"[JSHandle]"},"spec":[{"type":"text","text":"Returns the value of the `expression` invocation as a `JSHandle`."},{"type":"text","text":"The only difference between [`method: Page.evaluate`] and [`method: Page.evaluateHandle`] is that [`method: Page.evaluateHandle`] returns `JSHandle`."},{"type":"text","text":"If the function passed to the [`method: Page.evaluateHandle`] returns a [Promise], then [`method: Page.evaluateHandle`] would wait for the promise to resolve and return its value."},{"type":"code","lines":["const aWindowHandle = await page.evaluateHandle(() => Promise.resolve(window));","aWindowHandle; // Handle for the window object."],"codeLang":"js"},{"type":"code","lines":["// Handle for the window object.","JSHandle aWindowHandle = page.evaluateHandle(\"() => Promise.resolve(window)\");"],"codeLang":"java"},{"type":"code","lines":["a_window_handle = await page.evaluate_handle(\"Promise.resolve(window)\")","a_window_handle # handle for the window object."],"codeLang":"python async"},{"type":"code","lines":["a_window_handle = page.evaluate_handle(\"Promise.resolve(window)\")","a_window_handle # handle for the window object."],"codeLang":"python sync"},{"type":"code","lines":["// Handle for the window object.","var aWindowHandle = await page.EvaluateHandleAsync(\"() => Promise.resolve(window)\");"],"codeLang":"csharp"},{"type":"text","text":"A string can also be passed in instead of a function:"},{"type":"code","lines":["const aHandle = await page.evaluateHandle('document'); // Handle for the 'document'"],"codeLang":"js"},{"type":"code","lines":["JSHandle aHandle = page.evaluateHandle(\"document\"); // Handle for the \"document\"."],"codeLang":"java"},{"type":"code","lines":["a_handle = await page.evaluate_handle(\"document\") # handle for the \"document\""],"codeLang":"python async"},{"type":"code","lines":["a_handle = page.evaluate_handle(\"document\") # handle for the \"document\""],"codeLang":"python sync"},{"type":"code","lines":["var docHandle = await page.EvalueHandleAsync(\"document\"); // Handle for the `document`"],"codeLang":"csharp"},{"type":"text","text":"`JSHandle` instances can be passed as an argument to the [`method: Page.evaluateHandle`]:"},{"type":"code","lines":["const aHandle = await page.evaluateHandle(() => document.body);","const resultHandle = await page.evaluateHandle(body => body.innerHTML, aHandle);","console.log(await resultHandle.jsonValue());","await resultHandle.dispose();"],"codeLang":"js"},{"type":"code","lines":["JSHandle aHandle = page.evaluateHandle(\"() => document.body\");","JSHandle resultHandle = page.evaluateHandle(\"([body, suffix]) => body.innerHTML + suffix\", Arrays.asList(aHandle, \"hello\"));","System.out.println(resultHandle.jsonValue());","resultHandle.dispose();"],"codeLang":"java"},{"type":"code","lines":["a_handle = await page.evaluate_handle(\"document.body\")","result_handle = await page.evaluate_handle(\"body => body.innerHTML\", a_handle)","print(await result_handle.json_value())","await result_handle.dispose()"],"codeLang":"python async"},{"type":"code","lines":["a_handle = page.evaluate_handle(\"document.body\")","result_handle = page.evaluate_handle(\"body => body.innerHTML\", a_handle)","print(result_handle.json_value())","result_handle.dispose()"],"codeLang":"python sync"},{"type":"code","lines":["var handle = await page.EvaluateHandleAsync(\"() => document.body\");","var resultHandle = await page.EvaluateHandleAsync(\"([body, suffix]) => body.innerHTML + suffix\", new object[] { handle, \"hello\" });","Console.WriteLine(await resultHandle.JsonValueAsync<string>());","await resultHandle.DisposeAsync();"],"codeLang":"csharp"}],"required":true,"comment":"Returns the value of the `expression` invocation as a `JSHandle`.\n\nThe only difference between [`method: Page.evaluate`] and [`method: Page.evaluateHandle`] is that\n[`method: Page.evaluateHandle`] returns `JSHandle`.\n\nIf the function passed to the [`method: Page.evaluateHandle`] returns a [Promise], then [`method: Page.evaluateHandle`]\nwould wait for the promise to resolve and return its value.\n\n```js\nconst aWindowHandle = await page.evaluateHandle(() => Promise.resolve(window));\naWindowHandle; // Handle for the window object.\n```\n\n```java\n// Handle for the window object.\nJSHandle aWindowHandle = page.evaluateHandle(\"() => Promise.resolve(window)\");\n```\n\n```python async\na_window_handle = await page.evaluate_handle(\"Promise.resolve(window)\")\na_window_handle # handle for the window object.\n```\n\n```python sync\na_window_handle = page.evaluate_handle(\"Promise.resolve(window)\")\na_window_handle # handle for the window object.\n```\n\n```csharp\n// Handle for the window object.\nvar aWindowHandle = await page.EvaluateHandleAsync(\"() => Promise.resolve(window)\");\n```\n\nA string can also be passed in instead of a function:\n\n```js\nconst aHandle = await page.evaluateHandle('document'); // Handle for the 'document'\n```\n\n```java\nJSHandle aHandle = page.evaluateHandle(\"document\"); // Handle for the \"document\".\n```\n\n```python async\na_handle = await page.evaluate_handle(\"document\") # handle for the \"document\"\n```\n\n```python sync\na_handle = page.evaluate_handle(\"document\") # handle for the \"document\"\n```\n\n```csharp\nvar docHandle = await page.EvalueHandleAsync(\"document\"); // Handle for the `document`\n```\n\n`JSHandle` instances can be passed as an argument to the [`method: Page.evaluateHandle`]:\n\n```js\nconst aHandle = await page.evaluateHandle(() => document.body);\nconst resultHandle = await page.evaluateHandle(body => body.innerHTML, aHandle);\nconsole.log(await resultHandle.jsonValue());\nawait resultHandle.dispose();\n```\n\n```java\nJSHandle aHandle = page.evaluateHandle(\"() => document.body\");\nJSHandle resultHandle = page.evaluateHandle(\"([body, suffix]) => body.innerHTML + suffix\", Arrays.asList(aHandle, \"hello\"));\nSystem.out.println(resultHandle.jsonValue());\nresultHandle.dispose();\n```\n\n```python async\na_handle = await page.evaluate_handle(\"document.body\")\nresult_handle = await page.evaluate_handle(\"body => body.innerHTML\", a_handle)\nprint(await result_handle.json_value())\nawait result_handle.dispose()\n```\n\n```python sync\na_handle = page.evaluate_handle(\"document.body\")\nresult_handle = page.evaluate_handle(\"body => body.innerHTML\", a_handle)\nprint(result_handle.json_value())\nresult_handle.dispose()\n```\n\n```csharp\nvar handle = await page.EvaluateHandleAsync(\"() => document.body\");\nvar resultHandle = await page.EvaluateHandleAsync(\"([body, suffix]) => body.innerHTML + suffix\", new object[] { handle, \"hello\" });\nConsole.WriteLine(await resultHandle.JsonValueAsync<string>());\nawait resultHandle.DisposeAsync();\n```\n","deprecated":false,"async":true,"alias":"evaluateHandle","args":[{"kind":"property","langs":{"overrides":{"js":{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"expression","type":{"name":"","union":[{"name":"function"},{"name":"string"}],"expression":"[function]|[string]"},"spec":[{"type":"text","text":"Function to be evaluated in the page context."}],"argsArray":[],"required":true,"comment":"","args":{},"clazz":null,"deprecated":false,"async":false,"alias":"pageFunction"}}},"name":"expression","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted as a function. Otherwise, evaluated as an expression."}],"required":true,"comment":"JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted\nas a function. Otherwise, evaluated as an expression.","deprecated":false,"async":false,"alias":"expression"},{"kind":"property","langs":{},"name":"arg","type":{"name":"EvaluationArgument","expression":"[EvaluationArgument]"},"spec":[{"type":"text","text":"Optional argument to pass to `expression`."}],"required":false,"comment":"Optional argument to pass to `expression`.","deprecated":false,"async":false,"alias":"arg"}]},{"kind":"method","langs":{},"name":"exposeBinding","type":{"name":"void"},"spec":[{"type":"text","text":"The method adds a function called `name` on the `window` object of every frame in this page. When called, the function executes `callback` and returns a [Promise] which resolves to the return value of `callback`. If the `callback` returns a [Promise], it will be awaited."},{"type":"text","text":"The first argument of the `callback` function contains information about the caller: `{ browserContext: BrowserContext, page: Page, frame: Frame }`."},{"type":"text","text":"See [`method: BrowserContext.exposeBinding`] for the context-wide version."},{"type":"note","noteType":"note","text":"Functions installed via [`method: Page.exposeBinding`] survive navigations."},{"type":"text","text":"An example of exposing page URL to all frames in a page:"},{"type":"code","lines":["const { webkit } = require('playwright'); // Or 'chromium' or 'firefox'.","","(async () => {"," const browser = await webkit.launch({ headless: false });"," const context = await browser.newContext();"," const page = await context.newPage();"," await page.exposeBinding('pageURL', ({ page }) => page.url());"," await page.setContent(`"," <script>"," async function onClick() {"," document.querySelector('div').textContent = await window.pageURL();"," }"," </script>"," <button onclick=\"onClick()\">Click me</button>"," <div></div>"," `);"," await page.click('button');","})();"],"codeLang":"js"},{"type":"code","lines":["import com.microsoft.playwright.*;","","public class Example {"," public static void main(String[] args) {"," try (Playwright playwright = Playwright.create()) {"," BrowserType webkit = playwright.webkit();"," Browser browser = webkit.launch({ headless: false });"," BrowserContext context = browser.newContext();"," Page page = context.newPage();"," page.exposeBinding(\"pageURL\", (source, args) -> source.page().url());"," page.setContent(\"<script>\\n\" +"," \" async function onClick() {\\n\" +"," \" document.querySelector('div').textContent = await window.pageURL();\\n\" +"," \" }\\n\" +"," \"</script>\\n\" +"," \"<button onclick=\\\"onClick()\\\">Click me</button>\\n\" +"," \"<div></div>\");"," page.click(\"button\");"," }"," }","}"],"codeLang":"java"},{"type":"code","lines":["import asyncio","from playwright.async_api import async_playwright","","async def run(playwright):"," webkit = playwright.webkit"," browser = await webkit.launch(headless=false)"," context = await browser.new_context()"," page = await context.new_page()"," await page.expose_binding(\"pageURL\", lambda source: source[\"page\"].url)"," await page.set_content(\"\"\""," <script>"," async function onClick() {"," document.querySelector('div').textContent = await window.pageURL();"," }"," </script>"," <button onclick=\"onClick()\">Click me</button>"," <div></div>"," \"\"\")"," await page.click(\"button\")","","async def main():"," async with async_playwright() as playwright:"," await run(playwright)","asyncio.run(main())"],"codeLang":"python async"},{"type":"code","lines":["from playwright.sync_api import sync_playwright","","def run(playwright):"," webkit = playwright.webkit"," browser = webkit.launch(headless=false)"," context = browser.new_context()"," page = context.new_page()"," page.expose_binding(\"pageURL\", lambda source: source[\"page\"].url)"," page.set_content(\"\"\""," <script>"," async function onClick() {"," document.querySelector('div').textContent = await window.pageURL();"," }"," </script>"," <button onclick=\"onClick()\">Click me</button>"," <div></div>"," \"\"\")"," page.click(\"button\")","","with sync_playwright() as playwright:"," run(playwright)"],"codeLang":"python sync"},{"type":"code","lines":["using Microsoft.Playwright;","using System.Threading.Tasks;","","class PageExamples","{"," public static async Task Main()"," {"," using var playwright = await Playwright.CreateAsync();"," await using var browser = await playwright.Webkit.LaunchAsync(new BrowserTypeLaunchOptions"," {"," Headless: false"," });"," var page = await browser.NewPageAsync();",""," await page.ExposeBindingAsync(\"pageUrl\", (source) => source.Page.Url);"," await page.SetContentAsync(\"<script>\\n\" +"," \" async function onClick() {\\n\" +"," \" document.querySelector('div').textContent = await window.pageURL();\\n\" +"," \" }\\n\" +"," \"</script>\\n\" +"," \"<button onclick=\\\"onClick()\\\">Click me</button>\\n\" +"," \"<div></div>\");",""," await page.ClickAsync(\"button\");"," }","}"],"codeLang":"csharp"},{"type":"text","text":"An example of passing an element handle:"},{"type":"code","lines":["await page.exposeBinding('clicked', async (source, element) => {"," console.log(await element.textContent());","}, { handle: true });","await page.setContent(`"," <script>"," document.addEventListener('click', event => window.clicked(event.target));"," </script>"," <div>Click me</div>"," <div>Or click me</div>","`);"],"codeLang":"js"},{"type":"code","lines":["page.exposeBinding(\"clicked\", (source, args) -> {"," ElementHandle element = (ElementHandle) args[0];"," System.out.println(element.textContent());"," return null;","}, new Page.ExposeBindingOptions().setHandle(true));","page.setContent(\"\" +"," \"<script>\\n\" +"," \" document.addEventListener('click', event => window.clicked(event.target));\\n\" +"," \"</script>\\n\" +"," \"<div>Click me</div>\\n\" +"," \"<div>Or click me</div>\\n\");"],"codeLang":"java"},{"type":"code","lines":["async def print(source, element):"," print(await element.text_content())","","await page.expose_binding(\"clicked\", print, handle=true)","await page.set_content(\"\"\""," <script>"," document.addEventListener('click', event => window.clicked(event.target));"," </script>"," <div>Click me</div>"," <div>Or click me</div>","\"\"\")"],"codeLang":"python async"},{"type":"code","lines":["def print(source, element):"," print(element.text_content())","","page.expose_binding(\"clicked\", print, handle=true)","page.set_content(\"\"\""," <script>"," document.addEventListener('click', event => window.clicked(event.target));"," </script>"," <div>Click me</div>"," <div>Or click me</div>","\"\"\")"],"codeLang":"python sync"},{"type":"code","lines":["var result = new TaskCompletionSource<string>();","await page.ExposeBindingAsync(\"clicked\", async (BindingSource _, IJSHandle t) =>","{"," return result.TrySetResult(await t.AsElement().TextContentAsync());","});","","await page.SetContentAsync(\"<script>\\n\" +"," \" document.addEventListener('click', event => window.clicked(event.target));\\n\" +"," \"</script>\\n\" +"," \"<div>Click me</div>\\n\" +"," \"<div>Or click me</div>\\n\");","","await page.ClickAsync(\"div\");","Console.WriteLine(await result.Task);"],"codeLang":"csharp"}],"required":true,"comment":"The method adds a function called `name` on the `window` object of every frame in this page. When called, the function\nexecutes `callback` and returns a [Promise] which resolves to the return value of `callback`. If the `callback` returns\na [Promise], it will be awaited.\n\nThe first argument of the `callback` function contains information about the caller: `{ browserContext: BrowserContext,\npage: Page, frame: Frame }`.\n\nSee [`method: BrowserContext.exposeBinding`] for the context-wide version.\n\n> NOTE: Functions installed via [`method: Page.exposeBinding`] survive navigations.\n\nAn example of exposing page URL to all frames in a page:\n\n```js\nconst { webkit } = require('playwright'); // Or 'chromium' or 'firefox'.\n\n(async () => {\n const browser = await webkit.launch({ headless: false });\n const context = await browser.newContext();\n const page = await context.newPage();\n await page.exposeBinding('pageURL', ({ page }) => page.url());\n await page.setContent(`\n <script>\n async function onClick() {\n document.querySelector('div').textContent = await window.pageURL();\n }\n </script>\n <button onclick=\"onClick()\">Click me</button>\n <div></div>\n `);\n await page.click('button');\n})();\n```\n\n```java\nimport com.microsoft.playwright.*;\n\npublic class Example {\n public static void main(String[] args) {\n try (Playwright playwright = Playwright.create()) {\n BrowserType webkit = playwright.webkit();\n Browser browser = webkit.launch({ headless: false });\n BrowserContext context = browser.newContext();\n Page page = context.newPage();\n page.exposeBinding(\"pageURL\", (source, args) -> source.page().url());\n page.setContent(\"<script>\\n\" +\n \" async function onClick() {\\n\" +\n \" document.querySelector('div').textContent = await window.pageURL();\\n\" +\n \" }\\n\" +\n \"</script>\\n\" +\n \"<button onclick=\\\"onClick()\\\">Click me</button>\\n\" +\n \"<div></div>\");\n page.click(\"button\");\n }\n }\n}\n```\n\n```python async\nimport asyncio\nfrom playwright.async_api import async_playwright\n\nasync def run(playwright):\n webkit = playwright.webkit\n browser = await webkit.launch(headless=false)\n context = await browser.new_context()\n page = await context.new_page()\n await page.expose_binding(\"pageURL\", lambda source: source[\"page\"].url)\n await page.set_content(\"\"\"\n <script>\n async function onClick() {\n document.querySelector('div').textContent = await window.pageURL();\n }\n </script>\n <button onclick=\"onClick()\">Click me</button>\n <div></div>\n \"\"\")\n await page.click(\"button\")\n\nasync def main():\n async with async_playwright() as playwright:\n await run(playwright)\nasyncio.run(main())\n```\n\n```python sync\nfrom playwright.sync_api import sync_playwright\n\ndef run(playwright):\n webkit = playwright.webkit\n browser = webkit.launch(headless=false)\n context = browser.new_context()\n page = context.new_page()\n page.expose_binding(\"pageURL\", lambda source: source[\"page\"].url)\n page.set_content(\"\"\"\n <script>\n async function onClick() {\n document.querySelector('div').textContent = await window.pageURL();\n }\n </script>\n <button onclick=\"onClick()\">Click me</button>\n <div></div>\n \"\"\")\n page.click(\"button\")\n\nwith sync_playwright() as playwright:\n run(playwright)\n```\n\n```csharp\nusing Microsoft.Playwright;\nusing System.Threading.Tasks;\n\nclass PageExamples\n{\n public static async Task Main()\n {\n using var playwright = await Playwright.CreateAsync();\n await using var browser = await playwright.Webkit.LaunchAsync(new BrowserTypeLaunchOptions\n {\n Headless: false\n });\n var page = await browser.NewPageAsync();\n\n await page.ExposeBindingAsync(\"pageUrl\", (source) => source.Page.Url);\n await page.SetContentAsync(\"<script>\\n\" +\n \" async function onClick() {\\n\" +\n \" document.querySelector('div').textContent = await window.pageURL();\\n\" +\n \" }\\n\" +\n \"</script>\\n\" +\n \"<button onclick=\\\"onClick()\\\">Click me</button>\\n\" +\n \"<div></div>\");\n\n await page.ClickAsync(\"button\");\n }\n}\n```\n\nAn example of passing an element handle:\n\n```js\nawait page.exposeBinding('clicked', async (source, element) => {\n console.log(await element.textContent());\n}, { handle: true });\nawait page.setContent(`\n <script>\n document.addEventListener('click', event => window.clicked(event.target));\n </script>\n <div>Click me</div>\n <div>Or click me</div>\n`);\n```\n\n```java\npage.exposeBinding(\"clicked\", (source, args) -> {\n ElementHandle element = (ElementHandle) args[0];\n System.out.println(element.textContent());\n return null;\n}, new Page.ExposeBindingOptions().setHandle(true));\npage.setContent(\"\" +\n \"<script>\\n\" +\n \" document.addEventListener('click', event => window.clicked(event.target));\\n\" +\n \"</script>\\n\" +\n \"<div>Click me</div>\\n\" +\n \"<div>Or click me</div>\\n\");\n```\n\n```python async\nasync def print(source, element):\n print(await element.text_content())\n\nawait page.expose_binding(\"clicked\", print, handle=true)\nawait page.set_content(\"\"\"\n <script>\n document.addEventListener('click', event => window.clicked(event.target));\n </script>\n <div>Click me</div>\n <div>Or click me</div>\n\"\"\")\n```\n\n```python sync\ndef print(source, element):\n print(element.text_content())\n\npage.expose_binding(\"clicked\", print, handle=true)\npage.set_content(\"\"\"\n <script>\n document.addEventListener('click', event => window.clicked(event.target));\n </script>\n <div>Click me</div>\n <div>Or click me</div>\n\"\"\")\n```\n\n```csharp\nvar result = new TaskCompletionSource<string>();\nawait page.ExposeBindingAsync(\"clicked\", async (BindingSource _, IJSHandle t) =>\n{\n return result.TrySetResult(await t.AsElement().TextContentAsync());\n});\n\nawait page.SetContentAsync(\"<script>\\n\" +\n \" document.addEventListener('click', event => window.clicked(event.target));\\n\" +\n \"</script>\\n\" +\n \"<div>Click me</div>\\n\" +\n \"<div>Or click me</div>\\n\");\n\nawait page.ClickAsync(\"div\");\nConsole.WriteLine(await result.Task);\n```\n","deprecated":false,"async":true,"alias":"exposeBinding","args":[{"kind":"property","langs":{},"name":"name","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Name of the function on the window object."}],"required":true,"comment":"Name of the function on the window object.","deprecated":false,"async":false,"alias":"name"},{"kind":"property","langs":{},"name":"callback","type":{"name":"function","expression":"[function]"},"spec":[{"type":"text","text":"Callback function that will be called in the Playwright's context."}],"required":true,"comment":"Callback function that will be called in the Playwright's context.","deprecated":false,"async":false,"alias":"callback"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"handle","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether to pass the argument as a handle, instead of passing by value. When passing a handle, only one argument is supported. When passing by value, multiple arguments are supported."}],"required":false,"comment":"Whether to pass the argument as a handle, instead of passing by value. When passing a handle, only one argument is\nsupported. When passing by value, multiple arguments are supported.","deprecated":false,"async":false,"alias":"handle"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"exposeFunction","type":{"name":"void"},"spec":[{"type":"text","text":"The method adds a function called `name` on the `window` object of every frame in the page. When called, the function executes `callback` and returns a [Promise] which resolves to the return value of `callback`."},{"type":"text","text":"If the `callback` returns a [Promise], it will be awaited."},{"type":"text","text":"See [`method: BrowserContext.exposeFunction`] for context-wide exposed function."},{"type":"note","noteType":"note","text":"Functions installed via [`method: Page.exposeFunction`] survive navigations."},{"type":"text","text":"An example of adding a `sha256` function to the page:"},{"type":"code","lines":["const { webkit } = require('playwright'); // Or 'chromium' or 'firefox'.","const crypto = require('crypto');","","(async () => {"," const browser = await webkit.launch({ headless: false });"," const page = await browser.newPage();"," await page.exposeFunction('sha256', text => crypto.createHash('sha256').update(text).digest('hex'));"," await page.setContent(`"," <script>"," async function onClick() {"," document.querySelector('div').textContent = await window.sha256('PLAYWRIGHT');"," }"," </script>"," <button onclick=\"onClick()\">Click me</button>"," <div></div>"," `);"," await page.click('button');","})();"],"codeLang":"js"},{"type":"code","lines":["import com.microsoft.playwright.*;","","import java.nio.charset.StandardCharsets;","import java.security.MessageDigest;","import java.security.NoSuchAlgorithmException;","import java.util.Base64;","","public class Example {"," public static void main(String[] args) {"," try (Playwright playwright = Playwright.create()) {"," BrowserType webkit = playwright.webkit();"," Browser browser = webkit.launch({ headless: false });"," Page page = browser.newPage();"," page.exposeFunction(\"sha256\", args -> {"," String text = (String) args[0];"," MessageDigest crypto;"," try {"," crypto = MessageDigest.getInstance(\"SHA-256\");"," } catch (NoSuchAlgorithmException e) {"," return null;"," }"," byte[] token = crypto.digest(text.getBytes(StandardCharsets.UTF_8));"," return Base64.getEncoder().encodeToString(token);"," });"," page.setContent(\"<script>\\n\" +"," \" async function onClick() {\\n\" +"," \" document.querySelector('div').textContent = await window.sha256('PLAYWRIGHT');\\n\" +"," \" }\\n\" +"," \"</script>\\n\" +"," \"<button onclick=\\\"onClick()\\\">Click me</button>\\n\" +"," \"<div></div>\\n\");"," page.click(\"button\");"," }"," }","}"],"codeLang":"java"},{"type":"code","lines":["import asyncio","import hashlib","from playwright.async_api import async_playwright","","def sha256(text):"," m = hashlib.sha256()"," m.update(bytes(text, \"utf8\"))"," return m.hexdigest()","","","async def run(playwright):"," webkit = playwright.webkit"," browser = await webkit.launch(headless=False)"," page = await browser.new_page()"," await page.expose_function(\"sha256\", sha256)"," await page.set_content(\"\"\""," <script>"," async function onClick() {"," document.querySelector('div').textContent = await window.sha256('PLAYWRIGHT');"," }"," </script>"," <button onclick=\"onClick()\">Click me</button>"," <div></div>"," \"\"\")"," await page.click(\"button\")","","async def main():"," async with async_playwright() as playwright:"," await run(playwright)","asyncio.run(main())"],"codeLang":"python async"},{"type":"code","lines":["import hashlib","from playwright.sync_api import sync_playwright","","def sha256(text):"," m = hashlib.sha256()"," m.update(bytes(text, \"utf8\"))"," return m.hexdigest()","","","def run(playwright):"," webkit = playwright.webkit"," browser = webkit.launch(headless=False)"," page = browser.new_page()"," page.expose_function(\"sha256\", sha256)"," page.set_content(\"\"\""," <script>"," async function onClick() {"," document.querySelector('div').textContent = await window.sha256('PLAYWRIGHT');"," }"," </script>"," <button onclick=\"onClick()\">Click me</button>"," <div></div>"," \"\"\")"," page.click(\"button\")","","with sync_playwright() as playwright:"," run(playwright)"],"codeLang":"python sync"},{"type":"code","lines":["using Microsoft.Playwright;","using System;","using System.Security.Cryptography;","using System.Threading.Tasks;","","class PageExamples","{"," public static async Task Main()"," {"," using var playwright = await Playwright.CreateAsync();"," await using var browser = await playwright.Webkit.LaunchAsync(new BrowserTypeLaunchOptions"," {"," Headless: false"," });"," var page = await browser.NewPageAsync();",""," await page.ExposeFunctionAsync(\"sha256\", (string input) =>"," {"," return Convert.ToBase64String("," SHA256.Create().ComputeHash(System.Text.Encoding.UTF8.GetBytes(input)));"," });",""," await page.SetContentAsync(\"<script>\\n\" +"," \" async function onClick() {\\n\" +"," \" document.querySelector('div').textContent = await window.sha256('PLAYWRIGHT');\\n\" +"," \" }\\n\" +"," \"</script>\\n\" +"," \"<button onclick=\\\"onClick()\\\">Click me</button>\\n\" +"," \"<div></div>\");",""," await page.ClickAsync(\"button\");"," Console.WriteLine(await page.TextContentAsync(\"div\"));"," }","}"],"codeLang":"csharp"}],"required":true,"comment":"The method adds a function called `name` on the `window` object of every frame in the page. When called, the function\nexecutes `callback` and returns a [Promise] which resolves to the return value of `callback`.\n\nIf the `callback` returns a [Promise], it will be awaited.\n\nSee [`method: BrowserContext.exposeFunction`] for context-wide exposed function.\n\n> NOTE: Functions installed via [`method: Page.exposeFunction`] survive navigations.\n\nAn example of adding a `sha256` function to the page:\n\n```js\nconst { webkit } = require('playwright'); // Or 'chromium' or 'firefox'.\nconst crypto = require('crypto');\n\n(async () => {\n const browser = await webkit.launch({ headless: false });\n const page = await browser.newPage();\n await page.exposeFunction('sha256', text => crypto.createHash('sha256').update(text).digest('hex'));\n await page.setContent(`\n <script>\n async function onClick() {\n document.querySelector('div').textContent = await window.sha256('PLAYWRIGHT');\n }\n </script>\n <button onclick=\"onClick()\">Click me</button>\n <div></div>\n `);\n await page.click('button');\n})();\n```\n\n```java\nimport com.microsoft.playwright.*;\n\nimport java.nio.charset.StandardCharsets;\nimport java.security.MessageDigest;\nimport java.security.NoSuchAlgorithmException;\nimport java.util.Base64;\n\npublic class Example {\n public static void main(String[] args) {\n try (Playwright playwright = Playwright.create()) {\n BrowserType webkit = playwright.webkit();\n Browser browser = webkit.launch({ headless: false });\n Page page = browser.newPage();\n page.exposeFunction(\"sha256\", args -> {\n String text = (String) args[0];\n MessageDigest crypto;\n try {\n crypto = MessageDigest.getInstance(\"SHA-256\");\n } catch (NoSuchAlgorithmException e) {\n return null;\n }\n byte[] token = crypto.digest(text.getBytes(StandardCharsets.UTF_8));\n return Base64.getEncoder().encodeToString(token);\n });\n page.setContent(\"<script>\\n\" +\n \" async function onClick() {\\n\" +\n \" document.querySelector('div').textContent = await window.sha256('PLAYWRIGHT');\\n\" +\n \" }\\n\" +\n \"</script>\\n\" +\n \"<button onclick=\\\"onClick()\\\">Click me</button>\\n\" +\n \"<div></div>\\n\");\n page.click(\"button\");\n }\n }\n}\n```\n\n```python async\nimport asyncio\nimport hashlib\nfrom playwright.async_api import async_playwright\n\ndef sha256(text):\n m = hashlib.sha256()\n m.update(bytes(text, \"utf8\"))\n return m.hexdigest()\n\n\nasync def run(playwright):\n webkit = playwright.webkit\n browser = await webkit.launch(headless=False)\n page = await browser.new_page()\n await page.expose_function(\"sha256\", sha256)\n await page.set_content(\"\"\"\n <script>\n async function onClick() {\n document.querySelector('div').textContent = await window.sha256('PLAYWRIGHT');\n }\n </script>\n <button onclick=\"onClick()\">Click me</button>\n <div></div>\n \"\"\")\n await page.click(\"button\")\n\nasync def main():\n async with async_playwright() as playwright:\n await run(playwright)\nasyncio.run(main())\n```\n\n```python sync\nimport hashlib\nfrom playwright.sync_api import sync_playwright\n\ndef sha256(text):\n m = hashlib.sha256()\n m.update(bytes(text, \"utf8\"))\n return m.hexdigest()\n\n\ndef run(playwright):\n webkit = playwright.webkit\n browser = webkit.launch(headless=False)\n page = browser.new_page()\n page.expose_function(\"sha256\", sha256)\n page.set_content(\"\"\"\n <script>\n async function onClick() {\n document.querySelector('div').textContent = await window.sha256('PLAYWRIGHT');\n }\n </script>\n <button onclick=\"onClick()\">Click me</button>\n <div></div>\n \"\"\")\n page.click(\"button\")\n\nwith sync_playwright() as playwright:\n run(playwright)\n```\n\n```csharp\nusing Microsoft.Playwright;\nusing System;\nusing System.Security.Cryptography;\nusing System.Threading.Tasks;\n\nclass PageExamples\n{\n public static async Task Main()\n {\n using var playwright = await Playwright.CreateAsync();\n await using var browser = await playwright.Webkit.LaunchAsync(new BrowserTypeLaunchOptions\n {\n Headless: false\n });\n var page = await browser.NewPageAsync();\n\n await page.ExposeFunctionAsync(\"sha256\", (string input) =>\n {\n return Convert.ToBase64String(\n SHA256.Create().ComputeHash(System.Text.Encoding.UTF8.GetBytes(input)));\n });\n\n await page.SetContentAsync(\"<script>\\n\" +\n \" async function onClick() {\\n\" +\n \" document.querySelector('div').textContent = await window.sha256('PLAYWRIGHT');\\n\" +\n \" }\\n\" +\n \"</script>\\n\" +\n \"<button onclick=\\\"onClick()\\\">Click me</button>\\n\" +\n \"<div></div>\");\n\n await page.ClickAsync(\"button\");\n Console.WriteLine(await page.TextContentAsync(\"div\"));\n }\n}\n```\n","deprecated":false,"async":true,"alias":"exposeFunction","args":[{"kind":"property","langs":{},"name":"name","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Name of the function on the window object"}],"required":true,"comment":"Name of the function on the window object","deprecated":false,"async":false,"alias":"name"},{"kind":"property","langs":{},"name":"callback","type":{"name":"function","expression":"[function]"},"spec":[{"type":"text","text":"Callback function which will be called in Playwright's context."}],"required":true,"comment":"Callback function which will be called in Playwright's context.","deprecated":false,"async":false,"alias":"callback"}]},{"kind":"method","langs":{},"name":"fill","type":{"name":"void"},"spec":[{"type":"text","text":"This method waits for an element matching `selector`, waits for [actionability](./actionability.md) checks, focuses the element, fills it and triggers an `input` event after filling. Note that you can pass an empty string to clear the input field."},{"type":"text","text":"If the target element is not an `<input>`, `<textarea>` or `[contenteditable]` element, this method throws an error. However, if the element is inside the `<label>` element that has an associated [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), the control will be filled instead."},{"type":"text","text":"To send fine-grained keyboard events, use [`method: Page.type`]."},{"type":"text","text":"Shortcut for main frame's [`method: Frame.fill`]."}],"required":true,"comment":"This method waits for an element matching `selector`, waits for [actionability](./actionability.md) checks, focuses the\nelement, fills it and triggers an `input` event after filling. Note that you can pass an empty string to clear the input\nfield.\n\nIf the target element is not an `<input>`, `<textarea>` or `[contenteditable]` element, this method throws an error.\nHowever, if the element is inside the `<label>` element that has an associated\n[control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), the control will be filled\ninstead.\n\nTo send fine-grained keyboard events, use [`method: Page.type`].\n\nShortcut for main frame's [`method: Frame.fill`].","deprecated":false,"async":true,"alias":"fill","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See\n[working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"value","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Value to fill for the `<input>`, `<textarea>` or `[contenteditable]` element."}],"required":true,"comment":"Value to fill for the `<input>`, `<textarea>` or `[contenteditable]` element.","deprecated":false,"async":false,"alias":"value"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"noWaitAfter","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`."}],"required":false,"comment":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can\nopt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to\ninaccessible pages. Defaults to `false`.","deprecated":false,"async":false,"alias":"noWaitAfter"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"focus","type":{"name":"void"},"spec":[{"type":"text","text":"This method fetches an element with `selector` and focuses it. If there's no element matching `selector`, the method waits until a matching element appears in the DOM."},{"type":"text","text":"Shortcut for main frame's [`method: Frame.focus`]."}],"required":true,"comment":"This method fetches an element with `selector` and focuses it. If there's no element matching `selector`, the method\nwaits until a matching element appears in the DOM.\n\nShortcut for main frame's [`method: Frame.focus`].","deprecated":false,"async":true,"alias":"focus","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See\n[working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"frame","type":{"name":"","union":[{"name":"null"},{"name":"Frame"}],"expression":"[null]|[Frame]"},"spec":[{"type":"text","text":"Returns frame matching the specified criteria. Either `name` or `url` must be specified."},{"type":"code","lines":["const frame = page.frame('frame-name');"],"codeLang":"js"},{"type":"code","lines":["Frame frame = page.frame(\"frame-name\");"],"codeLang":"java"},{"type":"code","lines":["frame = page.frame(name=\"frame-name\")"],"codeLang":"py"},{"type":"code","lines":["var frame = page.Frame(\"frame-name\");"],"codeLang":"csharp"},{"type":"code","lines":["const frame = page.frame({ url: /.*domain.*/ });"],"codeLang":"js"},{"type":"code","lines":["Frame frame = page.frameByUrl(Pattern.compile(\".*domain.*\");"],"codeLang":"java"},{"type":"code","lines":["frame = page.frame(url=r\".*domain.*\")"],"codeLang":"py"},{"type":"code","lines":["var frame = page.FrameByUrl(\".*domain.*\");"],"codeLang":"csharp"}],"required":true,"comment":"Returns frame matching the specified criteria. Either `name` or `url` must be specified.\n\n```js\nconst frame = page.frame('frame-name');\n```\n\n```java\nFrame frame = page.frame(\"frame-name\");\n```\n\n```py\nframe = page.frame(name=\"frame-name\")\n```\n\n```csharp\nvar frame = page.Frame(\"frame-name\");\n```\n\n```js\nconst frame = page.frame({ url: /.*domain.*/ });\n```\n\n```java\nFrame frame = page.frameByUrl(Pattern.compile(\".*domain.*\");\n```\n\n```py\nframe = page.frame(url=r\".*domain.*\")\n```\n\n```csharp\nvar frame = page.FrameByUrl(\".*domain.*\");\n```\n","deprecated":false,"async":false,"alias":"frame","args":[{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"frameSelector","type":{"name":"","union":[{"name":"string"},{"name":"Object","properties":[{"kind":"property","langs":{},"name":"name","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Frame name specified in the `iframe`'s `name` attribute. Optional."}],"required":false,"comment":"Frame name specified in the `iframe`'s `name` attribute. Optional.","deprecated":false,"async":false,"alias":"name"},{"kind":"property","langs":{},"name":"url","type":{"name":"","union":[{"name":"string"},{"name":"RegExp"},{"name":"function","args":[{"name":"URL"}],"returnType":{"name":"boolean"}}],"expression":"[string]|[RegExp]|[function]([URL]):[boolean]"},"spec":[{"type":"text","text":"A glob pattern, regex pattern or predicate receiving frame's `url` as a [URL] object. Optional."}],"required":false,"comment":"A glob pattern, regex pattern or predicate receiving frame's `url` as a [URL] object. Optional.","deprecated":false,"async":false,"alias":"url"}]}],"expression":"[string]|[Object]"},"spec":[{"type":"text","text":"Frame name or other frame lookup options."}],"required":true,"comment":"Frame name or other frame lookup options.","deprecated":false,"async":false,"alias":"frameSelector"},{"kind":"property","langs":{"only":["csharp","java"],"aliases":{},"types":{},"overrides":{}},"name":"name","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Frame name specified in the `iframe`'s `name` attribute."}],"required":true,"comment":"Frame name specified in the `iframe`'s `name` attribute.","deprecated":false,"async":false,"alias":"name"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{"only":["python"],"aliases":{},"types":{},"overrides":{}},"name":"name","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Frame name specified in the `iframe`'s `name` attribute. Optional."}],"required":false,"comment":"Frame name specified in the `iframe`'s `name` attribute. Optional.","deprecated":false,"async":false,"alias":"name"},{"kind":"property","langs":{"only":["python"],"aliases":{},"types":{},"overrides":{}},"name":"url","type":{"name":"","union":[{"name":"string"},{"name":"RegExp"},{"name":"function","args":[{"name":"URL"}],"returnType":{"name":"boolean"}}],"expression":"[string]|[RegExp]|[function]([URL]):[boolean]"},"spec":[{"type":"text","text":"A glob pattern, regex pattern or predicate receiving frame's `url` as a [URL] object. Optional."}],"required":false,"comment":"A glob pattern, regex pattern or predicate receiving frame's `url` as a [URL] object. Optional.","deprecated":false,"async":false,"alias":"url"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{"only":["csharp","java"],"aliases":{},"types":{},"overrides":{}},"name":"frameByUrl","type":{"name":"","union":[{"name":"null"},{"name":"Frame"}],"expression":"[null]|[Frame]"},"spec":[{"type":"text","text":"Returns frame with matching URL."}],"required":true,"comment":"Returns frame with matching URL.","deprecated":false,"async":false,"alias":"frameByUrl","args":[{"kind":"property","langs":{"only":["csharp","java"],"aliases":{},"types":{},"overrides":{}},"name":"url","type":{"name":"","union":[{"name":"string"},{"name":"RegExp"},{"name":"function","args":[{"name":"URL"}],"returnType":{"name":"boolean"}}],"expression":"[string]|[RegExp]|[function]([URL]):[boolean]"},"spec":[{"type":"text","text":"A glob pattern, regex pattern or predicate receiving frame's `url` as a [URL] object."}],"required":true,"comment":"A glob pattern, regex pattern or predicate receiving frame's `url` as a [URL] object.","deprecated":false,"async":false,"alias":"url"}]},{"kind":"method","langs":{},"name":"frames","type":{"name":"Array","templates":[{"name":"Frame"}],"expression":"[Array]<[Frame]>"},"spec":[{"type":"text","text":"An array of all frames attached to the page."}],"required":true,"comment":"An array of all frames attached to the page.","deprecated":false,"async":false,"alias":"frames","args":[]},{"kind":"method","langs":{},"name":"getAttribute","type":{"name":"","union":[{"name":"null"},{"name":"string"}],"expression":"[null]|[string]"},"spec":[{"type":"text","text":"Returns element attribute value."}],"required":true,"comment":"Returns element attribute value.","deprecated":false,"async":true,"alias":"getAttribute","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See\n[working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"name","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Attribute name to get the value for."}],"required":true,"comment":"Attribute name to get the value for.","deprecated":false,"async":false,"alias":"name"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"goBack","type":{"name":"","union":[{"name":"null"},{"name":"Response"}],"expression":"[null]|[Response]"},"spec":[{"type":"text","text":"Returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of the last redirect. If can not go back, returns `null`."},{"type":"text","text":"Navigate to the previous page in history."}],"required":true,"comment":"Returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of the\nlast redirect. If can not go back, returns `null`.\n\nNavigate to the previous page in history.","deprecated":false,"async":true,"alias":"goBack","args":[{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultNavigationTimeout`], [`method: BrowserContext.setDefaultTimeout`], [`method: Page.setDefaultNavigationTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be\nchanged by using the [`method: BrowserContext.setDefaultNavigationTimeout`],\n[`method: BrowserContext.setDefaultTimeout`], [`method: Page.setDefaultNavigationTimeout`] or\n[`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"},{"kind":"property","langs":{},"name":"waitUntil","type":{"name":"WaitUntilState","union":[{"name":"\"load\""},{"name":"\"domcontentloaded\""},{"name":"\"networkidle\""}],"expression":"[WaitUntilState]<\"load\"|\"domcontentloaded\"|\"networkidle\">"},"spec":[{"type":"text","text":"When to consider operation succeeded, defaults to `load`. Events can be either:"},{"type":"li","text":"`'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.","liType":"bullet"},{"type":"li","text":"`'load'` - consider operation to be finished when the `load` event is fired.","liType":"bullet"},{"type":"li","text":"`'networkidle'` - consider operation to be finished when there are no network connections for at least `500` ms.","liType":"bullet"}],"required":false,"comment":"When to consider operation succeeded, defaults to `load`. Events can be either:\n- `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.\n- `'load'` - consider operation to be finished when the `load` event is fired.\n- `'networkidle'` - consider operation to be finished when there are no network connections for at least `500` ms.","deprecated":false,"async":false,"alias":"waitUntil"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"goForward","type":{"name":"","union":[{"name":"null"},{"name":"Response"}],"expression":"[null]|[Response]"},"spec":[{"type":"text","text":"Returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of the last redirect. If can not go forward, returns `null`."},{"type":"text","text":"Navigate to the next page in history."}],"required":true,"comment":"Returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of the\nlast redirect. If can not go forward, returns `null`.\n\nNavigate to the next page in history.","deprecated":false,"async":true,"alias":"goForward","args":[{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultNavigationTimeout`], [`method: BrowserContext.setDefaultTimeout`], [`method: Page.setDefaultNavigationTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be\nchanged by using the [`method: BrowserContext.setDefaultNavigationTimeout`],\n[`method: BrowserContext.setDefaultTimeout`], [`method: Page.setDefaultNavigationTimeout`] or\n[`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"},{"kind":"property","langs":{},"name":"waitUntil","type":{"name":"WaitUntilState","union":[{"name":"\"load\""},{"name":"\"domcontentloaded\""},{"name":"\"networkidle\""}],"expression":"[WaitUntilState]<\"load\"|\"domcontentloaded\"|\"networkidle\">"},"spec":[{"type":"text","text":"When to consider operation succeeded, defaults to `load`. Events can be either:"},{"type":"li","text":"`'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.","liType":"bullet"},{"type":"li","text":"`'load'` - consider operation to be finished when the `load` event is fired.","liType":"bullet"},{"type":"li","text":"`'networkidle'` - consider operation to be finished when there are no network connections for at least `500` ms.","liType":"bullet"}],"required":false,"comment":"When to consider operation succeeded, defaults to `load`. Events can be either:\n- `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.\n- `'load'` - consider operation to be finished when the `load` event is fired.\n- `'networkidle'` - consider operation to be finished when there are no network connections for at least `500` ms.","deprecated":false,"async":false,"alias":"waitUntil"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{"aliases":{"java":"navigate"},"types":{},"overrides":{}},"name":"goto","type":{"name":"","union":[{"name":"null"},{"name":"Response"}],"expression":"[null]|[Response]"},"spec":[{"type":"text","text":"Returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of the last redirect."},{"type":"text","text":"`page.goto` will throw an error if:"},{"type":"li","text":"there's an SSL error (e.g. in case of self-signed certificates).","liType":"bullet"},{"type":"li","text":"target URL is invalid.","liType":"bullet"},{"type":"li","text":"the `timeout` is exceeded during navigation.","liType":"bullet"},{"type":"li","text":"the remote server does not respond or is unreachable.","liType":"bullet"},{"type":"li","text":"the main resource failed to load.","liType":"bullet"},{"type":"text","text":"`page.goto` will not throw an error when any valid HTTP status code is returned by the remote server, including 404 \"Not Found\" and 500 \"Internal Server Error\". The status code for such responses can be retrieved by calling [`method: Response.status`]."},{"type":"note","noteType":"note","text":"`page.goto` either throws an error or returns a main resource response. The only exceptions are navigation to `about:blank` or navigation to the same URL with a different hash, which would succeed and return `null`."},{"type":"note","noteType":"note","text":"Headless mode doesn't support navigation to a PDF document. See the [upstream issue](https://bugs.chromium.org/p/chromium/issues/detail?id=761295)."},{"type":"text","text":"Shortcut for main frame's [`method: Frame.goto`]"}],"required":true,"comment":"Returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of the\nlast redirect.\n\n`page.goto` will throw an error if:\n- there's an SSL error (e.g. in case of self-signed certificates).\n- target URL is invalid.\n- the `timeout` is exceeded during navigation.\n- the remote server does not respond or is unreachable.\n- the main resource failed to load.\n\n`page.goto` will not throw an error when any valid HTTP status code is returned by the remote server, including 404 \"Not\nFound\" and 500 \"Internal Server Error\". The status code for such responses can be retrieved by calling\n[`method: Response.status`].\n\n> NOTE: `page.goto` either throws an error or returns a main resource response. The only exceptions are navigation to\n`about:blank` or navigation to the same URL with a different hash, which would succeed and return `null`.\n> NOTE: Headless mode doesn't support navigation to a PDF document. See the\n[upstream issue](https://bugs.chromium.org/p/chromium/issues/detail?id=761295).\n\nShortcut for main frame's [`method: Frame.goto`]","deprecated":false,"async":true,"alias":"goto","args":[{"kind":"property","langs":{},"name":"url","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"URL to navigate page to. The url should include scheme, e.g. `https://`."}],"required":true,"comment":"URL to navigate page to. The url should include scheme, e.g. `https://`.","deprecated":false,"async":false,"alias":"url"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"referer","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Referer header value. If provided it will take preference over the referer header value set by [`method: Page.setExtraHTTPHeaders`]."}],"required":false,"comment":"Referer header value. If provided it will take preference over the referer header value set by\n[`method: Page.setExtraHTTPHeaders`].","deprecated":false,"async":false,"alias":"referer"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultNavigationTimeout`], [`method: BrowserContext.setDefaultTimeout`], [`method: Page.setDefaultNavigationTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be\nchanged by using the [`method: BrowserContext.setDefaultNavigationTimeout`],\n[`method: BrowserContext.setDefaultTimeout`], [`method: Page.setDefaultNavigationTimeout`] or\n[`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"},{"kind":"property","langs":{},"name":"waitUntil","type":{"name":"WaitUntilState","union":[{"name":"\"load\""},{"name":"\"domcontentloaded\""},{"name":"\"networkidle\""}],"expression":"[WaitUntilState]<\"load\"|\"domcontentloaded\"|\"networkidle\">"},"spec":[{"type":"text","text":"When to consider operation succeeded, defaults to `load`. Events can be either:"},{"type":"li","text":"`'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.","liType":"bullet"},{"type":"li","text":"`'load'` - consider operation to be finished when the `load` event is fired.","liType":"bullet"},{"type":"li","text":"`'networkidle'` - consider operation to be finished when there are no network connections for at least `500` ms.","liType":"bullet"}],"required":false,"comment":"When to consider operation succeeded, defaults to `load`. Events can be either:\n- `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.\n- `'load'` - consider operation to be finished when the `load` event is fired.\n- `'networkidle'` - consider operation to be finished when there are no network connections for at least `500` ms.","deprecated":false,"async":false,"alias":"waitUntil"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"hover","type":{"name":"void"},"spec":[{"type":"text","text":"This method hovers over an element matching `selector` by performing the following steps:"},{"type":"li","text":"Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.","liType":"ordinal"},{"type":"li","text":"Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried.","liType":"ordinal"},{"type":"li","text":"Scroll the element into view if needed.","liType":"ordinal"},{"type":"li","text":"Use [`property: Page.mouse`] to hover over the center of the element, or the specified `position`.","liType":"ordinal"},{"type":"li","text":"Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.","liType":"ordinal"},{"type":"text","text":"When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing zero timeout disables this."},{"type":"text","text":"Shortcut for main frame's [`method: Frame.hover`]."}],"required":true,"comment":"This method hovers over an element matching `selector` by performing the following steps:\n1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.\n1. Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the\n element is detached during the checks, the whole action is retried.\n1. Scroll the element into view if needed.\n1. Use [`property: Page.mouse`] to hover over the center of the element, or the specified `position`.\n1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.\n\nWhen all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing\nzero timeout disables this.\n\nShortcut for main frame's [`method: Frame.hover`].","deprecated":false,"async":true,"alias":"hover","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See\n[working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"force","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`."}],"required":false,"comment":"Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.","deprecated":false,"async":false,"alias":"force"},{"kind":"property","langs":{},"name":"modifiers","type":{"name":"Array","templates":[{"name":"KeyboardModifier","union":[{"name":"\"Alt\""},{"name":"\"Control\""},{"name":"\"Meta\""},{"name":"\"Shift\""}]}],"expression":"[Array]<[KeyboardModifier]<\"Alt\"|\"Control\"|\"Meta\"|\"Shift\">>"},"spec":[{"type":"text","text":"Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current modifiers back. If not specified, currently pressed modifiers are used."}],"required":false,"comment":"Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current\nmodifiers back. If not specified, currently pressed modifiers are used.","deprecated":false,"async":false,"alias":"modifiers"},{"kind":"property","langs":{},"name":"position","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"x","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"x"},{"kind":"property","langs":{},"name":"y","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"y"}],"expression":"[Object]"},"spec":[{"type":"text","text":"A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element."}],"required":false,"comment":"A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the\nelement.","deprecated":false,"async":false,"alias":"position"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"},{"kind":"property","langs":{},"name":"trial","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it."}],"required":false,"comment":"When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to\n`false`. Useful to wait until the element is ready for the action without performing it.","deprecated":false,"async":false,"alias":"trial"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"innerHTML","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Returns `element.innerHTML`."}],"required":true,"comment":"Returns `element.innerHTML`.","deprecated":false,"async":true,"alias":"innerHTML","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See\n[working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"innerText","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Returns `element.innerText`."}],"required":true,"comment":"Returns `element.innerText`.","deprecated":false,"async":true,"alias":"innerText","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See\n[working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"isChecked","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Returns whether the element is checked. Throws if the element is not a checkbox or radio input."}],"required":true,"comment":"Returns whether the element is checked. Throws if the element is not a checkbox or radio input.","deprecated":false,"async":true,"alias":"isChecked","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See\n[working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"isClosed","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Indicates that the page has been closed."}],"required":true,"comment":"Indicates that the page has been closed.","deprecated":false,"async":false,"alias":"isClosed","args":[]},{"kind":"method","langs":{},"name":"isDisabled","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Returns whether the element is disabled, the opposite of [enabled](./actionability.md#enabled)."}],"required":true,"comment":"Returns whether the element is disabled, the opposite of [enabled](./actionability.md#enabled).","deprecated":false,"async":true,"alias":"isDisabled","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See\n[working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"isEditable","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Returns whether the element is [editable](./actionability.md#editable)."}],"required":true,"comment":"Returns whether the element is [editable](./actionability.md#editable).","deprecated":false,"async":true,"alias":"isEditable","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See\n[working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"isEnabled","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Returns whether the element is [enabled](./actionability.md#enabled)."}],"required":true,"comment":"Returns whether the element is [enabled](./actionability.md#enabled).","deprecated":false,"async":true,"alias":"isEnabled","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See\n[working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"isHidden","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Returns whether the element is hidden, the opposite of [visible](./actionability.md#visible). `selector` that does not match any elements is considered hidden."}],"required":true,"comment":"Returns whether the element is hidden, the opposite of [visible](./actionability.md#visible). `selector` that does not\nmatch any elements is considered hidden.","deprecated":false,"async":true,"alias":"isHidden","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See\n[working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"isVisible","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Returns whether the element is [visible](./actionability.md#visible). `selector` that does not match any elements is considered not visible."}],"required":true,"comment":"Returns whether the element is [visible](./actionability.md#visible). `selector` that does not match any elements is\nconsidered not visible.","deprecated":false,"async":true,"alias":"isVisible","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See\n[working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"property","langs":{},"name":"keyboard","type":{"name":"Keyboard","expression":"[Keyboard]"},"spec":[],"required":true,"comment":"","deprecated":false,"async":false,"alias":"keyboard","args":[]},{"kind":"method","langs":{},"name":"mainFrame","type":{"name":"Frame","expression":"[Frame]"},"spec":[{"type":"text","text":"The page's main frame. Page is guaranteed to have a main frame which persists during navigations."}],"required":true,"comment":"The page's main frame. Page is guaranteed to have a main frame which persists during navigations.","deprecated":false,"async":false,"alias":"mainFrame","args":[]},{"kind":"property","langs":{},"name":"mouse","type":{"name":"Mouse","expression":"[Mouse]"},"spec":[],"required":true,"comment":"","deprecated":false,"async":false,"alias":"mouse","args":[]},{"kind":"method","langs":{},"name":"opener","type":{"name":"","union":[{"name":"null"},{"name":"Page"}],"expression":"[null]|[Page]"},"spec":[{"type":"text","text":"Returns the opener for popup pages and `null` for others. If the opener has been closed already the returns `null`."}],"required":true,"comment":"Returns the opener for popup pages and `null` for others. If the opener has been closed already the returns `null`.","deprecated":false,"async":true,"alias":"opener","args":[]},{"kind":"method","langs":{},"name":"pause","type":{"name":"void"},"spec":[{"type":"text","text":"Pauses script execution. Playwright will stop executing the script and wait for the user to either press 'Resume' button in the page overlay or to call `playwright.resume()` in the DevTools console."},{"type":"text","text":"User can inspect selectors or perform manual steps while paused. Resume will continue running the original script from the place it was paused."},{"type":"note","noteType":"note","text":"This method requires Playwright to be started in a headed mode, with a falsy `headless` value in the [`method: BrowserType.launch`]."}],"required":true,"comment":"Pauses script execution. Playwright will stop executing the script and wait for the user to either press 'Resume' button\nin the page overlay or to call `playwright.resume()` in the DevTools console.\n\nUser can inspect selectors or perform manual steps while paused. Resume will continue running the original script from\nthe place it was paused.\n\n> NOTE: This method requires Playwright to be started in a headed mode, with a falsy `headless` value in the\n[`method: BrowserType.launch`].","deprecated":false,"async":true,"alias":"pause","args":[]},{"kind":"method","langs":{},"name":"pdf","type":{"name":"Buffer","expression":"[Buffer]"},"spec":[{"type":"text","text":"Returns the PDF buffer."},{"type":"note","noteType":"note","text":"Generating a pdf is currently only supported in Chromium headless."},{"type":"text","text":"`page.pdf()` generates a pdf of the page with `print` css media. To generate a pdf with `screen` media, call [`method: Page.emulateMedia`] before calling `page.pdf()`:"},{"type":"note","noteType":"note","text":"By default, `page.pdf()` generates a pdf with modified colors for printing. Use the [`-webkit-print-color-adjust`](https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-print-color-adjust) property to force rendering of exact colors."},{"type":"code","lines":["// Generates a PDF with 'screen' media type.","await page.emulateMedia({media: 'screen'});","await page.pdf({path: 'page.pdf'});"],"codeLang":"js"},{"type":"code","lines":["// Generates a PDF with \"screen\" media type.","page.emulateMedia(new Page.EmulateMediaOptions().setMedia(Media.SCREEN));","page.pdf(new Page.PdfOptions().setPath(Paths.get(\"page.pdf\")));"],"codeLang":"java"},{"type":"code","lines":["# generates a pdf with \"screen\" media type.","await page.emulate_media(media=\"screen\")","await page.pdf(path=\"page.pdf\")"],"codeLang":"python async"},{"type":"code","lines":["# generates a pdf with \"screen\" media type.","page.emulate_media(media=\"screen\")","page.pdf(path=\"page.pdf\")"],"codeLang":"python sync"},{"type":"code","lines":["// Generates a PDF with 'screen' media type","await page.EmulateMediaAsync(new PageEmulateMediaOptions { Media = Media.Screen });","await page.PdfAsync(new PagePdfOptions { Path = \"page.pdf\" });"],"codeLang":"csharp"},{"type":"text","text":"The `width`, `height`, and `margin` options accept values labeled with units. Unlabeled values are treated as pixels."},{"type":"text","text":"A few examples:"},{"type":"li","text":"`page.pdf({width: 100})` - prints with width set to 100 pixels","liType":"bullet"},{"type":"li","text":"`page.pdf({width: '100px'})` - prints with width set to 100 pixels","liType":"bullet"},{"type":"li","text":"`page.pdf({width: '10cm'})` - prints with width set to 10 centimeters.","liType":"bullet"},{"type":"text","text":"All possible units are:"},{"type":"li","text":"`px` - pixel","liType":"bullet"},{"type":"li","text":"`in` - inch","liType":"bullet"},{"type":"li","text":"`cm` - centimeter","liType":"bullet"},{"type":"li","text":"`mm` - millimeter","liType":"bullet"},{"type":"text","text":"The `format` options are:"},{"type":"li","text":"`Letter`: 8.5in x 11in","liType":"bullet"},{"type":"li","text":"`Legal`: 8.5in x 14in","liType":"bullet"},{"type":"li","text":"`Tabloid`: 11in x 17in","liType":"bullet"},{"type":"li","text":"`Ledger`: 17in x 11in","liType":"bullet"},{"type":"li","text":"`A0`: 33.1in x 46.8in","liType":"bullet"},{"type":"li","text":"`A1`: 23.4in x 33.1in","liType":"bullet"},{"type":"li","text":"`A2`: 16.54in x 23.4in","liType":"bullet"},{"type":"li","text":"`A3`: 11.7in x 16.54in","liType":"bullet"},{"type":"li","text":"`A4`: 8.27in x 11.7in","liType":"bullet"},{"type":"li","text":"`A5`: 5.83in x 8.27in","liType":"bullet"},{"type":"li","text":"`A6`: 4.13in x 5.83in","liType":"bullet"},{"type":"note","noteType":"note","text":"`headerTemplate` and `footerTemplate` markup have the following limitations: > 1. Script tags inside templates are not evaluated. > 2. Page styles are not visible inside templates."}],"required":true,"comment":"Returns the PDF buffer.\n\n> NOTE: Generating a pdf is currently only supported in Chromium headless.\n\n`page.pdf()` generates a pdf of the page with `print` css media. To generate a pdf with `screen` media, call\n[`method: Page.emulateMedia`] before calling `page.pdf()`:\n\n> NOTE: By default, `page.pdf()` generates a pdf with modified colors for printing. Use the\n[`-webkit-print-color-adjust`](https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-print-color-adjust) property to\nforce rendering of exact colors.\n\n```js\n// Generates a PDF with 'screen' media type.\nawait page.emulateMedia({media: 'screen'});\nawait page.pdf({path: 'page.pdf'});\n```\n\n```java\n// Generates a PDF with \"screen\" media type.\npage.emulateMedia(new Page.EmulateMediaOptions().setMedia(Media.SCREEN));\npage.pdf(new Page.PdfOptions().setPath(Paths.get(\"page.pdf\")));\n```\n\n```python async\n# generates a pdf with \"screen\" media type.\nawait page.emulate_media(media=\"screen\")\nawait page.pdf(path=\"page.pdf\")\n```\n\n```python sync\n# generates a pdf with \"screen\" media type.\npage.emulate_media(media=\"screen\")\npage.pdf(path=\"page.pdf\")\n```\n\n```csharp\n// Generates a PDF with 'screen' media type\nawait page.EmulateMediaAsync(new PageEmulateMediaOptions { Media = Media.Screen });\nawait page.PdfAsync(new PagePdfOptions { Path = \"page.pdf\" });\n```\n\nThe `width`, `height`, and `margin` options accept values labeled with units. Unlabeled values are treated as pixels.\n\nA few examples:\n- `page.pdf({width: 100})` - prints with width set to 100 pixels\n- `page.pdf({width: '100px'})` - prints with width set to 100 pixels\n- `page.pdf({width: '10cm'})` - prints with width set to 10 centimeters.\n\nAll possible units are:\n- `px` - pixel\n- `in` - inch\n- `cm` - centimeter\n- `mm` - millimeter\n\nThe `format` options are:\n- `Letter`: 8.5in x 11in\n- `Legal`: 8.5in x 14in\n- `Tabloid`: 11in x 17in\n- `Ledger`: 17in x 11in\n- `A0`: 33.1in x 46.8in\n- `A1`: 23.4in x 33.1in\n- `A2`: 16.54in x 23.4in\n- `A3`: 11.7in x 16.54in\n- `A4`: 8.27in x 11.7in\n- `A5`: 5.83in x 8.27in\n- `A6`: 4.13in x 5.83in\n\n> NOTE: `headerTemplate` and `footerTemplate` markup have the following limitations: > 1. Script tags inside templates\nare not evaluated. > 2. Page styles are not visible inside templates.","deprecated":false,"async":true,"alias":"pdf","args":[{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"displayHeaderFooter","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Display header and footer. Defaults to `false`."}],"required":false,"comment":"Display header and footer. Defaults to `false`.","deprecated":false,"async":false,"alias":"displayHeaderFooter"},{"kind":"property","langs":{},"name":"footerTemplate","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"HTML template for the print footer. Should use the same format as the `headerTemplate`."}],"required":false,"comment":"HTML template for the print footer. Should use the same format as the `headerTemplate`.","deprecated":false,"async":false,"alias":"footerTemplate"},{"kind":"property","langs":{},"name":"format","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Paper format. If set, takes priority over `width` or `height` options. Defaults to 'Letter'."}],"required":false,"comment":"Paper format. If set, takes priority over `width` or `height` options. Defaults to 'Letter'.","deprecated":false,"async":false,"alias":"format"},{"kind":"property","langs":{},"name":"headerTemplate","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"HTML template for the print header. Should be valid HTML markup with following classes used to inject printing values into them:"},{"type":"li","text":"`'date'` formatted print date","liType":"bullet"},{"type":"li","text":"`'title'` document title","liType":"bullet"},{"type":"li","text":"`'url'` document location","liType":"bullet"},{"type":"li","text":"`'pageNumber'` current page number","liType":"bullet"},{"type":"li","text":"`'totalPages'` total pages in the document","liType":"bullet"}],"required":false,"comment":"HTML template for the print header. Should be valid HTML markup with following classes used to inject printing values\ninto them:\n- `'date'` formatted print date\n- `'title'` document title\n- `'url'` document location\n- `'pageNumber'` current page number\n- `'totalPages'` total pages in the document","deprecated":false,"async":false,"alias":"headerTemplate"},{"kind":"property","langs":{"only":["js","python"],"aliases":{},"types":{},"overrides":{}},"name":"height","type":{"name":"","union":[{"name":"string"},{"name":"float"}],"expression":"[string]|[float]"},"spec":[{"type":"text","text":"Paper height, accepts values labeled with units."}],"required":false,"comment":"Paper height, accepts values labeled with units.","deprecated":false,"async":false,"alias":"height"},{"kind":"property","langs":{"only":["csharp","java"],"aliases":{},"types":{},"overrides":{}},"name":"height","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Paper height, accepts values labeled with units."}],"required":false,"comment":"Paper height, accepts values labeled with units.","deprecated":false,"async":false,"alias":"height"},{"kind":"property","langs":{},"name":"landscape","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Paper orientation. Defaults to `false`."}],"required":false,"comment":"Paper orientation. Defaults to `false`.","deprecated":false,"async":false,"alias":"landscape"},{"kind":"property","langs":{"only":["js","python"],"aliases":{},"types":{},"overrides":{}},"name":"margin","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"top","type":{"name":"","union":[{"name":"string"},{"name":"float"}],"expression":"[string]|[float]"},"spec":[{"type":"text","text":"Top margin, accepts values labeled with units. Defaults to `0`."}],"required":false,"comment":"Top margin, accepts values labeled with units. Defaults to `0`.","deprecated":false,"async":false,"alias":"top"},{"kind":"property","langs":{},"name":"right","type":{"name":"","union":[{"name":"string"},{"name":"float"}],"expression":"[string]|[float]"},"spec":[{"type":"text","text":"Right margin, accepts values labeled with units. Defaults to `0`."}],"required":false,"comment":"Right margin, accepts values labeled with units. Defaults to `0`.","deprecated":false,"async":false,"alias":"right"},{"kind":"property","langs":{},"name":"bottom","type":{"name":"","union":[{"name":"string"},{"name":"float"}],"expression":"[string]|[float]"},"spec":[{"type":"text","text":"Bottom margin, accepts values labeled with units. Defaults to `0`."}],"required":false,"comment":"Bottom margin, accepts values labeled with units. Defaults to `0`.","deprecated":false,"async":false,"alias":"bottom"},{"kind":"property","langs":{},"name":"left","type":{"name":"","union":[{"name":"string"},{"name":"float"}],"expression":"[string]|[float]"},"spec":[{"type":"text","text":"Left margin, accepts values labeled with units. Defaults to `0`."}],"required":false,"comment":"Left margin, accepts values labeled with units. Defaults to `0`.","deprecated":false,"async":false,"alias":"left"}],"expression":"[Object]"},"spec":[{"type":"text","text":"Paper margins, defaults to none."}],"required":false,"comment":"Paper margins, defaults to none.","deprecated":false,"async":false,"alias":"margin"},{"kind":"property","langs":{"only":["csharp","java"],"aliases":{},"types":{},"overrides":{}},"name":"margin","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"top","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Top margin, accepts values labeled with units. Defaults to `0`."}],"required":false,"comment":"Top margin, accepts values labeled with units. Defaults to `0`.","deprecated":false,"async":false,"alias":"top"},{"kind":"property","langs":{},"name":"right","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Right margin, accepts values labeled with units. Defaults to `0`."}],"required":false,"comment":"Right margin, accepts values labeled with units. Defaults to `0`.","deprecated":false,"async":false,"alias":"right"},{"kind":"property","langs":{},"name":"bottom","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Bottom margin, accepts values labeled with units. Defaults to `0`."}],"required":false,"comment":"Bottom margin, accepts values labeled with units. Defaults to `0`.","deprecated":false,"async":false,"alias":"bottom"},{"kind":"property","langs":{},"name":"left","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Left margin, accepts values labeled with units. Defaults to `0`."}],"required":false,"comment":"Left margin, accepts values labeled with units. Defaults to `0`.","deprecated":false,"async":false,"alias":"left"}],"expression":"[Object]"},"spec":[{"type":"text","text":"Paper margins, defaults to none."}],"required":false,"comment":"Paper margins, defaults to none.","deprecated":false,"async":false,"alias":"margin"},{"kind":"property","langs":{},"name":"pageRanges","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Paper ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string, which means print all pages."}],"required":false,"comment":"Paper ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string, which means print all pages.","deprecated":false,"async":false,"alias":"pageRanges"},{"kind":"property","langs":{},"name":"path","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"The file path to save the PDF to. If `path` is a relative path, then it is resolved relative to the current working directory. If no path is provided, the PDF won't be saved to the disk."}],"required":false,"comment":"The file path to save the PDF to. If `path` is a relative path, then it is resolved relative to the current working\ndirectory. If no path is provided, the PDF won't be saved to the disk.","deprecated":false,"async":false,"alias":"path"},{"kind":"property","langs":{},"name":"preferCSSPageSize","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Give any CSS `@page` size declared in the page priority over what is declared in `width` and `height` or `format` options. Defaults to `false`, which will scale the content to fit the paper size."}],"required":false,"comment":"Give any CSS `@page` size declared in the page priority over what is declared in `width` and `height` or `format`\noptions. Defaults to `false`, which will scale the content to fit the paper size.","deprecated":false,"async":false,"alias":"preferCSSPageSize"},{"kind":"property","langs":{},"name":"printBackground","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Print background graphics. Defaults to `false`."}],"required":false,"comment":"Print background graphics. Defaults to `false`.","deprecated":false,"async":false,"alias":"printBackground"},{"kind":"property","langs":{},"name":"scale","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Scale of the webpage rendering. Defaults to `1`. Scale amount must be between 0.1 and 2."}],"required":false,"comment":"Scale of the webpage rendering. Defaults to `1`. Scale amount must be between 0.1 and 2.","deprecated":false,"async":false,"alias":"scale"},{"kind":"property","langs":{"only":["js","python"],"aliases":{},"types":{},"overrides":{}},"name":"width","type":{"name":"","union":[{"name":"string"},{"name":"float"}],"expression":"[string]|[float]"},"spec":[{"type":"text","text":"Paper width, accepts values labeled with units."}],"required":false,"comment":"Paper width, accepts values labeled with units.","deprecated":false,"async":false,"alias":"width"},{"kind":"property","langs":{"only":["csharp","java"],"aliases":{},"types":{},"overrides":{}},"name":"width","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Paper width, accepts values labeled with units."}],"required":false,"comment":"Paper width, accepts values labeled with units.","deprecated":false,"async":false,"alias":"width"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"press","type":{"name":"void"},"spec":[{"type":"text","text":"Focuses the element, and then uses [`method: Keyboard.down`] and [`method: Keyboard.up`]."},{"type":"text","text":"`key` can specify the intended [keyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key) value or a single character to generate the text for. A superset of the `key` values can be found [here](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values). Examples of the keys are:"},{"type":"text","text":"`F1` - `F12`, `Digit0`- `Digit9`, `KeyA`- `KeyZ`, `Backquote`, `Minus`, `Equal`, `Backslash`, `Backspace`, `Tab`, `Delete`, `Escape`, `ArrowDown`, `End`, `Enter`, `Home`, `Insert`, `PageDown`, `PageUp`, `ArrowRight`, `ArrowUp`, etc."},{"type":"text","text":"Following modification shortcuts are also supported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`."},{"type":"text","text":"Holding down `Shift` will type the text that corresponds to the `key` in the upper case."},{"type":"text","text":"If `key` is a single character, it is case-sensitive, so the values `a` and `A` will generate different respective texts."},{"type":"text","text":"Shortcuts such as `key: \"Control+o\"` or `key: \"Control+Shift+T\"` are supported as well. When specified with the modifier, modifier is pressed and being held while the subsequent key is being pressed."},{"type":"code","lines":["const page = await browser.newPage();","await page.goto('https://keycode.info');","await page.press('body', 'A');","await page.screenshot({ path: 'A.png' });","await page.press('body', 'ArrowLeft');","await page.screenshot({ path: 'ArrowLeft.png' });","await page.press('body', 'Shift+O');","await page.screenshot({ path: 'O.png' });","await browser.close();"],"codeLang":"js"},{"type":"code","lines":["Page page = browser.newPage();","page.navigate(\"https://keycode.info\");","page.press(\"body\", \"A\");","page.screenshot(new Page.ScreenshotOptions().setPath(Paths.get(\"A.png\")));","page.press(\"body\", \"ArrowLeft\");","page.screenshot(new Page.ScreenshotOptions().setPath(Paths.get(\"ArrowLeft.png\" )));","page.press(\"body\", \"Shift+O\");","page.screenshot(new Page.ScreenshotOptions().setPath(Paths.get(\"O.png\" )));"],"codeLang":"java"},{"type":"code","lines":["page = await browser.new_page()","await page.goto(\"https://keycode.info\")","await page.press(\"body\", \"A\")","await page.screenshot(path=\"a.png\")","await page.press(\"body\", \"ArrowLeft\")","await page.screenshot(path=\"arrow_left.png\")","await page.press(\"body\", \"Shift+O\")","await page.screenshot(path=\"o.png\")","await browser.close()"],"codeLang":"python async"},{"type":"code","lines":["page = browser.new_page()","page.goto(\"https://keycode.info\")","page.press(\"body\", \"A\")","page.screenshot(path=\"a.png\")","page.press(\"body\", \"ArrowLeft\")","page.screenshot(path=\"arrow_left.png\")","page.press(\"body\", \"Shift+O\")","page.screenshot(path=\"o.png\")","browser.close()"],"codeLang":"python sync"},{"type":"code","lines":["var page = await browser.NewPageAsync();","await page.GotoAsync(\"https://keycode.info\");","await page.PressAsync(\"body\", \"A\");","await page.ScreenshotAsync(new PageScreenshotOptions { Path = \"A.png\" });","await page.PressAsync(\"body\", \"ArrowLeft\");","await page.ScreenshotAsync(new PageScreenshotOptions { Path = \"ArrowLeft.png\" });","await page.PressAsync(\"body\", \"Shift+O\");","await page.ScreenshotAsync(new PageScreenshotOptions { Path = \"O.png\" });"],"codeLang":"csharp"}],"required":true,"comment":"Focuses the element, and then uses [`method: Keyboard.down`] and [`method: Keyboard.up`].\n\n`key` can specify the intended [keyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key)\nvalue or a single character to generate the text for. A superset of the `key` values can be found\n[here](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values). Examples of the keys are:\n\n`F1` - `F12`, `Digit0`- `Digit9`, `KeyA`- `KeyZ`, `Backquote`, `Minus`, `Equal`, `Backslash`, `Backspace`, `Tab`,\n`Delete`, `Escape`, `ArrowDown`, `End`, `Enter`, `Home`, `Insert`, `PageDown`, `PageUp`, `ArrowRight`, `ArrowUp`, etc.\n\nFollowing modification shortcuts are also supported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`.\n\nHolding down `Shift` will type the text that corresponds to the `key` in the upper case.\n\nIf `key` is a single character, it is case-sensitive, so the values `a` and `A` will generate different respective\ntexts.\n\nShortcuts such as `key: \"Control+o\"` or `key: \"Control+Shift+T\"` are supported as well. When specified with the\nmodifier, modifier is pressed and being held while the subsequent key is being pressed.\n\n```js\nconst page = await browser.newPage();\nawait page.goto('https://keycode.info');\nawait page.press('body', 'A');\nawait page.screenshot({ path: 'A.png' });\nawait page.press('body', 'ArrowLeft');\nawait page.screenshot({ path: 'ArrowLeft.png' });\nawait page.press('body', 'Shift+O');\nawait page.screenshot({ path: 'O.png' });\nawait browser.close();\n```\n\n```java\nPage page = browser.newPage();\npage.navigate(\"https://keycode.info\");\npage.press(\"body\", \"A\");\npage.screenshot(new Page.ScreenshotOptions().setPath(Paths.get(\"A.png\")));\npage.press(\"body\", \"ArrowLeft\");\npage.screenshot(new Page.ScreenshotOptions().setPath(Paths.get(\"ArrowLeft.png\" )));\npage.press(\"body\", \"Shift+O\");\npage.screenshot(new Page.ScreenshotOptions().setPath(Paths.get(\"O.png\" )));\n```\n\n```python async\npage = await browser.new_page()\nawait page.goto(\"https://keycode.info\")\nawait page.press(\"body\", \"A\")\nawait page.screenshot(path=\"a.png\")\nawait page.press(\"body\", \"ArrowLeft\")\nawait page.screenshot(path=\"arrow_left.png\")\nawait page.press(\"body\", \"Shift+O\")\nawait page.screenshot(path=\"o.png\")\nawait browser.close()\n```\n\n```python sync\npage = browser.new_page()\npage.goto(\"https://keycode.info\")\npage.press(\"body\", \"A\")\npage.screenshot(path=\"a.png\")\npage.press(\"body\", \"ArrowLeft\")\npage.screenshot(path=\"arrow_left.png\")\npage.press(\"body\", \"Shift+O\")\npage.screenshot(path=\"o.png\")\nbrowser.close()\n```\n\n```csharp\nvar page = await browser.NewPageAsync();\nawait page.GotoAsync(\"https://keycode.info\");\nawait page.PressAsync(\"body\", \"A\");\nawait page.ScreenshotAsync(new PageScreenshotOptions { Path = \"A.png\" });\nawait page.PressAsync(\"body\", \"ArrowLeft\");\nawait page.ScreenshotAsync(new PageScreenshotOptions { Path = \"ArrowLeft.png\" });\nawait page.PressAsync(\"body\", \"Shift+O\");\nawait page.ScreenshotAsync(new PageScreenshotOptions { Path = \"O.png\" });\n```\n","deprecated":false,"async":true,"alias":"press","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See\n[working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"key","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Name of the key to press or a character to generate, such as `ArrowLeft` or `a`."}],"required":true,"comment":"Name of the key to press or a character to generate, such as `ArrowLeft` or `a`.","deprecated":false,"async":false,"alias":"key"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"delay","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Time to wait between `keydown` and `keyup` in milliseconds. Defaults to 0."}],"required":false,"comment":"Time to wait between `keydown` and `keyup` in milliseconds. Defaults to 0.","deprecated":false,"async":false,"alias":"delay"},{"kind":"property","langs":{},"name":"noWaitAfter","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`."}],"required":false,"comment":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can\nopt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to\ninaccessible pages. Defaults to `false`.","deprecated":false,"async":false,"alias":"noWaitAfter"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{"aliases":{"python":"query_selector","js":"$"},"types":{},"overrides":{}},"name":"querySelector","type":{"name":"","union":[{"name":"null"},{"name":"ElementHandle"}],"expression":"[null]|[ElementHandle]"},"spec":[{"type":"text","text":"The method finds an element matching the specified selector within the page. If no elements match the selector, the return value resolves to `null`. To wait for an element on the page, use [`method: Page.waitForSelector`]."},{"type":"text","text":"Shortcut for main frame's [`method: Frame.querySelector`]."}],"required":true,"comment":"The method finds an element matching the specified selector within the page. If no elements match the selector, the\nreturn value resolves to `null`. To wait for an element on the page, use [`method: Page.waitForSelector`].\n\nShortcut for main frame's [`method: Frame.querySelector`].","deprecated":false,"async":true,"alias":"querySelector","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to query for. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to query for. See [working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"}]},{"kind":"method","langs":{"aliases":{"python":"query_selector_all","js":"$$"},"types":{},"overrides":{}},"name":"querySelectorAll","type":{"name":"Array","templates":[{"name":"ElementHandle"}],"expression":"[Array]<[ElementHandle]>"},"spec":[{"type":"text","text":"The method finds all elements matching the specified selector within the page. If no elements match the selector, the return value resolves to `[]`."},{"type":"text","text":"Shortcut for main frame's [`method: Frame.querySelectorAll`]."}],"required":true,"comment":"The method finds all elements matching the specified selector within the page. If no elements match the selector, the\nreturn value resolves to `[]`.\n\nShortcut for main frame's [`method: Frame.querySelectorAll`].","deprecated":false,"async":true,"alias":"querySelectorAll","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to query for. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to query for. See [working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"}]},{"kind":"method","langs":{},"name":"reload","type":{"name":"","union":[{"name":"null"},{"name":"Response"}],"expression":"[null]|[Response]"},"spec":[{"type":"text","text":"Returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of the last redirect."}],"required":true,"comment":"Returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of the\nlast redirect.","deprecated":false,"async":true,"alias":"reload","args":[{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultNavigationTimeout`], [`method: BrowserContext.setDefaultTimeout`], [`method: Page.setDefaultNavigationTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be\nchanged by using the [`method: BrowserContext.setDefaultNavigationTimeout`],\n[`method: BrowserContext.setDefaultTimeout`], [`method: Page.setDefaultNavigationTimeout`] or\n[`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"},{"kind":"property","langs":{},"name":"waitUntil","type":{"name":"WaitUntilState","union":[{"name":"\"load\""},{"name":"\"domcontentloaded\""},{"name":"\"networkidle\""}],"expression":"[WaitUntilState]<\"load\"|\"domcontentloaded\"|\"networkidle\">"},"spec":[{"type":"text","text":"When to consider operation succeeded, defaults to `load`. Events can be either:"},{"type":"li","text":"`'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.","liType":"bullet"},{"type":"li","text":"`'load'` - consider operation to be finished when the `load` event is fired.","liType":"bullet"},{"type":"li","text":"`'networkidle'` - consider operation to be finished when there are no network connections for at least `500` ms.","liType":"bullet"}],"required":false,"comment":"When to consider operation succeeded, defaults to `load`. Events can be either:\n- `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.\n- `'load'` - consider operation to be finished when the `load` event is fired.\n- `'networkidle'` - consider operation to be finished when there are no network connections for at least `500` ms.","deprecated":false,"async":false,"alias":"waitUntil"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"route","type":{"name":"void"},"spec":[{"type":"text","text":"Routing provides the capability to modify network requests that are made by a page."},{"type":"text","text":"Once routing is enabled, every request matching the url pattern will stall unless it's continued, fulfilled or aborted."},{"type":"note","noteType":"note","text":"The handler will only be called for the first url if the response is a redirect."},{"type":"text","text":"An example of a naive handler that aborts all image requests:"},{"type":"code","lines":["const page = await browser.newPage();","await page.route('**/*.{png,jpg,jpeg}', route => route.abort());","await page.goto('https://example.com');","await browser.close();"],"codeLang":"js"},{"type":"code","lines":["Page page = browser.newPage();","page.route(\"**/*.{png,jpg,jpeg}\", route -> route.abort());","page.navigate(\"https://example.com\");","browser.close();"],"codeLang":"java"},{"type":"code","lines":["page = await browser.new_page()","await page.route(\"**/*.{png,jpg,jpeg}\", lambda route: route.abort())","await page.goto(\"https://example.com\")","await browser.close()"],"codeLang":"python async"},{"type":"code","lines":["page = browser.new_page()","page.route(\"**/*.{png,jpg,jpeg}\", lambda route: route.abort())","page.goto(\"https://example.com\")","browser.close()"],"codeLang":"python sync"},{"type":"code","lines":["var page = await browser.NewPageAsync();","await page.RouteAsync(\"**/*.{png,jpg,jpeg}\", async r => await r.AbortAsync());","await page.GotoAsync(\"https://www.microsoft.com\");"],"codeLang":"csharp"},{"type":"text","text":"or the same snippet using a regex pattern instead:"},{"type":"code","lines":["const page = await browser.newPage();","await page.route(/(\\.png$)|(\\.jpg$)/, route => route.abort());","await page.goto('https://example.com');","await browser.close();"],"codeLang":"js"},{"type":"code","lines":["Page page = browser.newPage();","page.route(Pattern.compile(\"(\\\\.png$)|(\\\\.jpg$)\"),route -> route.abort());","page.navigate(\"https://example.com\");","browser.close();"],"codeLang":"java"},{"type":"code","lines":["page = await browser.new_page()","await page.route(re.compile(r\"(\\.png$)|(\\.jpg$)\"), lambda route: route.abort())","await page.goto(\"https://example.com\")","await browser.close()"],"codeLang":"python async"},{"type":"code","lines":["page = browser.new_page()","page.route(re.compile(r\"(\\.png$)|(\\.jpg$)\"), lambda route: route.abort())","page.goto(\"https://example.com\")","browser.close()"],"codeLang":"python sync"},{"type":"code","lines":["var page = await browser.NewPageAsync();","await page.RouteAsync(new Regex(\"(\\\\.png$)|(\\\\.jpg$)\"), async r => await r.AbortAsync());","await page.GotoAsync(\"https://www.microsoft.com\");"],"codeLang":"csharp"},{"type":"text","text":"It is possible to examine the request to decide the route action. For example, mocking all requests that contain some post data, and leaving all other requests as is:"},{"type":"code","lines":["await page.route('/api/**', route => {"," if (route.request().postData().includes('my-string'))"," route.fulfill({ body: 'mocked-data' });"," else"," route.continue();","});"],"codeLang":"js"},{"type":"code","lines":["page.route(\"/api/**\", route -> {"," if (route.request().postData().contains(\"my-string\"))"," route.fulfill(new Route.FulfillOptions().setBody(\"mocked-data\"));"," else"," route.resume();","});"],"codeLang":"java"},{"type":"code","lines":["def handle_route(route):"," if (\"my-string\" in route.request.post_data)"," route.fulfill(body=\"mocked-data\")"," else"," route.continue_()","await page.route(\"/api/**\", handle_route)"],"codeLang":"python async"},{"type":"code","lines":["def handle_route(route):"," if (\"my-string\" in route.request.post_data)"," route.fulfill(body=\"mocked-data\")"," else"," route.continue_()","page.route(\"/api/**\", handle_route)"],"codeLang":"python sync"},{"type":"code","lines":["await page.RouteAsync(\"/api/**\", async r =>","{"," if (r.Request.PostData.Contains(\"my-string\"))"," await r.FulfillAsync(new RouteFulfillOptions { Body = \"mocked-data\" });"," else"," await r.ContinueAsync();","});"],"codeLang":"csharp"},{"type":"text","text":"Page routes take precedence over browser context routes (set up with [`method: BrowserContext.route`]) when request matches both handlers."},{"type":"text","text":"To remove a route with its handler you can use [`method: Page.unroute`]."},{"type":"note","noteType":"note","text":"Enabling routing disables http cache."}],"required":true,"comment":"Routing provides the capability to modify network requests that are made by a page.\n\nOnce routing is enabled, every request matching the url pattern will stall unless it's continued, fulfilled or aborted.\n\n> NOTE: The handler will only be called for the first url if the response is a redirect.\n\nAn example of a naive handler that aborts all image requests:\n\n```js\nconst page = await browser.newPage();\nawait page.route('**/*.{png,jpg,jpeg}', route => route.abort());\nawait page.goto('https://example.com');\nawait browser.close();\n```\n\n```java\nPage page = browser.newPage();\npage.route(\"**/*.{png,jpg,jpeg}\", route -> route.abort());\npage.navigate(\"https://example.com\");\nbrowser.close();\n```\n\n```python async\npage = await browser.new_page()\nawait page.route(\"**/*.{png,jpg,jpeg}\", lambda route: route.abort())\nawait page.goto(\"https://example.com\")\nawait browser.close()\n```\n\n```python sync\npage = browser.new_page()\npage.route(\"**/*.{png,jpg,jpeg}\", lambda route: route.abort())\npage.goto(\"https://example.com\")\nbrowser.close()\n```\n\n```csharp\nvar page = await browser.NewPageAsync();\nawait page.RouteAsync(\"**/*.{png,jpg,jpeg}\", async r => await r.AbortAsync());\nawait page.GotoAsync(\"https://www.microsoft.com\");\n```\n\nor the same snippet using a regex pattern instead:\n\n```js\nconst page = await browser.newPage();\nawait page.route(/(\\.png$)|(\\.jpg$)/, route => route.abort());\nawait page.goto('https://example.com');\nawait browser.close();\n```\n\n```java\nPage page = browser.newPage();\npage.route(Pattern.compile(\"(\\\\.png$)|(\\\\.jpg$)\"),route -> route.abort());\npage.navigate(\"https://example.com\");\nbrowser.close();\n```\n\n```python async\npage = await browser.new_page()\nawait page.route(re.compile(r\"(\\.png$)|(\\.jpg$)\"), lambda route: route.abort())\nawait page.goto(\"https://example.com\")\nawait browser.close()\n```\n\n```python sync\npage = browser.new_page()\npage.route(re.compile(r\"(\\.png$)|(\\.jpg$)\"), lambda route: route.abort())\npage.goto(\"https://example.com\")\nbrowser.close()\n```\n\n```csharp\nvar page = await browser.NewPageAsync();\nawait page.RouteAsync(new Regex(\"(\\\\.png$)|(\\\\.jpg$)\"), async r => await r.AbortAsync());\nawait page.GotoAsync(\"https://www.microsoft.com\");\n```\n\nIt is possible to examine the request to decide the route action. For example, mocking all requests that contain some\npost data, and leaving all other requests as is:\n\n```js\nawait page.route('/api/**', route => {\n if (route.request().postData().includes('my-string'))\n route.fulfill({ body: 'mocked-data' });\n else\n route.continue();\n});\n```\n\n```java\npage.route(\"/api/**\", route -> {\n if (route.request().postData().contains(\"my-string\"))\n route.fulfill(new Route.FulfillOptions().setBody(\"mocked-data\"));\n else\n route.resume();\n});\n```\n\n```python async\ndef handle_route(route):\n if (\"my-string\" in route.request.post_data)\n route.fulfill(body=\"mocked-data\")\n else\n route.continue_()\nawait page.route(\"/api/**\", handle_route)\n```\n\n```python sync\ndef handle_route(route):\n if (\"my-string\" in route.request.post_data)\n route.fulfill(body=\"mocked-data\")\n else\n route.continue_()\npage.route(\"/api/**\", handle_route)\n```\n\n```csharp\nawait page.RouteAsync(\"/api/**\", async r =>\n{\n if (r.Request.PostData.Contains(\"my-string\"))\n await r.FulfillAsync(new RouteFulfillOptions { Body = \"mocked-data\" });\n else\n await r.ContinueAsync();\n});\n```\n\nPage routes take precedence over browser context routes (set up with [`method: BrowserContext.route`]) when request\nmatches both handlers.\n\nTo remove a route with its handler you can use [`method: Page.unroute`].\n\n> NOTE: Enabling routing disables http cache.","deprecated":false,"async":true,"alias":"route","args":[{"kind":"property","langs":{},"name":"url","type":{"name":"","union":[{"name":"string"},{"name":"RegExp"},{"name":"function","args":[{"name":"URL"}],"returnType":{"name":"boolean"}}],"expression":"[string]|[RegExp]|[function]([URL]):[boolean]"},"spec":[{"type":"text","text":"A glob pattern, regex pattern or predicate receiving [URL] to match while routing."}],"required":true,"comment":"A glob pattern, regex pattern or predicate receiving [URL] to match while routing.","deprecated":false,"async":false,"alias":"url"},{"kind":"property","langs":{"only":["js","python"],"aliases":{},"types":{},"overrides":{}},"name":"handler","type":{"name":"function","args":[{"name":"Route"},{"name":"Request"}],"returnType":null,"expression":"[function]([Route], [Request])"},"spec":[{"type":"text","text":"handler function to route the request."}],"required":true,"comment":"handler function to route the request.","deprecated":false,"async":false,"alias":"handler"},{"kind":"property","langs":{"only":["csharp","java"],"aliases":{},"types":{},"overrides":{}},"name":"handler","type":{"name":"function","args":[{"name":"Route"}],"returnType":null,"expression":"[function]([Route])"},"spec":[{"type":"text","text":"handler function to route the request."}],"required":true,"comment":"handler function to route the request.","deprecated":false,"async":false,"alias":"handler"}]},{"kind":"method","langs":{},"name":"screenshot","type":{"name":"Buffer","expression":"[Buffer]"},"spec":[{"type":"text","text":"Returns the buffer with the captured screenshot."}],"required":true,"comment":"Returns the buffer with the captured screenshot.","deprecated":false,"async":true,"alias":"screenshot","args":[{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"clip","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"x","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"x-coordinate of top-left corner of clip area"}],"required":true,"comment":"x-coordinate of top-left corner of clip area","deprecated":false,"async":false,"alias":"x"},{"kind":"property","langs":{},"name":"y","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"y-coordinate of top-left corner of clip area"}],"required":true,"comment":"y-coordinate of top-left corner of clip area","deprecated":false,"async":false,"alias":"y"},{"kind":"property","langs":{},"name":"width","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"width of clipping area"}],"required":true,"comment":"width of clipping area","deprecated":false,"async":false,"alias":"width"},{"kind":"property","langs":{},"name":"height","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"height of clipping area"}],"required":true,"comment":"height of clipping area","deprecated":false,"async":false,"alias":"height"}],"expression":"[Object]"},"spec":[{"type":"text","text":"An object which specifies clipping of the resulting image. Should have the following fields:"}],"required":false,"comment":"An object which specifies clipping of the resulting image. Should have the following fields:","deprecated":false,"async":false,"alias":"clip"},{"kind":"property","langs":{},"name":"fullPage","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"When true, takes a screenshot of the full scrollable page, instead of the currently visible viewport. Defaults to `false`."}],"required":false,"comment":"When true, takes a screenshot of the full scrollable page, instead of the currently visible viewport. Defaults to\n`false`.","deprecated":false,"async":false,"alias":"fullPage"},{"kind":"property","langs":{},"name":"omitBackground","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Hides default white background and allows capturing screenshots with transparency. Not applicable to `jpeg` images. Defaults to `false`."}],"required":false,"comment":"Hides default white background and allows capturing screenshots with transparency. Not applicable to `jpeg` images.\nDefaults to `false`.","deprecated":false,"async":false,"alias":"omitBackground"},{"kind":"property","langs":{},"name":"path","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"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 the current working directory. If no path is provided, the image won't be saved to the disk."}],"required":false,"comment":"The file path to save the image to. The screenshot type will be inferred from file extension. If `path` is a relative\npath, then it is resolved relative to the current working directory. If no path is provided, the image won't be saved to\nthe disk.","deprecated":false,"async":false,"alias":"path"},{"kind":"property","langs":{},"name":"quality","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"The quality of the image, between 0-100. Not applicable to `png` images."}],"required":false,"comment":"The quality of the image, between 0-100. Not applicable to `png` images.","deprecated":false,"async":false,"alias":"quality"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"},{"kind":"property","langs":{},"name":"type","type":{"name":"ScreenshotType","union":[{"name":"\"png\""},{"name":"\"jpeg\""}],"expression":"[ScreenshotType]<\"png\"|\"jpeg\">"},"spec":[{"type":"text","text":"Specify screenshot type, defaults to `png`."}],"required":false,"comment":"Specify screenshot type, defaults to `png`.","deprecated":false,"async":false,"alias":"type"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"selectOption","type":{"name":"Array","templates":[{"name":"string"}],"expression":"[Array]<[string]>"},"spec":[{"type":"text","text":"This method waits for an element matching `selector`, waits for [actionability](./actionability.md) checks, waits until all specified options are present in the `<select>` element and selects these options."},{"type":"text","text":"If the target element is not a `<select>` element, this method throws an error. However, if the element is inside the `<label>` element that has an associated [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), the control will be used instead."},{"type":"text","text":"Returns the array of option values that have been successfully selected."},{"type":"text","text":"Triggers a `change` and `input` event once all the provided options have been selected."},{"type":"code","lines":["// single selection matching the value","page.selectOption('select#colors', 'blue');","","// single selection matching the label","page.selectOption('select#colors', { label: 'Blue' });","","// multiple selection","page.selectOption('select#colors', ['red', 'green', 'blue']);",""],"codeLang":"js"},{"type":"code","lines":["// single selection matching the value","page.selectOption(\"select#colors\", \"blue\");","// single selection matching both the value and the label","page.selectOption(\"select#colors\", new SelectOption().setLabel(\"Blue\"));","// multiple selection","page.selectOption(\"select#colors\", new String[] {\"red\", \"green\", \"blue\"});"],"codeLang":"java"},{"type":"code","lines":["# single selection matching the value","await page.select_option(\"select#colors\", \"blue\")","# single selection matching the label","await page.select_option(\"select#colors\", label=\"blue\")","# multiple selection","await page.select_option(\"select#colors\", value=[\"red\", \"green\", \"blue\"])"],"codeLang":"python async"},{"type":"code","lines":["# single selection matching the value","page.select_option(\"select#colors\", \"blue\")","# single selection matching both the label","page.select_option(\"select#colors\", label=\"blue\")","# multiple selection","page.select_option(\"select#colors\", value=[\"red\", \"green\", \"blue\"])"],"codeLang":"python sync"},{"type":"code","lines":["// single selection matching the value","await page.SelectOptionAsync(\"select#colors\", new[] { \"blue\" });","// single selection matching both the value and the label","await page.SelectOptionAsync(\"select#colors\", new[] { new SelectOptionValue() { Label = \"blue\" } });","// multiple ","await page.SelectOptionAsync(\"select#colors\", new[] { \"red\", \"green\", \"blue\" });"],"codeLang":"csharp"},{"type":"text","text":"Shortcut for main frame's [`method: Frame.selectOption`]."}],"required":true,"comment":"This method waits for an element matching `selector`, waits for [actionability](./actionability.md) checks, waits until\nall specified options are present in the `<select>` element and selects these options.\n\nIf the target element is not a `<select>` element, this method throws an error. However, if the element is inside the\n`<label>` element that has an associated\n[control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), the control will be used instead.\n\nReturns the array of option values that have been successfully selected.\n\nTriggers a `change` and `input` event once all the provided options have been selected.\n\n```js\n// single selection matching the value\npage.selectOption('select#colors', 'blue');\n\n// single selection matching the label\npage.selectOption('select#colors', { label: 'Blue' });\n\n// multiple selection\npage.selectOption('select#colors', ['red', 'green', 'blue']);\n\n```\n\n```java\n// single selection matching the value\npage.selectOption(\"select#colors\", \"blue\");\n// single selection matching both the value and the label\npage.selectOption(\"select#colors\", new SelectOption().setLabel(\"Blue\"));\n// multiple selection\npage.selectOption(\"select#colors\", new String[] {\"red\", \"green\", \"blue\"});\n```\n\n```python async\n# single selection matching the value\nawait page.select_option(\"select#colors\", \"blue\")\n# single selection matching the label\nawait page.select_option(\"select#colors\", label=\"blue\")\n# multiple selection\nawait page.select_option(\"select#colors\", value=[\"red\", \"green\", \"blue\"])\n```\n\n```python sync\n# single selection matching the value\npage.select_option(\"select#colors\", \"blue\")\n# single selection matching both the label\npage.select_option(\"select#colors\", label=\"blue\")\n# multiple selection\npage.select_option(\"select#colors\", value=[\"red\", \"green\", \"blue\"])\n```\n\n```csharp\n// single selection matching the value\nawait page.SelectOptionAsync(\"select#colors\", new[] { \"blue\" });\n// single selection matching both the value and the label\nawait page.SelectOptionAsync(\"select#colors\", new[] { new SelectOptionValue() { Label = \"blue\" } });\n// multiple \nawait page.SelectOptionAsync(\"select#colors\", new[] { \"red\", \"green\", \"blue\" });\n```\n\nShortcut for main frame's [`method: Frame.selectOption`].","deprecated":false,"async":true,"alias":"selectOption","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See\n[working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{"only":["java","js","csharp"],"aliases":{},"types":{},"overrides":{}},"name":"values","type":{"name":"","union":[{"name":"null"},{"name":"string"},{"name":"ElementHandle"},{"name":"Array","templates":[{"name":"string"}]},{"name":"Object","properties":[{"kind":"property","langs":{},"name":"value","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Matches by `option.value`. Optional."}],"required":false,"comment":"Matches by `option.value`. Optional.","deprecated":false,"async":false,"alias":"value"},{"kind":"property","langs":{},"name":"label","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Matches by `option.label`. Optional."}],"required":false,"comment":"Matches by `option.label`. Optional.","deprecated":false,"async":false,"alias":"label"},{"kind":"property","langs":{},"name":"index","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"Matches by the index. Optional."}],"required":false,"comment":"Matches by the index. Optional.","deprecated":false,"async":false,"alias":"index"}]},{"name":"Array","templates":[{"name":"ElementHandle"}]},{"name":"Array","templates":[{"name":"Object","properties":[{"kind":"property","langs":{},"name":"value","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Matches by `option.value`. Optional."}],"required":false,"comment":"Matches by `option.value`. Optional.","deprecated":false,"async":false,"alias":"value"},{"kind":"property","langs":{},"name":"label","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Matches by `option.label`. Optional."}],"required":false,"comment":"Matches by `option.label`. Optional.","deprecated":false,"async":false,"alias":"label"},{"kind":"property","langs":{},"name":"index","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"Matches by the index. Optional."}],"required":false,"comment":"Matches by the index. Optional.","deprecated":false,"async":false,"alias":"index"}]}]}],"expression":"[null]|[string]|[ElementHandle]|[Array]<[string]>|[Object]|[Array]<[ElementHandle]>|[Array]<[Object]>"},"spec":[{"type":"text","text":"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."}],"required":true,"comment":"Options to select. If the `<select>` has the `multiple` attribute, all matching options are selected, otherwise only the\nfirst option matching one of the passed options is selected. String values are equivalent to `{value:'string'}`. Option\nis considered matching if all specified properties match.","deprecated":false,"async":false,"alias":"values"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"noWaitAfter","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`."}],"required":false,"comment":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can\nopt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to\ninaccessible pages. Defaults to `false`.","deprecated":false,"async":false,"alias":"noWaitAfter"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"},{"kind":"property","langs":{"only":["python"],"aliases":{},"types":{},"overrides":{}},"name":"element","type":{"name":"","union":[{"name":"ElementHandle"},{"name":"Array","templates":[{"name":"ElementHandle"}]}],"expression":"[ElementHandle]|[Array]<[ElementHandle]>"},"spec":[{"type":"text","text":"Option elements to select. Optional."}],"required":false,"comment":"Option elements to select. Optional.","deprecated":false,"async":false,"alias":"element"},{"kind":"property","langs":{"only":["python"],"aliases":{},"types":{},"overrides":{}},"name":"index","type":{"name":"","union":[{"name":"int"},{"name":"Array","templates":[{"name":"int"}]}],"expression":"[int]|[Array]<[int]>"},"spec":[{"type":"text","text":"Options to select by index. Optional."}],"required":false,"comment":"Options to select by index. Optional.","deprecated":false,"async":false,"alias":"index"},{"kind":"property","langs":{"only":["python"],"aliases":{},"types":{},"overrides":{}},"name":"value","type":{"name":"","union":[{"name":"string"},{"name":"Array","templates":[{"name":"string"}]}],"expression":"[string]|[Array]<[string]>"},"spec":[{"type":"text","text":"Options to select by value. If the `<select>` has the `multiple` attribute, all given options are selected, otherwise only the first option matching one of the passed options is selected. Optional."}],"required":false,"comment":"Options to select by value. If the `<select>` has the `multiple` attribute, all given options are selected, otherwise\nonly the first option matching one of the passed options is selected. Optional.","deprecated":false,"async":false,"alias":"value"},{"kind":"property","langs":{"only":["python"],"aliases":{},"types":{},"overrides":{}},"name":"label","type":{"name":"","union":[{"name":"string"},{"name":"Array","templates":[{"name":"string"}]}],"expression":"[string]|[Array]<[string]>"},"spec":[{"type":"text","text":"Options to select by label. If the `<select>` has the `multiple` attribute, all given options are selected, otherwise only the first option matching one of the passed options is selected. Optional."}],"required":false,"comment":"Options to select by label. If the `<select>` has the `multiple` attribute, all given options are selected, otherwise\nonly the first option matching one of the passed options is selected. Optional.","deprecated":false,"async":false,"alias":"label"}]},{"kind":"method","langs":{},"name":"setContent","type":{"name":"void"},"spec":[],"required":true,"comment":"","deprecated":false,"async":true,"alias":"setContent","args":[{"kind":"property","langs":{},"name":"html","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"HTML markup to assign to the page."}],"required":true,"comment":"HTML markup to assign to the page.","deprecated":false,"async":false,"alias":"html"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultNavigationTimeout`], [`method: BrowserContext.setDefaultTimeout`], [`method: Page.setDefaultNavigationTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be\nchanged by using the [`method: BrowserContext.setDefaultNavigationTimeout`],\n[`method: BrowserContext.setDefaultTimeout`], [`method: Page.setDefaultNavigationTimeout`] or\n[`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"},{"kind":"property","langs":{},"name":"waitUntil","type":{"name":"WaitUntilState","union":[{"name":"\"load\""},{"name":"\"domcontentloaded\""},{"name":"\"networkidle\""}],"expression":"[WaitUntilState]<\"load\"|\"domcontentloaded\"|\"networkidle\">"},"spec":[{"type":"text","text":"When to consider operation succeeded, defaults to `load`. Events can be either:"},{"type":"li","text":"`'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.","liType":"bullet"},{"type":"li","text":"`'load'` - consider operation to be finished when the `load` event is fired.","liType":"bullet"},{"type":"li","text":"`'networkidle'` - consider operation to be finished when there are no network connections for at least `500` ms.","liType":"bullet"}],"required":false,"comment":"When to consider operation succeeded, defaults to `load`. Events can be either:\n- `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.\n- `'load'` - consider operation to be finished when the `load` event is fired.\n- `'networkidle'` - consider operation to be finished when there are no network connections for at least `500` ms.","deprecated":false,"async":false,"alias":"waitUntil"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"setDefaultNavigationTimeout","type":{"name":"void"},"spec":[{"type":"text","text":"This setting will change the default maximum navigation time for the following methods and related shortcuts:"},{"type":"li","text":"[`method: Page.goBack`]","liType":"bullet"},{"type":"li","text":"[`method: Page.goForward`]","liType":"bullet"},{"type":"li","text":"[`method: Page.goto`]","liType":"bullet"},{"type":"li","text":"[`method: Page.reload`]","liType":"bullet"},{"type":"li","text":"[`method: Page.setContent`]","liType":"bullet"},{"type":"li","text":"[`method: Page.waitForNavigation`]","liType":"bullet"},{"type":"li","text":"[`method: Page.waitForURL`]","liType":"bullet"},{"type":"note","noteType":"note","text":"[`method: Page.setDefaultNavigationTimeout`] takes priority over [`method: Page.setDefaultTimeout`], [`method: BrowserContext.setDefaultTimeout`] and [`method: BrowserContext.setDefaultNavigationTimeout`]."}],"required":true,"comment":"This setting will change the default maximum navigation time for the following methods and related shortcuts:\n- [`method: Page.goBack`]\n- [`method: Page.goForward`]\n- [`method: Page.goto`]\n- [`method: Page.reload`]\n- [`method: Page.setContent`]\n- [`method: Page.waitForNavigation`]\n- [`method: Page.waitForURL`]\n\n> NOTE: [`method: Page.setDefaultNavigationTimeout`] takes priority over [`method: Page.setDefaultTimeout`],\n[`method: BrowserContext.setDefaultTimeout`] and [`method: BrowserContext.setDefaultNavigationTimeout`].","deprecated":false,"async":false,"alias":"setDefaultNavigationTimeout","args":[{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum navigation time in milliseconds"}],"required":true,"comment":"Maximum navigation time in milliseconds","deprecated":false,"async":false,"alias":"timeout"}]},{"kind":"method","langs":{},"name":"setDefaultTimeout","type":{"name":"void"},"spec":[{"type":"text","text":"This setting will change the default maximum time for all the methods accepting `timeout` option."},{"type":"note","noteType":"note","text":"[`method: Page.setDefaultNavigationTimeout`] takes priority over [`method: Page.setDefaultTimeout`]."}],"required":true,"comment":"This setting will change the default maximum time for all the methods accepting `timeout` option.\n\n> NOTE: [`method: Page.setDefaultNavigationTimeout`] takes priority over [`method: Page.setDefaultTimeout`].","deprecated":false,"async":false,"alias":"setDefaultTimeout","args":[{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds"}],"required":true,"comment":"Maximum time in milliseconds","deprecated":false,"async":false,"alias":"timeout"}]},{"kind":"method","langs":{},"name":"setExtraHTTPHeaders","type":{"name":"void"},"spec":[{"type":"text","text":"The extra HTTP headers will be sent with every request the page initiates."},{"type":"note","noteType":"note","text":"[`method: Page.setExtraHTTPHeaders`] does not guarantee the order of headers in the outgoing requests."}],"required":true,"comment":"The extra HTTP headers will be sent with every request the page initiates.\n\n> NOTE: [`method: Page.setExtraHTTPHeaders`] does not guarantee the order of headers in the outgoing requests.","deprecated":false,"async":true,"alias":"setExtraHTTPHeaders","args":[{"kind":"property","langs":{},"name":"headers","type":{"name":"Object","templates":[{"name":"string"},{"name":"string"}],"expression":"[Object]<[string], [string]>"},"spec":[{"type":"text","text":"An object containing additional HTTP headers to be sent with every request. All header values must be strings."}],"required":true,"comment":"An object containing additional HTTP headers to be sent with every request. All header values must be strings.","deprecated":false,"async":false,"alias":"headers"}]},{"kind":"method","langs":{},"name":"setInputFiles","type":{"name":"void"},"spec":[{"type":"text","text":"This method expects `selector` to point to an [input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input)."},{"type":"text","text":"Sets the value of the file input to these file paths or files. If some of the `filePaths` are relative paths, then they are resolved relative to the the current working directory. For empty array, clears the selected files."}],"required":true,"comment":"This method expects `selector` to point to an\n[input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input).\n\nSets the value of the file input to these file paths or files. If some of the `filePaths` are relative paths, then they\nare resolved relative to the the current working directory. For empty array, clears the selected files.","deprecated":false,"async":true,"alias":"setInputFiles","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See\n[working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"files","type":{"name":"","union":[{"name":"path"},{"name":"Array","templates":[{"name":"path"}]},{"name":"Object","properties":[{"kind":"property","langs":{},"name":"name","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"File name"}],"required":true,"comment":"File name","deprecated":false,"async":false,"alias":"name"},{"kind":"property","langs":{},"name":"mimeType","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"File type"}],"required":true,"comment":"File type","deprecated":false,"async":false,"alias":"mimeType"},{"kind":"property","langs":{},"name":"buffer","type":{"name":"Buffer","expression":"[Buffer]"},"spec":[{"type":"text","text":"File content"}],"required":true,"comment":"File content","deprecated":false,"async":false,"alias":"buffer"}]},{"name":"Array","templates":[{"name":"Object","properties":[{"kind":"property","langs":{},"name":"name","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"File name"}],"required":true,"comment":"File name","deprecated":false,"async":false,"alias":"name"},{"kind":"property","langs":{},"name":"mimeType","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"File type"}],"required":true,"comment":"File type","deprecated":false,"async":false,"alias":"mimeType"},{"kind":"property","langs":{},"name":"buffer","type":{"name":"Buffer","expression":"[Buffer]"},"spec":[{"type":"text","text":"File content"}],"required":true,"comment":"File content","deprecated":false,"async":false,"alias":"buffer"}]}]}],"expression":"[path]|[Array]<[path]>|[Object]|[Array]<[Object]>"},"spec":[],"required":true,"comment":"","deprecated":false,"async":false,"alias":"files"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"noWaitAfter","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`."}],"required":false,"comment":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can\nopt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to\ninaccessible pages. Defaults to `false`.","deprecated":false,"async":false,"alias":"noWaitAfter"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"setViewportSize","type":{"name":"void"},"spec":[{"type":"text","text":"In the case of multiple pages in a single browser, each page can have its own viewport size. However, [`method: Browser.newContext`] allows to set viewport size (and more) for all pages in the context at once."},{"type":"text","text":"`page.setViewportSize` will resize the page. A lot of websites don't expect phones to change size, so you should set the viewport size before navigating to the page."},{"type":"code","lines":["const page = await browser.newPage();","await page.setViewportSize({"," width: 640,"," height: 480,","});","await page.goto('https://example.com');"],"codeLang":"js"},{"type":"code","lines":["Page page = browser.newPage();","page.setViewportSize(640, 480);","page.navigate(\"https://example.com\");"],"codeLang":"java"},{"type":"code","lines":["page = await browser.new_page()","await page.set_viewport_size({\"width\": 640, \"height\": 480})","await page.goto(\"https://example.com\")"],"codeLang":"python async"},{"type":"code","lines":["page = browser.new_page()","page.set_viewport_size({\"width\": 640, \"height\": 480})","page.goto(\"https://example.com\")"],"codeLang":"python sync"},{"type":"code","lines":["var page = await browser.NewPageAsync();","await page.SetViewportSizeAsync(640, 480);","await page.GotoAsync(\"https://www.microsoft.com\");"],"codeLang":"csharp"}],"required":true,"comment":"In the case of multiple pages in a single browser, each page can have its own viewport size. However,\n[`method: Browser.newContext`] allows to set viewport size (and more) for all pages in the context at once.\n\n`page.setViewportSize` will resize the page. A lot of websites don't expect phones to change size, so you should set the\nviewport size before navigating to the page.\n\n```js\nconst page = await browser.newPage();\nawait page.setViewportSize({\n width: 640,\n height: 480,\n});\nawait page.goto('https://example.com');\n```\n\n```java\nPage page = browser.newPage();\npage.setViewportSize(640, 480);\npage.navigate(\"https://example.com\");\n```\n\n```python async\npage = await browser.new_page()\nawait page.set_viewport_size({\"width\": 640, \"height\": 480})\nawait page.goto(\"https://example.com\")\n```\n\n```python sync\npage = browser.new_page()\npage.set_viewport_size({\"width\": 640, \"height\": 480})\npage.goto(\"https://example.com\")\n```\n\n```csharp\nvar page = await browser.NewPageAsync();\nawait page.SetViewportSizeAsync(640, 480);\nawait page.GotoAsync(\"https://www.microsoft.com\");\n```\n","deprecated":false,"async":true,"alias":"setViewportSize","args":[{"kind":"property","langs":{"only":["js","python"],"aliases":{},"types":{},"overrides":{}},"name":"viewportSize","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"width","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"page width in pixels."}],"required":true,"comment":"page width in pixels.","deprecated":false,"async":false,"alias":"width"},{"kind":"property","langs":{},"name":"height","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"page height in pixels."}],"required":true,"comment":"page height in pixels.","deprecated":false,"async":false,"alias":"height"}],"expression":"[Object]"},"spec":[],"required":true,"comment":"","deprecated":false,"async":false,"alias":"viewportSize"},{"kind":"property","langs":{"only":["csharp","java"],"aliases":{},"types":{},"overrides":{}},"name":"width","type":{"name":"int","expression":"[int]"},"spec":[],"required":true,"comment":"","deprecated":false,"async":false,"alias":"width"},{"kind":"property","langs":{"only":["csharp","java"],"aliases":{},"types":{},"overrides":{}},"name":"height","type":{"name":"int","expression":"[int]"},"spec":[],"required":true,"comment":"","deprecated":false,"async":false,"alias":"height"}]},{"kind":"method","langs":{},"name":"tap","type":{"name":"void"},"spec":[{"type":"text","text":"This method taps an element matching `selector` by performing the following steps:"},{"type":"li","text":"Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.","liType":"ordinal"},{"type":"li","text":"Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried.","liType":"ordinal"},{"type":"li","text":"Scroll the element into view if needed.","liType":"ordinal"},{"type":"li","text":"Use [`property: Page.touchscreen`] to tap the center of the element, or the specified `position`.","liType":"ordinal"},{"type":"li","text":"Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.","liType":"ordinal"},{"type":"text","text":"When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing zero timeout disables this."},{"type":"note","noteType":"note","text":"[`method: Page.tap`] requires that the `hasTouch` option of the browser context be set to true."},{"type":"text","text":"Shortcut for main frame's [`method: Frame.tap`]."}],"required":true,"comment":"This method taps an element matching `selector` by performing the following steps:\n1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.\n1. Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the\n element is detached during the checks, the whole action is retried.\n1. Scroll the element into view if needed.\n1. Use [`property: Page.touchscreen`] to tap the center of the element, or the specified `position`.\n1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.\n\nWhen all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing\nzero timeout disables this.\n\n> NOTE: [`method: Page.tap`] requires that the `hasTouch` option of the browser context be set to true.\n\nShortcut for main frame's [`method: Frame.tap`].","deprecated":false,"async":true,"alias":"tap","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See\n[working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"force","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`."}],"required":false,"comment":"Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.","deprecated":false,"async":false,"alias":"force"},{"kind":"property","langs":{},"name":"modifiers","type":{"name":"Array","templates":[{"name":"KeyboardModifier","union":[{"name":"\"Alt\""},{"name":"\"Control\""},{"name":"\"Meta\""},{"name":"\"Shift\""}]}],"expression":"[Array]<[KeyboardModifier]<\"Alt\"|\"Control\"|\"Meta\"|\"Shift\">>"},"spec":[{"type":"text","text":"Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current modifiers back. If not specified, currently pressed modifiers are used."}],"required":false,"comment":"Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current\nmodifiers back. If not specified, currently pressed modifiers are used.","deprecated":false,"async":false,"alias":"modifiers"},{"kind":"property","langs":{},"name":"noWaitAfter","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`."}],"required":false,"comment":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can\nopt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to\ninaccessible pages. Defaults to `false`.","deprecated":false,"async":false,"alias":"noWaitAfter"},{"kind":"property","langs":{},"name":"position","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"x","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"x"},{"kind":"property","langs":{},"name":"y","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"y"}],"expression":"[Object]"},"spec":[{"type":"text","text":"A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element."}],"required":false,"comment":"A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the\nelement.","deprecated":false,"async":false,"alias":"position"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"},{"kind":"property","langs":{},"name":"trial","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it."}],"required":false,"comment":"When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to\n`false`. Useful to wait until the element is ready for the action without performing it.","deprecated":false,"async":false,"alias":"trial"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"textContent","type":{"name":"","union":[{"name":"null"},{"name":"string"}],"expression":"[null]|[string]"},"spec":[{"type":"text","text":"Returns `element.textContent`."}],"required":true,"comment":"Returns `element.textContent`.","deprecated":false,"async":true,"alias":"textContent","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See\n[working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"title","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Returns the page's title. Shortcut for main frame's [`method: Frame.title`]."}],"required":true,"comment":"Returns the page's title. Shortcut for main frame's [`method: Frame.title`].","deprecated":false,"async":true,"alias":"title","args":[]},{"kind":"property","langs":{},"name":"touchscreen","type":{"name":"Touchscreen","expression":"[Touchscreen]"},"spec":[],"required":true,"comment":"","deprecated":false,"async":false,"alias":"touchscreen","args":[]},{"kind":"method","langs":{},"name":"type","type":{"name":"void"},"spec":[{"type":"text","text":"Sends a `keydown`, `keypress`/`input`, and `keyup` event for each character in the text. `page.type` can be used to send fine-grained keyboard events. To fill values in form fields, use [`method: Page.fill`]."},{"type":"text","text":"To press a special key, like `Control` or `ArrowDown`, use [`method: Keyboard.press`]."},{"type":"code","lines":["await page.type('#mytextarea', 'Hello'); // Types instantly","await page.type('#mytextarea', 'World', {delay: 100}); // Types slower, like a user"],"codeLang":"js"},{"type":"code","lines":["// Types instantly","page.type(\"#mytextarea\", \"Hello\");","// Types slower, like a user","page.type(\"#mytextarea\", \"World\", new Page.TypeOptions().setDelay(100));"],"codeLang":"java"},{"type":"code","lines":["await page.type(\"#mytextarea\", \"hello\") # types instantly","await page.type(\"#mytextarea\", \"world\", delay=100) # types slower, like a user"],"codeLang":"python async"},{"type":"code","lines":["page.type(\"#mytextarea\", \"hello\") # types instantly","page.type(\"#mytextarea\", \"world\", delay=100) # types slower, like a user"],"codeLang":"python sync"},{"type":"code","lines":["await page.TypeAsync(\"#mytextarea\", \"hello\"); // types instantly","await page.TypeAsync(\"#mytextarea\", \"world\"); // types slower, like a user"],"codeLang":"csharp"},{"type":"text","text":"Shortcut for main frame's [`method: Frame.type`]."}],"required":true,"comment":"Sends a `keydown`, `keypress`/`input`, and `keyup` event for each character in the text. `page.type` can be used to send\nfine-grained keyboard events. To fill values in form fields, use [`method: Page.fill`].\n\nTo press a special key, like `Control` or `ArrowDown`, use [`method: Keyboard.press`].\n\n```js\nawait page.type('#mytextarea', 'Hello'); // Types instantly\nawait page.type('#mytextarea', 'World', {delay: 100}); // Types slower, like a user\n```\n\n```java\n// Types instantly\npage.type(\"#mytextarea\", \"Hello\");\n// Types slower, like a user\npage.type(\"#mytextarea\", \"World\", new Page.TypeOptions().setDelay(100));\n```\n\n```python async\nawait page.type(\"#mytextarea\", \"hello\") # types instantly\nawait page.type(\"#mytextarea\", \"world\", delay=100) # types slower, like a user\n```\n\n```python sync\npage.type(\"#mytextarea\", \"hello\") # types instantly\npage.type(\"#mytextarea\", \"world\", delay=100) # types slower, like a user\n```\n\n```csharp\nawait page.TypeAsync(\"#mytextarea\", \"hello\"); // types instantly\nawait page.TypeAsync(\"#mytextarea\", \"world\"); // types slower, like a user\n```\n\nShortcut for main frame's [`method: Frame.type`].","deprecated":false,"async":true,"alias":"type","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See\n[working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"text","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A text to type into a focused element."}],"required":true,"comment":"A text to type into a focused element.","deprecated":false,"async":false,"alias":"text"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"delay","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Time to wait between key presses in milliseconds. Defaults to 0."}],"required":false,"comment":"Time to wait between key presses in milliseconds. Defaults to 0.","deprecated":false,"async":false,"alias":"delay"},{"kind":"property","langs":{},"name":"noWaitAfter","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`."}],"required":false,"comment":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can\nopt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to\ninaccessible pages. Defaults to `false`.","deprecated":false,"async":false,"alias":"noWaitAfter"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"uncheck","type":{"name":"void"},"spec":[{"type":"text","text":"This method unchecks an element matching `selector` by performing the following steps:"},{"type":"li","text":"Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.","liType":"ordinal"},{"type":"li","text":"Ensure that matched element is a checkbox or a radio input. If not, this method throws. If the element is already unchecked, this method returns immediately.","liType":"ordinal"},{"type":"li","text":"Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried.","liType":"ordinal"},{"type":"li","text":"Scroll the element into view if needed.","liType":"ordinal"},{"type":"li","text":"Use [`property: Page.mouse`] to click in the center of the element.","liType":"ordinal"},{"type":"li","text":"Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.","liType":"ordinal"},{"type":"li","text":"Ensure that the element is now unchecked. If not, this method throws.","liType":"ordinal"},{"type":"text","text":"When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing zero timeout disables this."},{"type":"text","text":"Shortcut for main frame's [`method: Frame.uncheck`]."}],"required":true,"comment":"This method unchecks an element matching `selector` by performing the following steps:\n1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.\n1. Ensure that matched element is a checkbox or a radio input. If not, this method throws. If the element is already\n unchecked, this method returns immediately.\n1. Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the\n element is detached during the checks, the whole action is retried.\n1. Scroll the element into view if needed.\n1. Use [`property: Page.mouse`] to click in the center of the element.\n1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.\n1. Ensure that the element is now unchecked. If not, this method throws.\n\nWhen all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing\nzero timeout disables this.\n\nShortcut for main frame's [`method: Frame.uncheck`].","deprecated":false,"async":true,"alias":"uncheck","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See\n[working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"force","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`."}],"required":false,"comment":"Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.","deprecated":false,"async":false,"alias":"force"},{"kind":"property","langs":{},"name":"noWaitAfter","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`."}],"required":false,"comment":"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can\nopt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to\ninaccessible pages. Defaults to `false`.","deprecated":false,"async":false,"alias":"noWaitAfter"},{"kind":"property","langs":{},"name":"position","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"x","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"x"},{"kind":"property","langs":{},"name":"y","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":""}],"required":true,"comment":"","deprecated":false,"async":false,"alias":"y"}],"expression":"[Object]"},"spec":[{"type":"text","text":"A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element."}],"required":false,"comment":"A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the\nelement.","deprecated":false,"async":false,"alias":"position"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"},{"kind":"property","langs":{},"name":"trial","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it."}],"required":false,"comment":"When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to\n`false`. Useful to wait until the element is ready for the action without performing it.","deprecated":false,"async":false,"alias":"trial"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"unroute","type":{"name":"void"},"spec":[{"type":"text","text":"Removes a route created with [`method: Page.route`]. When `handler` is not specified, removes all routes for the `url`."}],"required":true,"comment":"Removes a route created with [`method: Page.route`]. When `handler` is not specified, removes all routes for the `url`.","deprecated":false,"async":true,"alias":"unroute","args":[{"kind":"property","langs":{},"name":"url","type":{"name":"","union":[{"name":"string"},{"name":"RegExp"},{"name":"function","args":[{"name":"URL"}],"returnType":{"name":"boolean"}}],"expression":"[string]|[RegExp]|[function]([URL]):[boolean]"},"spec":[{"type":"text","text":"A glob pattern, regex pattern or predicate receiving [URL] to match while routing."}],"required":true,"comment":"A glob pattern, regex pattern or predicate receiving [URL] to match while routing.","deprecated":false,"async":false,"alias":"url"},{"kind":"property","langs":{"only":["js","python"],"aliases":{},"types":{},"overrides":{}},"name":"handler","type":{"name":"function","args":[{"name":"Route"},{"name":"Request"}],"returnType":null,"expression":"[function]([Route], [Request])"},"spec":[{"type":"text","text":"Optional handler function to route the request."}],"required":false,"comment":"Optional handler function to route the request.","deprecated":false,"async":false,"alias":"handler"},{"kind":"property","langs":{"only":["csharp","java"],"aliases":{},"types":{},"overrides":{}},"name":"handler","type":{"name":"function","args":[{"name":"Route"}],"returnType":null,"expression":"[function]([Route])"},"spec":[{"type":"text","text":"Optional handler function to route the request."}],"required":false,"comment":"Optional handler function to route the request.","deprecated":false,"async":false,"alias":"handler"}]},{"kind":"method","langs":{},"name":"url","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Shortcut for main frame's [`method: Frame.url`]."}],"required":true,"comment":"Shortcut for main frame's [`method: Frame.url`].","deprecated":false,"async":false,"alias":"url","args":[]},{"kind":"method","langs":{},"name":"video","type":{"name":"","union":[{"name":"null"},{"name":"Video"}],"expression":"[null]|[Video]"},"spec":[{"type":"text","text":"Video object associated with this page."}],"required":true,"comment":"Video object associated with this page.","deprecated":false,"async":false,"alias":"video","args":[]},{"kind":"method","langs":{},"name":"viewportSize","type":{"name":"","union":[{"name":"null"},{"name":"Object","properties":[{"kind":"property","langs":{},"name":"width","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"page width in pixels."}],"required":true,"comment":"page width in pixels.","deprecated":false,"async":false,"alias":"width"},{"kind":"property","langs":{},"name":"height","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"page height in pixels."}],"required":true,"comment":"page height in pixels.","deprecated":false,"async":false,"alias":"height"}]}],"expression":"[null]|[Object]"},"spec":[],"required":true,"comment":"","deprecated":false,"async":false,"alias":"viewportSize","args":[]},{"kind":"method","langs":{"only":["java"],"aliases":{},"types":{},"overrides":{}},"name":"waitForClose","type":{"name":"Page","expression":"[Page]"},"spec":[{"type":"text","text":"Performs action and waits for the Page to close."}],"required":true,"comment":"Performs action and waits for the Page to close.","deprecated":false,"async":true,"alias":"waitForClose","args":[{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{"only":["csharp","java","python"],"aliases":{},"types":{},"overrides":{}},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`]."}],"required":false,"comment":"Maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default\nvalue can be changed by using the [`method: BrowserContext.setDefaultTimeout`].","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"},{"kind":"property","langs":{"only":["java"],"aliases":{},"types":{},"overrides":{}},"name":"callback","type":{"name":"Runnable","expression":"[Runnable]"},"spec":[{"type":"text","text":"Callback that performs the action triggering the event."}],"required":true,"comment":"Callback that performs the action triggering the event.","deprecated":false,"async":false,"alias":"callback"}]},{"kind":"method","langs":{"only":["java","python","csharp"],"aliases":{"python":"expect_console_message","csharp":"RunAndWaitForConsoleMessage"},"types":{"python":{"name":"EventContextManager","templates":[{"name":"ConsoleMessage"}],"expression":"[EventContextManager]<[ConsoleMessage]>"}},"overrides":{}},"name":"waitForConsoleMessage","type":{"name":"ConsoleMessage","expression":"[ConsoleMessage]"},"spec":[{"type":"text","text":"Performs action and waits for a `ConsoleMessage` to be logged by in the page. If predicate is provided, it passes `ConsoleMessage` value into the `predicate` function and waits for `predicate(message)` to return a truthy value. Will throw an error if the page is closed before the [`event: Page.console`] event is fired."}],"required":true,"comment":"Performs action and waits for a `ConsoleMessage` to be logged by in the page. If predicate is provided, it passes\n`ConsoleMessage` value into the `predicate` function and waits for `predicate(message)` to return a truthy value. Will\nthrow an error if the page is closed before the [`event: Page.console`] event is fired.","deprecated":false,"async":true,"alias":"waitForConsoleMessage","args":[{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"predicate","type":{"name":"function","args":[{"name":"ConsoleMessage"}],"returnType":{"name":"boolean"},"expression":"[function]([ConsoleMessage]):[boolean]"},"spec":[{"type":"text","text":"Receives the `ConsoleMessage` object and resolves to truthy value when the waiting should resolve."}],"required":false,"comment":"Receives the `ConsoleMessage` object and resolves to truthy value when the waiting should resolve.","deprecated":false,"async":false,"alias":"predicate"},{"kind":"property","langs":{"only":["csharp","java","python"],"aliases":{},"types":{},"overrides":{}},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`]."}],"required":false,"comment":"Maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default\nvalue can be changed by using the [`method: BrowserContext.setDefaultTimeout`].","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"},{"kind":"property","langs":{"only":["csharp"],"aliases":{},"types":{},"overrides":{}},"name":"action","type":{"name":"Func","templates":[{"name":"Task"}],"expression":"[Func<Task>]"},"spec":[{"type":"text","text":"Action that triggers the event."}],"required":true,"comment":"Action that triggers the event.","deprecated":false,"async":false,"alias":"action"},{"kind":"property","langs":{"only":["java"],"aliases":{},"types":{},"overrides":{}},"name":"callback","type":{"name":"Runnable","expression":"[Runnable]"},"spec":[{"type":"text","text":"Callback that performs the action triggering the event."}],"required":true,"comment":"Callback that performs the action triggering the event.","deprecated":false,"async":false,"alias":"callback"}]},{"kind":"method","langs":{"only":["java","python","csharp"],"aliases":{"python":"expect_download","csharp":"RunAndWaitForDownload"},"types":{"python":{"name":"EventContextManager","templates":[{"name":"Download"}],"expression":"[EventContextManager]<[Download]>"}},"overrides":{}},"name":"waitForDownload","type":{"name":"Download","expression":"[Download]"},"spec":[{"type":"text","text":"Performs action and waits for a new `Download`. If predicate is provided, it passes `Download` value into the `predicate` function and waits for `predicate(download)` to return a truthy value. Will throw an error if the page is closed before the download event is fired."}],"required":true,"comment":"Performs action and waits for a new `Download`. If predicate is provided, it passes `Download` value into the\n`predicate` function and waits for `predicate(download)` to return a truthy value. Will throw an error if the page is\nclosed before the download event is fired.","deprecated":false,"async":true,"alias":"waitForDownload","args":[{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"predicate","type":{"name":"function","args":[{"name":"Download"}],"returnType":{"name":"boolean"},"expression":"[function]([Download]):[boolean]"},"spec":[{"type":"text","text":"Receives the `Download` object and resolves to truthy value when the waiting should resolve."}],"required":false,"comment":"Receives the `Download` object and resolves to truthy value when the waiting should resolve.","deprecated":false,"async":false,"alias":"predicate"},{"kind":"property","langs":{"only":["csharp","java","python"],"aliases":{},"types":{},"overrides":{}},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`]."}],"required":false,"comment":"Maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default\nvalue can be changed by using the [`method: BrowserContext.setDefaultTimeout`].","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"},{"kind":"property","langs":{"only":["csharp"],"aliases":{},"types":{},"overrides":{}},"name":"action","type":{"name":"Func","templates":[{"name":"Task"}],"expression":"[Func<Task>]"},"spec":[{"type":"text","text":"Action that triggers the event."}],"required":true,"comment":"Action that triggers the event.","deprecated":false,"async":false,"alias":"action"},{"kind":"property","langs":{"only":["java"],"aliases":{},"types":{},"overrides":{}},"name":"callback","type":{"name":"Runnable","expression":"[Runnable]"},"spec":[{"type":"text","text":"Callback that performs the action triggering the event."}],"required":true,"comment":"Callback that performs the action triggering the event.","deprecated":false,"async":false,"alias":"callback"}]},{"kind":"method","langs":{"only":["js","python"],"aliases":{"python":"expect_event"},"types":{"python":{"name":"EventContextManager","expression":"[EventContextManager]"}},"overrides":{}},"name":"waitForEvent","type":{"name":"any","expression":"[any]"},"spec":[{"type":"text","text":"Waits for event to fire and passes its value into the predicate function. Returns when the predicate returns truthy value. Will throw an error if the page is closed before the event is fired. Returns the event data value."},{"type":"code","lines":["const [frame, _] = await Promise.all(["," page.waitForEvent('framenavigated'),"," page.click('button')","]);"],"codeLang":"js"},{"type":"code","lines":["async with page.expect_event(\"framenavigated\") as event_info:"," await page.click(\"button\")","frame = await event_info.value"],"codeLang":"python async"},{"type":"code","lines":["with page.expect_event(\"framenavigated\") as event_info:"," page.click(\"button\")","frame = event_info.value"],"codeLang":"python sync"}],"required":true,"comment":"Waits for event to fire and passes its value into the predicate function. Returns when the predicate returns truthy\nvalue. Will throw an error if the page is closed before the event is fired. Returns the event data value.\n\n```js\nconst [frame, _] = await Promise.all([\n page.waitForEvent('framenavigated'),\n page.click('button')\n]);\n```\n\n```python async\nasync with page.expect_event(\"framenavigated\") as event_info:\n await page.click(\"button\")\nframe = await event_info.value\n```\n\n```python sync\nwith page.expect_event(\"framenavigated\") as event_info:\n page.click(\"button\")\nframe = event_info.value\n```\n","deprecated":false,"async":true,"alias":"waitForEvent","args":[{"kind":"property","langs":{"only":["js","python","java"],"aliases":{},"types":{},"overrides":{}},"name":"event","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Event name, same one typically passed into `*.on(event)`."}],"required":true,"comment":"Event name, same one typically passed into `*.on(event)`.","deprecated":false,"async":false,"alias":"event"},{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"optionsOrPredicate","type":{"name":"","union":[{"name":"function"},{"name":"Object","properties":[{"kind":"property","langs":{},"name":"predicate","type":{"name":"function","expression":"[function]"},"spec":[{"type":"text","text":"receives the event data and resolves to truthy value when the waiting should resolve."}],"required":true,"comment":"receives the event data and resolves to truthy value when the waiting should resolve.","deprecated":false,"async":false,"alias":"predicate"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`]."}],"required":false,"comment":"maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default\nvalue can be changed by using the [`method: BrowserContext.setDefaultTimeout`].","deprecated":false,"async":false,"alias":"timeout"}]}],"expression":"[function]|[Object]"},"spec":[{"type":"text","text":"Either a predicate that receives an event or an options object. Optional."}],"required":false,"comment":"Either a predicate that receives an event or an options object. Optional.","deprecated":false,"async":false,"alias":"optionsOrPredicate"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"predicate","type":{"name":"function","expression":"[function]"},"spec":[{"type":"text","text":"Receives the event data and resolves to truthy value when the waiting should resolve."}],"required":false,"comment":"Receives the event data and resolves to truthy value when the waiting should resolve.","deprecated":false,"async":false,"alias":"predicate"},{"kind":"property","langs":{"only":["csharp","java","python"],"aliases":{},"types":{},"overrides":{}},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`]."}],"required":false,"comment":"Maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default\nvalue can be changed by using the [`method: BrowserContext.setDefaultTimeout`].","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{"only":["java","python","csharp"],"aliases":{"python":"expect_file_chooser","csharp":"RunAndWaitForFileChooser"},"types":{"python":{"name":"EventContextManager","templates":[{"name":"FileChooser"}],"expression":"[EventContextManager]<[FileChooser]>"}},"overrides":{}},"name":"waitForFileChooser","type":{"name":"FileChooser","expression":"[FileChooser]"},"spec":[{"type":"text","text":"Performs action and waits for a new `FileChooser` to be created. If predicate is provided, it passes `FileChooser` value into the `predicate` function and waits for `predicate(fileChooser)` to return a truthy value. Will throw an error if the page is closed before the file chooser is opened."}],"required":true,"comment":"Performs action and waits for a new `FileChooser` to be created. If predicate is provided, it passes `FileChooser` value\ninto the `predicate` function and waits for `predicate(fileChooser)` to return a truthy value. Will throw an error if\nthe page is closed before the file chooser is opened.","deprecated":false,"async":true,"alias":"waitForFileChooser","args":[{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"predicate","type":{"name":"function","args":[{"name":"FileChooser"}],"returnType":{"name":"boolean"},"expression":"[function]([FileChooser]):[boolean]"},"spec":[{"type":"text","text":"Receives the `FileChooser` object and resolves to truthy value when the waiting should resolve."}],"required":false,"comment":"Receives the `FileChooser` object and resolves to truthy value when the waiting should resolve.","deprecated":false,"async":false,"alias":"predicate"},{"kind":"property","langs":{"only":["csharp","java","python"],"aliases":{},"types":{},"overrides":{}},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`]."}],"required":false,"comment":"Maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default\nvalue can be changed by using the [`method: BrowserContext.setDefaultTimeout`].","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"},{"kind":"property","langs":{"only":["csharp"],"aliases":{},"types":{},"overrides":{}},"name":"action","type":{"name":"Func","templates":[{"name":"Task"}],"expression":"[Func<Task>]"},"spec":[{"type":"text","text":"Action that triggers the event."}],"required":true,"comment":"Action that triggers the event.","deprecated":false,"async":false,"alias":"action"},{"kind":"property","langs":{"only":["java"],"aliases":{},"types":{},"overrides":{}},"name":"callback","type":{"name":"Runnable","expression":"[Runnable]"},"spec":[{"type":"text","text":"Callback that performs the action triggering the event."}],"required":true,"comment":"Callback that performs the action triggering the event.","deprecated":false,"async":false,"alias":"callback"}]},{"kind":"method","langs":{},"name":"waitForFunction","type":{"name":"JSHandle","expression":"[JSHandle]"},"spec":[{"type":"text","text":"Returns when the `expression` returns a truthy value. It resolves to a JSHandle of the truthy value."},{"type":"text","text":"The [`method: Page.waitForFunction`] can be used to observe viewport size change:"},{"type":"code","lines":["const { webkit } = require('playwright'); // Or 'chromium' or 'firefox'.","","(async () => {"," const browser = await webkit.launch();"," const page = await browser.newPage();"," const watchDog = page.waitForFunction(() => window.innerWidth < 100);"," await page.setViewportSize({width: 50, height: 50});"," await watchDog;"," await browser.close();","})();"],"codeLang":"js"},{"type":"code","lines":["import com.microsoft.playwright.*;","","public class Example {"," public static void main(String[] args) {"," try (Playwright playwright = Playwright.create()) {"," BrowserType webkit = playwright.webkit();"," Browser browser = webkit.launch();"," Page page = browser.newPage();"," page.setViewportSize(50, 50);"," page.waitForFunction(\"() => window.innerWidth < 100\");"," browser.close();"," }"," }","}"],"codeLang":"java"},{"type":"code","lines":["import asyncio","from playwright.async_api import async_playwright","","async def run(playwright):"," webkit = playwright.webkit"," browser = await webkit.launch()"," page = await browser.new_page()"," await page.evaluate(\"window.x = 0; setTimeout(() => { window.x = 100 }, 1000);\")"," await page.wait_for_function(\"() => window.x > 0\")"," await browser.close()","","async def main():"," async with async_playwright() as playwright:"," await run(playwright)","asyncio.run(main())"],"codeLang":"python async"},{"type":"code","lines":["from playwright.sync_api import sync_playwright","","def run(playwright):"," webkit = playwright.webkit"," browser = webkit.launch()"," page = browser.new_page()"," page.evaluate(\"window.x = 0; setTimeout(() => { window.x = 100 }, 1000);\")"," page.wait_for_function(\"() => window.x > 0\")"," browser.close()","","with sync_playwright() as playwright:"," run(playwright)"],"codeLang":"python sync"},{"type":"code","lines":["using Microsoft.Playwright;","using System.Threading.Tasks;","","class FrameExamples","{"," public static async Task WaitForFunction()"," {"," using var playwright = await Playwright.CreateAsync();"," await using var browser = await playwright.Webkit.LaunchAsync();"," var page = await browser.NewPageAsync();"," await page.SetViewportSizeAsync(50, 50);"," await page.MainFrame.WaitForFunctionAsync(\"window.innerWidth < 100\");"," }","}"],"codeLang":"csharp"},{"type":"text","text":"To pass an argument to the predicate of [`method: Page.waitForFunction`] function:"},{"type":"code","lines":["const selector = '.foo';","await page.waitForFunction(selector => !!document.querySelector(selector), selector);"],"codeLang":"js"},{"type":"code","lines":["String selector = \".foo\";","page.waitForFunction(\"selector => !!document.querySelector(selector)\", selector);"],"codeLang":"java"},{"type":"code","lines":["selector = \".foo\"","await page.wait_for_function(\"selector => !!document.querySelector(selector)\", selector)"],"codeLang":"python async"},{"type":"code","lines":["selector = \".foo\"","page.wait_for_function(\"selector => !!document.querySelector(selector)\", selector)"],"codeLang":"python sync"},{"type":"code","lines":["var selector = \".foo\";","await page.WaitForFunctionAsync(\"selector => !!document.querySelector(selector)\", selector);"],"codeLang":"csharp"},{"type":"text","text":"Shortcut for main frame's [`method: Frame.waitForFunction`]."}],"required":true,"comment":"Returns when the `expression` returns a truthy value. It resolves to a JSHandle of the truthy value.\n\nThe [`method: Page.waitForFunction`] can be used to observe viewport size change:\n\n```js\nconst { webkit } = require('playwright'); // Or 'chromium' or 'firefox'.\n\n(async () => {\n const browser = await webkit.launch();\n const page = await browser.newPage();\n const watchDog = page.waitForFunction(() => window.innerWidth < 100);\n await page.setViewportSize({width: 50, height: 50});\n await watchDog;\n await browser.close();\n})();\n```\n\n```java\nimport com.microsoft.playwright.*;\n\npublic class Example {\n public static void main(String[] args) {\n try (Playwright playwright = Playwright.create()) {\n BrowserType webkit = playwright.webkit();\n Browser browser = webkit.launch();\n Page page = browser.newPage();\n page.setViewportSize(50, 50);\n page.waitForFunction(\"() => window.innerWidth < 100\");\n browser.close();\n }\n }\n}\n```\n\n```python async\nimport asyncio\nfrom playwright.async_api import async_playwright\n\nasync def run(playwright):\n webkit = playwright.webkit\n browser = await webkit.launch()\n page = await browser.new_page()\n await page.evaluate(\"window.x = 0; setTimeout(() => { window.x = 100 }, 1000);\")\n await page.wait_for_function(\"() => window.x > 0\")\n await browser.close()\n\nasync def main():\n async with async_playwright() as playwright:\n await run(playwright)\nasyncio.run(main())\n```\n\n```python sync\nfrom playwright.sync_api import sync_playwright\n\ndef run(playwright):\n webkit = playwright.webkit\n browser = webkit.launch()\n page = browser.new_page()\n page.evaluate(\"window.x = 0; setTimeout(() => { window.x = 100 }, 1000);\")\n page.wait_for_function(\"() => window.x > 0\")\n browser.close()\n\nwith sync_playwright() as playwright:\n run(playwright)\n```\n\n```csharp\nusing Microsoft.Playwright;\nusing System.Threading.Tasks;\n\nclass FrameExamples\n{\n public static async Task WaitForFunction()\n {\n using var playwright = await Playwright.CreateAsync();\n await using var browser = await playwright.Webkit.LaunchAsync();\n var page = await browser.NewPageAsync();\n await page.SetViewportSizeAsync(50, 50);\n await page.MainFrame.WaitForFunctionAsync(\"window.innerWidth < 100\");\n }\n}\n```\n\nTo pass an argument to the predicate of [`method: Page.waitForFunction`] function:\n\n```js\nconst selector = '.foo';\nawait page.waitForFunction(selector => !!document.querySelector(selector), selector);\n```\n\n```java\nString selector = \".foo\";\npage.waitForFunction(\"selector => !!document.querySelector(selector)\", selector);\n```\n\n```python async\nselector = \".foo\"\nawait page.wait_for_function(\"selector => !!document.querySelector(selector)\", selector)\n```\n\n```python sync\nselector = \".foo\"\npage.wait_for_function(\"selector => !!document.querySelector(selector)\", selector)\n```\n\n```csharp\nvar selector = \".foo\";\nawait page.WaitForFunctionAsync(\"selector => !!document.querySelector(selector)\", selector);\n```\n\nShortcut for main frame's [`method: Frame.waitForFunction`].","deprecated":false,"async":true,"alias":"waitForFunction","args":[{"kind":"property","langs":{"overrides":{"js":{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"expression","type":{"name":"","union":[{"name":"function"},{"name":"string"}],"expression":"[function]|[string]"},"spec":[{"type":"text","text":"Function to be evaluated in the page context."}],"argsArray":[],"required":true,"comment":"","args":{},"clazz":null,"deprecated":false,"async":false,"alias":"pageFunction"}}},"name":"expression","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted as a function. Otherwise, evaluated as an expression."}],"required":true,"comment":"JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted\nas a function. Otherwise, evaluated as an expression.","deprecated":false,"async":false,"alias":"expression"},{"kind":"property","langs":{},"name":"arg","type":{"name":"EvaluationArgument","expression":"[EvaluationArgument]"},"spec":[{"type":"text","text":"Optional argument to pass to `expression`."}],"required":false,"comment":"Optional argument to pass to `expression`.","deprecated":false,"async":false,"alias":"arg"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{"only":["js","python"],"aliases":{},"types":{},"overrides":{}},"name":"polling","type":{"name":"","union":[{"name":"float"},{"name":"\"raf\""}],"expression":"[float]|\"raf\""},"spec":[{"type":"text","text":"If `polling` is `'raf'`, then `expression` is constantly executed in `requestAnimationFrame` callback. If `polling` is a number, then it is treated as an interval in milliseconds at which the function would be executed. Defaults to `raf`."}],"required":false,"comment":"If `polling` is `'raf'`, then `expression` is constantly executed in `requestAnimationFrame` callback. If `polling` is a\nnumber, then it is treated as an interval in milliseconds at which the function would be executed. Defaults to `raf`.","deprecated":false,"async":false,"alias":"polling"},{"kind":"property","langs":{"only":["csharp","java"],"aliases":{},"types":{},"overrides":{}},"name":"pollingInterval","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"If specified, then it is treated as an interval in milliseconds at which the function would be executed. By default if the option is not specified `expression` is executed in `requestAnimationFrame` callback."}],"required":false,"comment":"If specified, then it is treated as an interval in milliseconds at which the function would be executed. By default if\nthe option is not specified `expression` is executed in `requestAnimationFrame` callback.","deprecated":false,"async":false,"alias":"pollingInterval"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`]."}],"required":false,"comment":"maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default\nvalue can be changed by using the [`method: BrowserContext.setDefaultTimeout`].","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"waitForLoadState","type":{"name":"void"},"spec":[{"type":"text","text":"Returns when the required load state has been reached."},{"type":"text","text":"This resolves when the page reaches a required load state, `load` by default. The navigation must have been committed when this method is called. If current document has already reached the required state, resolves immediately."},{"type":"code","lines":["await page.click('button'); // Click triggers navigation.","await page.waitForLoadState(); // The promise resolves after 'load' event."],"codeLang":"js"},{"type":"code","lines":["page.click(\"button\"); // Click triggers navigation.","page.waitForLoadState(); // The promise resolves after \"load\" event."],"codeLang":"java"},{"type":"code","lines":["await page.click(\"button\") # click triggers navigation.","await page.wait_for_load_state() # the promise resolves after \"load\" event."],"codeLang":"python async"},{"type":"code","lines":["page.click(\"button\") # click triggers navigation.","page.wait_for_load_state() # the promise resolves after \"load\" event."],"codeLang":"python sync"},{"type":"code","lines":["await page.ClickAsync(\"button\"); // Click triggers navigation.","await page.WaitForLoadStateAsync(); // The promise resolves after 'load' event."],"codeLang":"csharp"},{"type":"code","lines":["const [popup] = await Promise.all(["," page.waitForEvent('popup'),"," page.click('button'), // Click triggers a popup.","])","await popup.waitForLoadState('domcontentloaded'); // The promise resolves after 'domcontentloaded' event.","console.log(await popup.title()); // Popup is ready to use."],"codeLang":"js"},{"type":"code","lines":["Page popup = page.waitForPopup(() -> {"," page.click(\"button\"); // Click triggers a popup.","});","popup.waitForLoadState(LoadState.DOMCONTENTLOADED);","System.out.println(popup.title()); // Popup is ready to use."],"codeLang":"java"},{"type":"code","lines":["async with page.expect_popup() as page_info:"," await page.click(\"button\") # click triggers a popup.","popup = await page_info.value"," # Following resolves after \"domcontentloaded\" event.","await popup.wait_for_load_state(\"domcontentloaded\")","print(await popup.title()) # popup is ready to use."],"codeLang":"python async"},{"type":"code","lines":["with page.expect_popup() as page_info:"," page.click(\"button\") # click triggers a popup.","popup = page_info.value"," # Following resolves after \"domcontentloaded\" event.","popup.wait_for_load_state(\"domcontentloaded\")","print(popup.title()) # popup is ready to use."],"codeLang":"python sync"},{"type":"code","lines":["var popup = await page.RunAndWaitForPopupAsync(async () =>","{"," await page.ClickAsync(\"button\"); // click triggers the popup/","});","await popup.WaitForLoadStateAsync(LoadState.DOMContentLoaded);","Console.WriteLine(await popup.TitleAsync()); // popup is ready to use."],"codeLang":"csharp"},{"type":"text","text":"Shortcut for main frame's [`method: Frame.waitForLoadState`]."}],"required":true,"comment":"Returns when the required load state has been reached.\n\nThis resolves when the page reaches a required load state, `load` by default. The navigation must have been committed\nwhen this method is called. If current document has already reached the required state, resolves immediately.\n\n```js\nawait page.click('button'); // Click triggers navigation.\nawait page.waitForLoadState(); // The promise resolves after 'load' event.\n```\n\n```java\npage.click(\"button\"); // Click triggers navigation.\npage.waitForLoadState(); // The promise resolves after \"load\" event.\n```\n\n```python async\nawait page.click(\"button\") # click triggers navigation.\nawait page.wait_for_load_state() # the promise resolves after \"load\" event.\n```\n\n```python sync\npage.click(\"button\") # click triggers navigation.\npage.wait_for_load_state() # the promise resolves after \"load\" event.\n```\n\n```csharp\nawait page.ClickAsync(\"button\"); // Click triggers navigation.\nawait page.WaitForLoadStateAsync(); // The promise resolves after 'load' event.\n```\n\n```js\nconst [popup] = await Promise.all([\n page.waitForEvent('popup'),\n page.click('button'), // Click triggers a popup.\n])\nawait popup.waitForLoadState('domcontentloaded'); // The promise resolves after 'domcontentloaded' event.\nconsole.log(await popup.title()); // Popup is ready to use.\n```\n\n```java\nPage popup = page.waitForPopup(() -> {\n page.click(\"button\"); // Click triggers a popup.\n});\npopup.waitForLoadState(LoadState.DOMCONTENTLOADED);\nSystem.out.println(popup.title()); // Popup is ready to use.\n```\n\n```python async\nasync with page.expect_popup() as page_info:\n await page.click(\"button\") # click triggers a popup.\npopup = await page_info.value\n # Following resolves after \"domcontentloaded\" event.\nawait popup.wait_for_load_state(\"domcontentloaded\")\nprint(await popup.title()) # popup is ready to use.\n```\n\n```python sync\nwith page.expect_popup() as page_info:\n page.click(\"button\") # click triggers a popup.\npopup = page_info.value\n # Following resolves after \"domcontentloaded\" event.\npopup.wait_for_load_state(\"domcontentloaded\")\nprint(popup.title()) # popup is ready to use.\n```\n\n```csharp\nvar popup = await page.RunAndWaitForPopupAsync(async () =>\n{\n await page.ClickAsync(\"button\"); // click triggers the popup/\n});\nawait popup.WaitForLoadStateAsync(LoadState.DOMContentLoaded);\nConsole.WriteLine(await popup.TitleAsync()); // popup is ready to use.\n```\n\nShortcut for main frame's [`method: Frame.waitForLoadState`].","deprecated":false,"async":true,"alias":"waitForLoadState","args":[{"kind":"property","langs":{},"name":"state","type":{"name":"LoadState","union":[{"name":"\"load\""},{"name":"\"domcontentloaded\""},{"name":"\"networkidle\""}],"expression":"[LoadState]<\"load\"|\"domcontentloaded\"|\"networkidle\">"},"spec":[{"type":"text","text":"Optional load state to wait for, defaults to `load`. If the state has been already reached while loading current document, the method resolves immediately. Can be one of:"},{"type":"li","text":"`'load'` - wait for the `load` event to be fired.","liType":"bullet"},{"type":"li","text":"`'domcontentloaded'` - wait for the `DOMContentLoaded` event to be fired.","liType":"bullet"},{"type":"li","text":"`'networkidle'` - wait until there are no network connections for at least `500` ms.","liType":"bullet"}],"required":false,"comment":"Optional load state to wait for, defaults to `load`. If the state has been already reached while loading current\ndocument, the method resolves immediately. Can be one of:\n- `'load'` - wait for the `load` event to be fired.\n- `'domcontentloaded'` - wait for the `DOMContentLoaded` event to be fired.\n- `'networkidle'` - wait until there are no network connections for at least `500` ms.","deprecated":false,"async":false,"alias":"state"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultNavigationTimeout`], [`method: BrowserContext.setDefaultTimeout`], [`method: Page.setDefaultNavigationTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be\nchanged by using the [`method: BrowserContext.setDefaultNavigationTimeout`],\n[`method: BrowserContext.setDefaultTimeout`], [`method: Page.setDefaultNavigationTimeout`] or\n[`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{"aliases":{"python":"expect_navigation","csharp":"RunAndWaitForNavigation"},"types":{"python":{"name":"EventContextManager","templates":[{"name":"Response"}],"expression":"[EventContextManager]<[Response]>"}},"overrides":{}},"name":"waitForNavigation","type":{"name":"","union":[{"name":"null"},{"name":"Response"}],"expression":"[null]|[Response]"},"spec":[{"type":"text","text":"Waits for the main frame navigation and returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of the last redirect. In case of navigation to a different anchor or navigation due to History API usage, the navigation will resolve with `null`."},{"type":"text","text":"This resolves when the page navigates to a new URL or reloads. It is useful for when you run code which will indirectly cause the page to navigate. e.g. The click target has an `onclick` handler that triggers navigation from a `setTimeout`. Consider this example:"},{"type":"code","lines":["const [response] = await Promise.all(["," page.waitForNavigation(), // The promise resolves after navigation has finished"," page.click('a.delayed-navigation'), // Clicking the link will indirectly cause a navigation","]);"],"codeLang":"js"},{"type":"code","lines":["// The method returns after navigation has finished","Response response = page.waitForNavigation(() -> {"," page.click(\"a.delayed-navigation\"); // Clicking the link will indirectly cause a navigation","});"],"codeLang":"java"},{"type":"code","lines":["async with page.expect_navigation():"," await page.click(\"a.delayed-navigation\") # clicking the link will indirectly cause a navigation","# Resolves after navigation has finished"],"codeLang":"python async"},{"type":"code","lines":["with page.expect_navigation():"," page.click(\"a.delayed-navigation\") # clicking the link will indirectly cause a navigation","# Resolves after navigation has finished"],"codeLang":"python sync"},{"type":"code","lines":["await page.RunAndWaitForNavigationAsync(async () =>","{"," // Clicking the link will indirectly cause a navigation."," await page.ClickAsync(\"a.delayed-navigation\");","});","","// The method continues after navigation has finished"],"codeLang":"csharp"},{"type":"note","noteType":"note","text":"Usage of the [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) to change the URL is considered a navigation."},{"type":"text","text":"Shortcut for main frame's [`method: Frame.waitForNavigation`]."}],"required":true,"comment":"Waits for the main frame navigation and returns the main resource response. In case of multiple redirects, the\nnavigation will resolve with the response of the last redirect. In case of navigation to a different anchor or\nnavigation due to History API usage, the navigation will resolve with `null`.\n\nThis resolves when the page navigates to a new URL or reloads. It is useful for when you run code which will indirectly\ncause the page to navigate. e.g. The click target has an `onclick` handler that triggers navigation from a `setTimeout`.\nConsider this example:\n\n```js\nconst [response] = await Promise.all([\n page.waitForNavigation(), // The promise resolves after navigation has finished\n page.click('a.delayed-navigation'), // Clicking the link will indirectly cause a navigation\n]);\n```\n\n```java\n// The method returns after navigation has finished\nResponse response = page.waitForNavigation(() -> {\n page.click(\"a.delayed-navigation\"); // Clicking the link will indirectly cause a navigation\n});\n```\n\n```python async\nasync with page.expect_navigation():\n await page.click(\"a.delayed-navigation\") # clicking the link will indirectly cause a navigation\n# Resolves after navigation has finished\n```\n\n```python sync\nwith page.expect_navigation():\n page.click(\"a.delayed-navigation\") # clicking the link will indirectly cause a navigation\n# Resolves after navigation has finished\n```\n\n```csharp\nawait page.RunAndWaitForNavigationAsync(async () =>\n{\n // Clicking the link will indirectly cause a navigation.\n await page.ClickAsync(\"a.delayed-navigation\");\n});\n\n// The method continues after navigation has finished\n```\n\n> NOTE: Usage of the [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) to change the URL is\nconsidered a navigation.\n\nShortcut for main frame's [`method: Frame.waitForNavigation`].","deprecated":false,"async":true,"alias":"waitForNavigation","args":[{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultNavigationTimeout`], [`method: BrowserContext.setDefaultTimeout`], [`method: Page.setDefaultNavigationTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be\nchanged by using the [`method: BrowserContext.setDefaultNavigationTimeout`],\n[`method: BrowserContext.setDefaultTimeout`], [`method: Page.setDefaultNavigationTimeout`] or\n[`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"},{"kind":"property","langs":{},"name":"url","type":{"name":"","union":[{"name":"string"},{"name":"RegExp"},{"name":"function","args":[{"name":"URL"}],"returnType":{"name":"boolean"}}],"expression":"[string]|[RegExp]|[function]([URL]):[boolean]"},"spec":[{"type":"text","text":"A glob pattern, regex pattern or predicate receiving [URL] to match while waiting for the navigation."}],"required":false,"comment":"A glob pattern, regex pattern or predicate receiving [URL] to match while waiting for the navigation.","deprecated":false,"async":false,"alias":"url"},{"kind":"property","langs":{},"name":"waitUntil","type":{"name":"WaitUntilState","union":[{"name":"\"load\""},{"name":"\"domcontentloaded\""},{"name":"\"networkidle\""}],"expression":"[WaitUntilState]<\"load\"|\"domcontentloaded\"|\"networkidle\">"},"spec":[{"type":"text","text":"When to consider operation succeeded, defaults to `load`. Events can be either:"},{"type":"li","text":"`'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.","liType":"bullet"},{"type":"li","text":"`'load'` - consider operation to be finished when the `load` event is fired.","liType":"bullet"},{"type":"li","text":"`'networkidle'` - consider operation to be finished when there are no network connections for at least `500` ms.","liType":"bullet"}],"required":false,"comment":"When to consider operation succeeded, defaults to `load`. Events can be either:\n- `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.\n- `'load'` - consider operation to be finished when the `load` event is fired.\n- `'networkidle'` - consider operation to be finished when there are no network connections for at least `500` ms.","deprecated":false,"async":false,"alias":"waitUntil"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"},{"kind":"property","langs":{"only":["csharp"],"aliases":{},"types":{},"overrides":{}},"name":"action","type":{"name":"Func","templates":[{"name":"Task"}],"expression":"[Func<Task>]"},"spec":[{"type":"text","text":"Action that triggers the event."}],"required":true,"comment":"Action that triggers the event.","deprecated":false,"async":false,"alias":"action"},{"kind":"property","langs":{"only":["java"],"aliases":{},"types":{},"overrides":{}},"name":"callback","type":{"name":"Runnable","expression":"[Runnable]"},"spec":[{"type":"text","text":"Callback that performs the action triggering the event."}],"required":true,"comment":"Callback that performs the action triggering the event.","deprecated":false,"async":false,"alias":"callback"}]},{"kind":"method","langs":{"only":["java","python","csharp"],"aliases":{"python":"expect_popup","csharp":"RunAndWaitForPopup"},"types":{"python":{"name":"EventContextManager","templates":[{"name":"Page"}],"expression":"[EventContextManager]<[Page]>"}},"overrides":{}},"name":"waitForPopup","type":{"name":"Page","expression":"[Page]"},"spec":[{"type":"text","text":"Performs action and waits for a popup `Page`. If predicate is provided, it passes [Popup] value into the `predicate` function and waits for `predicate(page)` to return a truthy value. Will throw an error if the page is closed before the popup event is fired."}],"required":true,"comment":"Performs action and waits for a popup `Page`. If predicate is provided, it passes [Popup] value into the `predicate`\nfunction and waits for `predicate(page)` to return a truthy value. Will throw an error if the page is closed before the\npopup event is fired.","deprecated":false,"async":true,"alias":"waitForPopup","args":[{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"predicate","type":{"name":"function","args":[{"name":"Page"}],"returnType":{"name":"boolean"},"expression":"[function]([Page]):[boolean]"},"spec":[{"type":"text","text":"Receives the `Page` object and resolves to truthy value when the waiting should resolve."}],"required":false,"comment":"Receives the `Page` object and resolves to truthy value when the waiting should resolve.","deprecated":false,"async":false,"alias":"predicate"},{"kind":"property","langs":{"only":["csharp","java","python"],"aliases":{},"types":{},"overrides":{}},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`]."}],"required":false,"comment":"Maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default\nvalue can be changed by using the [`method: BrowserContext.setDefaultTimeout`].","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"},{"kind":"property","langs":{"only":["csharp"],"aliases":{},"types":{},"overrides":{}},"name":"action","type":{"name":"Func","templates":[{"name":"Task"}],"expression":"[Func<Task>]"},"spec":[{"type":"text","text":"Action that triggers the event."}],"required":true,"comment":"Action that triggers the event.","deprecated":false,"async":false,"alias":"action"},{"kind":"property","langs":{"only":["java"],"aliases":{},"types":{},"overrides":{}},"name":"callback","type":{"name":"Runnable","expression":"[Runnable]"},"spec":[{"type":"text","text":"Callback that performs the action triggering the event."}],"required":true,"comment":"Callback that performs the action triggering the event.","deprecated":false,"async":false,"alias":"callback"}]},{"kind":"method","langs":{"aliases":{"python":"expect_request","csharp":"RunAndWaitForRequest"},"types":{"python":{"name":"EventContextManager","templates":[{"name":"Request"}],"expression":"[EventContextManager]<[Request]>"}},"overrides":{}},"name":"waitForRequest","type":{"name":"Request","expression":"[Request]"},"spec":[{"type":"text","text":"Waits for the matching request and returns it. See [waiting for event](./events.md#waiting-for-event) for more details about events."},{"type":"code","lines":["// Note that Promise.all prevents a race condition","// between clicking and waiting for the request.","const [request] = await Promise.all(["," // Waits for the next request with the specified url"," page.waitForRequest('https://example.com/resource'),"," // Triggers the request"," page.click('button.triggers-request'),","]);","","// Alternative way with a predicate.","const [request] = await Promise.all(["," // Waits for the next request matching some conditions"," page.waitForRequest(request => request.url() === 'https://example.com' && request.method() === 'GET'),"," // Triggers the request"," page.click('button.triggers-request'),","]);"],"codeLang":"js"},{"type":"code","lines":["// Waits for the next request with the specified url","Request request = page.waitForRequest(\"https://example.com/resource\", () -> {"," // Triggers the request"," page.click(\"button.triggers-request\");","});","","// Waits for the next request matching some conditions","Request request = page.waitForRequest(request -> \"https://example.com\".equals(request.url()) && \"GET\".equals(request.method()), () -> {"," // Triggers the request"," page.click(\"button.triggers-request\");","});"],"codeLang":"java"},{"type":"code","lines":["async with page.expect_request(\"http://example.com/resource\") as first:"," await page.click('button')","first_request = await first.value","","# or with a lambda","async with page.expect_request(lambda request: request.url == \"http://example.com\" and request.method == \"get\") as second:"," await page.click('img')","second_request = await second.value"],"codeLang":"python async"},{"type":"code","lines":["with page.expect_request(\"http://example.com/resource\") as first:"," page.click('button')","first_request = first.value","","# or with a lambda","with page.expect_request(lambda request: request.url == \"http://example.com\" and request.method == \"get\") as second:"," page.click('img')","second_request = second.value"],"codeLang":"python sync"},{"type":"code","lines":["// Waits for the next request with the specified url.","await page.RunAndWaitForRequestAsync(async () =>","{"," await page.ClickAsync(\"button\");","}, \"http://example.com/resource\");","","// Alternative way with a predicate.","await page.RunAndWaitForRequestAsync(async () =>","{"," await page.ClickAsync(\"button\");","}, request => request.Url == \"https://example.com\" && request.Method == \"GET\");"],"codeLang":"csharp"}],"required":true,"comment":"Waits for the matching request and returns it. See [waiting for event](./events.md#waiting-for-event) for more details\nabout events.\n\n```js\n// Note that Promise.all prevents a race condition\n// between clicking and waiting for the request.\nconst [request] = await Promise.all([\n // Waits for the next request with the specified url\n page.waitForRequest('https://example.com/resource'),\n // Triggers the request\n page.click('button.triggers-request'),\n]);\n\n// Alternative way with a predicate.\nconst [request] = await Promise.all([\n // Waits for the next request matching some conditions\n page.waitForRequest(request => request.url() === 'https://example.com' && request.method() === 'GET'),\n // Triggers the request\n page.click('button.triggers-request'),\n]);\n```\n\n```java\n// Waits for the next request with the specified url\nRequest request = page.waitForRequest(\"https://example.com/resource\", () -> {\n // Triggers the request\n page.click(\"button.triggers-request\");\n});\n\n// Waits for the next request matching some conditions\nRequest request = page.waitForRequest(request -> \"https://example.com\".equals(request.url()) && \"GET\".equals(request.method()), () -> {\n // Triggers the request\n page.click(\"button.triggers-request\");\n});\n```\n\n```python async\nasync with page.expect_request(\"http://example.com/resource\") as first:\n await page.click('button')\nfirst_request = await first.value\n\n# or with a lambda\nasync with page.expect_request(lambda request: request.url == \"http://example.com\" and request.method == \"get\") as second:\n await page.click('img')\nsecond_request = await second.value\n```\n\n```python sync\nwith page.expect_request(\"http://example.com/resource\") as first:\n page.click('button')\nfirst_request = first.value\n\n# or with a lambda\nwith page.expect_request(lambda request: request.url == \"http://example.com\" and request.method == \"get\") as second:\n page.click('img')\nsecond_request = second.value\n```\n\n```csharp\n// Waits for the next request with the specified url.\nawait page.RunAndWaitForRequestAsync(async () =>\n{\n await page.ClickAsync(\"button\");\n}, \"http://example.com/resource\");\n\n// Alternative way with a predicate.\nawait page.RunAndWaitForRequestAsync(async () =>\n{\n await page.ClickAsync(\"button\");\n}, request => request.Url == \"https://example.com\" && request.Method == \"GET\");\n```\n","deprecated":false,"async":true,"alias":"waitForRequest","args":[{"kind":"property","langs":{"only":["csharp"],"aliases":{},"types":{},"overrides":{}},"name":"action","type":{"name":"Func","templates":[{"name":"Task"}],"expression":"[Func<Task>]"},"spec":[{"type":"text","text":"Action that triggers the event."}],"required":true,"comment":"Action that triggers the event.","deprecated":false,"async":false,"alias":"action"},{"kind":"property","langs":{"overrides":{"js":{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"urlOrPredicate","type":{"name":"","union":[{"name":"string"},{"name":"RegExp"},{"name":"function","args":[{"name":"Request"}],"returnType":{"name":"","union":[{"name":"boolean"},{"name":"Promise","templates":[{"name":"boolean"}]}]}}],"expression":"[string]|[RegExp]|[function]([Request]):[boolean]|[Promise]<[boolean]>"},"spec":[{"type":"text","text":"Request URL string, regex or predicate receiving [Request] object."}],"argsArray":[],"required":true,"comment":"","args":{},"clazz":null,"deprecated":false,"async":false,"alias":"urlOrPredicate"}}},"name":"urlOrPredicate","type":{"name":"","union":[{"name":"string"},{"name":"RegExp"},{"name":"function","args":[{"name":"Request"}],"returnType":{"name":"boolean"}}],"expression":"[string]|[RegExp]|[function]([Request]):[boolean]"},"spec":[{"type":"text","text":"Request URL string, regex or predicate receiving `Request` object."}],"required":true,"comment":"Request URL string, regex or predicate receiving `Request` object.","deprecated":false,"async":false,"alias":"urlOrPredicate"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum wait time in milliseconds, defaults to 30 seconds, pass `0` to disable the timeout. The default value can be changed by using the [`method: Page.setDefaultTimeout`] method."}],"required":false,"comment":"Maximum wait time in milliseconds, defaults to 30 seconds, pass `0` to disable the timeout. The default value can be\nchanged by using the [`method: Page.setDefaultTimeout`] method.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"},{"kind":"property","langs":{"only":["java"],"aliases":{},"types":{},"overrides":{}},"name":"callback","type":{"name":"Runnable","expression":"[Runnable]"},"spec":[{"type":"text","text":"Callback that performs the action triggering the event."}],"required":true,"comment":"Callback that performs the action triggering the event.","deprecated":false,"async":false,"alias":"callback"}]},{"kind":"method","langs":{"only":["java","python","csharp"],"aliases":{"python":"expect_request_finished","csharp":"RunAndWaitForRequestFinished"},"types":{"python":{"name":"EventContextManager","templates":[{"name":"Request"}],"expression":"[EventContextManager]<[Request]>"}},"overrides":{}},"name":"waitForRequestFinished","type":{"name":"Request","expression":"[Request]"},"spec":[{"type":"text","text":"Performs action and waits for a `Request` to finish loading. If predicate is provided, it passes `Request` value into the `predicate` function and waits for `predicate(request)` to return a truthy value. Will throw an error if the page is closed before the [`event: Page.requestFinished`] event is fired."}],"required":true,"comment":"Performs action and waits for a `Request` to finish loading. If predicate is provided, it passes `Request` value into\nthe `predicate` function and waits for `predicate(request)` to return a truthy value. Will throw an error if the page is\nclosed before the [`event: Page.requestFinished`] event is fired.","deprecated":false,"async":true,"alias":"waitForRequestFinished","args":[{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"predicate","type":{"name":"function","args":[{"name":"Request"}],"returnType":{"name":"boolean"},"expression":"[function]([Request]):[boolean]"},"spec":[{"type":"text","text":"Receives the `Request` object and resolves to truthy value when the waiting should resolve."}],"required":false,"comment":"Receives the `Request` object and resolves to truthy value when the waiting should resolve.","deprecated":false,"async":false,"alias":"predicate"},{"kind":"property","langs":{"only":["csharp","java","python"],"aliases":{},"types":{},"overrides":{}},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`]."}],"required":false,"comment":"Maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default\nvalue can be changed by using the [`method: BrowserContext.setDefaultTimeout`].","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"},{"kind":"property","langs":{"only":["csharp"],"aliases":{},"types":{},"overrides":{}},"name":"action","type":{"name":"Func","templates":[{"name":"Task"}],"expression":"[Func<Task>]"},"spec":[{"type":"text","text":"Action that triggers the event."}],"required":true,"comment":"Action that triggers the event.","deprecated":false,"async":false,"alias":"action"},{"kind":"property","langs":{"only":["java"],"aliases":{},"types":{},"overrides":{}},"name":"callback","type":{"name":"Runnable","expression":"[Runnable]"},"spec":[{"type":"text","text":"Callback that performs the action triggering the event."}],"required":true,"comment":"Callback that performs the action triggering the event.","deprecated":false,"async":false,"alias":"callback"}]},{"kind":"method","langs":{"aliases":{"python":"expect_response","csharp":"RunAndWaitForResponse"},"types":{"python":{"name":"EventContextManager","templates":[{"name":"Response"}],"expression":"[EventContextManager]<[Response]>"}},"overrides":{}},"name":"waitForResponse","type":{"name":"Response","expression":"[Response]"},"spec":[{"type":"text","text":"Returns the matched response. See [waiting for event](./events.md#waiting-for-event) for more details about events."},{"type":"code","lines":["// Note that Promise.all prevents a race condition","// between clicking and waiting for the response.","const [response] = await Promise.all(["," // Waits for the next response with the specified url"," page.waitForResponse('https://example.com/resource'),"," // Triggers the response"," page.click('button.triggers-response'),","]);","","// Alternative way with a predicate.","const [response] = await Promise.all(["," // Waits for the next response matching some conditions"," page.waitForResponse(response => response.url() === 'https://example.com' && response.status() === 200),"," // Triggers the response"," page.click('button.triggers-response'),","]);"],"codeLang":"js"},{"type":"code","lines":["// Waits for the next response with the specified url","Response response = page.waitForResponse(\"https://example.com/resource\", () -> {"," // Triggers the response"," page.click(\"button.triggers-response\");","});","","// Waits for the next response matching some conditions","Response response = page.waitForResponse(response -> \"https://example.com\".equals(response.url()) && response.status() == 200, () -> {"," // Triggers the response"," page.click(\"button.triggers-response\");","});"],"codeLang":"java"},{"type":"code","lines":["async with page.expect_response(\"https://example.com/resource\") as response_info:"," await page.click(\"input\")","response = response_info.value","return response.ok","","# or with a lambda","async with page.expect_response(lambda response: response.url == \"https://example.com\" and response.status === 200) as response_info:"," await page.click(\"input\")","response = response_info.value","return response.ok"],"codeLang":"python async"},{"type":"code","lines":["with page.expect_response(\"https://example.com/resource\") as response_info:"," page.click(\"input\")","response = response_info.value","return response.ok","","# or with a lambda","with page.expect_response(lambda response: response.url == \"https://example.com\" and response.status === 200) as response_info:"," page.click(\"input\")","response = response_info.value","return response.ok"],"codeLang":"python sync"},{"type":"code","lines":["// Waits for the next response with the specified url.","await page.RunAndWaitForResponseAsync(async () =>","{"," await page.ClickAsync(\"button.triggers-response\");","}, \"http://example.com/resource\");","","// Alternative way with a predicate.","await page.RunAndWaitForResponseAsync(async () =>","{"," await page.ClickAsync(\"button\");","}, response => response.Url == \"https://example.com\" && response.Status == 200);"],"codeLang":"csharp"}],"required":true,"comment":"Returns the matched response. See [waiting for event](./events.md#waiting-for-event) for more details about events.\n\n```js\n// Note that Promise.all prevents a race condition\n// between clicking and waiting for the response.\nconst [response] = await Promise.all([\n // Waits for the next response with the specified url\n page.waitForResponse('https://example.com/resource'),\n // Triggers the response\n page.click('button.triggers-response'),\n]);\n\n// Alternative way with a predicate.\nconst [response] = await Promise.all([\n // Waits for the next response matching some conditions\n page.waitForResponse(response => response.url() === 'https://example.com' && response.status() === 200),\n // Triggers the response\n page.click('button.triggers-response'),\n]);\n```\n\n```java\n// Waits for the next response with the specified url\nResponse response = page.waitForResponse(\"https://example.com/resource\", () -> {\n // Triggers the response\n page.click(\"button.triggers-response\");\n});\n\n// Waits for the next response matching some conditions\nResponse response = page.waitForResponse(response -> \"https://example.com\".equals(response.url()) && response.status() == 200, () -> {\n // Triggers the response\n page.click(\"button.triggers-response\");\n});\n```\n\n```python async\nasync with page.expect_response(\"https://example.com/resource\") as response_info:\n await page.click(\"input\")\nresponse = response_info.value\nreturn response.ok\n\n# or with a lambda\nasync with page.expect_response(lambda response: response.url == \"https://example.com\" and response.status === 200) as response_info:\n await page.click(\"input\")\nresponse = response_info.value\nreturn response.ok\n```\n\n```python sync\nwith page.expect_response(\"https://example.com/resource\") as response_info:\n page.click(\"input\")\nresponse = response_info.value\nreturn response.ok\n\n# or with a lambda\nwith page.expect_response(lambda response: response.url == \"https://example.com\" and response.status === 200) as response_info:\n page.click(\"input\")\nresponse = response_info.value\nreturn response.ok\n```\n\n```csharp\n// Waits for the next response with the specified url.\nawait page.RunAndWaitForResponseAsync(async () =>\n{\n await page.ClickAsync(\"button.triggers-response\");\n}, \"http://example.com/resource\");\n\n// Alternative way with a predicate.\nawait page.RunAndWaitForResponseAsync(async () =>\n{\n await page.ClickAsync(\"button\");\n}, response => response.Url == \"https://example.com\" && response.Status == 200);\n```\n","deprecated":false,"async":true,"alias":"waitForResponse","args":[{"kind":"property","langs":{"only":["csharp"],"aliases":{},"types":{},"overrides":{}},"name":"action","type":{"name":"Func","templates":[{"name":"Task"}],"expression":"[Func<Task>]"},"spec":[{"type":"text","text":"Action that triggers the event."}],"required":true,"comment":"Action that triggers the event.","deprecated":false,"async":false,"alias":"action"},{"kind":"property","langs":{"overrides":{"js":{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"urlOrPredicate","type":{"name":"","union":[{"name":"string"},{"name":"RegExp"},{"name":"function","args":[{"name":"Response"}],"returnType":{"name":"","union":[{"name":"boolean"},{"name":"Promise","templates":[{"name":"boolean"}]}]}}],"expression":"[string]|[RegExp]|[function]([Response]):[boolean]|[Promise]<[boolean]>"},"spec":[{"type":"text","text":"Request URL string, regex or predicate receiving [Response] object."}],"argsArray":[],"required":true,"comment":"","args":{},"clazz":null,"deprecated":false,"async":false,"alias":"urlOrPredicate"}}},"name":"urlOrPredicate","type":{"name":"","union":[{"name":"string"},{"name":"RegExp"},{"name":"function","args":[{"name":"Response"}],"returnType":{"name":"boolean"}}],"expression":"[string]|[RegExp]|[function]([Response]):[boolean]"},"spec":[{"type":"text","text":"Request URL string, regex or predicate receiving `Response` object."}],"required":true,"comment":"Request URL string, regex or predicate receiving `Response` object.","deprecated":false,"async":false,"alias":"urlOrPredicate"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum wait time in milliseconds, defaults to 30 seconds, pass `0` to disable the timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum wait time in milliseconds, defaults to 30 seconds, pass `0` to disable the timeout. The default value can be\nchanged by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"},{"kind":"property","langs":{"only":["java"],"aliases":{},"types":{},"overrides":{}},"name":"callback","type":{"name":"Runnable","expression":"[Runnable]"},"spec":[{"type":"text","text":"Callback that performs the action triggering the event."}],"required":true,"comment":"Callback that performs the action triggering the event.","deprecated":false,"async":false,"alias":"callback"}]},{"kind":"method","langs":{},"name":"waitForSelector","type":{"name":"","union":[{"name":"null"},{"name":"ElementHandle"}],"expression":"[null]|[ElementHandle]"},"spec":[{"type":"text","text":"Returns when element specified by selector satisfies `state` option. Returns `null` if waiting for `hidden` or `detached`."},{"type":"text","text":"Wait for the `selector` to satisfy `state` option (either appear/disappear from dom, or become visible/hidden). If at the moment of calling the method `selector` already satisfies the condition, the method will return immediately. If the selector doesn't satisfy the condition for the `timeout` milliseconds, the function will throw."},{"type":"text","text":"This method works across navigations:"},{"type":"code","lines":["const { chromium } = require('playwright'); // Or 'firefox' or 'webkit'.","","(async () => {"," const browser = await chromium.launch();"," const page = await browser.newPage();"," for (let currentURL of ['https://google.com', 'https://bbc.com']) {"," await page.goto(currentURL);"," const element = await page.waitForSelector('img');"," console.log('Loaded image: ' + await element.getAttribute('src'));"," }"," await browser.close();","})();"],"codeLang":"js"},{"type":"code","lines":["import com.microsoft.playwright.*;","","public class Example {"," public static void main(String[] args) {"," try (Playwright playwright = Playwright.create()) {"," BrowserType chromium = playwright.chromium();"," Browser browser = chromium.launch();"," Page page = browser.newPage();"," for (String currentURL : Arrays.asList(\"https://google.com\", \"https://bbc.com\")) {"," page.navigate(currentURL);"," ElementHandle element = page.waitForSelector(\"img\");"," System.out.println(\"Loaded image: \" + element.getAttribute(\"src\"));"," }"," browser.close();"," }"," }","}"],"codeLang":"java"},{"type":"code","lines":["import asyncio","from playwright.async_api import async_playwright","","async def run(playwright):"," chromium = playwright.chromium"," browser = await chromium.launch()"," page = await browser.new_page()"," for current_url in [\"https://google.com\", \"https://bbc.com\"]:"," await page.goto(current_url, wait_until=\"domcontentloaded\")"," element = await page.wait_for_selector(\"img\")"," print(\"Loaded image: \" + str(await element.get_attribute(\"src\")))"," await browser.close()","","async def main():"," async with async_playwright() as playwright:"," await run(playwright)","asyncio.run(main())"],"codeLang":"python async"},{"type":"code","lines":["from playwright.sync_api import sync_playwright","","def run(playwright):"," chromium = playwright.chromium"," browser = chromium.launch()"," page = browser.new_page()"," for current_url in [\"https://google.com\", \"https://bbc.com\"]:"," page.goto(current_url, wait_until=\"domcontentloaded\")"," element = page.wait_for_selector(\"img\")"," print(\"Loaded image: \" + str(element.get_attribute(\"src\")))"," browser.close()","","with sync_playwright() as playwright:"," run(playwright)"],"codeLang":"python sync"},{"type":"code","lines":["using Microsoft.Playwright;","using System;","using System.Threading.Tasks;","","class FrameExamples","{"," public static async Task Images()"," {"," using var playwright = await Playwright.CreateAsync();"," await using var browser = await playwright.Chromium.LaunchAsync();"," var page = await browser.NewPageAsync();",""," foreach (var currentUrl in new[] { \"https://www.google.com\", \"https://bbc.com\" })"," {"," await page.GotoAsync(currentUrl);"," var element = await page.WaitForSelectorAsync(\"img\");"," Console.WriteLine($\"Loaded image: {await element.GetAttributeAsync(\"src\")}\");"," }",""," await browser.CloseAsync();"," }","}"],"codeLang":"csharp"}],"required":true,"comment":"Returns when element specified by selector satisfies `state` option. Returns `null` if waiting for `hidden` or\n`detached`.\n\nWait for the `selector` to satisfy `state` option (either appear/disappear from dom, or become visible/hidden). If at\nthe moment of calling the method `selector` already satisfies the condition, the method will return immediately. If the\nselector doesn't satisfy the condition for the `timeout` milliseconds, the function will throw.\n\nThis method works across navigations:\n\n```js\nconst { chromium } = require('playwright'); // Or 'firefox' or 'webkit'.\n\n(async () => {\n const browser = await chromium.launch();\n const page = await browser.newPage();\n for (let currentURL of ['https://google.com', 'https://bbc.com']) {\n await page.goto(currentURL);\n const element = await page.waitForSelector('img');\n console.log('Loaded image: ' + await element.getAttribute('src'));\n }\n await browser.close();\n})();\n```\n\n```java\nimport com.microsoft.playwright.*;\n\npublic class Example {\n public static void main(String[] args) {\n try (Playwright playwright = Playwright.create()) {\n BrowserType chromium = playwright.chromium();\n Browser browser = chromium.launch();\n Page page = browser.newPage();\n for (String currentURL : Arrays.asList(\"https://google.com\", \"https://bbc.com\")) {\n page.navigate(currentURL);\n ElementHandle element = page.waitForSelector(\"img\");\n System.out.println(\"Loaded image: \" + element.getAttribute(\"src\"));\n }\n browser.close();\n }\n }\n}\n```\n\n```python async\nimport asyncio\nfrom playwright.async_api import async_playwright\n\nasync def run(playwright):\n chromium = playwright.chromium\n browser = await chromium.launch()\n page = await browser.new_page()\n for current_url in [\"https://google.com\", \"https://bbc.com\"]:\n await page.goto(current_url, wait_until=\"domcontentloaded\")\n element = await page.wait_for_selector(\"img\")\n print(\"Loaded image: \" + str(await element.get_attribute(\"src\")))\n await browser.close()\n\nasync def main():\n async with async_playwright() as playwright:\n await run(playwright)\nasyncio.run(main())\n```\n\n```python sync\nfrom playwright.sync_api import sync_playwright\n\ndef run(playwright):\n chromium = playwright.chromium\n browser = chromium.launch()\n page = browser.new_page()\n for current_url in [\"https://google.com\", \"https://bbc.com\"]:\n page.goto(current_url, wait_until=\"domcontentloaded\")\n element = page.wait_for_selector(\"img\")\n print(\"Loaded image: \" + str(element.get_attribute(\"src\")))\n browser.close()\n\nwith sync_playwright() as playwright:\n run(playwright)\n```\n\n```csharp\nusing Microsoft.Playwright;\nusing System;\nusing System.Threading.Tasks;\n\nclass FrameExamples\n{\n public static async Task Images()\n {\n using var playwright = await Playwright.CreateAsync();\n await using var browser = await playwright.Chromium.LaunchAsync();\n var page = await browser.NewPageAsync();\n\n foreach (var currentUrl in new[] { \"https://www.google.com\", \"https://bbc.com\" })\n {\n await page.GotoAsync(currentUrl);\n var element = await page.WaitForSelectorAsync(\"img\");\n Console.WriteLine($\"Loaded image: {await element.GetAttributeAsync(\"src\")}\");\n }\n\n await browser.CloseAsync();\n }\n}\n```\n","deprecated":false,"async":true,"alias":"waitForSelector","args":[{"kind":"property","langs":{},"name":"selector","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"A selector to query for. See [working with selectors](./selectors.md) for more details."}],"required":true,"comment":"A selector to query for. See [working with selectors](./selectors.md) for more details.","deprecated":false,"async":false,"alias":"selector"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"state","type":{"name":"WaitForSelectorState","union":[{"name":"\"attached\""},{"name":"\"detached\""},{"name":"\"visible\""},{"name":"\"hidden\""}],"expression":"[WaitForSelectorState]<\"attached\"|\"detached\"|\"visible\"|\"hidden\">"},"spec":[{"type":"text","text":"Defaults to `'visible'`. Can be either:"},{"type":"li","text":"`'attached'` - wait for element to be present in DOM.","liType":"bullet"},{"type":"li","text":"`'detached'` - wait for element to not be present in DOM.","liType":"bullet"},{"type":"li","text":"`'visible'` - wait for element to have non-empty bounding box and no `visibility:hidden`. Note that element without any content or with `display:none` has an empty bounding box and is not considered visible.","liType":"bullet"},{"type":"li","text":"`'hidden'` - wait for element to be either detached from DOM, or have an empty bounding box or `visibility:hidden`. This is opposite to the `'visible'` option.","liType":"bullet"}],"required":false,"comment":"Defaults to `'visible'`. Can be either:\n- `'attached'` - wait for element to be present in DOM.\n- `'detached'` - wait for element to not be present in DOM.\n- `'visible'` - wait for element to have non-empty bounding box and no `visibility:hidden`. Note that element without\n any content or with `display:none` has an empty bounding box and is not considered visible.\n- `'hidden'` - wait for element to be either detached from DOM, or have an empty bounding box or `visibility:hidden`.\n This is opposite to the `'visible'` option.","deprecated":false,"async":false,"alias":"state"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by\nusing the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"waitForTimeout","type":{"name":"void"},"spec":[{"type":"text","text":"Waits for the given `timeout` in milliseconds."},{"type":"text","text":"Note that `page.waitForTimeout()` should only be used for debugging. Tests using the timer in production are going to be flaky. Use signals such as network events, selectors becoming visible and others instead."},{"type":"code","lines":["// wait for 1 second","await page.waitForTimeout(1000);"],"codeLang":"js"},{"type":"code","lines":["// wait for 1 second","page.waitForTimeout(1000);"],"codeLang":"java"},{"type":"code","lines":["# wait for 1 second","await page.wait_for_timeout(1000)"],"codeLang":"python async"},{"type":"code","lines":["# wait for 1 second","page.wait_for_timeout(1000)"],"codeLang":"python sync"},{"type":"code","lines":["// Wait for 1 second","await page.WaitForTimeoutAsync(1000);"],"codeLang":"csharp"},{"type":"text","text":"Shortcut for main frame's [`method: Frame.waitForTimeout`]."}],"required":true,"comment":"Waits for the given `timeout` in milliseconds.\n\nNote that `page.waitForTimeout()` should only be used for debugging. Tests using the timer in production are going to be\nflaky. Use signals such as network events, selectors becoming visible and others instead.\n\n```js\n// wait for 1 second\nawait page.waitForTimeout(1000);\n```\n\n```java\n// wait for 1 second\npage.waitForTimeout(1000);\n```\n\n```python async\n# wait for 1 second\nawait page.wait_for_timeout(1000)\n```\n\n```python sync\n# wait for 1 second\npage.wait_for_timeout(1000)\n```\n\n```csharp\n// Wait for 1 second\nawait page.WaitForTimeoutAsync(1000);\n```\n\nShortcut for main frame's [`method: Frame.waitForTimeout`].","deprecated":false,"async":true,"alias":"waitForTimeout","args":[{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"A timeout to wait for"}],"required":true,"comment":"A timeout to wait for","deprecated":false,"async":false,"alias":"timeout"}]},{"kind":"method","langs":{},"name":"waitForURL","type":{"name":"void"},"spec":[{"type":"text","text":"Waits for the main frame to navigate to the given URL."},{"type":"code","lines":["await page.click('a.delayed-navigation'); // Clicking the link will indirectly cause a navigation","await page.waitForURL('**/target.html');"],"codeLang":"js"},{"type":"code","lines":["page.click(\"a.delayed-navigation\"); // Clicking the link will indirectly cause a navigation","page.waitForURL(\"**/target.html\");"],"codeLang":"java"},{"type":"code","lines":["await page.click(\"a.delayed-navigation\") # clicking the link will indirectly cause a navigation","await page.wait_for_url(\"**/target.html\")"],"codeLang":"python async"},{"type":"code","lines":["page.click(\"a.delayed-navigation\") # clicking the link will indirectly cause a navigation","page.wait_for_url(\"**/target.html\")"],"codeLang":"python sync"},{"type":"code","lines":["await page.ClickAsync(\"a.delayed-navigation\"); // clicking the link will indirectly cause a navigation","await page.WaitForURLAsync(\"**/target.html\");"],"codeLang":"csharp"},{"type":"text","text":"Shortcut for main frame's [`method: Frame.waitForURL`]."}],"required":true,"comment":"Waits for the main frame to navigate to the given URL.\n\n```js\nawait page.click('a.delayed-navigation'); // Clicking the link will indirectly cause a navigation\nawait page.waitForURL('**/target.html');\n```\n\n```java\npage.click(\"a.delayed-navigation\"); // Clicking the link will indirectly cause a navigation\npage.waitForURL(\"**/target.html\");\n```\n\n```python async\nawait page.click(\"a.delayed-navigation\") # clicking the link will indirectly cause a navigation\nawait page.wait_for_url(\"**/target.html\")\n```\n\n```python sync\npage.click(\"a.delayed-navigation\") # clicking the link will indirectly cause a navigation\npage.wait_for_url(\"**/target.html\")\n```\n\n```csharp\nawait page.ClickAsync(\"a.delayed-navigation\"); // clicking the link will indirectly cause a navigation\nawait page.WaitForURLAsync(\"**/target.html\");\n```\n\nShortcut for main frame's [`method: Frame.waitForURL`].","deprecated":false,"async":true,"alias":"waitForURL","args":[{"kind":"property","langs":{},"name":"url","type":{"name":"","union":[{"name":"string"},{"name":"RegExp"},{"name":"function","args":[{"name":"URL"}],"returnType":{"name":"boolean"}}],"expression":"[string]|[RegExp]|[function]([URL]):[boolean]"},"spec":[{"type":"text","text":"A glob pattern, regex pattern or predicate receiving [URL] to match while waiting for the navigation."}],"required":true,"comment":"A glob pattern, regex pattern or predicate receiving [URL] to match while waiting for the navigation.","deprecated":false,"async":false,"alias":"url"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultNavigationTimeout`], [`method: BrowserContext.setDefaultTimeout`], [`method: Page.setDefaultNavigationTimeout`] or [`method: Page.setDefaultTimeout`] methods."}],"required":false,"comment":"Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be\nchanged by using the [`method: BrowserContext.setDefaultNavigationTimeout`],\n[`method: BrowserContext.setDefaultTimeout`], [`method: Page.setDefaultNavigationTimeout`] or\n[`method: Page.setDefaultTimeout`] methods.","deprecated":false,"async":false,"alias":"timeout"},{"kind":"property","langs":{},"name":"waitUntil","type":{"name":"WaitUntilState","union":[{"name":"\"load\""},{"name":"\"domcontentloaded\""},{"name":"\"networkidle\""}],"expression":"[WaitUntilState]<\"load\"|\"domcontentloaded\"|\"networkidle\">"},"spec":[{"type":"text","text":"When to consider operation succeeded, defaults to `load`. Events can be either:"},{"type":"li","text":"`'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.","liType":"bullet"},{"type":"li","text":"`'load'` - consider operation to be finished when the `load` event is fired.","liType":"bullet"},{"type":"li","text":"`'networkidle'` - consider operation to be finished when there are no network connections for at least `500` ms.","liType":"bullet"}],"required":false,"comment":"When to consider operation succeeded, defaults to `load`. Events can be either:\n- `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.\n- `'load'` - consider operation to be finished when the `load` event is fired.\n- `'networkidle'` - consider operation to be finished when there are no network connections for at least `500` ms.","deprecated":false,"async":false,"alias":"waitUntil"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{"only":["java","python","csharp"],"aliases":{"python":"expect_websocket","csharp":"RunAndWaitForWebSocket"},"types":{"python":{"name":"EventContextManager","templates":[{"name":"WebSocket"}],"expression":"[EventContextManager]<[WebSocket]>"}},"overrides":{}},"name":"waitForWebSocket","type":{"name":"WebSocket","expression":"[WebSocket]"},"spec":[{"type":"text","text":"Performs action and waits for a new `WebSocket`. If predicate is provided, it passes `WebSocket` value into the `predicate` function and waits for `predicate(webSocket)` to return a truthy value. Will throw an error if the page is closed before the WebSocket event is fired."}],"required":true,"comment":"Performs action and waits for a new `WebSocket`. If predicate is provided, it passes `WebSocket` value into the\n`predicate` function and waits for `predicate(webSocket)` to return a truthy value. Will throw an error if the page is\nclosed before the WebSocket event is fired.","deprecated":false,"async":true,"alias":"waitForWebSocket","args":[{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"predicate","type":{"name":"function","args":[{"name":"WebSocket"}],"returnType":{"name":"boolean"},"expression":"[function]([WebSocket]):[boolean]"},"spec":[{"type":"text","text":"Receives the `WebSocket` object and resolves to truthy value when the waiting should resolve."}],"required":false,"comment":"Receives the `WebSocket` object and resolves to truthy value when the waiting should resolve.","deprecated":false,"async":false,"alias":"predicate"},{"kind":"property","langs":{"only":["csharp","java","python"],"aliases":{},"types":{},"overrides":{}},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`]."}],"required":false,"comment":"Maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default\nvalue can be changed by using the [`method: BrowserContext.setDefaultTimeout`].","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"},{"kind":"property","langs":{"only":["csharp"],"aliases":{},"types":{},"overrides":{}},"name":"action","type":{"name":"Func","templates":[{"name":"Task"}],"expression":"[Func<Task>]"},"spec":[{"type":"text","text":"Action that triggers the event."}],"required":true,"comment":"Action that triggers the event.","deprecated":false,"async":false,"alias":"action"},{"kind":"property","langs":{"only":["java"],"aliases":{},"types":{},"overrides":{}},"name":"callback","type":{"name":"Runnable","expression":"[Runnable]"},"spec":[{"type":"text","text":"Callback that performs the action triggering the event."}],"required":true,"comment":"Callback that performs the action triggering the event.","deprecated":false,"async":false,"alias":"callback"}]},{"kind":"method","langs":{"only":["java","python","csharp"],"aliases":{"python":"expect_worker","csharp":"RunAndWaitForWorker"},"types":{"python":{"name":"EventContextManager","templates":[{"name":"Worker"}],"expression":"[EventContextManager]<[Worker]>"}},"overrides":{}},"name":"waitForWorker","type":{"name":"Worker","expression":"[Worker]"},"spec":[{"type":"text","text":"Performs action and waits for a new `Worker`. If predicate is provided, it passes `Worker` value into the `predicate` function and waits for `predicate(worker)` to return a truthy value. Will throw an error if the page is closed before the worker event is fired."}],"required":true,"comment":"Performs action and waits for a new `Worker`. If predicate is provided, it passes `Worker` value into the `predicate`\nfunction and waits for `predicate(worker)` to return a truthy value. Will throw an error if the page is closed before\nthe worker event is fired.","deprecated":false,"async":true,"alias":"waitForWorker","args":[{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"predicate","type":{"name":"function","args":[{"name":"Worker"}],"returnType":{"name":"boolean"},"expression":"[function]([Worker]):[boolean]"},"spec":[{"type":"text","text":"Receives the `Worker` object and resolves to truthy value when the waiting should resolve."}],"required":false,"comment":"Receives the `Worker` object and resolves to truthy value when the waiting should resolve.","deprecated":false,"async":false,"alias":"predicate"},{"kind":"property","langs":{"only":["csharp","java","python"],"aliases":{},"types":{},"overrides":{}},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`]."}],"required":false,"comment":"Maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default\nvalue can be changed by using the [`method: BrowserContext.setDefaultTimeout`].","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"},{"kind":"property","langs":{"only":["csharp"],"aliases":{},"types":{},"overrides":{}},"name":"action","type":{"name":"Func","templates":[{"name":"Task"}],"expression":"[Func<Task>]"},"spec":[{"type":"text","text":"Action that triggers the event."}],"required":true,"comment":"Action that triggers the event.","deprecated":false,"async":false,"alias":"action"},{"kind":"property","langs":{"only":["java"],"aliases":{},"types":{},"overrides":{}},"name":"callback","type":{"name":"Runnable","expression":"[Runnable]"},"spec":[{"type":"text","text":"Callback that performs the action triggering the event."}],"required":true,"comment":"Callback that performs the action triggering the event.","deprecated":false,"async":false,"alias":"callback"}]},{"kind":"method","langs":{},"name":"workers","type":{"name":"Array","templates":[{"name":"Worker"}],"expression":"[Array]<[Worker]>"},"spec":[{"type":"text","text":"This method returns all of the dedicated [WebWorkers](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) associated with the page."},{"type":"note","noteType":"note","text":"This does not contain ServiceWorkers"}],"required":true,"comment":"This method returns all of the dedicated [WebWorkers](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API)\nassociated with the page.\n\n> NOTE: This does not contain ServiceWorkers","deprecated":false,"async":false,"alias":"workers","args":[]},{"kind":"method","langs":{"only":["python"],"aliases":{"python":"wait_for_event"},"types":{},"overrides":{}},"name":"waitForEvent2","type":{"name":"any","expression":"[any]"},"spec":[{"type":"note","noteType":"note","text":"In most cases, you should use [`method: Page.waitForEvent`]."},{"type":"text","text":"Waits for given `event` to fire. If predicate is provided, it passes event's value into the `predicate` function and waits for `predicate(event)` to return a truthy value. Will throw an error if the page is closed before the `event` is fired."}],"required":true,"comment":"> NOTE: In most cases, you should use [`method: Page.waitForEvent`].\n\nWaits for given `event` to fire. If predicate is provided, it passes event's value into the `predicate` function and\nwaits for `predicate(event)` to return a truthy value. Will throw an error if the page is closed before the `event` is\nfired.","deprecated":false,"async":true,"alias":"waitForEvent2","args":[{"kind":"property","langs":{"only":["js","python","java"],"aliases":{},"types":{},"overrides":{}},"name":"event","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Event name, same one typically passed into `*.on(event)`."}],"required":true,"comment":"Event name, same one typically passed into `*.on(event)`.","deprecated":false,"async":false,"alias":"event"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"predicate","type":{"name":"function","expression":"[function]"},"spec":[{"type":"text","text":"Receives the event data and resolves to truthy value when the waiting should resolve."}],"required":false,"comment":"Receives the event data and resolves to truthy value when the waiting should resolve.","deprecated":false,"async":false,"alias":"predicate"},{"kind":"property","langs":{"only":["csharp","java","python"],"aliases":{},"types":{},"overrides":{}},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`]."}],"required":false,"comment":"Maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default\nvalue can be changed by using the [`method: BrowserContext.setDefaultTimeout`].","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{"only":["java"],"aliases":{},"types":{},"overrides":{}},"name":"onceDialog","type":{"name":"void"},"spec":[{"type":"text","text":"Adds one-off `Dialog` handler. The handler will be removed immediately after next `Dialog` is created."},{"type":"code","lines":["page.onceDialog(dialog -> {"," dialog.accept(\"foo\");","});","","// prints 'foo'","System.out.println(page.evaluate(\"prompt('Enter string:')\"));","","// prints 'null' as the dialog will be auto-dismissed because there are no handlers.","System.out.println(page.evaluate(\"prompt('Enter string:')\"));"],"codeLang":"java"},{"type":"text","text":"This code above is equivalent to:"},{"type":"code","lines":["Consumer<Dialog> handler = new Consumer<Dialog>() {"," @Override"," public void accept(Dialog dialog) {"," dialog.accept(\"foo\");"," page.offDialog(this);"," }","};","page.onDialog(handler);","","// prints 'foo'","System.out.println(page.evaluate(\"prompt('Enter string:')\"));","","// prints 'null' as the dialog will be auto-dismissed because there are no handlers.","System.out.println(page.evaluate(\"prompt('Enter string:')\"));"],"codeLang":"java"}],"required":true,"comment":"Adds one-off `Dialog` handler. The handler will be removed immediately after next `Dialog` is created.\n\n```java\npage.onceDialog(dialog -> {\n dialog.accept(\"foo\");\n});\n\n// prints 'foo'\nSystem.out.println(page.evaluate(\"prompt('Enter string:')\"));\n\n// prints 'null' as the dialog will be auto-dismissed because there are no handlers.\nSystem.out.println(page.evaluate(\"prompt('Enter string:')\"));\n```\n\nThis code above is equivalent to:\n\n```java\nConsumer<Dialog> handler = new Consumer<Dialog>() {\n @Override\n public void accept(Dialog dialog) {\n dialog.accept(\"foo\");\n page.offDialog(this);\n }\n};\npage.onDialog(handler);\n\n// prints 'foo'\nSystem.out.println(page.evaluate(\"prompt('Enter string:')\"));\n\n// prints 'null' as the dialog will be auto-dismissed because there are no handlers.\nSystem.out.println(page.evaluate(\"prompt('Enter string:')\"));\n```\n","deprecated":false,"async":false,"alias":"onceDialog","args":[{"kind":"property","langs":{},"name":"handler","type":{"name":"function","args":[{"name":"Dialog"}],"returnType":null,"expression":"[function]([Dialog])"},"spec":[{"type":"text","text":"Receives the `Dialog` object, it **must** either [`method: Dialog.accept`] or [`method: Dialog.dismiss`] the dialog - otherwise the page will [freeze](https://developer.mozilla.org/en-US/docs/Web/JavaScript/EventLoop#never_blocking) waiting for the dialog, and actions like click will never finish."}],"required":true,"comment":"Receives the `Dialog` object, it **must** either [`method: Dialog.accept`] or [`method: Dialog.dismiss`] the dialog -\notherwise the page will [freeze](https://developer.mozilla.org/en-US/docs/Web/JavaScript/EventLoop#never_blocking)\nwaiting for the dialog, and actions like click will never finish.","deprecated":false,"async":false,"alias":"handler"}]}]},{"name":"Playwright","spec":[{"type":"text","text":"Playwright module provides a method to launch a browser instance. The following is a typical example of using Playwright to drive automation:"},{"type":"code","lines":["const { chromium, firefox, webkit } = require('playwright');","","(async () => {"," const browser = await chromium.launch(); // Or 'firefox' or 'webkit'."," const page = await browser.newPage();"," await page.goto('http://example.com');"," // other actions..."," await browser.close();","})();"],"codeLang":"js"},{"type":"code","lines":["import com.microsoft.playwright.*;","","public class Example {"," public static void main(String[] args) {"," try (Playwright playwright = Playwright.create()) {"," BrowserType chromium = playwright.chromium();"," Browser browser = chromium.launch();"," Page page = browser.newPage();"," page.navigate(\"http://example.com\");"," // other actions..."," browser.close();"," }"," }","}"],"codeLang":"java"},{"type":"code","lines":["import asyncio","from playwright.async_api import async_playwright","","async def run(playwright):"," chromium = playwright.chromium # or \"firefox\" or \"webkit\"."," browser = await chromium.launch()"," page = await browser.new_page()"," await page.goto(\"http://example.com\")"," # other actions..."," await browser.close()","","async def main():"," async with async_playwright() as playwright:"," await run(playwright)","asyncio.run(main())"],"codeLang":"python async"},{"type":"code","lines":["from playwright.sync_api import sync_playwright","","def run(playwright):"," chromium = playwright.chromium # or \"firefox\" or \"webkit\"."," browser = chromium.launch()"," page = browser.new_page()"," page.goto(\"http://example.com\")"," # other actions..."," browser.close()","","with sync_playwright() as playwright:"," run(playwright)"],"codeLang":"python sync"},{"type":"code","lines":["using Microsoft.Playwright;","using System.Threading.Tasks;","","class PlaywrightExample","{"," public static async Task Main()"," {"," using var playwright = await Playwright.CreateAsync();"," await using var browser = await playwright.Chromium.LaunchAsync();"," var page = await browser.NewPageAsync();",""," await page.GotoAsync(\"https://www.microsoft.com\");"," // other actions..."," }","}"],"codeLang":"csharp"}],"langs":{},"comment":"Playwright module provides a method to launch a browser instance. The following is a typical example of using Playwright\nto drive automation:\n\n```js\nconst { chromium, firefox, webkit } = require('playwright');\n\n(async () => {\n const browser = await chromium.launch(); // Or 'firefox' or 'webkit'.\n const page = await browser.newPage();\n await page.goto('http://example.com');\n // other actions...\n await browser.close();\n})();\n```\n\n```java\nimport com.microsoft.playwright.*;\n\npublic class Example {\n public static void main(String[] args) {\n try (Playwright playwright = Playwright.create()) {\n BrowserType chromium = playwright.chromium();\n Browser browser = chromium.launch();\n Page page = browser.newPage();\n page.navigate(\"http://example.com\");\n // other actions...\n browser.close();\n }\n }\n}\n```\n\n```python async\nimport asyncio\nfrom playwright.async_api import async_playwright\n\nasync def run(playwright):\n chromium = playwright.chromium # or \"firefox\" or \"webkit\".\n browser = await chromium.launch()\n page = await browser.new_page()\n await page.goto(\"http://example.com\")\n # other actions...\n await browser.close()\n\nasync def main():\n async with async_playwright() as playwright:\n await run(playwright)\nasyncio.run(main())\n```\n\n```python sync\nfrom playwright.sync_api import sync_playwright\n\ndef run(playwright):\n chromium = playwright.chromium # or \"firefox\" or \"webkit\".\n browser = chromium.launch()\n page = browser.new_page()\n page.goto(\"http://example.com\")\n # other actions...\n browser.close()\n\nwith sync_playwright() as playwright:\n run(playwright)\n```\n\n```csharp\nusing Microsoft.Playwright;\nusing System.Threading.Tasks;\n\nclass PlaywrightExample\n{\n public static async Task Main()\n {\n using var playwright = await Playwright.CreateAsync();\n await using var browser = await playwright.Chromium.LaunchAsync();\n var page = await browser.NewPageAsync();\n\n await page.GotoAsync(\"https://www.microsoft.com\");\n // other actions...\n }\n}\n```\n","members":[{"kind":"property","langs":{},"name":"chromium","type":{"name":"BrowserType","expression":"[BrowserType]"},"spec":[{"type":"text","text":"This object can be used to launch or connect to Chromium, returning instances of `Browser`."}],"required":true,"comment":"This object can be used to launch or connect to Chromium, returning instances of `Browser`.","deprecated":false,"async":false,"alias":"chromium","args":[]},{"kind":"property","langs":{"only":["js","python"],"aliases":{},"types":{},"overrides":{}},"name":"devices","type":{"name":"Object","expression":"[Object]"},"spec":[{"type":"text","text":"Returns a dictionary of devices to be used with [`method: Browser.newContext`] or [`method: Browser.newPage`]."},{"type":"code","lines":["const { webkit, devices } = require('playwright');","const iPhone = devices['iPhone 6'];","","(async () => {"," const browser = await webkit.launch();"," const context = await browser.newContext({"," ...iPhone"," });"," const page = await context.newPage();"," await page.goto('http://example.com');"," // other actions..."," await browser.close();","})();"],"codeLang":"js"},{"type":"code","lines":["import asyncio","from playwright.async_api import async_playwright","","async def run(playwright):"," webkit = playwright.webkit"," iphone = playwright.devices[\"iPhone 6\"]"," browser = await webkit.launch()"," context = await browser.new_context(**iphone)"," page = await context.new_page()"," await page.goto(\"http://example.com\")"," # other actions..."," await browser.close()","","async def main():"," async with async_playwright() as playwright:"," await run(playwright)","asyncio.run(main())"],"codeLang":"python async"},{"type":"code","lines":["from playwright.sync_api import sync_playwright","","def run(playwright):"," webkit = playwright.webkit"," iphone = playwright.devices[\"iPhone 6\"]"," browser = webkit.launch()"," context = browser.new_context(**iphone)"," page = context.new_page()"," page.goto(\"http://example.com\")"," # other actions..."," browser.close()","","with sync_playwright() as playwright:"," run(playwright)"],"codeLang":"python sync"}],"required":true,"comment":"Returns a dictionary of devices to be used with [`method: Browser.newContext`] or [`method: Browser.newPage`].\n\n```js\nconst { webkit, devices } = require('playwright');\nconst iPhone = devices['iPhone 6'];\n\n(async () => {\n const browser = await webkit.launch();\n const context = await browser.newContext({\n ...iPhone\n });\n const page = await context.newPage();\n await page.goto('http://example.com');\n // other actions...\n await browser.close();\n})();\n```\n\n```python async\nimport asyncio\nfrom playwright.async_api import async_playwright\n\nasync def run(playwright):\n webkit = playwright.webkit\n iphone = playwright.devices[\"iPhone 6\"]\n browser = await webkit.launch()\n context = await browser.new_context(**iphone)\n page = await context.new_page()\n await page.goto(\"http://example.com\")\n # other actions...\n await browser.close()\n\nasync def main():\n async with async_playwright() as playwright:\n await run(playwright)\nasyncio.run(main())\n```\n\n```python sync\nfrom playwright.sync_api import sync_playwright\n\ndef run(playwright):\n webkit = playwright.webkit\n iphone = playwright.devices[\"iPhone 6\"]\n browser = webkit.launch()\n context = browser.new_context(**iphone)\n page = context.new_page()\n page.goto(\"http://example.com\")\n # other actions...\n browser.close()\n\nwith sync_playwright() as playwright:\n run(playwright)\n```\n","deprecated":false,"async":false,"alias":"devices","args":[]},{"kind":"property","langs":{"only":["csharp"],"aliases":{},"types":{},"overrides":{}},"name":"devices","type":{"name":"IReadOnlyDictionary","templates":[{"name":"string"},{"name":"BrowserNewContextOptions"}],"expression":"[IReadOnlyDictionary<string, BrowserNewContextOptions>]"},"spec":[{"type":"text","text":"Returns a dictionary of devices to be used with [`method: Browser.newContext`] or [`method: Browser.newPage`]."},{"type":"code","lines":["using Microsoft.Playwright;","using System.Threading.Tasks;","","class PlaywrightExample","{"," public static async Task Main()"," {"," using var playwright = await Playwright.CreateAsync();"," await using var browser = await playwright.Webkit.LaunchAsync();"," await using var context = await browser.NewContextAsync(Playwright.Devices[\"iPhone 6\"]);",""," var page = await context.NewPageAsync();"," await page.GotoAsync(\"https://www.theverge.com\");"," // other actions..."," }","}"],"codeLang":"csharp"}],"required":true,"comment":"Returns a dictionary of devices to be used with [`method: Browser.newContext`] or [`method: Browser.newPage`].\n\n```csharp\nusing Microsoft.Playwright;\nusing System.Threading.Tasks;\n\nclass PlaywrightExample\n{\n public static async Task Main()\n {\n using var playwright = await Playwright.CreateAsync();\n await using var browser = await playwright.Webkit.LaunchAsync();\n await using var context = await browser.NewContextAsync(Playwright.Devices[\"iPhone 6\"]);\n\n var page = await context.NewPageAsync();\n await page.GotoAsync(\"https://www.theverge.com\");\n // other actions...\n }\n}\n```\n","deprecated":false,"async":false,"alias":"devices","args":[]},{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"errors","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"TimeoutError","type":{"name":"function","expression":"[function]"},"spec":[{"type":"text","text":"A class of `TimeoutError`."}],"required":true,"comment":"A class of `TimeoutError`.","deprecated":false,"async":false,"alias":"TimeoutError"}],"expression":"[Object]"},"spec":[{"type":"text","text":"Playwright methods might throw errors if they are unable to fulfill a request. For example, [`method: Page.waitForSelector`] might fail if the selector doesn't match any nodes during the given timeframe."},{"type":"text","text":"For certain types of errors Playwright uses specific error classes. These classes are available via [`playwright.errors`](#playwrighterrors)."},{"type":"text","text":"An example of handling a timeout error:"},{"type":"code","lines":["try {"," await page.waitForSelector('.foo');","} catch (e) {"," if (e instanceof playwright.errors.TimeoutError) {"," // Do something if this is a timeout."," }","}"],"codeLang":"js"},{"type":"code","lines":["try:"," await page.wait_for_selector(\".foo\")","except TimeoutError as e:"," # do something if this is a timeout."],"codeLang":"python async"},{"type":"code","lines":["try:"," page.wait_for_selector(\".foo\")","except TimeoutError as e:"," # do something if this is a timeout."],"codeLang":"python sync"}],"required":true,"comment":"Playwright methods might throw errors if they are unable to fulfill a request. For example,\n[`method: Page.waitForSelector`] might fail if the selector doesn't match any nodes during the given timeframe.\n\nFor certain types of errors Playwright uses specific error classes. These classes are available via\n[`playwright.errors`](#playwrighterrors).\n\nAn example of handling a timeout error:\n\n```js\ntry {\n await page.waitForSelector('.foo');\n} catch (e) {\n if (e instanceof playwright.errors.TimeoutError) {\n // Do something if this is a timeout.\n }\n}\n```\n\n```python async\ntry:\n await page.wait_for_selector(\".foo\")\nexcept TimeoutError as e:\n # do something if this is a timeout.\n```\n\n```python sync\ntry:\n page.wait_for_selector(\".foo\")\nexcept TimeoutError as e:\n # do something if this is a timeout.\n```\n","deprecated":false,"async":false,"alias":"errors","args":[]},{"kind":"property","langs":{},"name":"firefox","type":{"name":"BrowserType","expression":"[BrowserType]"},"spec":[{"type":"text","text":"This object can be used to launch or connect to Firefox, returning instances of `Browser`."}],"required":true,"comment":"This object can be used to launch or connect to Firefox, returning instances of `Browser`.","deprecated":false,"async":false,"alias":"firefox","args":[]},{"kind":"property","langs":{},"name":"selectors","type":{"name":"Selectors","expression":"[Selectors]"},"spec":[{"type":"text","text":"Selectors can be used to install custom selector engines. See [Working with selectors](./selectors.md) for more information."}],"required":true,"comment":"Selectors can be used to install custom selector engines. See [Working with selectors](./selectors.md) for more\ninformation.","deprecated":false,"async":false,"alias":"selectors","args":[]},{"kind":"property","langs":{},"name":"webkit","type":{"name":"BrowserType","expression":"[BrowserType]"},"spec":[{"type":"text","text":"This object can be used to launch or connect to WebKit, returning instances of `Browser`."}],"required":true,"comment":"This object can be used to launch or connect to WebKit, returning instances of `Browser`.","deprecated":false,"async":false,"alias":"webkit","args":[]},{"kind":"method","langs":{"only":["java"],"aliases":{},"types":{},"overrides":{}},"name":"close","type":{"name":"void"},"spec":[{"type":"text","text":"Terminates this instance of Playwright, will also close all created browsers if they are still running."}],"required":true,"comment":"Terminates this instance of Playwright, will also close all created browsers if they are still running.","deprecated":false,"async":false,"alias":"close","args":[]},{"kind":"method","langs":{"only":["java"],"aliases":{},"types":{},"overrides":{}},"name":"create","type":{"name":"Playwright","expression":"[Playwright]"},"spec":[{"type":"text","text":"Launches new Playwright driver process and connects to it. [`method: Playwright.close`] should be called when the instance is no longer needed."},{"type":"code","lines":["Playwright playwright = Playwright.create()) {","Browser browser = playwright.webkit().launch();","Page page = browser.newPage();","page.navigate(\"https://www.w3.org/\");","playwright.close();"],"codeLang":"java"}],"required":true,"comment":"Launches new Playwright driver process and connects to it. [`method: Playwright.close`] should be called when the\ninstance is no longer needed.\n\n```java\nPlaywright playwright = Playwright.create()) {\nBrowser browser = playwright.webkit().launch();\nPage page = browser.newPage();\npage.navigate(\"https://www.w3.org/\");\nplaywright.close();\n```\n","deprecated":false,"async":false,"alias":"create","args":[{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{"only":["java"],"aliases":{},"types":{},"overrides":{}},"name":"env","type":{"name":"Object","templates":[{"name":"string"},{"name":"string"}],"expression":"[Object]<[string], [string]>"},"spec":[{"type":"text","text":"Additional environment variables that will be passed to the driver process. By default driver process inherits environment variables of the Playwright process."}],"required":false,"comment":"Additional environment variables that will be passed to the driver process. By default driver process inherits\nenvironment variables of the Playwright process.","deprecated":false,"async":false,"alias":"env"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{"only":["python"],"aliases":{},"types":{},"overrides":{}},"name":"stop","type":{"name":"void"},"spec":[{"type":"text","text":"Terminates this instance of Playwright in case it was created bypassing the Python context manager. This is useful in REPL applications."},{"type":"code","lines":[">>> from playwright.sync_api import sync_playwright","",">>> playwright = sync_playwright().start()","",">>> browser = playwright.chromium.launch()",">>> page = browser.new_page()",">>> page.goto(\"http://whatsmyuseragent.org/\")",">>> page.screenshot(path=\"example.png\")",">>> browser.close()","",">>> playwright.stop()"],"codeLang":"py"}],"required":true,"comment":"Terminates this instance of Playwright in case it was created bypassing the Python context manager. This is useful in\nREPL applications.\n\n```py\n>>> from playwright.sync_api import sync_playwright\n\n>>> playwright = sync_playwright().start()\n\n>>> browser = playwright.chromium.launch()\n>>> page = browser.new_page()\n>>> page.goto(\"http://whatsmyuseragent.org/\")\n>>> page.screenshot(path=\"example.png\")\n>>> browser.close()\n\n>>> playwright.stop()\n```\n","deprecated":false,"async":true,"alias":"stop","args":[]}]},{"name":"PlaywrightException","spec":[{"type":"li","text":"extends: [RuntimeException]","liType":"bullet"},{"type":"text","text":"PlaywrightException is thrown whenever certain operations are terminated abnormally, e.g. browser closes while [`method: Page.evaluate`] is running. All Playwright exceptions inherit from this class."}],"extends":"RuntimeException","langs":{"only":["java"],"aliases":{},"types":{},"overrides":{}},"comment":"- extends: [RuntimeException]\n\nPlaywrightException is thrown whenever certain operations are terminated abnormally, e.g. browser closes while\n[`method: Page.evaluate`] is running. All Playwright exceptions inherit from this class.","members":[]},{"name":"Request","spec":[{"type":"text","text":"Whenever the page sends a request for a network resource the following sequence of events are emitted by `Page`:"},{"type":"li","text":"[`event: Page.request`] emitted when the request is issued by the page.","liType":"bullet"},{"type":"li","text":"[`event: Page.response`] emitted when/if the response status and headers are received for the request.","liType":"bullet"},{"type":"li","text":"[`event: Page.requestFinished`] emitted when the response body is downloaded and the request is complete.","liType":"bullet"},{"type":"text","text":"If request fails at some point, then instead of `'requestfinished'` event (and possibly instead of 'response' event), the [`event: Page.requestFailed`] event is emitted."},{"type":"note","noteType":"note","text":"HTTP Error responses, such as 404 or 503, are still successful responses from HTTP standpoint, so request will complete with `'requestfinished'` event."},{"type":"text","text":"If request gets a 'redirect' response, the request is successfully finished with the 'requestfinished' event, and a new request is issued to a redirected url."}],"langs":{},"comment":"Whenever the page sends a request for a network resource the following sequence of events are emitted by `Page`:\n- [`event: Page.request`] emitted when the request is issued by the page.\n- [`event: Page.response`] emitted when/if the response status and headers are received for the request.\n- [`event: Page.requestFinished`] emitted when the response body is downloaded and the request is complete.\n\nIf request fails at some point, then instead of `'requestfinished'` event (and possibly instead of 'response' event),\nthe [`event: Page.requestFailed`] event is emitted.\n\n> NOTE: HTTP Error responses, such as 404 or 503, are still successful responses from HTTP standpoint, so request will\ncomplete with `'requestfinished'` event.\n\nIf request gets a 'redirect' response, the request is successfully finished with the 'requestfinished' event, and a new\nrequest is issued to a redirected url.","members":[{"kind":"method","langs":{"types":{"js":{"name":"","union":[{"name":"null"},{"name":"Object","properties":[{"kind":"property","langs":{},"name":"errorText","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Human-readable error message, e.g. `'net::ERR_FAILED'`."}],"argsArray":[],"required":true,"comment":"","args":{},"clazz":null,"deprecated":false,"async":false,"alias":"errorText"}]}],"expression":"[null]|[Object]"}}},"name":"failure","type":{"name":"","union":[{"name":"null"},{"name":"string"}],"expression":"[null]|[string]"},"spec":[{"type":"text","text":"The method returns `null` unless this request has failed, as reported by `requestfailed` event."},{"type":"text","text":"Example of logging of all the failed requests:"},{"type":"code","lines":["page.on('requestfailed', request => {"," console.log(request.url() + ' ' + request.failure().errorText);","});"],"codeLang":"js"},{"type":"code","lines":["page.onRequestFailed(request -> {"," System.out.println(request.url() + \" \" + request.failure());","});"],"codeLang":"java"},{"type":"code","lines":["page.on(\"requestfailed\", lambda request: print(request.url + \" \" + request.failure))"],"codeLang":"py"},{"type":"code","lines":["page.RequestFailed += (_, request) =>","{"," Console.WriteLine(request.Failure);","};"],"codeLang":"csharp"}],"required":true,"comment":"The method returns `null` unless this request has failed, as reported by `requestfailed` event.\n\nExample of logging of all the failed requests:\n\n```js\npage.on('requestfailed', request => {\n console.log(request.url() + ' ' + request.failure().errorText);\n});\n```\n\n```java\npage.onRequestFailed(request -> {\n System.out.println(request.url() + \" \" + request.failure());\n});\n```\n\n```py\npage.on(\"requestfailed\", lambda request: print(request.url + \" \" + request.failure))\n```\n\n```csharp\npage.RequestFailed += (_, request) =>\n{\n Console.WriteLine(request.Failure);\n};\n```\n","deprecated":false,"async":false,"alias":"failure","args":[]},{"kind":"method","langs":{},"name":"frame","type":{"name":"Frame","expression":"[Frame]"},"spec":[{"type":"text","text":"Returns the `Frame` that initiated this request."}],"required":true,"comment":"Returns the `Frame` that initiated this request.","deprecated":false,"async":false,"alias":"frame","args":[]},{"kind":"method","langs":{},"name":"headers","type":{"name":"Object","templates":[{"name":"string"},{"name":"string"}],"expression":"[Object]<[string], [string]>"},"spec":[{"type":"text","text":"An object with HTTP headers associated with the request. All header names are lower-case."}],"required":true,"comment":"An object with HTTP headers associated with the request. All header names are lower-case.","deprecated":false,"async":false,"alias":"headers","args":[]},{"kind":"method","langs":{},"name":"isNavigationRequest","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether this request is driving frame's navigation."}],"required":true,"comment":"Whether this request is driving frame's navigation.","deprecated":false,"async":false,"alias":"isNavigationRequest","args":[]},{"kind":"method","langs":{},"name":"method","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Request's method (GET, POST, etc.)"}],"required":true,"comment":"Request's method (GET, POST, etc.)","deprecated":false,"async":false,"alias":"method","args":[]},{"kind":"method","langs":{},"name":"postData","type":{"name":"","union":[{"name":"null"},{"name":"string"}],"expression":"[null]|[string]"},"spec":[{"type":"text","text":"Request's post body, if any."}],"required":true,"comment":"Request's post body, if any.","deprecated":false,"async":false,"alias":"postData","args":[]},{"kind":"method","langs":{},"name":"postDataBuffer","type":{"name":"","union":[{"name":"null"},{"name":"Buffer"}],"expression":"[null]|[Buffer]"},"spec":[{"type":"text","text":"Request's post body in a binary form, if any."}],"required":true,"comment":"Request's post body in a binary form, if any.","deprecated":false,"async":false,"alias":"postDataBuffer","args":[]},{"kind":"method","langs":{"only":["js","python"],"aliases":{},"types":{},"overrides":{}},"name":"postDataJSON","type":{"name":"","union":[{"name":"null"},{"name":"any"}],"expression":"[null]|[any]"},"spec":[{"type":"text","text":"Returns parsed request's body for `form-urlencoded` and JSON as a fallback if any."},{"type":"text","text":"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."}],"required":true,"comment":"Returns parsed request's body for `form-urlencoded` and JSON as a fallback if any.\n\nWhen the response is `application/x-www-form-urlencoded` then a key/value object of the values will be returned.\nOtherwise it will be parsed as JSON.","deprecated":false,"async":false,"alias":"postDataJSON","args":[]},{"kind":"method","langs":{},"name":"redirectedFrom","type":{"name":"","union":[{"name":"null"},{"name":"Request"}],"expression":"[null]|[Request]"},"spec":[{"type":"text","text":"Request that was redirected by the server to this one, if any."},{"type":"text","text":"When the server responds with a redirect, Playwright creates a new `Request` object. The two requests are connected by `redirectedFrom()` and `redirectedTo()` methods. When multiple server redirects has happened, it is possible to construct the whole redirect chain by repeatedly calling `redirectedFrom()`."},{"type":"text","text":"For example, if the website `http://example.com` redirects to `https://example.com`:"},{"type":"code","lines":["const response = await page.goto('http://example.com');","console.log(response.request().redirectedFrom().url()); // 'http://example.com'"],"codeLang":"js"},{"type":"code","lines":["Response response = page.navigate(\"http://example.com\");","System.out.println(response.request().redirectedFrom().url()); // \"http://example.com\""],"codeLang":"java"},{"type":"code","lines":["response = await page.goto(\"http://example.com\")","print(response.request.redirected_from.url) # \"http://example.com\""],"codeLang":"python async"},{"type":"code","lines":["response = page.goto(\"http://example.com\")","print(response.request.redirected_from.url) # \"http://example.com\""],"codeLang":"python sync"},{"type":"code","lines":["var response = await page.GotoAsync(\"http://www.microsoft.com\");","Console.WriteLine(response.Request.RedirectedFrom?.Url); // http://www.microsoft.com"],"codeLang":"csharp"},{"type":"text","text":"If the website `https://google.com` has no redirects:"},{"type":"code","lines":["const response = await page.goto('https://google.com');","console.log(response.request().redirectedFrom()); // null"],"codeLang":"js"},{"type":"code","lines":["Response response = page.navigate(\"https://google.com\");","System.out.println(response.request().redirectedFrom()); // null"],"codeLang":"java"},{"type":"code","lines":["response = await page.goto(\"https://google.com\")","print(response.request.redirected_from) # None"],"codeLang":"python async"},{"type":"code","lines":["response = page.goto(\"https://google.com\")","print(response.request.redirected_from) # None"],"codeLang":"python sync"},{"type":"code","lines":["var response = await page.GotoAsync(\"https://www.google.com\");","Console.WriteLine(response.Request.RedirectedFrom?.Url); // null"],"codeLang":"csharp"}],"required":true,"comment":"Request that was redirected by the server to this one, if any.\n\nWhen the server responds with a redirect, Playwright creates a new `Request` object. The two requests are connected by\n`redirectedFrom()` and `redirectedTo()` methods. When multiple server redirects has happened, it is possible to\nconstruct the whole redirect chain by repeatedly calling `redirectedFrom()`.\n\nFor example, if the website `http://example.com` redirects to `https://example.com`:\n\n```js\nconst response = await page.goto('http://example.com');\nconsole.log(response.request().redirectedFrom().url()); // 'http://example.com'\n```\n\n```java\nResponse response = page.navigate(\"http://example.com\");\nSystem.out.println(response.request().redirectedFrom().url()); // \"http://example.com\"\n```\n\n```python async\nresponse = await page.goto(\"http://example.com\")\nprint(response.request.redirected_from.url) # \"http://example.com\"\n```\n\n```python sync\nresponse = page.goto(\"http://example.com\")\nprint(response.request.redirected_from.url) # \"http://example.com\"\n```\n\n```csharp\nvar response = await page.GotoAsync(\"http://www.microsoft.com\");\nConsole.WriteLine(response.Request.RedirectedFrom?.Url); // http://www.microsoft.com\n```\n\nIf the website `https://google.com` has no redirects:\n\n```js\nconst response = await page.goto('https://google.com');\nconsole.log(response.request().redirectedFrom()); // null\n```\n\n```java\nResponse response = page.navigate(\"https://google.com\");\nSystem.out.println(response.request().redirectedFrom()); // null\n```\n\n```python async\nresponse = await page.goto(\"https://google.com\")\nprint(response.request.redirected_from) # None\n```\n\n```python sync\nresponse = page.goto(\"https://google.com\")\nprint(response.request.redirected_from) # None\n```\n\n```csharp\nvar response = await page.GotoAsync(\"https://www.google.com\");\nConsole.WriteLine(response.Request.RedirectedFrom?.Url); // null\n```\n","deprecated":false,"async":false,"alias":"redirectedFrom","args":[]},{"kind":"method","langs":{},"name":"redirectedTo","type":{"name":"","union":[{"name":"null"},{"name":"Request"}],"expression":"[null]|[Request]"},"spec":[{"type":"text","text":"New request issued by the browser if the server responded with redirect."},{"type":"text","text":"This method is the opposite of [`method: Request.redirectedFrom`]:"},{"type":"code","lines":["console.log(request.redirectedFrom().redirectedTo() === request); // true"],"codeLang":"js"},{"type":"code","lines":["System.out.println(request.redirectedFrom().redirectedTo() == request); // true"],"codeLang":"java"},{"type":"code","lines":["assert request.redirected_from.redirected_to == request"],"codeLang":"py"},{"type":"code","lines":["Console.WriteLine(request.RedirectedFrom?.RedirectedTo == request); // True"],"codeLang":"csharp"}],"required":true,"comment":"New request issued by the browser if the server responded with redirect.\n\nThis method is the opposite of [`method: Request.redirectedFrom`]:\n\n```js\nconsole.log(request.redirectedFrom().redirectedTo() === request); // true\n```\n\n```java\nSystem.out.println(request.redirectedFrom().redirectedTo() == request); // true\n```\n\n```py\nassert request.redirected_from.redirected_to == request\n```\n\n```csharp\nConsole.WriteLine(request.RedirectedFrom?.RedirectedTo == request); // True\n```\n","deprecated":false,"async":false,"alias":"redirectedTo","args":[]},{"kind":"method","langs":{},"name":"resourceType","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Contains the request's resource type as it was perceived by the rendering engine. ResourceType will be one of the following: `document`, `stylesheet`, `image`, `media`, `font`, `script`, `texttrack`, `xhr`, `fetch`, `eventsource`, `websocket`, `manifest`, `other`."}],"required":true,"comment":"Contains the request's resource type as it was perceived by the rendering engine. ResourceType will be one of the\nfollowing: `document`, `stylesheet`, `image`, `media`, `font`, `script`, `texttrack`, `xhr`, `fetch`, `eventsource`,\n`websocket`, `manifest`, `other`.","deprecated":false,"async":false,"alias":"resourceType","args":[]},{"kind":"method","langs":{},"name":"response","type":{"name":"","union":[{"name":"null"},{"name":"Response"}],"expression":"[null]|[Response]"},"spec":[{"type":"text","text":"Returns the matching `Response` object, or `null` if the response was not received due to error."}],"required":true,"comment":"Returns the matching `Response` object, or `null` if the response was not received due to error.","deprecated":false,"async":true,"alias":"response","args":[]},{"kind":"method","langs":{},"name":"timing","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"startTime","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Request start time in milliseconds elapsed since January 1, 1970 00:00:00 UTC"}],"required":true,"comment":"Request start time in milliseconds elapsed since January 1, 1970 00:00:00 UTC","deprecated":false,"async":false,"alias":"startTime"},{"kind":"property","langs":{},"name":"domainLookupStart","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"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."}],"required":true,"comment":"Time immediately before the browser starts the domain name lookup for the resource. The value is given in milliseconds\nrelative to `startTime`, -1 if not available.","deprecated":false,"async":false,"alias":"domainLookupStart"},{"kind":"property","langs":{},"name":"domainLookupEnd","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Time immediately after the browser starts the domain name lookup for the resource. The value is given in milliseconds relative to `startTime`, -1 if not available."}],"required":true,"comment":"Time immediately after the browser starts the domain name lookup for the resource. The value is given in milliseconds\nrelative to `startTime`, -1 if not available.","deprecated":false,"async":false,"alias":"domainLookupEnd"},{"kind":"property","langs":{},"name":"connectStart","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Time immediately before the user agent starts establishing the connection to the server to retrieve the resource. The value is given in milliseconds relative to `startTime`, -1 if not available."}],"required":true,"comment":"Time immediately before the user agent starts establishing the connection to the server to retrieve the resource. The\nvalue is given in milliseconds relative to `startTime`, -1 if not available.","deprecated":false,"async":false,"alias":"connectStart"},{"kind":"property","langs":{},"name":"secureConnectionStart","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Time immediately before the browser starts the handshake process to secure the current connection. The value is given in milliseconds relative to `startTime`, -1 if not available."}],"required":true,"comment":"Time immediately before the browser starts the handshake process to secure the current connection. The value is given in\nmilliseconds relative to `startTime`, -1 if not available.","deprecated":false,"async":false,"alias":"secureConnectionStart"},{"kind":"property","langs":{},"name":"connectEnd","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Time immediately before the user agent starts establishing the connection to the server to retrieve the resource. The value is given in milliseconds relative to `startTime`, -1 if not available."}],"required":true,"comment":"Time immediately before the user agent starts establishing the connection to the server to retrieve the resource. The\nvalue is given in milliseconds relative to `startTime`, -1 if not available.","deprecated":false,"async":false,"alias":"connectEnd"},{"kind":"property","langs":{},"name":"requestStart","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Time immediately before the browser starts requesting the resource from the server, cache, or local resource. The value is given in milliseconds relative to `startTime`, -1 if not available."}],"required":true,"comment":"Time immediately before the browser starts requesting the resource from the server, cache, or local resource. The value\nis given in milliseconds relative to `startTime`, -1 if not available.","deprecated":false,"async":false,"alias":"requestStart"},{"kind":"property","langs":{},"name":"responseStart","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Time immediately after the browser starts requesting the resource from the server, cache, or local resource. The value is given in milliseconds relative to `startTime`, -1 if not available."}],"required":true,"comment":"Time immediately after the browser starts requesting the resource from the server, cache, or local resource. The value\nis given in milliseconds relative to `startTime`, -1 if not available.","deprecated":false,"async":false,"alias":"responseStart"},{"kind":"property","langs":{},"name":"responseEnd","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Time immediately after the browser receives the last byte of the resource or immediately before the transport connection is closed, whichever comes first. The value is given in milliseconds relative to `startTime`, -1 if not available."}],"required":true,"comment":"Time immediately after the browser receives the last byte of the resource or immediately before the transport connection\nis closed, whichever comes first. The value is given in milliseconds relative to `startTime`, -1 if not available.","deprecated":false,"async":false,"alias":"responseEnd"}],"expression":"[Object]"},"spec":[{"type":"text","text":"Returns resource timing information for given request. Most of the timing values become available upon the response, `responseEnd` becomes available when request finishes. Find more information at [Resource Timing API](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming)."},{"type":"code","lines":["const [request] = await Promise.all(["," page.waitForEvent('requestfinished'),"," page.goto('http://example.com')","]);","console.log(request.timing());"],"codeLang":"js"},{"type":"code","lines":["page.onRequestFinished(request -> {"," Timing timing = request.timing();"," System.out.println(timing.responseEnd - timing.startTime);","});","page.navigate(\"http://example.com\");"],"codeLang":"java"},{"type":"code","lines":["async with page.expect_event(\"requestfinished\") as request_info:"," await page.goto(\"http://example.com\")","request = await request_info.value","print(request.timing)"],"codeLang":"python async"},{"type":"code","lines":["with page.expect_event(\"requestfinished\") as request_info:"," page.goto(\"http://example.com\")","request = request_info.value","print(request.timing)"],"codeLang":"python sync"},{"type":"code","lines":["var request = await page.RunAndWaitForRequestFinishedAsync(async () =>","{"," await page.GotoAsync(\"https://www.microsoft.com\");","});","Console.WriteLine(request.Timing.ResponseEnd);"],"codeLang":"csharp"}],"required":true,"comment":"Returns resource timing information for given request. Most of the timing values become available upon the response,\n`responseEnd` becomes available when request finishes. Find more information at\n[Resource Timing API](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming).\n\n```js\nconst [request] = await Promise.all([\n page.waitForEvent('requestfinished'),\n page.goto('http://example.com')\n]);\nconsole.log(request.timing());\n```\n\n```java\npage.onRequestFinished(request -> {\n Timing timing = request.timing();\n System.out.println(timing.responseEnd - timing.startTime);\n});\npage.navigate(\"http://example.com\");\n```\n\n```python async\nasync with page.expect_event(\"requestfinished\") as request_info:\n await page.goto(\"http://example.com\")\nrequest = await request_info.value\nprint(request.timing)\n```\n\n```python sync\nwith page.expect_event(\"requestfinished\") as request_info:\n page.goto(\"http://example.com\")\nrequest = request_info.value\nprint(request.timing)\n```\n\n```csharp\nvar request = await page.RunAndWaitForRequestFinishedAsync(async () =>\n{\n await page.GotoAsync(\"https://www.microsoft.com\");\n});\nConsole.WriteLine(request.Timing.ResponseEnd);\n```\n","deprecated":false,"async":false,"alias":"timing","args":[]},{"kind":"method","langs":{},"name":"url","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"URL of the request."}],"required":true,"comment":"URL of the request.","deprecated":false,"async":false,"alias":"url","args":[]},{"kind":"method","langs":{"only":["csharp"],"aliases":{},"types":{},"overrides":{}},"name":"PostDataJSON","type":{"name":"JsonElement?","expression":"[JsonElement?]"},"spec":[{"type":"text","text":"Returns parsed request's body for `form-urlencoded` and JSON as a fallback if any."},{"type":"text","text":"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."}],"required":true,"comment":"Returns parsed request's body for `form-urlencoded` and JSON as a fallback if any.\n\nWhen the response is `application/x-www-form-urlencoded` then a key/value object of the values will be returned.\nOtherwise it will be parsed as JSON.","deprecated":false,"async":false,"alias":"PostDataJSON","args":[]}]},{"name":"Response","spec":[{"type":"text","text":"`Response` class represents responses which are received by page."}],"langs":{},"comment":"`Response` class represents responses which are received by page.","members":[{"kind":"method","langs":{},"name":"body","type":{"name":"Buffer","expression":"[Buffer]"},"spec":[{"type":"text","text":"Returns the buffer with response body."}],"required":true,"comment":"Returns the buffer with response body.","deprecated":false,"async":true,"alias":"body","args":[]},{"kind":"method","langs":{"types":{"js":{"name":"","union":[{"name":"null"},{"name":"Error"}],"expression":"[null]|[Error]"}}},"name":"finished","type":{"name":"","union":[{"name":"null"},{"name":"string"}],"expression":"[null]|[string]"},"spec":[{"type":"text","text":"Waits for this response to finish, returns failure error if request failed."}],"required":true,"comment":"Waits for this response to finish, returns failure error if request failed.","deprecated":false,"async":true,"alias":"finished","args":[]},{"kind":"method","langs":{},"name":"frame","type":{"name":"Frame","expression":"[Frame]"},"spec":[{"type":"text","text":"Returns the `Frame` that initiated this response."}],"required":true,"comment":"Returns the `Frame` that initiated this response.","deprecated":false,"async":false,"alias":"frame","args":[]},{"kind":"method","langs":{},"name":"headers","type":{"name":"Object","templates":[{"name":"string"},{"name":"string"}],"expression":"[Object]<[string], [string]>"},"spec":[{"type":"text","text":"Returns the object with HTTP headers associated with the response. All header names are lower-case."}],"required":true,"comment":"Returns the object with HTTP headers associated with the response. All header names are lower-case.","deprecated":false,"async":false,"alias":"headers","args":[]},{"kind":"method","langs":{"only":["js","python"],"aliases":{},"types":{},"overrides":{}},"name":"json","type":{"name":"Serializable","expression":"[Serializable]"},"spec":[{"type":"text","text":"Returns the JSON representation of response body."},{"type":"text","text":"This method will throw if the response body is not parsable via `JSON.parse`."}],"required":true,"comment":"Returns the JSON representation of response body.\n\nThis method will throw if the response body is not parsable via `JSON.parse`.","deprecated":false,"async":true,"alias":"json","args":[]},{"kind":"method","langs":{"only":["csharp"],"aliases":{},"types":{},"overrides":{}},"name":"json","type":{"name":"JsonElement?","expression":"[JsonElement?]"},"spec":[{"type":"text","text":"Returns the JSON representation of response body."},{"type":"text","text":"This method will throw if the response body is not parsable via `JSON.parse`."}],"required":true,"comment":"Returns the JSON representation of response body.\n\nThis method will throw if the response body is not parsable via `JSON.parse`.","deprecated":false,"async":true,"alias":"json","args":[]},{"kind":"method","langs":{},"name":"ok","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Contains a boolean stating whether the response was successful (status in the range 200-299) or not."}],"required":true,"comment":"Contains a boolean stating whether the response was successful (status in the range 200-299) or not.","deprecated":false,"async":false,"alias":"ok","args":[]},{"kind":"method","langs":{},"name":"request","type":{"name":"Request","expression":"[Request]"},"spec":[{"type":"text","text":"Returns the matching `Request` object."}],"required":true,"comment":"Returns the matching `Request` object.","deprecated":false,"async":false,"alias":"request","args":[]},{"kind":"method","langs":{},"name":"status","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"Contains the status code of the response (e.g., 200 for a success)."}],"required":true,"comment":"Contains the status code of the response (e.g., 200 for a success).","deprecated":false,"async":false,"alias":"status","args":[]},{"kind":"method","langs":{},"name":"statusText","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Contains the status text of the response (e.g. usually an \"OK\" for a success)."}],"required":true,"comment":"Contains the status text of the response (e.g. usually an \"OK\" for a success).","deprecated":false,"async":false,"alias":"statusText","args":[]},{"kind":"method","langs":{},"name":"text","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Returns the text representation of response body."}],"required":true,"comment":"Returns the text representation of response body.","deprecated":false,"async":true,"alias":"text","args":[]},{"kind":"method","langs":{},"name":"url","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Contains the URL of the response."}],"required":true,"comment":"Contains the URL of the response.","deprecated":false,"async":false,"alias":"url","args":[]}]},{"name":"Route","spec":[{"type":"text","text":"Whenever a network route is set up with [`method: Page.route`] or [`method: BrowserContext.route`], the `Route` object allows to handle the route."}],"langs":{},"comment":"Whenever a network route is set up with [`method: Page.route`] or [`method: BrowserContext.route`], the `Route` object\nallows to handle the route.","members":[{"kind":"method","langs":{},"name":"abort","type":{"name":"void"},"spec":[{"type":"text","text":"Aborts the route's request."}],"required":true,"comment":"Aborts the route's request.","deprecated":false,"async":true,"alias":"abort","args":[{"kind":"property","langs":{},"name":"errorCode","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Optional error code. Defaults to `failed`, could be one of the following:"},{"type":"li","text":"`'aborted'` - An operation was aborted (due to user action)","liType":"bullet"},{"type":"li","text":"`'accessdenied'` - Permission to access a resource, other than the network, was denied","liType":"bullet"},{"type":"li","text":"`'addressunreachable'` - The IP address is unreachable. This usually means that there is no route to the specified host or network.","liType":"bullet"},{"type":"li","text":"`'blockedbyclient'` - The client chose to block the request.","liType":"bullet"},{"type":"li","text":"`'blockedbyresponse'` - The request failed because the response was delivered along with requirements which are not met ('X-Frame-Options' and 'Content-Security-Policy' ancestor checks, for instance).","liType":"bullet"},{"type":"li","text":"`'connectionaborted'` - A connection timed out as a result of not receiving an ACK for data sent.","liType":"bullet"},{"type":"li","text":"`'connectionclosed'` - A connection was closed (corresponding to a TCP FIN).","liType":"bullet"},{"type":"li","text":"`'connectionfailed'` - A connection attempt failed.","liType":"bullet"},{"type":"li","text":"`'connectionrefused'` - A connection attempt was refused.","liType":"bullet"},{"type":"li","text":"`'connectionreset'` - A connection was reset (corresponding to a TCP RST).","liType":"bullet"},{"type":"li","text":"`'internetdisconnected'` - The Internet connection has been lost.","liType":"bullet"},{"type":"li","text":"`'namenotresolved'` - The host name could not be resolved.","liType":"bullet"},{"type":"li","text":"`'timedout'` - An operation timed out.","liType":"bullet"},{"type":"li","text":"`'failed'` - A generic failure occurred.","liType":"bullet"}],"required":false,"comment":"Optional error code. Defaults to `failed`, could be one of the following:\n- `'aborted'` - An operation was aborted (due to user action)\n- `'accessdenied'` - Permission to access a resource, other than the network, was denied\n- `'addressunreachable'` - The IP address is unreachable. This usually means that there is no route to the specified\n host or network.\n- `'blockedbyclient'` - The client chose to block the request.\n- `'blockedbyresponse'` - The request failed because the response was delivered along with requirements which are not\n met ('X-Frame-Options' and 'Content-Security-Policy' ancestor checks, for instance).\n- `'connectionaborted'` - A connection timed out as a result of not receiving an ACK for data sent.\n- `'connectionclosed'` - A connection was closed (corresponding to a TCP FIN).\n- `'connectionfailed'` - A connection attempt failed.\n- `'connectionrefused'` - A connection attempt was refused.\n- `'connectionreset'` - A connection was reset (corresponding to a TCP RST).\n- `'internetdisconnected'` - The Internet connection has been lost.\n- `'namenotresolved'` - The host name could not be resolved.\n- `'timedout'` - An operation timed out.\n- `'failed'` - A generic failure occurred.","deprecated":false,"async":false,"alias":"errorCode"}]},{"kind":"method","langs":{"aliases":{"java":"resume","python":"continue_"},"types":{},"overrides":{}},"name":"continue","type":{"name":"void"},"spec":[{"type":"text","text":"Continues route's request with optional overrides."},{"type":"code","lines":["await page.route('**/*', (route, request) => {"," // Override headers"," const headers = {"," ...request.headers(),"," foo: 'bar', // set \"foo\" header"," origin: undefined, // remove \"origin\" header"," };"," route.continue({headers});","});"],"codeLang":"js"},{"type":"code","lines":["page.route(\"**/*\", route -> {"," // Override headers"," Map<String, String> headers = new HashMap<>(route.request().headers());"," headers.put(\"foo\", \"bar\"); // set \"foo\" header"," headers.remove(\"origin\"); // remove \"origin\" header"," route.resume(new Route.ResumeOptions().setHeaders(headers));","});"],"codeLang":"java"},{"type":"code","lines":["async def handle(route, request):"," # override headers"," headers = {"," **request.headers,"," \"foo\": \"bar\" # set \"foo\" header"," \"origin\": None # remove \"origin\" header"," }"," await route.continue_(headers=headers)","}","await page.route(\"**/*\", handle)"],"codeLang":"python async"},{"type":"code","lines":["def handle(route, request):"," # override headers"," headers = {"," **request.headers,"," \"foo\": \"bar\" # set \"foo\" header"," \"origin\": None # remove \"origin\" header"," }"," route.continue_(headers=headers)","}","page.route(\"**/*\", handle)"],"codeLang":"python sync"},{"type":"code","lines":["await page.RouteAsync(\"**/*\", route =>","{"," var headers = new Dictionary<string, string>(route.Request.Headers) { { \"foo\", \"bar\" } };"," headers.Remove(\"origin\");"," route.ContinueAsync(headers);","});"],"codeLang":"csharp"}],"required":true,"comment":"Continues route's request with optional overrides.\n\n```js\nawait page.route('**/*', (route, request) => {\n // Override headers\n const headers = {\n ...request.headers(),\n foo: 'bar', // set \"foo\" header\n origin: undefined, // remove \"origin\" header\n };\n route.continue({headers});\n});\n```\n\n```java\npage.route(\"**/*\", route -> {\n // Override headers\n Map<String, String> headers = new HashMap<>(route.request().headers());\n headers.put(\"foo\", \"bar\"); // set \"foo\" header\n headers.remove(\"origin\"); // remove \"origin\" header\n route.resume(new Route.ResumeOptions().setHeaders(headers));\n});\n```\n\n```python async\nasync def handle(route, request):\n # override headers\n headers = {\n **request.headers,\n \"foo\": \"bar\" # set \"foo\" header\n \"origin\": None # remove \"origin\" header\n }\n await route.continue_(headers=headers)\n}\nawait page.route(\"**/*\", handle)\n```\n\n```python sync\ndef handle(route, request):\n # override headers\n headers = {\n **request.headers,\n \"foo\": \"bar\" # set \"foo\" header\n \"origin\": None # remove \"origin\" header\n }\n route.continue_(headers=headers)\n}\npage.route(\"**/*\", handle)\n```\n\n```csharp\nawait page.RouteAsync(\"**/*\", route =>\n{\n var headers = new Dictionary<string, string>(route.Request.Headers) { { \"foo\", \"bar\" } };\n headers.Remove(\"origin\");\n route.ContinueAsync(headers);\n});\n```\n","deprecated":false,"async":true,"alias":"continue","args":[{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"headers","type":{"name":"Object","templates":[{"name":"string"},{"name":"string"}],"expression":"[Object]<[string], [string]>"},"spec":[{"type":"text","text":"If set changes the request HTTP headers. Header values will be converted to a string."}],"required":false,"comment":"If set changes the request HTTP headers. Header values will be converted to a string.","deprecated":false,"async":false,"alias":"headers"},{"kind":"property","langs":{},"name":"method","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"If set changes the request method (e.g. GET or POST)"}],"required":false,"comment":"If set changes the request method (e.g. GET or POST)","deprecated":false,"async":false,"alias":"method"},{"kind":"property","langs":{},"name":"postData","type":{"name":"","union":[{"name":"string"},{"name":"Buffer"}],"expression":"[string]|[Buffer]"},"spec":[{"type":"text","text":"If set changes the post data of request"}],"required":false,"comment":"If set changes the post data of request","deprecated":false,"async":false,"alias":"postData"},{"kind":"property","langs":{},"name":"url","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"If set changes the request URL. New URL must have same protocol as original one."}],"required":false,"comment":"If set changes the request URL. New URL must have same protocol as original one.","deprecated":false,"async":false,"alias":"url"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"fulfill","type":{"name":"void"},"spec":[{"type":"text","text":"Fulfills route's request with given response."},{"type":"text","text":"An example of fulfilling all requests with 404 responses:"},{"type":"code","lines":["await page.route('**/*', route => {"," route.fulfill({"," status: 404,"," contentType: 'text/plain',"," body: 'Not Found!'"," });","});"],"codeLang":"js"},{"type":"code","lines":["page.route(\"**/*\", route -> {"," route.fulfill(new Route.FulfillOptions()"," .setStatus(404)"," .setContentType(\"text/plain\")"," .setBody(\"Not Found!\"));","});"],"codeLang":"java"},{"type":"code","lines":["await page.route(\"**/*\", lambda route: route.fulfill("," status=404,"," content_type=\"text/plain\","," body=\"not found!\"))"],"codeLang":"python async"},{"type":"code","lines":["page.route(\"**/*\", lambda route: route.fulfill("," status=404,"," content_type=\"text/plain\","," body=\"not found!\"))"],"codeLang":"python sync"},{"type":"code","lines":["await page.RouteAsync(\"**/*\", route => route.FulfillAsync("," status: 404,"," contentType: \"text/plain\", "," body: \"Not Found!\"));"],"codeLang":"csharp"},{"type":"text","text":"An example of serving static file:"},{"type":"code","lines":["await page.route('**/xhr_endpoint', route => route.fulfill({ path: 'mock_data.json' }));"],"codeLang":"js"},{"type":"code","lines":["page.route(\"**/xhr_endpoint\", route -> route.fulfill("," new Route.FulfillOptions().setPath(Paths.get(\"mock_data.json\")));"],"codeLang":"java"},{"type":"code","lines":["await page.route(\"**/xhr_endpoint\", lambda route: route.fulfill(path=\"mock_data.json\"))"],"codeLang":"python async"},{"type":"code","lines":["page.route(\"**/xhr_endpoint\", lambda route: route.fulfill(path=\"mock_data.json\"))"],"codeLang":"python sync"},{"type":"code","lines":["await page.RouteAsync(\"**/xhr_endpoint\", route => route.FulfillAsync(new RouteFulfillOptions { Path = \"mock_data.json\" }));"],"codeLang":"csharp"}],"required":true,"comment":"Fulfills route's request with given response.\n\nAn example of fulfilling all requests with 404 responses:\n\n```js\nawait page.route('**/*', route => {\n route.fulfill({\n status: 404,\n contentType: 'text/plain',\n body: 'Not Found!'\n });\n});\n```\n\n```java\npage.route(\"**/*\", route -> {\n route.fulfill(new Route.FulfillOptions()\n .setStatus(404)\n .setContentType(\"text/plain\")\n .setBody(\"Not Found!\"));\n});\n```\n\n```python async\nawait page.route(\"**/*\", lambda route: route.fulfill(\n status=404,\n content_type=\"text/plain\",\n body=\"not found!\"))\n```\n\n```python sync\npage.route(\"**/*\", lambda route: route.fulfill(\n status=404,\n content_type=\"text/plain\",\n body=\"not found!\"))\n```\n\n```csharp\nawait page.RouteAsync(\"**/*\", route => route.FulfillAsync(\n status: 404,\n contentType: \"text/plain\", \n body: \"Not Found!\"));\n```\n\nAn example of serving static file:\n\n```js\nawait page.route('**/xhr_endpoint', route => route.fulfill({ path: 'mock_data.json' }));\n```\n\n```java\npage.route(\"**/xhr_endpoint\", route -> route.fulfill(\n new Route.FulfillOptions().setPath(Paths.get(\"mock_data.json\")));\n```\n\n```python async\nawait page.route(\"**/xhr_endpoint\", lambda route: route.fulfill(path=\"mock_data.json\"))\n```\n\n```python sync\npage.route(\"**/xhr_endpoint\", lambda route: route.fulfill(path=\"mock_data.json\"))\n```\n\n```csharp\nawait page.RouteAsync(\"**/xhr_endpoint\", route => route.FulfillAsync(new RouteFulfillOptions { Path = \"mock_data.json\" }));\n```\n","deprecated":false,"async":true,"alias":"fulfill","args":[{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{"only":["js","python"],"aliases":{},"types":{},"overrides":{}},"name":"body","type":{"name":"","union":[{"name":"string"},{"name":"Buffer"}],"expression":"[string]|[Buffer]"},"spec":[{"type":"text","text":"Response body."}],"required":false,"comment":"Response body.","deprecated":false,"async":false,"alias":"body"},{"kind":"property","langs":{"only":["csharp","java"],"aliases":{},"types":{},"overrides":{}},"name":"body","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Optional response body as text."}],"required":false,"comment":"Optional response body as text.","deprecated":false,"async":false,"alias":"body"},{"kind":"property","langs":{"only":["csharp","java"],"aliases":{},"types":{},"overrides":{}},"name":"bodyBytes","type":{"name":"Buffer","expression":"[Buffer]"},"spec":[{"type":"text","text":"Optional response body as raw bytes."}],"required":false,"comment":"Optional response body as raw bytes.","deprecated":false,"async":false,"alias":"bodyBytes"},{"kind":"property","langs":{},"name":"contentType","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"If set, equals to setting `Content-Type` response header."}],"required":false,"comment":"If set, equals to setting `Content-Type` response header.","deprecated":false,"async":false,"alias":"contentType"},{"kind":"property","langs":{},"name":"headers","type":{"name":"Object","templates":[{"name":"string"},{"name":"string"}],"expression":"[Object]<[string], [string]>"},"spec":[{"type":"text","text":"Response headers. Header values will be converted to a string."}],"required":false,"comment":"Response headers. Header values will be converted to a string.","deprecated":false,"async":false,"alias":"headers"},{"kind":"property","langs":{},"name":"path","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"File path to respond with. The content type will be inferred from file extension. If `path` is a relative path, then it is resolved relative to the current working directory."}],"required":false,"comment":"File path to respond with. The content type will be inferred from file extension. If `path` is a relative path, then it\nis resolved relative to the current working directory.","deprecated":false,"async":false,"alias":"path"},{"kind":"property","langs":{},"name":"status","type":{"name":"int","expression":"[int]"},"spec":[{"type":"text","text":"Response status code, defaults to `200`."}],"required":false,"comment":"Response status code, defaults to `200`.","deprecated":false,"async":false,"alias":"status"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"request","type":{"name":"Request","expression":"[Request]"},"spec":[{"type":"text","text":"A request to be routed."}],"required":true,"comment":"A request to be routed.","deprecated":false,"async":false,"alias":"request","args":[]}]},{"name":"Selectors","spec":[{"type":"text","text":"Selectors can be used to install custom selector engines. See [Working with selectors](./selectors.md) for more information."}],"langs":{},"comment":"Selectors can be used to install custom selector engines. See [Working with selectors](./selectors.md) for more\ninformation.","members":[{"kind":"method","langs":{},"name":"register","type":{"name":"void"},"spec":[{"type":"text","text":"An example of registering selector engine that queries elements based on a tag name:"},{"type":"code","lines":["const { selectors, firefox } = require('playwright'); // Or 'chromium' or 'webkit'.","","(async () => {"," // Must be a function that evaluates to a selector engine instance."," const createTagNameEngine = () => ({"," // Returns the first element matching given selector in the root's subtree."," query(root, selector) {"," return root.querySelector(selector);"," },",""," // Returns all elements matching given selector in the root's subtree."," queryAll(root, selector) {"," return Array.from(root.querySelectorAll(selector));"," }"," });",""," // Register the engine. Selectors will be prefixed with \"tag=\"."," await selectors.register('tag', createTagNameEngine);",""," const browser = await firefox.launch();"," const page = await browser.newPage();"," await page.setContent(`<div><button>Click me</button></div>`);",""," // Use the selector prefixed with its name."," const button = await page.$('tag=button');"," // Combine it with other selector engines."," await page.click('tag=div >> text=\"Click me\"');"," // Can use it in any methods supporting selectors."," const buttonCount = await page.$$eval('tag=button', buttons => buttons.length);",""," await browser.close();","})();"],"codeLang":"js"},{"type":"code","lines":["// Script that evaluates to a selector engine instance.","String createTagNameEngine = \"{\\n\" +"," \" // Returns the first element matching given selector in the root's subtree.\\n\" +"," \" query(root, selector) {\\n\" +"," \" return root.querySelector(selector);\\n\" +"," \" },\\n\" +"," \" // Returns all elements matching given selector in the root's subtree.\\n\" +"," \" queryAll(root, selector) {\\n\" +"," \" return Array.from(root.querySelectorAll(selector));\\n\" +"," \" }\\n\" +"," \"}\";","// Register the engine. Selectors will be prefixed with \"tag=\".","playwright.selectors().register(\"tag\", createTagNameEngine);","Browser browser = playwright.firefox().launch();","Page page = browser.newPage();","page.setContent(\"<div><button>Click me</button></div>\");","// Use the selector prefixed with its name.","ElementHandle button = page.querySelector(\"tag=button\");","// Combine it with other selector engines.","page.click(\"tag=div >> text=\\\"Click me\\\"\");","// Can use it in any methods supporting selectors.","int buttonCount = (int) page.evalOnSelectorAll(\"tag=button\", \"buttons => buttons.length\");","browser.close();"],"codeLang":"java"},{"type":"code","lines":["# FIXME: add snippet"],"codeLang":"python async"},{"type":"code","lines":["# FIXME: add snippet"],"codeLang":"python sync"},{"type":"code","lines":["using var playwright = await Playwright.CreateAsync();","// Script that evaluates to a selector engine instance.","await playwright.Selectors.RegisterAsync(\"tag\", @\"{","// Returns the first element matching given selector in the root's subtree.","query(root, selector) {"," return root.querySelector(selector);"," },"," // Returns all elements matching given selector in the root's subtree."," queryAll(root, selector) {"," return Array.from(root.querySelectorAll(selector));"," }","}\");","","await using var browser = await playwright.Chromium.LaunchAsync();","var page = await browser.NewPageAsync();","await page.SetContentAsync(\"<div><button>Click me</button></div>\");","// Use the selector prefixed with its name.","var button = await page.QuerySelectorAsync(\"tag=button\");","// Combine it with other selector engines.","await page.ClickAsync(\"tag=div >> text=\\\"Click me\\\"\");","// Can use it in any methods supporting selectors.","int buttonCount = await page.EvalOnSelectorAllAsync<int>(\"tag=button\", \"buttons => buttons.length\");"],"codeLang":"csharp"}],"required":true,"comment":"An example of registering selector engine that queries elements based on a tag name:\n\n```js\nconst { selectors, firefox } = require('playwright'); // Or 'chromium' or 'webkit'.\n\n(async () => {\n // Must be a function that evaluates to a selector engine instance.\n const createTagNameEngine = () => ({\n // Returns the first element matching given selector in the root's subtree.\n query(root, selector) {\n return root.querySelector(selector);\n },\n\n // Returns all elements matching given selector in the root's subtree.\n queryAll(root, selector) {\n return Array.from(root.querySelectorAll(selector));\n }\n });\n\n // Register the engine. Selectors will be prefixed with \"tag=\".\n await selectors.register('tag', createTagNameEngine);\n\n const browser = await firefox.launch();\n const page = await browser.newPage();\n await page.setContent(`<div><button>Click me</button></div>`);\n\n // Use the selector prefixed with its name.\n const button = await page.$('tag=button');\n // Combine it with other selector engines.\n await page.click('tag=div >> text=\"Click me\"');\n // Can use it in any methods supporting selectors.\n const buttonCount = await page.$$eval('tag=button', buttons => buttons.length);\n\n await browser.close();\n})();\n```\n\n```java\n// Script that evaluates to a selector engine instance.\nString createTagNameEngine = \"{\\n\" +\n \" // Returns the first element matching given selector in the root's subtree.\\n\" +\n \" query(root, selector) {\\n\" +\n \" return root.querySelector(selector);\\n\" +\n \" },\\n\" +\n \" // Returns all elements matching given selector in the root's subtree.\\n\" +\n \" queryAll(root, selector) {\\n\" +\n \" return Array.from(root.querySelectorAll(selector));\\n\" +\n \" }\\n\" +\n \"}\";\n// Register the engine. Selectors will be prefixed with \"tag=\".\nplaywright.selectors().register(\"tag\", createTagNameEngine);\nBrowser browser = playwright.firefox().launch();\nPage page = browser.newPage();\npage.setContent(\"<div><button>Click me</button></div>\");\n// Use the selector prefixed with its name.\nElementHandle button = page.querySelector(\"tag=button\");\n// Combine it with other selector engines.\npage.click(\"tag=div >> text=\\\"Click me\\\"\");\n// Can use it in any methods supporting selectors.\nint buttonCount = (int) page.evalOnSelectorAll(\"tag=button\", \"buttons => buttons.length\");\nbrowser.close();\n```\n\n```python async\n# FIXME: add snippet\n```\n\n```python sync\n# FIXME: add snippet\n```\n\n```csharp\nusing var playwright = await Playwright.CreateAsync();\n// Script that evaluates to a selector engine instance.\nawait playwright.Selectors.RegisterAsync(\"tag\", @\"{\n// Returns the first element matching given selector in the root's subtree.\nquery(root, selector) {\n return root.querySelector(selector);\n },\n // Returns all elements matching given selector in the root's subtree.\n queryAll(root, selector) {\n return Array.from(root.querySelectorAll(selector));\n }\n}\");\n\nawait using var browser = await playwright.Chromium.LaunchAsync();\nvar page = await browser.NewPageAsync();\nawait page.SetContentAsync(\"<div><button>Click me</button></div>\");\n// Use the selector prefixed with its name.\nvar button = await page.QuerySelectorAsync(\"tag=button\");\n// Combine it with other selector engines.\nawait page.ClickAsync(\"tag=div >> text=\\\"Click me\\\"\");\n// Can use it in any methods supporting selectors.\nint buttonCount = await page.EvalOnSelectorAllAsync<int>(\"tag=button\", \"buttons => buttons.length\");\n```\n","deprecated":false,"async":true,"alias":"register","args":[{"kind":"property","langs":{},"name":"name","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"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."}],"required":true,"comment":"Name that is used in selectors as a prefix, e.g. `{name: 'foo'}` enables `foo=myselectorbody` selectors. May only\ncontain `[a-zA-Z0-9_]` characters.","deprecated":false,"async":false,"alias":"name"},{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"script","type":{"name":"","union":[{"name":"function"},{"name":"string"},{"name":"Object","properties":[{"kind":"property","langs":{},"name":"path","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the current working directory. Optional."}],"required":false,"comment":"Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the current working\ndirectory. Optional.","deprecated":false,"async":false,"alias":"path"},{"kind":"property","langs":{},"name":"content","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Raw script content. Optional."}],"required":false,"comment":"Raw script content. Optional.","deprecated":false,"async":false,"alias":"content"}]}],"expression":"[function]|[string]|[Object]"},"spec":[{"type":"text","text":"Script that evaluates to a selector engine instance."}],"required":true,"comment":"Script that evaluates to a selector engine instance.","deprecated":false,"async":false,"alias":"script"},{"kind":"property","langs":{"only":["java"],"aliases":{},"types":{},"overrides":{}},"name":"script","type":{"name":"","union":[{"name":"string"},{"name":"path"}],"expression":"[string]|[path]"},"spec":[{"type":"text","text":"Script that evaluates to a selector engine instance."}],"required":true,"comment":"Script that evaluates to a selector engine instance.","deprecated":false,"async":false,"alias":"script"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"contentScript","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether to run this selector engine in isolated JavaScript environment. This environment has access to the same DOM, but not any JavaScript objects from the frame's scripts. Defaults to `false`. Note that running as a content script is not guaranteed when this engine is used together with other registered engines."}],"required":false,"comment":"Whether to run this selector engine in isolated JavaScript environment. This environment has access to the same DOM, but\nnot any JavaScript objects from the frame's scripts. Defaults to `false`. Note that running as a content script is not\nguaranteed when this engine is used together with other registered engines.","deprecated":false,"async":false,"alias":"contentScript"},{"kind":"property","langs":{"only":["csharp"],"aliases":{},"types":{},"overrides":{}},"name":"path","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"Script that evaluates to a selector engine instance."}],"required":false,"comment":"Script that evaluates to a selector engine instance.","deprecated":false,"async":false,"alias":"path"},{"kind":"property","langs":{"only":["python"],"aliases":{},"types":{},"overrides":{}},"name":"path","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the current working directory."}],"required":false,"comment":"Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the current working\ndirectory.","deprecated":false,"async":false,"alias":"path"},{"kind":"property","langs":{"only":["csharp"],"aliases":{},"types":{},"overrides":{}},"name":"script","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Script that evaluates to a selector engine instance."}],"required":false,"comment":"Script that evaluates to a selector engine instance.","deprecated":false,"async":false,"alias":"script"},{"kind":"property","langs":{"only":["python"],"aliases":{},"types":{},"overrides":{}},"name":"script","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Raw script content."}],"required":false,"comment":"Raw script content.","deprecated":false,"async":false,"alias":"script"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]}]},{"name":"TimeoutError","spec":[{"type":"li","text":"extends: `Error`","liType":"bullet"},{"type":"text","text":"TimeoutError is emitted whenever certain operations are terminated due to timeout, e.g. [`method: Page.waitForSelector`] or [`method: BrowserType.launch`]."}],"extends":"Error","langs":{},"comment":"- extends: `Error`\n\nTimeoutError is emitted whenever certain operations are terminated due to timeout, e.g. [`method: Page.waitForSelector`]\nor [`method: BrowserType.launch`].","members":[]},{"name":"Touchscreen","spec":[{"type":"text","text":"The Touchscreen class operates in main-frame CSS pixels relative to the top-left corner of the viewport. Methods on the touchscreen can only be used in browser contexts that have been initialized with `hasTouch` set to true."}],"langs":{},"comment":"The Touchscreen class operates in main-frame CSS pixels relative to the top-left corner of the viewport. Methods on the\ntouchscreen can only be used in browser contexts that have been initialized with `hasTouch` set to true.","members":[{"kind":"method","langs":{},"name":"tap","type":{"name":"void"},"spec":[{"type":"text","text":"Dispatches a `touchstart` and `touchend` event with a single touch at the position (`x`,`y`)."}],"required":true,"comment":"Dispatches a `touchstart` and `touchend` event with a single touch at the position (`x`,`y`).","deprecated":false,"async":true,"alias":"tap","args":[{"kind":"property","langs":{},"name":"x","type":{"name":"float","expression":"[float]"},"spec":[],"required":true,"comment":"","deprecated":false,"async":false,"alias":"x"},{"kind":"property","langs":{},"name":"y","type":{"name":"float","expression":"[float]"},"spec":[],"required":true,"comment":"","deprecated":false,"async":false,"alias":"y"}]}]},{"name":"Tracing","spec":[{"type":"text","text":"API for collecting and saving Playwright traces. Playwright traces can be opened using the Playwright CLI after Playwright script runs."},{"type":"text","text":"Start with specifying the folder traces will be stored in:"},{"type":"code","lines":["const browser = await chromium.launch();","const context = await browser.newContext();","await context.tracing.start({ screenshots: true, snapshots: true });","const page = await context.newPage();","await page.goto('https://playwright.dev');","await context.tracing.stop({ path: 'trace.zip' });"],"codeLang":"js"},{"type":"code","lines":["Browser browser = chromium.launch();","BrowserContext context = browser.newContext();","context.tracing().start(new Tracing.StartOptions()"," .setScreenshots(true)"," .setSnapshots(true));","Page page = context.newPage();","page.navigate(\"https://playwright.dev\");","context.tracing().stop(new Tracing.StopOptions()"," .setPath(Paths.get(\"trace.zip\")));"],"codeLang":"java"},{"type":"code","lines":["browser = await chromium.launch()","context = await browser.new_context()","await context.tracing.start(screenshots=True, snapshots=True)","await page.goto(\"https://playwright.dev\")","await context.tracing.stop(path = \"trace.zip\")"],"codeLang":"python async"},{"type":"code","lines":["browser = chromium.launch()","context = browser.new_context()","context.tracing.start(screenshots=True, snapshots=True)","page.goto(\"https://playwright.dev\")","context.tracing.stop(path = \"trace.zip\")"],"codeLang":"python sync"},{"type":"code","lines":["await using var browser = playwright.Chromium.LaunchAsync();","await using var context = await browser.NewContextAsync();","await context.Tracing.StartAsync(new TracingStartOptions","{"," Screenshots: true,"," Snapshots: true","});","var page = context.NewPageAsync();","await page.GotoAsync(\"https://playwright.dev\");","await context.Tracing.StopAsync(new TracingStopOptions","{"," Path: \"trace.zip\"","});"],"codeLang":"csharp"}],"langs":{},"comment":"API for collecting and saving Playwright traces. Playwright traces can be opened using the Playwright CLI after\nPlaywright script runs.\n\nStart with specifying the folder traces will be stored in:\n\n```js\nconst browser = await chromium.launch();\nconst context = await browser.newContext();\nawait context.tracing.start({ screenshots: true, snapshots: true });\nconst page = await context.newPage();\nawait page.goto('https://playwright.dev');\nawait context.tracing.stop({ path: 'trace.zip' });\n```\n\n```java\nBrowser browser = chromium.launch();\nBrowserContext context = browser.newContext();\ncontext.tracing().start(new Tracing.StartOptions()\n .setScreenshots(true)\n .setSnapshots(true));\nPage page = context.newPage();\npage.navigate(\"https://playwright.dev\");\ncontext.tracing().stop(new Tracing.StopOptions()\n .setPath(Paths.get(\"trace.zip\")));\n```\n\n```python async\nbrowser = await chromium.launch()\ncontext = await browser.new_context()\nawait context.tracing.start(screenshots=True, snapshots=True)\nawait page.goto(\"https://playwright.dev\")\nawait context.tracing.stop(path = \"trace.zip\")\n```\n\n```python sync\nbrowser = chromium.launch()\ncontext = browser.new_context()\ncontext.tracing.start(screenshots=True, snapshots=True)\npage.goto(\"https://playwright.dev\")\ncontext.tracing.stop(path = \"trace.zip\")\n```\n\n```csharp\nawait using var browser = playwright.Chromium.LaunchAsync();\nawait using var context = await browser.NewContextAsync();\nawait context.Tracing.StartAsync(new TracingStartOptions\n{\n Screenshots: true,\n Snapshots: true\n});\nvar page = context.NewPageAsync();\nawait page.GotoAsync(\"https://playwright.dev\");\nawait context.Tracing.StopAsync(new TracingStopOptions\n{\n Path: \"trace.zip\"\n});\n```\n","members":[{"kind":"method","langs":{},"name":"start","type":{"name":"void"},"spec":[{"type":"text","text":"Start tracing."},{"type":"code","lines":["await context.tracing.start({ screenshots: true, snapshots: true });","const page = await context.newPage();","await page.goto('https://playwright.dev');","await context.tracing.stop({ path: 'trace.zip' });"],"codeLang":"js"},{"type":"code","lines":["context.tracing().start(new Tracing.StartOptions()"," .setScreenshots(true)"," .setSnapshots(true));","Page page = context.newPage();","page.navigate(\"https://playwright.dev\");","context.tracing().stop(new Tracing.StopOptions()"," .setPath(Paths.get(\"trace.zip\")));"],"codeLang":"java"},{"type":"code","lines":["await context.tracing.start(name=\"trace\", screenshots=True, snapshots=True)","await page.goto(\"https://playwright.dev\")","await context.tracing.stop()","await context.tracing.stop(path = \"trace.zip\")"],"codeLang":"python async"},{"type":"code","lines":["context.tracing.start(name=\"trace\", screenshots=True, snapshots=True)","page.goto(\"https://playwright.dev\")","context.tracing.stop()","context.tracing.stop(path = \"trace.zip\")"],"codeLang":"python sync"},{"type":"code","lines":["await using var browser = playwright.Chromium.LaunchAsync();","await using var context = await browser.NewContextAsync();","await context.Tracing.StartAsync(new TracingStartOptions","{"," Screenshots: true,"," Snapshots: true","});","var page = context.NewPageAsync();","await page.GotoAsync(\"https://playwright.dev\");","await context.Tracing.StopAsync(new TracingStopOptions","{"," Path: \"trace.zip\"","});"],"codeLang":"csharp"}],"required":true,"comment":"Start tracing.\n\n```js\nawait context.tracing.start({ screenshots: true, snapshots: true });\nconst page = await context.newPage();\nawait page.goto('https://playwright.dev');\nawait context.tracing.stop({ path: 'trace.zip' });\n```\n\n```java\ncontext.tracing().start(new Tracing.StartOptions()\n .setScreenshots(true)\n .setSnapshots(true));\nPage page = context.newPage();\npage.navigate(\"https://playwright.dev\");\ncontext.tracing().stop(new Tracing.StopOptions()\n .setPath(Paths.get(\"trace.zip\")));\n```\n\n```python async\nawait context.tracing.start(name=\"trace\", screenshots=True, snapshots=True)\nawait page.goto(\"https://playwright.dev\")\nawait context.tracing.stop()\nawait context.tracing.stop(path = \"trace.zip\")\n```\n\n```python sync\ncontext.tracing.start(name=\"trace\", screenshots=True, snapshots=True)\npage.goto(\"https://playwright.dev\")\ncontext.tracing.stop()\ncontext.tracing.stop(path = \"trace.zip\")\n```\n\n```csharp\nawait using var browser = playwright.Chromium.LaunchAsync();\nawait using var context = await browser.NewContextAsync();\nawait context.Tracing.StartAsync(new TracingStartOptions\n{\n Screenshots: true,\n Snapshots: true\n});\nvar page = context.NewPageAsync();\nawait page.GotoAsync(\"https://playwright.dev\");\nawait context.Tracing.StopAsync(new TracingStopOptions\n{\n Path: \"trace.zip\"\n});\n```\n","deprecated":false,"async":true,"alias":"start","args":[{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"name","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"If specified, the trace is going to be saved into the file with the given name inside the `tracesDir` folder specified in [`method: BrowserType.launch`]."}],"required":false,"comment":"If specified, the trace is going to be saved into the file with the given name inside the `tracesDir` folder specified\nin [`method: BrowserType.launch`].","deprecated":false,"async":false,"alias":"name"},{"kind":"property","langs":{},"name":"screenshots","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether to capture screenshots during tracing. Screenshots are used to build a timeline preview."}],"required":false,"comment":"Whether to capture screenshots during tracing. Screenshots are used to build a timeline preview.","deprecated":false,"async":false,"alias":"screenshots"},{"kind":"property","langs":{},"name":"snapshots","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Whether to capture DOM snapshot on every action."}],"required":false,"comment":"Whether to capture DOM snapshot on every action.","deprecated":false,"async":false,"alias":"snapshots"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{},"name":"stop","type":{"name":"void"},"spec":[{"type":"text","text":"Stop tracing."}],"required":true,"comment":"Stop tracing.","deprecated":false,"async":true,"alias":"stop","args":[{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"path","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"Export trace into the file with the given name."}],"required":false,"comment":"Export trace into the file with the given name.","deprecated":false,"async":false,"alias":"path"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]}]},{"name":"Video","spec":[{"type":"text","text":"When browser context is created with the `recordVideo` option, each page has a video object associated with it."},{"type":"code","lines":["console.log(await page.video().path());"],"codeLang":"js"},{"type":"code","lines":["System.out.println(page.video().path());"],"codeLang":"java"},{"type":"code","lines":["print(await page.video.path())"],"codeLang":"python async"},{"type":"code","lines":["print(page.video.path())"],"codeLang":"python sync"},{"type":"code","lines":["Console.WriteLine(await page.Video.GetPathAsync());"],"codeLang":"csharp"}],"langs":{},"comment":"When browser context is created with the `recordVideo` option, each page has a video object associated with it.\n\n```js\nconsole.log(await page.video().path());\n```\n\n```java\nSystem.out.println(page.video().path());\n```\n\n```python async\nprint(await page.video.path())\n```\n\n```python sync\nprint(page.video.path())\n```\n\n```csharp\nConsole.WriteLine(await page.Video.GetPathAsync());\n```\n","members":[{"kind":"method","langs":{},"name":"delete","type":{"name":"void"},"spec":[{"type":"text","text":"Deletes the video file. Will wait for the video to finish if necessary."}],"required":true,"comment":"Deletes the video file. Will wait for the video to finish if necessary.","deprecated":false,"async":true,"alias":"delete","args":[]},{"kind":"method","langs":{},"name":"path","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"Returns the file system path this video will be recorded to. The video is guaranteed to be written to the filesystem upon closing the browser context. This method throws when connected remotely."}],"required":true,"comment":"Returns the file system path this video will be recorded to. The video is guaranteed to be written to the filesystem\nupon closing the browser context. This method throws when connected remotely.","deprecated":false,"async":true,"alias":"path","args":[]},{"kind":"method","langs":{},"name":"saveAs","type":{"name":"void"},"spec":[{"type":"text","text":"Saves the video to a user-specified path. It is safe to call this method while the video is still in progress, or after the page has closed. This method waits until the page is closed and the video is fully saved."}],"required":true,"comment":"Saves the video to a user-specified path. It is safe to call this method while the video is still in progress, or after\nthe page has closed. This method waits until the page is closed and the video is fully saved.","deprecated":false,"async":true,"alias":"saveAs","args":[{"kind":"property","langs":{},"name":"path","type":{"name":"path","expression":"[path]"},"spec":[{"type":"text","text":"Path where the video should be saved."}],"required":true,"comment":"Path where the video should be saved.","deprecated":false,"async":false,"alias":"path"}]}]},{"name":"WebSocket","spec":[{"type":"text","text":"The `WebSocket` class represents websocket connections in the page."}],"langs":{},"comment":"The `WebSocket` class represents websocket connections in the page.","members":[{"kind":"event","langs":{},"name":"close","type":{"name":"WebSocket","expression":"[WebSocket]"},"spec":[{"type":"text","text":"Fired when the websocket closes."}],"required":true,"comment":"Fired when the websocket closes.","deprecated":false,"async":false,"alias":"close","args":[]},{"kind":"event","langs":{"types":{"csharp":{"name":"WebSocketFrame","expression":"[WebSocketFrame]"},"java":{"name":"WebSocketFrame","expression":"[WebSocketFrame]"}}},"name":"frameReceived","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"payload","type":{"name":"","union":[{"name":"string"},{"name":"Buffer"}],"expression":"[string]|[Buffer]"},"spec":[{"type":"text","text":"frame payload"}],"required":true,"comment":"frame payload","deprecated":false,"async":false,"alias":"payload"}],"expression":"[Object]"},"spec":[{"type":"text","text":"Fired when the websocket receives a frame."}],"required":true,"comment":"Fired when the websocket receives a frame.","deprecated":false,"async":false,"alias":"frameReceived","args":[]},{"kind":"event","langs":{"types":{"csharp":{"name":"WebSocketFrame","expression":"[WebSocketFrame]"},"java":{"name":"WebSocketFrame","expression":"[WebSocketFrame]"}}},"name":"frameSent","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"payload","type":{"name":"","union":[{"name":"string"},{"name":"Buffer"}],"expression":"[string]|[Buffer]"},"spec":[{"type":"text","text":"frame payload"}],"required":true,"comment":"frame payload","deprecated":false,"async":false,"alias":"payload"}],"expression":"[Object]"},"spec":[{"type":"text","text":"Fired when the websocket sends a frame."}],"required":true,"comment":"Fired when the websocket sends a frame.","deprecated":false,"async":false,"alias":"frameSent","args":[]},{"kind":"event","langs":{},"name":"socketError","type":{"name":"String","expression":"[String]"},"spec":[{"type":"text","text":"Fired when the websocket has an error."}],"required":true,"comment":"Fired when the websocket has an error.","deprecated":false,"async":false,"alias":"socketError","args":[]},{"kind":"method","langs":{},"name":"isClosed","type":{"name":"boolean","expression":"[boolean]"},"spec":[{"type":"text","text":"Indicates that the web socket has been closed."}],"required":true,"comment":"Indicates that the web socket has been closed.","deprecated":false,"async":false,"alias":"isClosed","args":[]},{"kind":"method","langs":{},"name":"url","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Contains the URL of the WebSocket."}],"required":true,"comment":"Contains the URL of the WebSocket.","deprecated":false,"async":false,"alias":"url","args":[]},{"kind":"method","langs":{"only":["js","python"],"aliases":{"python":"expect_event"},"types":{"python":{"name":"EventContextManager","expression":"[EventContextManager]"}},"overrides":{}},"name":"waitForEvent","type":{"name":"any","expression":"[any]"},"spec":[{"type":"text","text":"Waits for event to fire and passes its value into the predicate function. Returns when the predicate returns truthy value. Will throw an error if the webSocket is closed before the event is fired. Returns the event data value."}],"required":true,"comment":"Waits for event to fire and passes its value into the predicate function. Returns when the predicate returns truthy\nvalue. Will throw an error if the webSocket is closed before the event is fired. Returns the event data value.","deprecated":false,"async":true,"alias":"waitForEvent","args":[{"kind":"property","langs":{},"name":"event","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Event name, same one would pass into `webSocket.on(event)`."}],"required":true,"comment":"Event name, same one would pass into `webSocket.on(event)`.","deprecated":false,"async":false,"alias":"event"},{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"optionsOrPredicate","type":{"name":"","union":[{"name":"function"},{"name":"Object","properties":[{"kind":"property","langs":{},"name":"predicate","type":{"name":"function","expression":"[function]"},"spec":[{"type":"text","text":"receives the event data and resolves to truthy value when the waiting should resolve."}],"required":true,"comment":"receives the event data and resolves to truthy value when the waiting should resolve.","deprecated":false,"async":false,"alias":"predicate"},{"kind":"property","langs":{},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`]."}],"required":false,"comment":"maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default\nvalue can be changed by using the [`method: BrowserContext.setDefaultTimeout`].","deprecated":false,"async":false,"alias":"timeout"}]}],"expression":"[function]|[Object]"},"spec":[{"type":"text","text":"Either a predicate that receives an event or an options object. Optional."}],"required":false,"comment":"Either a predicate that receives an event or an options object. Optional.","deprecated":false,"async":false,"alias":"optionsOrPredicate"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"predicate","type":{"name":"function","expression":"[function]"},"spec":[{"type":"text","text":"Receives the event data and resolves to truthy value when the waiting should resolve."}],"required":false,"comment":"Receives the event data and resolves to truthy value when the waiting should resolve.","deprecated":false,"async":false,"alias":"predicate"},{"kind":"property","langs":{"only":["csharp","java","python"],"aliases":{},"types":{},"overrides":{}},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`]."}],"required":false,"comment":"Maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default\nvalue can be changed by using the [`method: BrowserContext.setDefaultTimeout`].","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]},{"kind":"method","langs":{"only":["java"],"aliases":{},"types":{},"overrides":{}},"name":"waitForFrameReceived","type":{"name":"WebSocketFrame","expression":"[WebSocketFrame]"},"spec":[{"type":"text","text":"Performs action and waits for a frame to be sent. If predicate is provided, it passes `WebSocketFrame` value into the `predicate` function and waits for `predicate(webSocketFrame)` to return a truthy value. Will throw an error if the WebSocket or Page is closed before the frame is received."}],"required":true,"comment":"Performs action and waits for a frame to be sent. If predicate is provided, it passes `WebSocketFrame` value into the\n`predicate` function and waits for `predicate(webSocketFrame)` to return a truthy value. Will throw an error if the\nWebSocket or Page is closed before the frame is received.","deprecated":false,"async":true,"alias":"waitForFrameReceived","args":[{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"predicate","type":{"name":"function","args":[{"name":"WebSocketFrame"}],"returnType":{"name":"boolean"},"expression":"[function]([WebSocketFrame]):[boolean]"},"spec":[{"type":"text","text":"Receives the `WebSocketFrame` object and resolves to truthy value when the waiting should resolve."}],"required":false,"comment":"Receives the `WebSocketFrame` object and resolves to truthy value when the waiting should resolve.","deprecated":false,"async":false,"alias":"predicate"},{"kind":"property","langs":{"only":["csharp","java","python"],"aliases":{},"types":{},"overrides":{}},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`]."}],"required":false,"comment":"Maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default\nvalue can be changed by using the [`method: BrowserContext.setDefaultTimeout`].","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"},{"kind":"property","langs":{"only":["java"],"aliases":{},"types":{},"overrides":{}},"name":"callback","type":{"name":"Runnable","expression":"[Runnable]"},"spec":[{"type":"text","text":"Callback that performs the action triggering the event."}],"required":true,"comment":"Callback that performs the action triggering the event.","deprecated":false,"async":false,"alias":"callback"}]},{"kind":"method","langs":{"only":["java"],"aliases":{},"types":{},"overrides":{}},"name":"waitForFrameSent","type":{"name":"WebSocketFrame","expression":"[WebSocketFrame]"},"spec":[{"type":"text","text":"Performs action and waits for a frame to be sent. If predicate is provided, it passes `WebSocketFrame` value into the `predicate` function and waits for `predicate(webSocketFrame)` to return a truthy value. Will throw an error if the WebSocket or Page is closed before the frame is sent."}],"required":true,"comment":"Performs action and waits for a frame to be sent. If predicate is provided, it passes `WebSocketFrame` value into the\n`predicate` function and waits for `predicate(webSocketFrame)` to return a truthy value. Will throw an error if the\nWebSocket or Page is closed before the frame is sent.","deprecated":false,"async":true,"alias":"waitForFrameSent","args":[{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"predicate","type":{"name":"function","args":[{"name":"WebSocketFrame"}],"returnType":{"name":"boolean"},"expression":"[function]([WebSocketFrame]):[boolean]"},"spec":[{"type":"text","text":"Receives the `WebSocketFrame` object and resolves to truthy value when the waiting should resolve."}],"required":false,"comment":"Receives the `WebSocketFrame` object and resolves to truthy value when the waiting should resolve.","deprecated":false,"async":false,"alias":"predicate"},{"kind":"property","langs":{"only":["csharp","java","python"],"aliases":{},"types":{},"overrides":{}},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`]."}],"required":false,"comment":"Maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default\nvalue can be changed by using the [`method: BrowserContext.setDefaultTimeout`].","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"},{"kind":"property","langs":{"only":["java"],"aliases":{},"types":{},"overrides":{}},"name":"callback","type":{"name":"Runnable","expression":"[Runnable]"},"spec":[{"type":"text","text":"Callback that performs the action triggering the event."}],"required":true,"comment":"Callback that performs the action triggering the event.","deprecated":false,"async":false,"alias":"callback"}]},{"kind":"method","langs":{"only":["python"],"aliases":{"python":"wait_for_event"},"types":{},"overrides":{}},"name":"waitForEvent2","type":{"name":"any","expression":"[any]"},"spec":[{"type":"note","noteType":"note","text":"In most cases, you should use [`method: WebSocket.waitForEvent`]."},{"type":"text","text":"Waits for given `event` to fire. If predicate is provided, it passes event's value into the `predicate` function and waits for `predicate(event)` to return a truthy value. Will throw an error if the socket is closed before the `event` is fired."}],"required":true,"comment":"> NOTE: In most cases, you should use [`method: WebSocket.waitForEvent`].\n\nWaits for given `event` to fire. If predicate is provided, it passes event's value into the `predicate` function and\nwaits for `predicate(event)` to return a truthy value. Will throw an error if the socket is closed before the `event` is\nfired.","deprecated":false,"async":true,"alias":"waitForEvent2","args":[{"kind":"property","langs":{"only":["js","python","java"],"aliases":{},"types":{},"overrides":{}},"name":"event","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"Event name, same one typically passed into `*.on(event)`."}],"required":true,"comment":"Event name, same one typically passed into `*.on(event)`.","deprecated":false,"async":false,"alias":"event"},{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{},"name":"predicate","type":{"name":"function","expression":"[function]"},"spec":[{"type":"text","text":"Receives the event data and resolves to truthy value when the waiting should resolve."}],"required":false,"comment":"Receives the event data and resolves to truthy value when the waiting should resolve.","deprecated":false,"async":false,"alias":"predicate"},{"kind":"property","langs":{"only":["csharp","java","python"],"aliases":{},"types":{},"overrides":{}},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`]."}],"required":false,"comment":"Maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default\nvalue can be changed by using the [`method: BrowserContext.setDefaultTimeout`].","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"}]}]},{"name":"WebSocketFrame","spec":[{"type":"text","text":"The `WebSocketFrame` class represents frames sent over `WebSocket` connections in the page. Frame payload is returned by either [`method: WebSocketFrame.text`] or [`method: WebSocketFrame.binary`] method depending on the its type."}],"langs":{"only":["csharp","java"],"aliases":{},"types":{},"overrides":{}},"comment":"The `WebSocketFrame` class represents frames sent over `WebSocket` connections in the page. Frame payload is returned by\neither [`method: WebSocketFrame.text`] or [`method: WebSocketFrame.binary`] method depending on the its type.","members":[{"kind":"method","langs":{},"name":"binary","type":{"name":"","union":[{"name":"null"},{"name":"Buffer"}],"expression":"[null]|[Buffer]"},"spec":[{"type":"text","text":"Returns binary payload."}],"required":true,"comment":"Returns binary payload.","deprecated":false,"async":false,"alias":"binary","args":[]},{"kind":"method","langs":{},"name":"text","type":{"name":"","union":[{"name":"null"},{"name":"string"}],"expression":"[null]|[string]"},"spec":[{"type":"text","text":"Returns text payload."}],"required":true,"comment":"Returns text payload.","deprecated":false,"async":false,"alias":"text","args":[]}]},{"name":"Worker","spec":[{"type":"text","text":"The Worker class represents a [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API). `worker` event is emitted on the page object to signal a worker creation. `close` event is emitted on the worker object when the worker is gone."},{"type":"code","lines":["page.on('worker', worker => {"," console.log('Worker created: ' + worker.url());"," worker.on('close', worker => console.log('Worker destroyed: ' + worker.url()));","});","","console.log('Current workers:');","for (const worker of page.workers())"," console.log(' ' + worker.url());"],"codeLang":"js"},{"type":"code","lines":["page.onWorker(worker -> {"," System.out.println(\"Worker created: \" + worker.url());"," worker.onClose(worker1 -> System.out.println(\"Worker destroyed: \" + worker1.url()));","});","System.out.println(\"Current workers:\");","for (Worker worker : page.workers())"," System.out.println(\" \" + worker.url());"],"codeLang":"java"},{"type":"code","lines":["def handle_worker(worker):"," print(\"worker created: \" + worker.url)"," worker.on(\"close\", lambda: print(\"worker destroyed: \" + worker.url))","","page.on('worker', handle_worker)","","print(\"current workers:\")","for worker in page.workers:"," print(\" \" + worker.url)"],"codeLang":"py"},{"type":"code","lines":["page.Worker += (_, worker) =>","{"," Console.WriteLine($\"Worker created: {worker.Url}\");"," worker.Close += (_, _) => Console.WriteLine($\"Worker closed {worker.Url}\");","};","","Console.WriteLine(\"Current Workers:\");","foreach(var pageWorker in page.Workers)","{"," Console.WriteLine($\"\\tWorker: {pageWorker.Url}\");","}"],"codeLang":"csharp"}],"langs":{},"comment":"The Worker class represents a [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API). `worker`\nevent is emitted on the page object to signal a worker creation. `close` event is emitted on the worker object when the\nworker is gone.\n\n```js\npage.on('worker', worker => {\n console.log('Worker created: ' + worker.url());\n worker.on('close', worker => console.log('Worker destroyed: ' + worker.url()));\n});\n\nconsole.log('Current workers:');\nfor (const worker of page.workers())\n console.log(' ' + worker.url());\n```\n\n```java\npage.onWorker(worker -> {\n System.out.println(\"Worker created: \" + worker.url());\n worker.onClose(worker1 -> System.out.println(\"Worker destroyed: \" + worker1.url()));\n});\nSystem.out.println(\"Current workers:\");\nfor (Worker worker : page.workers())\n System.out.println(\" \" + worker.url());\n```\n\n```py\ndef handle_worker(worker):\n print(\"worker created: \" + worker.url)\n worker.on(\"close\", lambda: print(\"worker destroyed: \" + worker.url))\n\npage.on('worker', handle_worker)\n\nprint(\"current workers:\")\nfor worker in page.workers:\n print(\" \" + worker.url)\n```\n\n```csharp\npage.Worker += (_, worker) =>\n{\n Console.WriteLine($\"Worker created: {worker.Url}\");\n worker.Close += (_, _) => Console.WriteLine($\"Worker closed {worker.Url}\");\n};\n\nConsole.WriteLine(\"Current Workers:\");\nforeach(var pageWorker in page.Workers)\n{\n Console.WriteLine($\"\\tWorker: {pageWorker.Url}\");\n}\n```\n","members":[{"kind":"event","langs":{},"name":"close","type":{"name":"Worker","expression":"[Worker]"},"spec":[{"type":"text","text":"Emitted when this dedicated [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) is terminated."}],"required":true,"comment":"Emitted when this dedicated [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) is terminated.","deprecated":false,"async":false,"alias":"close","args":[]},{"kind":"method","langs":{},"name":"evaluate","type":{"name":"Serializable","expression":"[Serializable]"},"spec":[{"type":"text","text":"Returns the return value of `expression`."},{"type":"text","text":"If the function passed to the [`method: Worker.evaluate`] returns a [Promise], then [`method: Worker.evaluate`] would wait for the promise to resolve and return its value."},{"type":"text","text":"If the function passed to the [`method: Worker.evaluate`] returns a non-[Serializable] value, then [`method: Worker.evaluate`] returns `undefined`. Playwright also supports transferring some additional values that are not serializable by `JSON`: `-0`, `NaN`, `Infinity`, `-Infinity`."}],"required":true,"comment":"Returns the return value of `expression`.\n\nIf the function passed to the [`method: Worker.evaluate`] returns a [Promise], then [`method: Worker.evaluate`] would\nwait for the promise to resolve and return its value.\n\nIf the function passed to the [`method: Worker.evaluate`] returns a non-[Serializable] value, then\n[`method: Worker.evaluate`] returns `undefined`. Playwright also supports transferring some additional values that are\nnot serializable by `JSON`: `-0`, `NaN`, `Infinity`, `-Infinity`.","deprecated":false,"async":true,"alias":"evaluate","args":[{"kind":"property","langs":{"overrides":{"js":{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"expression","type":{"name":"","union":[{"name":"function"},{"name":"string"}],"expression":"[function]|[string]"},"spec":[{"type":"text","text":"Function to be evaluated in the worker context."}],"argsArray":[],"required":true,"comment":"","args":{},"clazz":null,"deprecated":false,"async":false,"alias":"pageFunction"}}},"name":"expression","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted as a function. Otherwise, evaluated as an expression."}],"required":true,"comment":"JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted\nas a function. Otherwise, evaluated as an expression.","deprecated":false,"async":false,"alias":"expression"},{"kind":"property","langs":{},"name":"arg","type":{"name":"EvaluationArgument","expression":"[EvaluationArgument]"},"spec":[{"type":"text","text":"Optional argument to pass to `expression`."}],"required":false,"comment":"Optional argument to pass to `expression`.","deprecated":false,"async":false,"alias":"arg"}]},{"kind":"method","langs":{},"name":"evaluateHandle","type":{"name":"JSHandle","expression":"[JSHandle]"},"spec":[{"type":"text","text":"Returns the return value of `expression` as a `JSHandle`."},{"type":"text","text":"The only difference between [`method: Worker.evaluate`] and [`method: Worker.evaluateHandle`] is that [`method: Worker.evaluateHandle`] returns `JSHandle`."},{"type":"text","text":"If the function passed to the [`method: Worker.evaluateHandle`] returns a [Promise], then [`method: Worker.evaluateHandle`] would wait for the promise to resolve and return its value."}],"required":true,"comment":"Returns the return value of `expression` as a `JSHandle`.\n\nThe only difference between [`method: Worker.evaluate`] and [`method: Worker.evaluateHandle`] is that\n[`method: Worker.evaluateHandle`] returns `JSHandle`.\n\nIf the function passed to the [`method: Worker.evaluateHandle`] returns a [Promise], then\n[`method: Worker.evaluateHandle`] would wait for the promise to resolve and return its value.","deprecated":false,"async":true,"alias":"evaluateHandle","args":[{"kind":"property","langs":{"overrides":{"js":{"kind":"property","langs":{"only":["js"],"aliases":{},"types":{},"overrides":{}},"name":"expression","type":{"name":"","union":[{"name":"function"},{"name":"string"}],"expression":"[function]|[string]"},"spec":[{"type":"text","text":"Function to be evaluated in the worker context."}],"argsArray":[],"required":true,"comment":"","args":{},"clazz":null,"deprecated":false,"async":false,"alias":"pageFunction"}}},"name":"expression","type":{"name":"string","expression":"[string]"},"spec":[{"type":"text","text":"JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted as a function. Otherwise, evaluated as an expression."}],"required":true,"comment":"JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted\nas a function. Otherwise, evaluated as an expression.","deprecated":false,"async":false,"alias":"expression"},{"kind":"property","langs":{},"name":"arg","type":{"name":"EvaluationArgument","expression":"[EvaluationArgument]"},"spec":[{"type":"text","text":"Optional argument to pass to `expression`."}],"required":false,"comment":"Optional argument to pass to `expression`.","deprecated":false,"async":false,"alias":"arg"}]},{"kind":"method","langs":{},"name":"url","type":{"name":"string","expression":"[string]"},"spec":[],"required":true,"comment":"","deprecated":false,"async":false,"alias":"url","args":[]},{"kind":"method","langs":{"only":["java"],"aliases":{},"types":{},"overrides":{}},"name":"waitForClose","type":{"name":"Worker","expression":"[Worker]"},"spec":[{"type":"text","text":"Performs action and waits for the Worker to close."}],"required":true,"comment":"Performs action and waits for the Worker to close.","deprecated":false,"async":true,"alias":"waitForClose","args":[{"kind":"property","langs":{},"name":"options","type":{"name":"Object","properties":[{"kind":"property","langs":{"only":["csharp","java","python"],"aliases":{},"types":{},"overrides":{}},"name":"timeout","type":{"name":"float","expression":"[float]"},"spec":[{"type":"text","text":"Maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`]."}],"required":false,"comment":"Maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default\nvalue can be changed by using the [`method: BrowserContext.setDefaultTimeout`].","deprecated":false,"async":false,"alias":"timeout"}]},"required":false,"comment":"","deprecated":false,"async":false,"alias":"options"},{"kind":"property","langs":{"only":["java"],"aliases":{},"types":{},"overrides":{}},"name":"callback","type":{"name":"Runnable","expression":"[Runnable]"},"spec":[{"type":"text","text":"Callback that performs the action triggering the event."}],"required":true,"comment":"Callback that performs the action triggering the event.","deprecated":false,"async":false,"alias":"callback"}]}]}];
- function arr2hash (arr,primary_key) {
- var inside_out = {};
- for (var item of arr) {
- inside_out[item.name] = item;
- }
- return inside_out;
- }
- var fix_it=false;
- if (spec instanceof Array) {
- fix_it = true;
- spec = arr2hash(spec,'name');
- }
- // Establish argument order for callers, and correct spec array-ification
- for (var classname of Object.keys(spec)) {
- if (spec[classname].members instanceof Array) {
- spec[classname].members = arr2hash(spec[classname].members,'name');
- }
- for (var method of Object.keys(spec[classname].members)) {
- var order = 0;
- if (spec[classname].members[method].args instanceof Array) {
- spec[classname].members[method].args = arr2hash(spec[classname].members[method].args,'name');
- }
- for (var arg of Object.keys(spec[classname].members[method].args) ) {
- spec[classname].members[method].args[arg].order = order++;
- }
- }
- }
- //XXX spec is wrong here unfortunately
- if (fix_it) {
- for (var className of ['Page','Frame']) {
- spec[className].members.$$ = spec[className].members.querySelectorAll;
- spec[className].members.$ = spec[className].members.querySelector;
- spec[className].members.$$eval = spec[className].members.evalOnSelectorAll;
- spec[className].members.$eval = spec[className].members.evalOnSelector;
- }
- }
- // Parse arguments
- var args = process.argv.slice(2);
- if ( args.filter(arg => arg == '--help' || arg == '-h' || arg == '-?' ).length > 0 ) {
- console.log("Usage:\nplaywright_server [--debug | --check | --port PORT | --help]");
- exit(0);
- }
- if ( args.filter(arg => arg == '--check').length > 0 ) {
- console.log('OK');
- exit(0);
- }
- var debug = false;
- if ( args.filter(arg => arg == '--debug').length > 0 ) {
- debug = true;
- }
- var got_port = 6969;
- if ( args.filter(arg => arg == '--port').length > 0 ) {
- var pos = args.indexOf('--port') + 1;
- if (pos != 0) {
- got_port = args[pos];
- }
- }
- const app = express();
- const port = got_port;
- var objects = {};
- var browsers = { 'firefox' : firefox, 'chrome' : chromium, 'webkit' : webkit };
- //Stash for users to put data in
- var userdata = {};
- app.use(express.json())
- app.get('/spec', async (req, res) => {
- res.json( { error : false, message : spec } );
- });
- app.post('/session', async (req, res) => {
- var payload = req.body;
- var type = payload.type;
- var args = payload.args || [];
- if (debug) {
- console.log("Got launch arguments:");
- console.log(args);
- }
- var result;
- if ( type && browsers[type] ) {
- try {
- var browser = await browsers[type].launch(...args);
- objects[browser._guid] = browser;
- result = { error : false, message : browser };
- } catch (e) {
- result = { error : true, message : e.message};
- }
- } else {
- result = { error : true, message : "Please select a supported browser" };
- }
- res.json(result);
- });
- app.post('/command', async (req, res) => {
- var payload = req.body;
- var type = payload.type;
- var object = payload.object;
- var command = payload.command;
- var args = payload.args || [];
- var result = {};
- if (debug) {
- console.log(type,object,command,args);
- }
- // XXX this would be cleaner if the mouse() and keyboard() methods just returned a Mouse and Keyboard object
- var subject = objects[object];
- if (subject) {
- if (type == 'Mouse') {
- subject = objects[object].mouse;
- } else if (type == 'Keyboard' ) {
- subject = objects[object].keyboard;
- }
- }
- if (subject && spec[type] && spec[type].members[command]) {
- try {
- //XXX We have to do a bit of 'special' handling for scripts
- // This has implications for the type of scripts you can use
- if (command == 'evaluate' || command == 'evaluateHandle') {
- var toEval = args.shift();
- const fun = new Function (toEval);
- args = [
- fun,
- ...args
- ];
- }
- const res = await subject[command](...args);
- result = { error : false, message : res };
- if (Array.isArray(res)) {
- for (var r of res) {
- objects[r._guid] = r;
- }
- }
- // XXX videos are special, we have to magic up a guid etc for them
- if (command == 'video' && res) {
- res._guid = 'Video@' + uuidv4();
- res._type = 'Video';
- }
- // XXX So are FileChooser object unfortunately
- if (args[0] == 'filechooser' && res) {
- res._guid = 'FileChooser@' + uuidv4();
- res._type = 'FileChooser';
- }
- // XXX Downloads too sigh
- if (command == 'waitForEvent' && res._artifact) {
- res._guid = 'Download@' + uuidv4();
- res._type = 'Download';
- }
- if (res && res._guid) {
- objects[res._guid] = res;
- }
- } catch (e) {
- result = { error : true, message : e.message };
- }
- // Allow creation of event listeners if we can actually wait for them
- } else if (command == 'on' && subject && spec[type].members.waitForEvent ) {
- try {
- var evt = args.shift();
- const cb = new Function (args.shift());
- subject.on(evt,cb);
- result = { error : false, message : "Listener set up" };
- } catch (e) {
- result = { error : true, message : e.message };
- }
- } else {
- result = { error : true, message : "No such object, or " + command + " is not a globally recognized command for Playwright" };
- }
- res.json(result);
- });
- app.get('/shutdown', async (req, res) => {
- res.json( { error: false, message : "Sent kill signal to browser" });
- process.exit(0);
- });
- //Modulino
- if (require.main === module) {
- app.listen( port, () => {
- if (debug) {
- console.log(`Listening on port ${port}`);
- }
- });
- }
|