From bf33f28ce408eebd920195e1b1f27362f2c43311 Mon Sep 17 00:00:00 2001 From: octaltree Date: Sat, 30 Jul 2022 15:19:53 +0900 Subject: [PATCH 01/95] driver --- .rustfmt.toml | 2 +- src/build.rs | 126 ++++++++++++++++++++++++----------------- src/imp/core/driver.rs | 56 +++++++++++++----- 3 files changed, 116 insertions(+), 68 deletions(-) diff --git a/.rustfmt.toml b/.rustfmt.toml index cff415c..9061e9e 100644 --- a/.rustfmt.toml +++ b/.rustfmt.toml @@ -1,4 +1,4 @@ -edition = "2018" +edition = "2021" unstable_features = true fn_single_line = true trailing_comma = "Never" diff --git a/src/build.rs b/src/build.rs index a1a0790..8239200 100644 --- a/src/build.rs +++ b/src/build.rs @@ -4,12 +4,12 @@ use std::{ path::{Path, PathBuf, MAIN_SEPARATOR} }; -const DRIVER_VERSION: &str = "1.11.0-1620331022000"; +const DRIVER_VERSION: &str = "1.25.0-alpha-jul-26-2022"; fn main() { let out_dir: PathBuf = env::var_os("OUT_DIR").unwrap().into(); let dest = out_dir.join("driver.zip"); - let platform = PlaywrightPlatform::default(); + let platform = Platform::default(); fs::write(out_dir.join("platform"), platform.to_string()).unwrap(); download(&url(platform), &dest); println!("cargo:rerun-if-changed=src/build.rs"); @@ -29,19 +29,15 @@ fn download(url: &str, dest: &Path) { let cached = cache_dir.join("driver.zip"); if cfg!(debug_assertions) { let maybe_metadata = cached.metadata().ok(); - let cache_is_file = || { - maybe_metadata - .as_ref() - .map(fs::Metadata::is_file) - .unwrap_or_default() - }; - let cache_size = || { - maybe_metadata - .as_ref() - .map(fs::Metadata::len) - .unwrap_or_default() - }; - if cache_is_file() && cache_size() > 10000000 { + let cache_is_file = maybe_metadata + .as_ref() + .map(fs::Metadata::is_file) + .unwrap_or_default(); + let cache_size = maybe_metadata + .as_ref() + .map(fs::Metadata::len) + .unwrap_or_default(); + if cache_is_file && cache_size > 10000000 { fs::copy(cached, dest).unwrap(); check_size(dest); return; @@ -57,6 +53,10 @@ fn download(url: &str, dest: &Path) { check_size(dest); } +fn check_size(p: &Path) { + assert!(size(p) > 10_000_000, "file size is smaller than the driver"); +} + fn size(p: &Path) -> u64 { let maybe_metadata = p.metadata().ok(); let size = maybe_metadata @@ -66,62 +66,84 @@ fn size(p: &Path) -> u64 { size } -fn check_size(p: &Path) { - assert!(size(p) > 10_000_000, "file size is smaller than the driver"); -} - // No network access #[cfg(feature = "only-for-docs-rs")] fn download(_url: &str, dest: &Path) { File::create(dest).unwrap(); } -fn url(platform: PlaywrightPlatform) -> String { - // let next = DRIVER_VERSION - // .contains("next") - // .then(|| "/next") - // .unwrap_or_default(); - let next = "/next"; +fn url(platform: Platform) -> String { + let next = (DRIVER_VERSION.contains("-next") + || DRIVER_VERSION.contains("-alpha") + || DRIVER_VERSION.contains("-beta")) + .then(|| "next/") + .unwrap_or_default(); format!( - "https://playwright.azureedge.net/builds/driver{}/playwright-{}-{}.zip", + "https://playwright.azureedge.net/builds/driver/{}playwright-{}-{}.zip", next, DRIVER_VERSION, platform ) } -#[derive(Clone, Copy)] -enum PlaywrightPlatform { +#[derive(Clone, Copy, PartialEq, Eq)] +enum Platform { + Mac, + MacArm64, Linux, - Win32, - Win32x64, - Mac + LinuxArm64, + Win32X64 } -impl fmt::Display for PlaywrightPlatform { +const LABEL: &[(Platform, &str)] = &[ + (Platform::Mac, "mac"), + (Platform::MacArm64, "mac-arm64"), + (Platform::Linux, "linux"), + (Platform::LinuxArm64, "linux-arm64"), + (Platform::Win32X64, "win32_x64") +]; + +impl fmt::Display for Platform { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - match self { - Self::Linux => write!(f, "linux"), - Self::Win32 => write!(f, "win32"), - Self::Win32x64 => write!(f, "win32_x64"), - Self::Mac => write!(f, "mac") - } + let hit = LABEL + .into_iter() + .find(|(a, _)| a == self) + .map(|(_, s)| s) + .unwrap(); + write!(f, "{}", hit) + } +} + +impl std::str::FromStr for Platform { + type Err = (); + + fn from_str(s: &str) -> Result { + let hit = LABEL + .into_iter() + .find(|&(_, b)| *b == s) + .map(|&(a, _)| a) + .ok_or(())?; + Ok(hit) } } -impl Default for PlaywrightPlatform { +impl Default for Platform { fn default() -> Self { - match env::var("CARGO_CFG_TARGET_OS").as_deref() { - Ok("linux") => return PlaywrightPlatform::Linux, - Ok("macos") => return PlaywrightPlatform::Mac, - _ => () - }; if env::var("CARGO_CFG_WINDOWS").is_ok() { - if env::var("CARGO_CFG_TARGET_POINTER_WIDTH").as_deref() == Ok("64") { - PlaywrightPlatform::Win32x64 - } else { - PlaywrightPlatform::Win32 + return Self::Win32X64; + } + match env::var("CARGO_CFG_TARGET_OS").as_deref() { + Ok("linux") => { + if env::var("CARGO_CFG_TARGET_ARCH").unwrap() == "aarch64" { + Self::LinuxArm64 + } else { + Self::Linux + } + } + Ok("macos") => { + if env::var("CARGO_CFG_TARGET_ARCH").unwrap() == "aarch64" { + Self::MacArm64 + } else { + Self::Mac + } } - } else if env::var("CARGO_CFG_UNIX").is_ok() { - PlaywrightPlatform::Linux - } else { - panic!("Unsupported plaform"); + _ => panic!("Unsupported plaform") } } } diff --git a/src/imp/core/driver.rs b/src/imp/core/driver.rs index 96eb244..225d458 100644 --- a/src/imp/core/driver.rs +++ b/src/imp/core/driver.rs @@ -1,5 +1,5 @@ use crate::imp::prelude::*; -use std::{env, fs, io}; +use std::{env, fmt, fs, io, str::FromStr}; use zip::{result::ZipError, ZipArchive}; #[derive(Debug, Clone, PartialEq)] @@ -41,32 +41,58 @@ impl Driver { dir } - pub fn platform(&self) -> Platform { - match Self::PLATFORM { - "linux" => Platform::Linux, - "mac" => Platform::Mac, - "win32" => Platform::Win32, - "win32_x64" => Platform::Win32x64, - _ => unreachable!() - } - } + pub fn platform(&self) -> Platform { Platform::from_str(Self::PLATFORM).unwrap() } pub fn executable(&self) -> PathBuf { match self.platform() { Platform::Linux => self.path.join("playwright.sh"), + Platform::LinuxArm64 => self.path.join("playwright.sh"), Platform::Mac => self.path.join("playwright.sh"), - Platform::Win32 => self.path.join("playwright.cmd"), - Platform::Win32x64 => self.path.join("playwright.cmd") + Platform::MacArm64 => self.path.join("playwright.sh"), + Platform::Win32X64 => self.path.join("playwright.cmd") } } } #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub enum Platform { + Mac, + MacArm64, Linux, - Win32, - Win32x64, - Mac + LinuxArm64, + Win32X64 +} + +const LABEL: &[(Platform, &str)] = &[ + (Platform::Mac, "mac"), + (Platform::MacArm64, "mac-arm64"), + (Platform::Linux, "linux"), + (Platform::LinuxArm64, "linux-arm64"), + (Platform::Win32X64, "win32_x64") +]; + +impl fmt::Display for Platform { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + let hit = LABEL + .into_iter() + .find(|(a, _)| a == self) + .map(|(_, s)| s) + .unwrap(); + write!(f, "{}", hit) + } +} + +impl FromStr for Platform { + type Err = (); + + fn from_str(s: &str) -> Result { + let hit = LABEL + .into_iter() + .find(|&(_, b)| *b == s) + .map(|&(a, _)| a) + .ok_or(())?; + Ok(hit) + } } #[cfg(test)] From 3f9f201fabb2f56551847931d7fb172600ea728f Mon Sep 17 00:00:00 2001 From: octaltree Date: Sat, 30 Jul 2022 15:41:45 +0900 Subject: [PATCH 02/95] api.json 1.25 --- src/api/api.json | 96641 +++++++++++++++++++++++++++++++++------------ 1 file changed, 70297 insertions(+), 26344 deletions(-) diff --git a/src/api/api.json b/src/api/api.json index a3b2aca..567df5b 100644 --- a/src/api/api.json +++ b/src/api/api.json @@ -46,9 +46,23 @@ } ], "expression": "[null]|[string]" + }, + "csharp": { + "name": "", + "union": [ + { + "name": "null" + }, + { + "name": "JsonElement" + } + ], + "expression": "[null]|[JsonElement]" } } }, + "experimental": false, + "since": "v1.8", "name": "snapshot", "type": { "name": "", @@ -62,6 +76,8 @@ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "role", "type": { "name": "string", @@ -77,11 +93,15 @@ "comment": "The [role](https://www.w3.org/TR/wai-aria/#usage_intro).", "deprecated": false, "async": false, - "alias": "role" + "alias": "role", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "name", "type": { "name": "string", @@ -97,11 +117,15 @@ "comment": "A human readable name for the node.", "deprecated": false, "async": false, - "alias": "name" + "alias": "name", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "value", "type": { "name": "", @@ -121,15 +145,19 @@ "text": "The current value of the node, if applicable." } ], - "required": false, + "required": true, "comment": "The current value of the node, if applicable.", "deprecated": false, "async": false, - "alias": "value" + "alias": "value", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "description", "type": { "name": "string", @@ -141,15 +169,19 @@ "text": "An additional human readable description of the node, if applicable." } ], - "required": false, + "required": true, "comment": "An additional human readable description of the node, if applicable.", "deprecated": false, "async": false, - "alias": "description" + "alias": "description", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "keyshortcuts", "type": { "name": "string", @@ -161,15 +193,19 @@ "text": "Keyboard shortcuts associated with this node, if applicable." } ], - "required": false, + "required": true, "comment": "Keyboard shortcuts associated with this node, if applicable.", "deprecated": false, "async": false, - "alias": "keyshortcuts" + "alias": "keyshortcuts", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "roledescription", "type": { "name": "string", @@ -181,15 +217,19 @@ "text": "A human readable alternative to the role, if applicable." } ], - "required": false, + "required": true, "comment": "A human readable alternative to the role, if applicable.", "deprecated": false, "async": false, - "alias": "roledescription" + "alias": "roledescription", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "valuetext", "type": { "name": "string", @@ -201,15 +241,19 @@ "text": "A description of the current value, if applicable." } ], - "required": false, + "required": true, "comment": "A description of the current value, if applicable.", "deprecated": false, "async": false, - "alias": "valuetext" + "alias": "valuetext", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "disabled", "type": { "name": "boolean", @@ -221,15 +265,19 @@ "text": "Whether the node is disabled, if applicable." } ], - "required": false, + "required": true, "comment": "Whether the node is disabled, if applicable.", "deprecated": false, "async": false, - "alias": "disabled" + "alias": "disabled", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "expanded", "type": { "name": "boolean", @@ -241,15 +289,19 @@ "text": "Whether the node is expanded or collapsed, if applicable." } ], - "required": false, + "required": true, "comment": "Whether the node is expanded or collapsed, if applicable.", "deprecated": false, "async": false, - "alias": "expanded" + "alias": "expanded", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "focused", "type": { "name": "boolean", @@ -261,15 +313,19 @@ "text": "Whether the node is focused, if applicable." } ], - "required": false, + "required": true, "comment": "Whether the node is focused, if applicable.", "deprecated": false, "async": false, - "alias": "focused" + "alias": "focused", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "modal", "type": { "name": "boolean", @@ -281,15 +337,19 @@ "text": "Whether the node is [modal](https://en.wikipedia.org/wiki/Modal_window), if applicable." } ], - "required": false, + "required": true, "comment": "Whether the node is [modal](https://en.wikipedia.org/wiki/Modal_window), if applicable.", "deprecated": false, "async": false, - "alias": "modal" + "alias": "modal", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "multiline", "type": { "name": "boolean", @@ -301,15 +361,19 @@ "text": "Whether the node text input supports multiline, if applicable." } ], - "required": false, + "required": true, "comment": "Whether the node text input supports multiline, if applicable.", "deprecated": false, "async": false, - "alias": "multiline" + "alias": "multiline", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "multiselectable", "type": { "name": "boolean", @@ -321,15 +385,19 @@ "text": "Whether more than one child can be selected, if applicable." } ], - "required": false, + "required": true, "comment": "Whether more than one child can be selected, if applicable.", "deprecated": false, "async": false, - "alias": "multiselectable" + "alias": "multiselectable", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "readonly", "type": { "name": "boolean", @@ -341,15 +409,19 @@ "text": "Whether the node is read only, if applicable." } ], - "required": false, + "required": true, "comment": "Whether the node is read only, if applicable.", "deprecated": false, "async": false, - "alias": "readonly" + "alias": "readonly", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "required", "type": { "name": "boolean", @@ -361,15 +433,19 @@ "text": "Whether the node is required, if applicable." } ], - "required": false, + "required": true, "comment": "Whether the node is required, if applicable.", "deprecated": false, "async": false, - "alias": "required" + "alias": "required", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "selected", "type": { "name": "boolean", @@ -381,15 +457,19 @@ "text": "Whether the node is selected in its parent node, if applicable." } ], - "required": false, + "required": true, "comment": "Whether the node is selected in its parent node, if applicable.", "deprecated": false, "async": false, - "alias": "selected" + "alias": "selected", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "checked", "type": { "name": "", @@ -409,15 +489,19 @@ "text": "Whether the checkbox is checked, or \"mixed\", if applicable." } ], - "required": false, + "required": true, "comment": "Whether the checkbox is checked, or \"mixed\", if applicable.", "deprecated": false, "async": false, - "alias": "checked" + "alias": "checked", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "pressed", "type": { "name": "", @@ -437,15 +521,19 @@ "text": "Whether the toggle button is checked, or \"mixed\", if applicable." } ], - "required": false, + "required": true, "comment": "Whether the toggle button is checked, or \"mixed\", if applicable.", "deprecated": false, "async": false, - "alias": "pressed" + "alias": "pressed", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "level", "type": { "name": "int", @@ -457,15 +545,19 @@ "text": "The level of a heading, if applicable." } ], - "required": false, + "required": true, "comment": "The level of a heading, if applicable.", "deprecated": false, "async": false, - "alias": "level" + "alias": "level", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "valuemin", "type": { "name": "float", @@ -477,15 +569,19 @@ "text": "The minimum value in a node, if applicable." } ], - "required": false, + "required": true, "comment": "The minimum value in a node, if applicable.", "deprecated": false, "async": false, - "alias": "valuemin" + "alias": "valuemin", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "valuemax", "type": { "name": "float", @@ -497,15 +593,19 @@ "text": "The maximum value in a node, if applicable." } ], - "required": false, + "required": true, "comment": "The maximum value in a node, if applicable.", "deprecated": false, "async": false, - "alias": "valuemax" + "alias": "valuemax", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "autocomplete", "type": { "name": "string", @@ -517,15 +617,19 @@ "text": "What kind of autocomplete is supported by a control, if applicable." } ], - "required": false, + "required": true, "comment": "What kind of autocomplete is supported by a control, if applicable.", "deprecated": false, "async": false, - "alias": "autocomplete" + "alias": "autocomplete", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "haspopup", "type": { "name": "string", @@ -537,15 +641,19 @@ "text": "What kind of popup is currently being shown for a node, if applicable." } ], - "required": false, + "required": true, "comment": "What kind of popup is currently being shown for a node, if applicable.", "deprecated": false, "async": false, - "alias": "haspopup" + "alias": "haspopup", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "invalid", "type": { "name": "string", @@ -557,15 +665,19 @@ "text": "Whether and in what way this node's value is invalid, if applicable." } ], - "required": false, + "required": true, "comment": "Whether and in what way this node's value is invalid, if applicable.", "deprecated": false, "async": false, - "alias": "invalid" + "alias": "invalid", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "orientation", "type": { "name": "string", @@ -577,15 +689,19 @@ "text": "Whether the node is oriented horizontally or vertically, if applicable." } ], - "required": false, + "required": true, "comment": "Whether the node is oriented horizontally or vertically, if applicable.", "deprecated": false, "async": false, - "alias": "orientation" + "alias": "orientation", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "children", "type": { "name": "Array", @@ -602,11 +718,13 @@ "text": "Child nodes, if any, if applicable." } ], - "required": false, + "required": true, "comment": "Child nodes, if any, if applicable.", "deprecated": false, "async": false, - "alias": "children" + "alias": "children", + "overloadIndex": 0, + "paramOrOption": null } ] } @@ -662,8 +780,8 @@ { "type": "code", "lines": [ - "var accessibilitySnapshot = await Page.Accessibility.SnapshotAsync();", - "Console.WriteLine(accessibilitySnapshot);" + "var accessibilitySnapshot = await page.Accessibility.SnapshotAsync();", + "Console.WriteLine(System.Text.Json.JsonSerializer.Serialize(accessibilitySnapshot));" ], "codeLang": "csharp" }, @@ -683,7 +801,8 @@ " return node;", " for (const child of node.children || []) {", " const foundNode = findFocusedNode(child);", - " return foundNode;", + " if (foundNode)", + " return foundNode;", " }", " return null;", "}" @@ -693,26 +812,8 @@ { "type": "code", "lines": [ - "Func findFocusedNode = root =>", - "{", - " var nodes = new Stack(new[] { root });", - " while (nodes.Count > 0)", - " {", - " var node = nodes.Pop();", - " if (node.Focused) return node;", - " foreach (var innerNode in node.Children)", - " {", - " nodes.Push(innerNode);", - " }", - " }", - "", - " return null;", - "};", - "", - "var accessibilitySnapshot = await Page.Accessibility.SnapshotAsync();", - "var focusedNode = findFocusedNode(accessibilitySnapshot);", - "if(focusedNode != null)", - " Console.WriteLine(focusedNode.Name);" + "var accessibilitySnapshot = await page.Accessibility.SnapshotAsync();", + "Console.WriteLine(System.Text.Json.JsonSerializer.Serialize(accessibilitySnapshot));" ], "codeLang": "csharp" }, @@ -732,7 +833,8 @@ " return node", " for child in (node.get(\"children\") or []):", " found_node = find_focused_node(child)", - " return found_node", + " if (found_node)", + " return found_node", " return None", "", "snapshot = await page.accessibility.snapshot()", @@ -750,7 +852,8 @@ " return node", " for child in (node.get(\"children\") or []):", " found_node = find_focused_node(child)", - " return found_node", + " if (found_node)", + " return found_node", " return None", "", "snapshot = page.accessibility.snapshot()", @@ -762,14 +865,18 @@ } ], "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(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\nFunc findFocusedNode = root =>\n{\n var nodes = new Stack(new[] { root });\n while (nodes.Count > 0)\n {\n var node = nodes.Pop();\n if (node.Focused) return node;\n foreach (var innerNode in node.Children)\n {\n nodes.Push(innerNode);\n }\n }\n\n return null;\n};\n\nvar accessibilitySnapshot = await Page.Accessibility.SnapshotAsync();\nvar focusedNode = findFocusedNode(accessibilitySnapshot);\nif(focusedNode != null)\n Console.WriteLine(focusedNode.Name);\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", + "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 if (foundNode)\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 if (found_node)\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 if (found_node)\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", + "overloadIndex": 0, + "paramOrOption": null, "args": [ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "options", "type": { "name": "Object", @@ -777,6 +884,8 @@ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.8", "name": "interestingOnly", "type": { "name": "boolean", @@ -792,11 +901,15 @@ "comment": "Prune uninteresting nodes from the tree. Defaults to `true`.", "deprecated": false, "async": false, - "alias": "interestingOnly" + "alias": "interestingOnly", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.8", "name": "root", "type": { "name": "ElementHandle", @@ -812,7 +925,9 @@ "comment": "The root DOM element for the snapshot. Defaults to the whole page.", "deprecated": false, "async": false, - "alias": "root" + "alias": "root", + "overloadIndex": 0, + "paramOrOption": null } ] }, @@ -820,7 +935,9 @@ "comment": "", "deprecated": false, "async": false, - "alias": "options" + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null } ] } @@ -831,14 +948,54 @@ "spec": [ { "type": "text", - "text": "Playwright has **experimental** support for Android automation. You can access android namespace via:" + "text": "Playwright has **experimental** support for Android automation. This includes Chrome for Android and Android WebView." }, { - "type": "code", - "lines": [ - "const { _android: android } = require('playwright');" - ], - "codeLang": "js" + "type": "text", + "text": "*Requirements*" + }, + { + "type": "li", + "text": "Android device or AVD Emulator.", + "liType": "bullet" + }, + { + "type": "li", + "text": "[ADB daemon](https://developer.android.com/studio/command-line/adb) running and authenticated with your device. Typically running `adb devices` is all you need to do.", + "liType": "bullet" + }, + { + "type": "li", + "text": "[`Chrome 87`](https://play.google.com/store/apps/details?id=com.android.chrome) or newer installed on the device", + "liType": "bullet" + }, + { + "type": "li", + "text": "\"Enable command line on non-rooted devices\" enabled in `chrome://flags`.", + "liType": "bullet" + }, + { + "type": "text", + "text": "*Known limitations*" + }, + { + "type": "li", + "text": "Raw USB operation is not yet supported, so you need ADB.", + "liType": "bullet" + }, + { + "type": "li", + "text": "Device needs to be awake to produce screenshots. Enabling \"Stay awake\" developer mode will help.", + "liType": "bullet" + }, + { + "type": "li", + "text": "We didn't run all the tests against the device, so not everything works.", + "liType": "bullet" + }, + { + "type": "text", + "text": "*How to run*" }, { "type": "text", @@ -905,9 +1062,9 @@ { "type": "code", "lines": [ - "$ PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm i -D playwright" + "PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm i -D playwright" ], - "codeLang": "sh js" + "codeLang": "bash js" } ], "langs": { @@ -918,11 +1075,13 @@ "types": {}, "overrides": {} }, - "comment": "Playwright has **experimental** support for Android automation. You can access 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```sh js\n$ PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm i -D playwright\n```\n", + "comment": "Playwright has **experimental** support for Android automation. This includes Chrome for Android and Android WebView.\n\n*Requirements*\n- Android device or AVD Emulator.\n- [ADB daemon](https://developer.android.com/studio/command-line/adb) running and authenticated with your device.\n Typically running `adb devices` is all you need to do.\n- [`Chrome 87`](https://play.google.com/store/apps/details?id=com.android.chrome) or newer installed on the device\n- \"Enable command line on non-rooted devices\" enabled in `chrome://flags`.\n\n*Known limitations*\n- Raw USB operation is not yet supported, so you need ADB.\n- Device needs to be awake to produce screenshots. Enabling \"Stay awake\" developer mode will help.\n- We didn't run all the tests against the device, so not everything works.\n\n*How to run*\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": {}, + "experimental": false, + "since": "v1.9", "name": "devices", "type": { "name": "Array", @@ -944,11 +1103,107 @@ "deprecated": false, "async": true, "alias": "devices", - "args": [] + "overloadIndex": 0, + "paramOrOption": null, + "args": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "options", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.22", + "name": "host", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "Optional host to establish ADB server connection. Default to `127.0.0.1`." + } + ], + "required": false, + "comment": "Optional host to establish ADB server connection. Default to `127.0.0.1`.", + "deprecated": false, + "async": false, + "alias": "host", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.21", + "name": "omitDriverInstall", + "type": { + "name": "boolean", + "expression": "[boolean]" + }, + "spec": [ + { + "type": "text", + "text": "Prevents automatic playwright driver installation on attach. Assumes that the drivers have been installed already." + } + ], + "required": false, + "comment": "Prevents automatic playwright driver installation on attach. Assumes that the drivers have been installed already.", + "deprecated": false, + "async": false, + "alias": "omitDriverInstall", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.20", + "name": "port", + "type": { + "name": "int", + "expression": "[int]" + }, + "spec": [ + { + "type": "text", + "text": "Optional port to establish ADB server connection. Default to `5037`." + } + ], + "required": false, + "comment": "Optional port to establish ADB server connection. Default to `5037`.", + "deprecated": false, + "async": false, + "alias": "port", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + "required": false, + "comment": "", + "deprecated": false, + "async": false, + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null + } + ] }, { "kind": "method", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "setDefaultTimeout", "type": { "name": "void" @@ -964,10 +1219,14 @@ "deprecated": false, "async": false, "alias": "setDefaultTimeout", + "overloadIndex": 0, + "paramOrOption": null, "args": [ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "timeout", "type": { "name": "float", @@ -983,7 +1242,9 @@ "comment": "Maximum time in milliseconds", "deprecated": false, "async": false, - "alias": "timeout" + "alias": "timeout", + "overloadIndex": 0, + "paramOrOption": null } ] } @@ -1010,6 +1271,8 @@ { "kind": "event", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "webView", "type": { "name": "AndroidWebView", @@ -1026,11 +1289,15 @@ "deprecated": false, "async": false, "alias": "webView", + "overloadIndex": 0, + "paramOrOption": null, "args": [] }, { "kind": "method", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "close", "type": { "name": "void" @@ -1046,11 +1313,15 @@ "deprecated": false, "async": true, "alias": "close", + "overloadIndex": 0, + "paramOrOption": null, "args": [] }, { "kind": "method", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "drag", "type": { "name": "void" @@ -1066,10 +1337,14 @@ "deprecated": false, "async": true, "alias": "drag", + "overloadIndex": 0, + "paramOrOption": null, "args": [ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "selector", "type": { "name": "AndroidSelector", @@ -1085,11 +1360,15 @@ "comment": "Selector to drag.", "deprecated": false, "async": false, - "alias": "selector" + "alias": "selector", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "dest", "type": { "name": "Object", @@ -1097,6 +1376,8 @@ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "x", "type": { "name": "float", @@ -1112,11 +1393,15 @@ "comment": "", "deprecated": false, "async": false, - "alias": "x" + "alias": "x", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "y", "type": { "name": "float", @@ -1132,7 +1417,9 @@ "comment": "", "deprecated": false, "async": false, - "alias": "y" + "alias": "y", + "overloadIndex": 0, + "paramOrOption": null } ], "expression": "[Object]" @@ -1147,11 +1434,15 @@ "comment": "Point to drag to.", "deprecated": false, "async": false, - "alias": "dest" + "alias": "dest", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "options", "type": { "name": "Object", @@ -1159,6 +1450,8 @@ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "speed", "type": { "name": "float", @@ -1174,7 +1467,9 @@ "comment": "Optional speed of the drag in pixels per second.", "deprecated": false, "async": false, - "alias": "speed" + "alias": "speed", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", @@ -1186,6 +1481,8 @@ "types": {}, "overrides": {} }, + "experimental": false, + "since": "v1.9", "name": "timeout", "type": { "name": "float", @@ -1201,7 +1498,9 @@ "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" + "alias": "timeout", + "overloadIndex": 0, + "paramOrOption": null } ] }, @@ -1209,13 +1508,17 @@ "comment": "", "deprecated": false, "async": false, - "alias": "options" + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null } ] }, { "kind": "method", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "fill", "type": { "name": "void" @@ -1231,10 +1534,14 @@ "deprecated": false, "async": true, "alias": "fill", + "overloadIndex": 0, + "paramOrOption": null, "args": [ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "selector", "type": { "name": "AndroidSelector", @@ -1250,11 +1557,15 @@ "comment": "Selector to fill.", "deprecated": false, "async": false, - "alias": "selector" + "alias": "selector", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "text", "type": { "name": "string", @@ -1270,11 +1581,15 @@ "comment": "Text to be filled in the input box.", "deprecated": false, "async": false, - "alias": "text" + "alias": "text", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "options", "type": { "name": "Object", @@ -1289,6 +1604,8 @@ "types": {}, "overrides": {} }, + "experimental": false, + "since": "v1.9", "name": "timeout", "type": { "name": "float", @@ -1304,7 +1621,9 @@ "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" + "alias": "timeout", + "overloadIndex": 0, + "paramOrOption": null } ] }, @@ -1312,13 +1631,17 @@ "comment": "", "deprecated": false, "async": false, - "alias": "options" + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null } ] }, { "kind": "method", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "fling", "type": { "name": "void" @@ -1334,10 +1657,14 @@ "deprecated": false, "async": true, "alias": "fling", + "overloadIndex": 0, + "paramOrOption": null, "args": [ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "selector", "type": { "name": "AndroidSelector", @@ -1353,11 +1680,15 @@ "comment": "Selector to fling.", "deprecated": false, "async": false, - "alias": "selector" + "alias": "selector", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "direction", "type": { "name": "AndroidFlingDirection", @@ -1387,11 +1718,15 @@ "comment": "Fling direction.", "deprecated": false, "async": false, - "alias": "direction" + "alias": "direction", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "options", "type": { "name": "Object", @@ -1399,6 +1734,8 @@ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "speed", "type": { "name": "float", @@ -1414,7 +1751,9 @@ "comment": "Optional speed of the fling in pixels per second.", "deprecated": false, "async": false, - "alias": "speed" + "alias": "speed", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", @@ -1426,6 +1765,8 @@ "types": {}, "overrides": {} }, + "experimental": false, + "since": "v1.9", "name": "timeout", "type": { "name": "float", @@ -1441,7 +1782,9 @@ "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" + "alias": "timeout", + "overloadIndex": 0, + "paramOrOption": null } ] }, @@ -1449,13 +1792,17 @@ "comment": "", "deprecated": false, "async": false, - "alias": "options" + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null } ] }, { "kind": "method", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "info", "type": { "name": "AndroidElementInfo", @@ -1472,10 +1819,14 @@ "deprecated": false, "async": true, "alias": "info", + "overloadIndex": 0, + "paramOrOption": null, "args": [ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "selector", "type": { "name": "AndroidSelector", @@ -1491,13 +1842,17 @@ "comment": "Selector to return information about.", "deprecated": false, "async": false, - "alias": "selector" + "alias": "selector", + "overloadIndex": 0, + "paramOrOption": null } ] }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "input", "type": { "name": "AndroidInput", @@ -1509,11 +1864,15 @@ "deprecated": false, "async": false, "alias": "input", + "overloadIndex": 0, + "paramOrOption": null, "args": [] }, { "kind": "method", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "installApk", "type": { "name": "void" @@ -1529,10 +1888,14 @@ "deprecated": false, "async": true, "alias": "installApk", + "overloadIndex": 0, + "paramOrOption": null, "args": [ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "file", "type": { "name": "", @@ -1556,11 +1919,15 @@ "comment": "Either a path to the apk file, or apk file content.", "deprecated": false, "async": false, - "alias": "file" + "alias": "file", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "options", "type": { "name": "Object", @@ -1568,6 +1935,8 @@ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "args", "type": { "name": "Array", @@ -1588,7 +1957,9 @@ "comment": "Optional arguments to pass to the `shell:cmd package install` call. Defaults to `-r -t -S`.", "deprecated": false, "async": false, - "alias": "args" + "alias": "args", + "overloadIndex": 0, + "paramOrOption": null } ] }, @@ -1596,13 +1967,17 @@ "comment": "", "deprecated": false, "async": false, - "alias": "options" + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null } ] }, { "kind": "method", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "launchBrowser", "type": { "name": "BrowserContext", @@ -1619,10 +1994,14 @@ "deprecated": false, "async": true, "alias": "launchBrowser", + "overloadIndex": 0, + "paramOrOption": null, "args": [ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "options", "type": { "name": "Object", @@ -1630,6 +2009,8 @@ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "acceptDownloads", "type": { "name": "boolean", @@ -1638,18 +2019,61 @@ "spec": [ { "type": "text", - "text": "Whether to automatically download all the attachments. Defaults to `false` where all the downloads are canceled." + "text": "Whether to automatically download all the attachments. Defaults to `true` where all the downloads are accepted." + } + ], + "required": false, + "comment": "Whether to automatically download all the attachments. Defaults to `true` where all the downloads are accepted.", + "deprecated": false, + "async": false, + "alias": "acceptDownloads", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.9", + "name": "baseURL", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "When using [`method: Page.goto`], [`method: Page.route`], [`method: Page.waitForURL`], [`method: Page.waitForRequest`], or [`method: Page.waitForResponse`] it takes the base URL in consideration by using the [`URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor for building the corresponding URL. Examples:" + }, + { + "type": "li", + "text": "baseURL: `http://localhost:3000` and navigating to `/bar.html` results in `http://localhost:3000/bar.html`", + "liType": "bullet" + }, + { + "type": "li", + "text": "baseURL: `http://localhost:3000/foo/` and navigating to `./bar.html` results in `http://localhost:3000/foo/bar.html`", + "liType": "bullet" + }, + { + "type": "li", + "text": "baseURL: `http://localhost:3000/foo` (without trailing slash) and navigating to `./bar.html` results in `http://localhost:3000/bar.html`", + "liType": "bullet" } ], "required": false, - "comment": "Whether to automatically download all the attachments. Defaults to `false` where all the downloads are canceled.", + "comment": "When using [`method: Page.goto`], [`method: Page.route`], [`method: Page.waitForURL`], [`method: Page.waitForRequest`],\nor [`method: Page.waitForResponse`] it takes the base URL in consideration by using the\n[`URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor for building the corresponding URL.\nExamples:\n- baseURL: `http://localhost:3000` and navigating to `/bar.html` results in `http://localhost:3000/bar.html`\n- baseURL: `http://localhost:3000/foo/` and navigating to `./bar.html` results in `http://localhost:3000/foo/bar.html`\n- baseURL: `http://localhost:3000/foo` (without trailing slash) and navigating to `./bar.html` results in\n `http://localhost:3000/bar.html`", "deprecated": false, "async": false, - "alias": "acceptDownloads" + "alias": "baseURL", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "bypassCSP", "type": { "name": "boolean", @@ -1665,11 +2089,15 @@ "comment": "Toggles bypassing page's Content-Security-Policy.", "deprecated": false, "async": false, - "alias": "bypassCSP" + "alias": "bypassCSP", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "colorScheme", "type": { "name": "ColorScheme", @@ -1696,11 +2124,15 @@ "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" + "alias": "colorScheme", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "command", "type": { "name": "string", @@ -1716,11 +2148,15 @@ "comment": "Optional package name to launch instead of default Chrome for Android.", "deprecated": false, "async": false, - "alias": "command" + "alias": "command", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "deviceScaleFactor", "type": { "name": "float", @@ -1736,11 +2172,15 @@ "comment": "Specify device scale factor (can be thought of as dpr). Defaults to `1`.", "deprecated": false, "async": false, - "alias": "deviceScaleFactor" + "alias": "deviceScaleFactor", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "extraHTTPHeaders", "type": { "name": "Object", @@ -1757,18 +2197,59 @@ "spec": [ { "type": "text", - "text": "An object containing additional HTTP headers to be sent with every request. All header values must be strings." + "text": "An object containing additional HTTP headers to be sent with every request." } ], "required": false, - "comment": "An object containing additional HTTP headers to be sent with every request. All header values must be strings.", + "comment": "An object containing additional HTTP headers to be sent with every request.", "deprecated": false, "async": false, - "alias": "extraHTTPHeaders" + "alias": "extraHTTPHeaders", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", + "name": "forcedColors", + "type": { + "name": "ForcedColors", + "union": [ + { + "name": "\"active\"" + }, + { + "name": "\"none\"" + } + ], + "expression": "[ForcedColors]<\"active\"|\"none\">" + }, + "spec": [ + { + "type": "text", + "text": "Emulates `'forced-colors'` media feature, supported values are `'active'`, `'none'`. See [`method: Page.emulateMedia`] for more details. Defaults to `'none'`." + }, + { + "type": "note", + "noteType": "note", + "text": "It's not supported in WebKit, see [here](https://bugs.webkit.org/show_bug.cgi?id=225281) in their issue tracker." + } + ], + "required": false, + "comment": "Emulates `'forced-colors'` media feature, supported values are `'active'`, `'none'`. See [`method: Page.emulateMedia`]\nfor more details. Defaults to `'none'`.\n\n> NOTE: It's not supported in WebKit, see [here](https://bugs.webkit.org/show_bug.cgi?id=225281) in their issue tracker.", + "deprecated": false, + "async": false, + "alias": "forcedColors", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.9", "name": "geolocation", "type": { "name": "Object", @@ -1776,6 +2257,8 @@ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "latitude", "type": { "name": "float", @@ -1791,11 +2274,15 @@ "comment": "Latitude between -90 and 90.", "deprecated": false, "async": false, - "alias": "latitude" + "alias": "latitude", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "longitude", "type": { "name": "float", @@ -1811,11 +2298,15 @@ "comment": "Longitude between -180 and 180.", "deprecated": false, "async": false, - "alias": "longitude" + "alias": "longitude", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "accuracy", "type": { "name": "float", @@ -1831,7 +2322,9 @@ "comment": "Non-negative accuracy value. Defaults to `0`.", "deprecated": false, "async": false, - "alias": "accuracy" + "alias": "accuracy", + "overloadIndex": 0, + "paramOrOption": null } ], "expression": "[Object]" @@ -1841,11 +2334,15 @@ "comment": "", "deprecated": false, "async": false, - "alias": "geolocation" + "alias": "geolocation", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "hasTouch", "type": { "name": "boolean", @@ -1861,11 +2358,15 @@ "comment": "Specifies if viewport supports touch events. Defaults to false.", "deprecated": false, "async": false, - "alias": "hasTouch" + "alias": "hasTouch", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "httpCredentials", "type": { "name": "Object", @@ -1873,6 +2374,8 @@ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "username", "type": { "name": "string", @@ -1888,11 +2391,15 @@ "comment": "", "deprecated": false, "async": false, - "alias": "username" + "alias": "username", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "password", "type": { "name": "string", @@ -1908,7 +2415,9 @@ "comment": "", "deprecated": false, "async": false, - "alias": "password" + "alias": "password", + "overloadIndex": 0, + "paramOrOption": null } ], "expression": "[Object]" @@ -1923,11 +2432,15 @@ "comment": "Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication).", "deprecated": false, "async": false, - "alias": "httpCredentials" + "alias": "httpCredentials", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "ignoreHTTPSErrors", "type": { "name": "boolean", @@ -1936,18 +2449,22 @@ "spec": [ { "type": "text", - "text": "Whether to ignore HTTPS errors during navigation. Defaults to `false`." + "text": "Whether to ignore HTTPS errors when sending network requests. Defaults to `false`." } ], "required": false, - "comment": "Whether to ignore HTTPS errors during navigation. Defaults to `false`.", + "comment": "Whether to ignore HTTPS errors when sending network requests. Defaults to `false`.", "deprecated": false, "async": false, - "alias": "ignoreHTTPSErrors" + "alias": "ignoreHTTPSErrors", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "isMobile", "type": { "name": "boolean", @@ -1963,11 +2480,15 @@ "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" + "alias": "isMobile", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "javaScriptEnabled", "type": { "name": "boolean", @@ -1983,11 +2504,15 @@ "comment": "Whether or not to enable JavaScript in the context. Defaults to `true`.", "deprecated": false, "async": false, - "alias": "javaScriptEnabled" + "alias": "javaScriptEnabled", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "locale", "type": { "name": "string", @@ -2003,7 +2528,9 @@ "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" + "alias": "locale", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", @@ -2015,6 +2542,8 @@ "types": {}, "overrides": {} }, + "experimental": false, + "since": "v1.9", "name": "logger", "type": { "name": "Logger", @@ -2030,7 +2559,9 @@ "comment": "Logger sink for Playwright logging.", "deprecated": false, "async": false, - "alias": "logger" + "alias": "logger", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", @@ -2042,6 +2573,8 @@ "types": {}, "overrides": {} }, + "experimental": false, + "since": "v1.9", "name": "noViewport", "type": { "name": "boolean", @@ -2057,11 +2590,15 @@ "comment": "Does not enforce fixed viewport, allows resizing window in the headed mode.", "deprecated": false, "async": false, - "alias": "noViewport" + "alias": "noViewport", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "offline", "type": { "name": "boolean", @@ -2077,11 +2614,15 @@ "comment": "Whether to emulate network being offline. Defaults to `false`.", "deprecated": false, "async": false, - "alias": "offline" + "alias": "offline", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "permissions", "type": { "name": "Array", @@ -2102,7 +2643,9 @@ "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" + "alias": "permissions", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", @@ -2114,6 +2657,8 @@ "types": {}, "overrides": {} }, + "experimental": false, + "since": "v1.9", "name": "recordHar", "type": { "name": "Object", @@ -2121,6 +2666,8 @@ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "omitContent", "type": { "name": "boolean", @@ -2129,18 +2676,57 @@ "spec": [ { "type": "text", - "text": "Optional setting to control whether to omit request content from the HAR. Defaults to `false`." + "text": "Optional setting to control whether to omit request content from the HAR. Defaults to `false`. Deprecated, use `content` policy instead." + } + ], + "required": false, + "comment": "Optional setting to control whether to omit request content from the HAR. Defaults to `false`. Deprecated, use `content`\npolicy instead.", + "deprecated": false, + "async": false, + "alias": "omitContent", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "content", + "type": { + "name": "HarContentPolicy", + "union": [ + { + "name": "\"omit\"" + }, + { + "name": "\"embed\"" + }, + { + "name": "\"attach\"" + } + ], + "expression": "[HarContentPolicy]<\"omit\"|\"embed\"|\"attach\">" + }, + "spec": [ + { + "type": "text", + "text": "Optional setting to control resource content management. If `omit` is specified, content is not persisted. If `attach` is specified, resources are persistet as separate files or entries in the ZIP archive. If `embed` is specified, content is stored inline the HAR file as per HAR specification. Defaults to `attach` for `.zip` output files and to `embed` for all other file extensions." } ], "required": false, - "comment": "Optional setting to control whether to omit request content from the HAR. Defaults to `false`.", + "comment": "Optional setting to control resource content management. If `omit` is specified, content is not persisted. If `attach`\nis specified, resources are persistet as separate files or entries in the ZIP archive. If `embed` is specified, content\nis stored inline the HAR file as per HAR specification. Defaults to `attach` for `.zip` output files and to `embed` for\nall other file extensions.", "deprecated": false, "async": false, - "alias": "omitContent" + "alias": "content", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "path", "type": { "name": "path", @@ -2149,14 +2735,80 @@ "spec": [ { "type": "text", - "text": "Path on the filesystem to write the HAR file to." + "text": "Path on the filesystem to write the HAR file to. If the file name ends with `.zip`, `content: 'attach'` is used by default." } ], "required": true, - "comment": "Path on the filesystem to write the HAR file to.", + "comment": "Path on the filesystem to write the HAR file to. If the file name ends with `.zip`, `content: 'attach'` is used by\ndefault.", + "deprecated": false, + "async": false, + "alias": "path", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "mode", + "type": { + "name": "HarMode", + "union": [ + { + "name": "\"full\"" + }, + { + "name": "\"minimal\"" + } + ], + "expression": "[HarMode]<\"full\"|\"minimal\">" + }, + "spec": [ + { + "type": "text", + "text": "When set to `minimal`, only record information necessary for routing from HAR. This omits sizes, timing, page, cookies, security and other types of HAR information that are not used when replaying from HAR. Defaults to `full`." + } + ], + "required": false, + "comment": "When set to `minimal`, only record information necessary for routing from HAR. This omits sizes, timing, page, cookies,\nsecurity and other types of HAR information that are not used when replaying from HAR. Defaults to `full`.", + "deprecated": false, + "async": false, + "alias": "mode", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "urlFilter", + "type": { + "name": "", + "union": [ + { + "name": "string" + }, + { + "name": "RegExp" + } + ], + "expression": "[string]|[RegExp]" + }, + "spec": [ + { + "type": "text", + "text": "A glob or regex pattern to filter requests that are stored in the HAR. When a `baseURL` via the context options was provided and the passed URL is a path, it gets merged via the [`new URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor." + } + ], + "required": false, + "comment": "A glob or regex pattern to filter requests that are stored in the HAR. When a `baseURL` via the context options was\nprovided and the passed URL is a path, it gets merged via the\n[`new URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor.", "deprecated": false, "async": false, - "alias": "path" + "alias": "urlFilter", + "overloadIndex": 0, + "paramOrOption": null } ], "expression": "[Object]" @@ -2171,7 +2823,98 @@ "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" + "alias": "recordHar", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp", + "java", + "python" + ], + "aliases": { + "python": "record_har_content" + }, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.9", + "name": "recordHarContent", + "type": { + "name": "HarContentPolicy", + "union": [ + { + "name": "\"omit\"" + }, + { + "name": "\"embed\"" + }, + { + "name": "\"attach\"" + } + ], + "expression": "[HarContentPolicy]<\"omit\"|\"embed\"|\"attach\">" + }, + "spec": [ + { + "type": "text", + "text": "Optional setting to control resource content management. If `omit` is specified, content is not persisted. If `attach` is specified, resources are persistet as separate files and all of these files are archived along with the HAR file. Defaults to `embed`, which stores content inline the HAR file as per HAR specification." + } + ], + "required": false, + "comment": "Optional setting to control resource content management. If `omit` is specified, content is not persisted. If `attach`\nis specified, resources are persistet as separate files and all of these files are archived along with the HAR file.\nDefaults to `embed`, which stores content inline the HAR file as per HAR specification.", + "deprecated": false, + "async": false, + "alias": "recordHarContent", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp", + "java", + "python" + ], + "aliases": { + "python": "record_har_mode" + }, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.9", + "name": "recordHarMode", + "type": { + "name": "HarMode", + "union": [ + { + "name": "\"full\"" + }, + { + "name": "\"minimal\"" + } + ], + "expression": "[HarMode]<\"full\"|\"minimal\">" + }, + "spec": [ + { + "type": "text", + "text": "When set to `minimal`, only record information necessary for routing from HAR. This omits sizes, timing, page, cookies, security and other types of HAR information that are not used when replaying from HAR. Defaults to `full`." + } + ], + "required": false, + "comment": "When set to `minimal`, only record information necessary for routing from HAR. This omits sizes, timing, page, cookies,\nsecurity and other types of HAR information that are not used when replaying from HAR. Defaults to `full`.", + "deprecated": false, + "async": false, + "alias": "recordHarMode", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", @@ -2187,6 +2930,8 @@ "types": {}, "overrides": {} }, + "experimental": false, + "since": "v1.9", "name": "recordHarOmitContent", "type": { "name": "boolean", @@ -2202,7 +2947,9 @@ "comment": "Optional setting to control whether to omit request content from the HAR. Defaults to `false`.", "deprecated": false, "async": false, - "alias": "recordHarOmitContent" + "alias": "recordHarOmitContent", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", @@ -2218,6 +2965,8 @@ "types": {}, "overrides": {} }, + "experimental": false, + "since": "v1.9", "name": "recordHarPath", "type": { "name": "path", @@ -2233,7 +2982,47 @@ "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" + "alias": "recordHarPath", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp", + "java", + "python" + ], + "aliases": { + "python": "record_har_url_filter" + }, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.9", + "name": "recordHarUrlFilter", + "type": { + "name": "", + "union": [ + { + "name": "string" + }, + { + "name": "RegExp" + } + ], + "expression": "[string]|[RegExp]" + }, + "spec": [], + "required": false, + "comment": "", + "deprecated": false, + "async": false, + "alias": "recordHarUrlFilter", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", @@ -2245,6 +3034,8 @@ "types": {}, "overrides": {} }, + "experimental": false, + "since": "v1.9", "name": "recordVideo", "type": { "name": "Object", @@ -2252,6 +3043,8 @@ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "dir", "type": { "name": "path", @@ -2267,11 +3060,15 @@ "comment": "Path to the directory to put videos into.", "deprecated": false, "async": false, - "alias": "dir" + "alias": "dir", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "size", "type": { "name": "Object", @@ -2279,6 +3076,8 @@ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "width", "type": { "name": "int", @@ -2294,11 +3093,15 @@ "comment": "Video frame width.", "deprecated": false, "async": false, - "alias": "width" + "alias": "width", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "height", "type": { "name": "int", @@ -2314,7 +3117,9 @@ "comment": "Video frame height.", "deprecated": false, "async": false, - "alias": "height" + "alias": "height", + "overloadIndex": 0, + "paramOrOption": null } ], "expression": "[Object]" @@ -2329,7 +3134,9 @@ "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" + "alias": "size", + "overloadIndex": 0, + "paramOrOption": null } ], "expression": "[Object]" @@ -2344,7 +3151,9 @@ "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" + "alias": "recordVideo", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", @@ -2360,6 +3169,8 @@ "types": {}, "overrides": {} }, + "experimental": false, + "since": "v1.9", "name": "recordVideoDir", "type": { "name": "path", @@ -2375,7 +3186,9 @@ "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" + "alias": "recordVideoDir", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", @@ -2391,6 +3204,8 @@ "types": {}, "overrides": {} }, + "experimental": false, + "since": "v1.9", "name": "recordVideoSize", "type": { "name": "Object", @@ -2398,6 +3213,8 @@ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "width", "type": { "name": "int", @@ -2413,11 +3230,15 @@ "comment": "Video frame width.", "deprecated": false, "async": false, - "alias": "width" + "alias": "width", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "height", "type": { "name": "int", @@ -2433,7 +3254,9 @@ "comment": "Video frame height.", "deprecated": false, "async": false, - "alias": "height" + "alias": "height", + "overloadIndex": 0, + "paramOrOption": null } ], "expression": "[Object]" @@ -2448,7 +3271,41 @@ "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" + "alias": "recordVideoSize", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.9", + "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", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", @@ -2460,6 +3317,8 @@ "types": {}, "overrides": {} }, + "experimental": false, + "since": "v1.9", "name": "screen", "type": { "name": "Object", @@ -2467,6 +3326,8 @@ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "width", "type": { "name": "int", @@ -2482,11 +3343,15 @@ "comment": "page width in pixels.", "deprecated": false, "async": false, - "alias": "width" + "alias": "width", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "height", "type": { "name": "int", @@ -2502,7 +3367,9 @@ "comment": "page height in pixels.", "deprecated": false, "async": false, - "alias": "height" + "alias": "height", + "overloadIndex": 0, + "paramOrOption": null } ], "expression": "[Object]" @@ -2517,11 +3384,81 @@ "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" + "alias": "screen", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.9", + "name": "serviceWorkers", + "type": { + "name": "ServiceWorkerPolicy", + "union": [ + { + "name": "\"allow\"" + }, + { + "name": "\"block\"" + } + ], + "expression": "[ServiceWorkerPolicy]<\"allow\"|\"block\">" + }, + "spec": [ + { + "type": "text", + "text": "Whether to allow sites to register Service workers. Defaults to `'allow'`." + }, + { + "type": "li", + "text": "`'allow'`: [Service Workers](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API) can be registered.", + "liType": "bullet" + }, + { + "type": "li", + "text": "`'block'`: Playwright will block all registration of Service Workers.", + "liType": "bullet" + } + ], + "required": false, + "comment": "Whether to allow sites to register Service workers. Defaults to `'allow'`.\n- `'allow'`: [Service Workers](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API) can be registered.\n- `'block'`: Playwright will block all registration of Service Workers.", + "deprecated": false, + "async": false, + "alias": "serviceWorkers", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.9", + "name": "strictSelectors", + "type": { + "name": "boolean", + "expression": "[boolean]" + }, + "spec": [ + { + "type": "text", + "text": "If specified, enables strict selectors mode for this context. In the strict selectors mode all operations on selectors that imply single target DOM element will throw when more than one element matches the selector. See `Locator` to learn more about the strict mode." + } + ], + "required": false, + "comment": "If specified, enables strict selectors mode for this context. In the strict selectors mode all operations on selectors\nthat imply single target DOM element will throw when more than one element matches the selector. See `Locator` to learn\nmore about the strict mode.", + "deprecated": false, + "async": false, + "alias": "strictSelectors", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "timezoneId", "type": { "name": "string", @@ -2537,11 +3474,15 @@ "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" + "alias": "timezoneId", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "userAgent", "type": { "name": "string", @@ -2557,7 +3498,9 @@ "comment": "Specific user agent to use in this context.", "deprecated": false, "async": false, - "alias": "userAgent" + "alias": "userAgent", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", @@ -2569,6 +3512,8 @@ "types": {}, "overrides": {} }, + "experimental": false, + "since": "v1.9", "name": "videoSize", "type": { "name": "Object", @@ -2576,6 +3521,8 @@ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "width", "type": { "name": "int", @@ -2591,11 +3538,15 @@ "comment": "Video frame width.", "deprecated": false, "async": false, - "alias": "width" + "alias": "width", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "height", "type": { "name": "int", @@ -2611,7 +3562,9 @@ "comment": "Video frame height.", "deprecated": false, "async": false, - "alias": "height" + "alias": "height", + "overloadIndex": 0, + "paramOrOption": null } ], "expression": "[Object]" @@ -2626,7 +3579,9 @@ "comment": "**DEPRECATED** Use `recordVideo` instead.", "deprecated": true, "async": false, - "alias": "videoSize" + "alias": "videoSize", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", @@ -2638,6 +3593,8 @@ "types": {}, "overrides": {} }, + "experimental": false, + "since": "v1.9", "name": "videosPath", "type": { "name": "path", @@ -2653,7 +3610,9 @@ "comment": "**DEPRECATED** Use `recordVideo` instead.", "deprecated": true, "async": false, - "alias": "videosPath" + "alias": "videosPath", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", @@ -2668,6 +3627,8 @@ "types": {}, "overrides": {} }, + "experimental": false, + "since": "v1.9", "name": "viewport", "type": { "name": "", @@ -2681,6 +3642,8 @@ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "width", "type": { "name": "int", @@ -2696,11 +3659,15 @@ "comment": "page width in pixels.", "deprecated": false, "async": false, - "alias": "width" + "alias": "width", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "height", "type": { "name": "int", @@ -2716,7 +3683,9 @@ "comment": "page height in pixels.", "deprecated": false, "async": false, - "alias": "height" + "alias": "height", + "overloadIndex": 0, + "paramOrOption": null } ] } @@ -2733,7 +3702,9 @@ "comment": "Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. `null` disables the default viewport.", "deprecated": false, "async": false, - "alias": "viewport" + "alias": "viewport", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", @@ -2747,6 +3718,8 @@ "types": {}, "overrides": {} }, + "experimental": false, + "since": "v1.9", "name": "viewport", "type": { "name": "", @@ -2760,6 +3733,8 @@ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "width", "type": { "name": "int", @@ -2775,11 +3750,15 @@ "comment": "page width in pixels.", "deprecated": false, "async": false, - "alias": "width" + "alias": "width", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "height", "type": { "name": "int", @@ -2795,7 +3774,9 @@ "comment": "page height in pixels.", "deprecated": false, "async": false, - "alias": "height" + "alias": "height", + "overloadIndex": 0, + "paramOrOption": null } ] } @@ -2812,7 +3793,9 @@ "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" + "alias": "viewport", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", @@ -2824,6 +3807,8 @@ "types": {}, "overrides": {} }, + "experimental": false, + "since": "v1.9", "name": "viewport", "type": { "name": "", @@ -2837,6 +3822,8 @@ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "width", "type": { "name": "int", @@ -2852,11 +3839,15 @@ "comment": "page width in pixels.", "deprecated": false, "async": false, - "alias": "width" + "alias": "width", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "height", "type": { "name": "int", @@ -2872,7 +3863,9 @@ "comment": "page height in pixels.", "deprecated": false, "async": false, - "alias": "height" + "alias": "height", + "overloadIndex": 0, + "paramOrOption": null } ] } @@ -2889,7 +3882,9 @@ "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" + "alias": "viewport", + "overloadIndex": 0, + "paramOrOption": null } ] }, @@ -2897,13 +3892,17 @@ "comment": "", "deprecated": false, "async": false, - "alias": "options" + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null } ] }, { "kind": "method", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "longTap", "type": { "name": "void" @@ -2919,10 +3918,14 @@ "deprecated": false, "async": true, "alias": "longTap", + "overloadIndex": 0, + "paramOrOption": null, "args": [ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "selector", "type": { "name": "AndroidSelector", @@ -2938,11 +3941,15 @@ "comment": "Selector to tap on.", "deprecated": false, "async": false, - "alias": "selector" + "alias": "selector", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "options", "type": { "name": "Object", @@ -2957,6 +3964,8 @@ "types": {}, "overrides": {} }, + "experimental": false, + "since": "v1.9", "name": "timeout", "type": { "name": "float", @@ -2972,7 +3981,9 @@ "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" + "alias": "timeout", + "overloadIndex": 0, + "paramOrOption": null } ] }, @@ -2980,13 +3991,17 @@ "comment": "", "deprecated": false, "async": false, - "alias": "options" + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null } ] }, { "kind": "method", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "model", "type": { "name": "string", @@ -3003,11 +4018,15 @@ "deprecated": false, "async": false, "alias": "model", + "overloadIndex": 0, + "paramOrOption": null, "args": [] }, { "kind": "method", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "open", "type": { "name": "AndroidSocket", @@ -3024,10 +4043,14 @@ "deprecated": false, "async": true, "alias": "open", + "overloadIndex": 0, + "paramOrOption": null, "args": [ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "command", "type": { "name": "string", @@ -3038,13 +4061,17 @@ "comment": "", "deprecated": false, "async": false, - "alias": "command" + "alias": "command", + "overloadIndex": 0, + "paramOrOption": null } ] }, { "kind": "method", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "pinchClose", "type": { "name": "void" @@ -3060,10 +4087,14 @@ "deprecated": false, "async": true, "alias": "pinchClose", + "overloadIndex": 0, + "paramOrOption": null, "args": [ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "selector", "type": { "name": "AndroidSelector", @@ -3079,11 +4110,15 @@ "comment": "Selector to pinch close.", "deprecated": false, "async": false, - "alias": "selector" + "alias": "selector", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "percent", "type": { "name": "float", @@ -3099,11 +4134,15 @@ "comment": "The size of the pinch as a percentage of the widget's size.", "deprecated": false, "async": false, - "alias": "percent" + "alias": "percent", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "options", "type": { "name": "Object", @@ -3111,6 +4150,8 @@ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "speed", "type": { "name": "float", @@ -3126,7 +4167,9 @@ "comment": "Optional speed of the pinch in pixels per second.", "deprecated": false, "async": false, - "alias": "speed" + "alias": "speed", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", @@ -3138,6 +4181,8 @@ "types": {}, "overrides": {} }, + "experimental": false, + "since": "v1.9", "name": "timeout", "type": { "name": "float", @@ -3153,7 +4198,9 @@ "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" + "alias": "timeout", + "overloadIndex": 0, + "paramOrOption": null } ] }, @@ -3161,13 +4208,17 @@ "comment": "", "deprecated": false, "async": false, - "alias": "options" + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null } ] }, { "kind": "method", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "pinchOpen", "type": { "name": "void" @@ -3183,10 +4234,14 @@ "deprecated": false, "async": true, "alias": "pinchOpen", + "overloadIndex": 0, + "paramOrOption": null, "args": [ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "selector", "type": { "name": "AndroidSelector", @@ -3202,11 +4257,15 @@ "comment": "Selector to pinch open.", "deprecated": false, "async": false, - "alias": "selector" + "alias": "selector", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "percent", "type": { "name": "float", @@ -3222,11 +4281,15 @@ "comment": "The size of the pinch as a percentage of the widget's size.", "deprecated": false, "async": false, - "alias": "percent" + "alias": "percent", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "options", "type": { "name": "Object", @@ -3234,6 +4297,8 @@ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "speed", "type": { "name": "float", @@ -3249,7 +4314,9 @@ "comment": "Optional speed of the pinch in pixels per second.", "deprecated": false, "async": false, - "alias": "speed" + "alias": "speed", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", @@ -3261,6 +4328,8 @@ "types": {}, "overrides": {} }, + "experimental": false, + "since": "v1.9", "name": "timeout", "type": { "name": "float", @@ -3276,7 +4345,9 @@ "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" + "alias": "timeout", + "overloadIndex": 0, + "paramOrOption": null } ] }, @@ -3284,13 +4355,17 @@ "comment": "", "deprecated": false, "async": false, - "alias": "options" + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null } ] }, { "kind": "method", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "press", "type": { "name": "void" @@ -3306,10 +4381,14 @@ "deprecated": false, "async": true, "alias": "press", + "overloadIndex": 0, + "paramOrOption": null, "args": [ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "selector", "type": { "name": "AndroidSelector", @@ -3325,11 +4404,15 @@ "comment": "Selector to press the key in.", "deprecated": false, "async": false, - "alias": "selector" + "alias": "selector", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "key", "type": { "name": "AndroidKey", @@ -3345,11 +4428,15 @@ "comment": "The key to press.", "deprecated": false, "async": false, - "alias": "key" + "alias": "key", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "options", "type": { "name": "Object", @@ -3364,6 +4451,8 @@ "types": {}, "overrides": {} }, + "experimental": false, + "since": "v1.9", "name": "timeout", "type": { "name": "float", @@ -3379,7 +4468,9 @@ "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" + "alias": "timeout", + "overloadIndex": 0, + "paramOrOption": null } ] }, @@ -3387,13 +4478,17 @@ "comment": "", "deprecated": false, "async": false, - "alias": "options" + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null } ] }, { "kind": "method", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "push", "type": { "name": "void" @@ -3409,10 +4504,14 @@ "deprecated": false, "async": true, "alias": "push", + "overloadIndex": 0, + "paramOrOption": null, "args": [ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "file", "type": { "name": "", @@ -3436,11 +4535,15 @@ "comment": "Either a path to the file, or file content.", "deprecated": false, "async": false, - "alias": "file" + "alias": "file", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "path", "type": { "name": "string", @@ -3456,11 +4559,15 @@ "comment": "Path to the file on the device.", "deprecated": false, "async": false, - "alias": "path" + "alias": "path", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "options", "type": { "name": "Object", @@ -3468,6 +4575,8 @@ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "mode", "type": { "name": "int", @@ -3483,7 +4592,9 @@ "comment": "Optional file mode, defaults to `644` (`rw-r--r--`).", "deprecated": false, "async": false, - "alias": "mode" + "alias": "mode", + "overloadIndex": 0, + "paramOrOption": null } ] }, @@ -3491,13 +4602,17 @@ "comment": "", "deprecated": false, "async": false, - "alias": "options" + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null } ] }, { "kind": "method", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "screenshot", "type": { "name": "Buffer", @@ -3514,10 +4629,14 @@ "deprecated": false, "async": true, "alias": "screenshot", + "overloadIndex": 0, + "paramOrOption": null, "args": [ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "options", "type": { "name": "Object", @@ -3525,6 +4644,8 @@ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "path", "type": { "name": "path", @@ -3540,7 +4661,9 @@ "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" + "alias": "path", + "overloadIndex": 0, + "paramOrOption": null } ] }, @@ -3548,13 +4671,17 @@ "comment": "", "deprecated": false, "async": false, - "alias": "options" + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null } ] }, { "kind": "method", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "scroll", "type": { "name": "void" @@ -3570,10 +4697,14 @@ "deprecated": false, "async": true, "alias": "scroll", + "overloadIndex": 0, + "paramOrOption": null, "args": [ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "selector", "type": { "name": "AndroidSelector", @@ -3589,11 +4720,15 @@ "comment": "Selector to scroll.", "deprecated": false, "async": false, - "alias": "selector" + "alias": "selector", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "direction", "type": { "name": "AndroidScrollDirection", @@ -3623,11 +4758,15 @@ "comment": "Scroll direction.", "deprecated": false, "async": false, - "alias": "direction" + "alias": "direction", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "percent", "type": { "name": "float", @@ -3643,11 +4782,15 @@ "comment": "Distance to scroll as a percentage of the widget's size.", "deprecated": false, "async": false, - "alias": "percent" + "alias": "percent", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "options", "type": { "name": "Object", @@ -3655,6 +4798,8 @@ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "speed", "type": { "name": "float", @@ -3670,7 +4815,9 @@ "comment": "Optional speed of the scroll in pixels per second.", "deprecated": false, "async": false, - "alias": "speed" + "alias": "speed", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", @@ -3682,6 +4829,8 @@ "types": {}, "overrides": {} }, + "experimental": false, + "since": "v1.9", "name": "timeout", "type": { "name": "float", @@ -3697,7 +4846,9 @@ "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" + "alias": "timeout", + "overloadIndex": 0, + "paramOrOption": null } ] }, @@ -3705,13 +4856,17 @@ "comment": "", "deprecated": false, "async": false, - "alias": "options" + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null } ] }, { "kind": "method", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "serial", "type": { "name": "string", @@ -3728,11 +4883,15 @@ "deprecated": false, "async": false, "alias": "serial", + "overloadIndex": 0, + "paramOrOption": null, "args": [] }, { "kind": "method", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "setDefaultTimeout", "type": { "name": "void" @@ -3748,10 +4907,14 @@ "deprecated": false, "async": false, "alias": "setDefaultTimeout", + "overloadIndex": 0, + "paramOrOption": null, "args": [ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "timeout", "type": { "name": "float", @@ -3767,13 +4930,17 @@ "comment": "Maximum time in milliseconds", "deprecated": false, "async": false, - "alias": "timeout" + "alias": "timeout", + "overloadIndex": 0, + "paramOrOption": null } ] }, { "kind": "method", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "shell", "type": { "name": "Buffer", @@ -3790,10 +4957,14 @@ "deprecated": false, "async": true, "alias": "shell", + "overloadIndex": 0, + "paramOrOption": null, "args": [ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "command", "type": { "name": "string", @@ -3809,13 +4980,17 @@ "comment": "Shell command to execute.", "deprecated": false, "async": false, - "alias": "command" + "alias": "command", + "overloadIndex": 0, + "paramOrOption": null } ] }, { "kind": "method", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "swipe", "type": { "name": "void" @@ -3831,10 +5006,14 @@ "deprecated": false, "async": true, "alias": "swipe", + "overloadIndex": 0, + "paramOrOption": null, "args": [ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "selector", "type": { "name": "AndroidSelector", @@ -3850,11 +5029,15 @@ "comment": "Selector to swipe.", "deprecated": false, "async": false, - "alias": "selector" + "alias": "selector", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "direction", "type": { "name": "AndroidSwipeDirection", @@ -3884,11 +5067,15 @@ "comment": "Swipe direction.", "deprecated": false, "async": false, - "alias": "direction" + "alias": "direction", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "percent", "type": { "name": "float", @@ -3904,11 +5091,15 @@ "comment": "Distance to swipe as a percentage of the widget's size.", "deprecated": false, "async": false, - "alias": "percent" + "alias": "percent", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "options", "type": { "name": "Object", @@ -3916,6 +5107,8 @@ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "speed", "type": { "name": "float", @@ -3931,7 +5124,9 @@ "comment": "Optional speed of the swipe in pixels per second.", "deprecated": false, "async": false, - "alias": "speed" + "alias": "speed", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", @@ -3943,6 +5138,8 @@ "types": {}, "overrides": {} }, + "experimental": false, + "since": "v1.9", "name": "timeout", "type": { "name": "float", @@ -3958,7 +5155,9 @@ "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" + "alias": "timeout", + "overloadIndex": 0, + "paramOrOption": null } ] }, @@ -3966,13 +5165,17 @@ "comment": "", "deprecated": false, "async": false, - "alias": "options" + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null } ] }, { "kind": "method", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "tap", "type": { "name": "void" @@ -3988,10 +5191,14 @@ "deprecated": false, "async": true, "alias": "tap", + "overloadIndex": 0, + "paramOrOption": null, "args": [ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "selector", "type": { "name": "AndroidSelector", @@ -4007,11 +5214,15 @@ "comment": "Selector to tap on.", "deprecated": false, "async": false, - "alias": "selector" + "alias": "selector", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "options", "type": { "name": "Object", @@ -4019,6 +5230,8 @@ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "duration", "type": { "name": "float", @@ -4034,7 +5247,9 @@ "comment": "Optional duration of the tap in milliseconds.", "deprecated": false, "async": false, - "alias": "duration" + "alias": "duration", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", @@ -4046,6 +5261,8 @@ "types": {}, "overrides": {} }, + "experimental": false, + "since": "v1.9", "name": "timeout", "type": { "name": "float", @@ -4061,7 +5278,9 @@ "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" + "alias": "timeout", + "overloadIndex": 0, + "paramOrOption": null } ] }, @@ -4069,13 +5288,17 @@ "comment": "", "deprecated": false, "async": false, - "alias": "options" + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null } ] }, { "kind": "method", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "wait", "type": { "name": "void" @@ -4091,10 +5314,14 @@ "deprecated": false, "async": true, "alias": "wait", + "overloadIndex": 0, + "paramOrOption": null, "args": [ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "selector", "type": { "name": "AndroidSelector", @@ -4110,11 +5337,15 @@ "comment": "Selector to wait for.", "deprecated": false, "async": false, - "alias": "selector" + "alias": "selector", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "options", "type": { "name": "Object", @@ -4122,10 +5353,17 @@ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "state", "type": { - "name": "\"gone\"", - "expression": "\"gone\"" + "name": "AndroidDeviceState", + "union": [ + { + "name": "\"gone\"" + } + ], + "expression": "[AndroidDeviceState]<\"gone\">" }, "spec": [ { @@ -4147,7 +5385,9 @@ "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" + "alias": "state", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", @@ -4159,6 +5399,8 @@ "types": {}, "overrides": {} }, + "experimental": false, + "since": "v1.9", "name": "timeout", "type": { "name": "float", @@ -4174,7 +5416,9 @@ "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" + "alias": "timeout", + "overloadIndex": 0, + "paramOrOption": null } ] }, @@ -4182,13 +5426,17 @@ "comment": "", "deprecated": false, "async": false, - "alias": "options" + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null } ] }, { "kind": "method", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "waitForEvent", "type": { "name": "any", @@ -4205,10 +5453,23 @@ "deprecated": false, "async": true, "alias": "waitForEvent", + "overloadIndex": 0, + "paramOrOption": null, "args": [ { "kind": "property", - "langs": {}, + "langs": { + "only": [ + "js", + "python", + "java" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.9", "name": "event", "type": { "name": "string", @@ -4224,11 +5485,15 @@ "comment": "Event name, same one typically passed into `*.on(event)`.", "deprecated": false, "async": false, - "alias": "event" + "alias": "event", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "optionsOrPredicate", "type": { "name": "", @@ -4242,6 +5507,8 @@ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "predicate", "type": { "name": "function", @@ -4257,11 +5524,15 @@ "comment": "receives the event data and resolves to truthy value when the waiting should resolve.", "deprecated": false, "async": false, - "alias": "predicate" + "alias": "predicate", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "timeout", "type": { "name": "float", @@ -4277,7 +5548,9 @@ "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" + "alias": "timeout", + "overloadIndex": 0, + "paramOrOption": null } ] } @@ -4294,13 +5567,17 @@ "comment": "Either a predicate that receives an event or an options object. Optional.", "deprecated": false, "async": false, - "alias": "optionsOrPredicate" + "alias": "optionsOrPredicate", + "overloadIndex": 0, + "paramOrOption": null } ] }, { "kind": "method", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "webView", "type": { "name": "AndroidWebView", @@ -4317,10 +5594,14 @@ "deprecated": false, "async": true, "alias": "webView", + "overloadIndex": 0, + "paramOrOption": null, "args": [ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "selector", "type": { "name": "Object", @@ -4328,6 +5609,8 @@ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "pkg", "type": { "name": "string", @@ -4336,14 +5619,40 @@ "spec": [ { "type": "text", - "text": "Package identifier." + "text": "Optional Package identifier." } ], - "required": true, - "comment": "Package identifier.", + "required": false, + "comment": "Optional Package identifier.", + "deprecated": false, + "async": false, + "alias": "pkg", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "socketName", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "Optional webview socket name." + } + ], + "required": false, + "comment": "Optional webview socket name.", "deprecated": false, "async": false, - "alias": "pkg" + "alias": "socketName", + "overloadIndex": 0, + "paramOrOption": null } ], "expression": "[Object]" @@ -4353,11 +5662,15 @@ "comment": "", "deprecated": false, "async": false, - "alias": "selector" + "alias": "selector", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "options", "type": { "name": "Object", @@ -4372,6 +5685,8 @@ "types": {}, "overrides": {} }, + "experimental": false, + "since": "v1.9", "name": "timeout", "type": { "name": "float", @@ -4387,7 +5702,9 @@ "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" + "alias": "timeout", + "overloadIndex": 0, + "paramOrOption": null } ] }, @@ -4395,13 +5712,17 @@ "comment": "", "deprecated": false, "async": false, - "alias": "options" + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null } ] }, { "kind": "method", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "webViews", "type": { "name": "Array", @@ -4423,6 +5744,8 @@ "deprecated": false, "async": false, "alias": "webViews", + "overloadIndex": 0, + "paramOrOption": null, "args": [] } ] @@ -4442,6 +5765,8 @@ { "kind": "method", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "drag", "type": { "name": "void" @@ -4457,10 +5782,14 @@ "deprecated": false, "async": true, "alias": "drag", + "overloadIndex": 0, + "paramOrOption": null, "args": [ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "from", "type": { "name": "Object", @@ -4468,6 +5797,8 @@ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "x", "type": { "name": "float", @@ -4483,11 +5814,15 @@ "comment": "", "deprecated": false, "async": false, - "alias": "x" + "alias": "x", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "y", "type": { "name": "float", @@ -4503,7 +5838,9 @@ "comment": "", "deprecated": false, "async": false, - "alias": "y" + "alias": "y", + "overloadIndex": 0, + "paramOrOption": null } ], "expression": "[Object]" @@ -4518,11 +5855,15 @@ "comment": "The start point of the drag.", "deprecated": false, "async": false, - "alias": "from" + "alias": "from", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "to", "type": { "name": "Object", @@ -4530,6 +5871,8 @@ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "x", "type": { "name": "float", @@ -4545,11 +5888,15 @@ "comment": "", "deprecated": false, "async": false, - "alias": "x" + "alias": "x", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "y", "type": { "name": "float", @@ -4565,7 +5912,9 @@ "comment": "", "deprecated": false, "async": false, - "alias": "y" + "alias": "y", + "overloadIndex": 0, + "paramOrOption": null } ], "expression": "[Object]" @@ -4580,11 +5929,15 @@ "comment": "The end point of the drag.", "deprecated": false, "async": false, - "alias": "to" + "alias": "to", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "steps", "type": { "name": "int", @@ -4600,13 +5953,17 @@ "comment": "The number of steps in the drag. Each step takes 5 milliseconds to complete.", "deprecated": false, "async": false, - "alias": "steps" + "alias": "steps", + "overloadIndex": 0, + "paramOrOption": null } ] }, { "kind": "method", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "press", "type": { "name": "void" @@ -4622,10 +5979,14 @@ "deprecated": false, "async": true, "alias": "press", + "overloadIndex": 0, + "paramOrOption": null, "args": [ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "key", "type": { "name": "AndroidKey", @@ -4641,13 +6002,17 @@ "comment": "Key to press.", "deprecated": false, "async": false, - "alias": "key" + "alias": "key", + "overloadIndex": 0, + "paramOrOption": null } ] }, { "kind": "method", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "swipe", "type": { "name": "void" @@ -4663,10 +6028,14 @@ "deprecated": false, "async": true, "alias": "swipe", + "overloadIndex": 0, + "paramOrOption": null, "args": [ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "from", "type": { "name": "Object", @@ -4674,6 +6043,8 @@ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "x", "type": { "name": "float", @@ -4689,11 +6060,15 @@ "comment": "", "deprecated": false, "async": false, - "alias": "x" + "alias": "x", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "y", "type": { "name": "float", @@ -4709,7 +6084,9 @@ "comment": "", "deprecated": false, "async": false, - "alias": "y" + "alias": "y", + "overloadIndex": 0, + "paramOrOption": null } ], "expression": "[Object]" @@ -4724,11 +6101,15 @@ "comment": "The point to start swiping from.", "deprecated": false, "async": false, - "alias": "from" + "alias": "from", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "segments", "type": { "name": "Array", @@ -4739,6 +6120,8 @@ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "x", "type": { "name": "float", @@ -4754,11 +6137,15 @@ "comment": "", "deprecated": false, "async": false, - "alias": "x" + "alias": "x", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "y", "type": { "name": "float", @@ -4774,7 +6161,9 @@ "comment": "", "deprecated": false, "async": false, - "alias": "y" + "alias": "y", + "overloadIndex": 0, + "paramOrOption": null } ] } @@ -4791,11 +6180,15 @@ "comment": "Points following the `from` point in the swipe gesture.", "deprecated": false, "async": false, - "alias": "segments" + "alias": "segments", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "steps", "type": { "name": "int", @@ -4811,13 +6204,17 @@ "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" + "alias": "steps", + "overloadIndex": 0, + "paramOrOption": null } ] }, { "kind": "method", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "tap", "type": { "name": "void" @@ -4833,10 +6230,14 @@ "deprecated": false, "async": true, "alias": "tap", + "overloadIndex": 0, + "paramOrOption": null, "args": [ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "point", "type": { "name": "Object", @@ -4844,6 +6245,8 @@ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "x", "type": { "name": "float", @@ -4859,11 +6262,15 @@ "comment": "", "deprecated": false, "async": false, - "alias": "x" + "alias": "x", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "y", "type": { "name": "float", @@ -4879,7 +6286,9 @@ "comment": "", "deprecated": false, "async": false, - "alias": "y" + "alias": "y", + "overloadIndex": 0, + "paramOrOption": null } ], "expression": "[Object]" @@ -4894,13 +6303,17 @@ "comment": "The point to tap at.", "deprecated": false, "async": false, - "alias": "point" + "alias": "point", + "overloadIndex": 0, + "paramOrOption": null } ] }, { "kind": "method", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "type", "type": { "name": "void" @@ -4916,10 +6329,14 @@ "deprecated": false, "async": true, "alias": "type", + "overloadIndex": 0, + "paramOrOption": null, "args": [ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "text", "type": { "name": "string", @@ -4935,7 +6352,9 @@ "comment": "Text to type.", "deprecated": false, "async": false, - "alias": "text" + "alias": "text", + "overloadIndex": 0, + "paramOrOption": null } ] } @@ -4962,6 +6381,8 @@ { "kind": "event", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "close", "type": { "name": "void" @@ -4977,11 +6398,15 @@ "deprecated": false, "async": false, "alias": "close", + "overloadIndex": 0, + "paramOrOption": null, "args": [] }, { "kind": "event", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "data", "type": { "name": "Buffer", @@ -4998,11 +6423,15 @@ "deprecated": false, "async": false, "alias": "data", + "overloadIndex": 0, + "paramOrOption": null, "args": [] }, { "kind": "method", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "close", "type": { "name": "void" @@ -5018,11 +6447,15 @@ "deprecated": false, "async": true, "alias": "close", + "overloadIndex": 0, + "paramOrOption": null, "args": [] }, { "kind": "method", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "write", "type": { "name": "void" @@ -5038,10 +6471,14 @@ "deprecated": false, "async": true, "alias": "write", + "overloadIndex": 0, + "paramOrOption": null, "args": [ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "data", "type": { "name": "Buffer", @@ -5057,7 +6494,9 @@ "comment": "Data to write.", "deprecated": false, "async": false, - "alias": "data" + "alias": "data", + "overloadIndex": 0, + "paramOrOption": null } ] } @@ -5084,6 +6523,8 @@ { "kind": "event", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "close", "type": { "name": "void" @@ -5099,11 +6540,15 @@ "deprecated": false, "async": false, "alias": "close", + "overloadIndex": 0, + "paramOrOption": null, "args": [] }, { "kind": "method", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "page", "type": { "name": "Page", @@ -5120,11 +6565,15 @@ "deprecated": false, "async": true, "alias": "page", + "overloadIndex": 0, + "paramOrOption": null, "args": [] }, { "kind": "method", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "pid", "type": { "name": "int", @@ -5141,11 +6590,15 @@ "deprecated": false, "async": false, "alias": "pid", + "overloadIndex": 0, + "paramOrOption": null, "args": [] }, { "kind": "method", "langs": {}, + "experimental": false, + "since": "v1.9", "name": "pkg", "type": { "name": "string", @@ -5162,351 +6615,52 @@ "deprecated": false, "async": false, "alias": "pkg", + "overloadIndex": 0, + "paramOrOption": null, "args": [] } ] }, { - "name": "Browser", + "name": "APIRequest", "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" + "text": "Exposes API that can be used for the Web API testing. This class is used for creating `APIRequestContext` instance which in turn can be used for sending web requests. An instance of this class can be obtained via [`property: Playwright.request`]. For more information see `APIRequestContext`." } ], - "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", + "comment": "Exposes API that can be used for the Web API testing. This class is used for creating `APIRequestContext` instance which\nin turn can be used for sending web requests. An instance of this class can be obtained via\n[`property: Playwright.request`]. For more information see `APIRequestContext`.", "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" - } - ], - "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", - "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": {}, + "experimental": false, + "since": "v1.16", "name": "newContext", "type": { - "name": "BrowserContext", - "expression": "[BrowserContext]" + "name": "APIRequestContext", + "expression": "[APIRequestContext]" }, "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" + "text": "Creates new instances of `APIRequestContext`." } ], "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", + "comment": "Creates new instances of `APIRequestContext`.", "deprecated": false, "async": true, "alias": "newContext", + "overloadIndex": 0, + "paramOrOption": null, "args": [ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "options", "type": { "name": "Object", @@ -5514,97 +6668,47 @@ { "kind": "property", "langs": {}, - "name": "acceptDownloads", + "experimental": false, + "since": "v1.16", + "name": "baseURL", "type": { - "name": "boolean", - "expression": "[boolean]" + "name": "string", + "expression": "[string]" }, "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": [ + "text": "Methods like [`method: APIRequestContext.get`] take the base URL into consideration by using the [`URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor for building the corresponding URL. Examples:" + }, { - "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": "li", + "text": "baseURL: `http://localhost:3000` and sending request to `/bar.html` results in `http://localhost:3000/bar.html`", + "liType": "bullet" + }, { - "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": "li", + "text": "baseURL: `http://localhost:3000/foo/` and sending request to `./bar.html` results in `http://localhost:3000/foo/bar.html`", + "liType": "bullet" + }, { - "type": "text", - "text": "Specify device scale factor (can be thought of as dpr). Defaults to `1`." + "type": "li", + "text": "baseURL: `http://localhost:3000/foo` (without trailing slash) and navigating to `./bar.html` results in `http://localhost:3000/bar.html`", + "liType": "bullet" } ], "required": false, - "comment": "Specify device scale factor (can be thought of as dpr). Defaults to `1`.", + "comment": "Methods like [`method: APIRequestContext.get`] take the base URL into consideration by using the\n[`URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor for building the corresponding URL.\nExamples:\n- baseURL: `http://localhost:3000` and sending request to `/bar.html` results in `http://localhost:3000/bar.html`\n- baseURL: `http://localhost:3000/foo/` and sending request to `./bar.html` results in\n `http://localhost:3000/foo/bar.html`\n- baseURL: `http://localhost:3000/foo` (without trailing slash) and navigating to `./bar.html` results in\n `http://localhost:3000/bar.html`", "deprecated": false, "async": false, - "alias": "deviceScaleFactor" + "alias": "baseURL", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.16", "name": "extraHTTPHeaders", "type": { "name": "Object", @@ -5621,115 +6725,22 @@ "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." + "text": "An object containing additional HTTP headers to be sent with every request." } ], "required": false, - "comment": "Specifies if viewport supports touch events. Defaults to false.", + "comment": "An object containing additional HTTP headers to be sent with every request.", "deprecated": false, "async": false, - "alias": "hasTouch" + "alias": "extraHTTPHeaders", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.16", "name": "httpCredentials", "type": { "name": "Object", @@ -5737,6 +6748,8 @@ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "username", "type": { "name": "string", @@ -5752,11 +6765,15 @@ "comment": "", "deprecated": false, "async": false, - "alias": "username" + "alias": "username", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "password", "type": { "name": "string", @@ -5772,7 +6789,9 @@ "comment": "", "deprecated": false, "async": false, - "alias": "password" + "alias": "password", + "overloadIndex": 0, + "paramOrOption": null } ], "expression": "[Object]" @@ -5787,11 +6806,15 @@ "comment": "Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication).", "deprecated": false, "async": false, - "alias": "httpCredentials" + "alias": "httpCredentials", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.16", "name": "ignoreHTTPSErrors", "type": { "name": "boolean", @@ -5800,177 +6823,22 @@ "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." + "text": "Whether to ignore HTTPS errors when sending network requests. Defaults to `false`." } ], "required": false, - "comment": "A list of permissions to grant to all pages in this context. See [`method: BrowserContext.grantPermissions`] for more\ndetails.", + "comment": "Whether to ignore HTTPS errors when sending network requests. Defaults to `false`.", "deprecated": false, "async": false, - "alias": "permissions" + "alias": "ignoreHTTPSErrors", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.16", "name": "proxy", "type": { "name": "Object", @@ -5978,6 +6846,8 @@ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "server", "type": { "name": "string", @@ -5993,11 +6863,15 @@ "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" + "alias": "server", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "bypass", "type": { "name": "string", @@ -6006,18 +6880,22 @@ "spec": [ { "type": "text", - "text": "Optional coma-separated domains to bypass proxy, for example `\".com, chromium.org, .domain.com\"`." + "text": "Optional comma-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\"`.", + "comment": "Optional comma-separated domains to bypass proxy, for example `\".com, chromium.org, .domain.com\"`.", "deprecated": false, "async": false, - "alias": "bypass" + "alias": "bypass", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "username", "type": { "name": "string", @@ -6033,11 +6911,15 @@ "comment": "Optional username to use if HTTP proxy requires authentication.", "deprecated": false, "async": false, - "alias": "username" + "alias": "username", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "password", "type": { "name": "string", @@ -6053,81 +6935,9 @@ "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" + "alias": "password", + "overloadIndex": 0, + "paramOrOption": null } ], "expression": "[Object]" @@ -6135,395 +6945,57 @@ "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`." + "text": "Network proxy settings." } ], "required": false, - "comment": "Optional setting to control whether to omit request content from the HAR. Defaults to `false`.", + "comment": "Network proxy settings.", "deprecated": false, "async": false, - "alias": "recordHarOmitContent" + "alias": "proxy", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": { "only": [ - "csharp", - "java", + "js", "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", + "experimental": false, + "since": "v1.16", + "name": "storageState", "type": { - "name": "Object", - "properties": [ + "name": "", + "union": [ { - "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" + "name": "path" }, { - "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": { - "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": {}, + "experimental": false, + "since": "v1.0", + "name": "cookies", + "type": { + "name": "Array", + "templates": [ { "name": "Object", "properties": [ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "name", "type": { "name": "string", @@ -6539,11 +7011,15 @@ "comment": "", "deprecated": false, "async": false, - "alias": "name" + "alias": "name", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "value", "type": { "name": "string", @@ -6559,31 +7035,15 @@ "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" + "alias": "value", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "domain", "type": { "name": "string", @@ -6592,18 +7052,22 @@ "spec": [ { "type": "text", - "text": "Optional either url or domain / path are required" + "text": "" } ], - "required": false, - "comment": "Optional either url or domain / path are required", + "required": true, + "comment": "", "deprecated": false, "async": false, - "alias": "domain" + "alias": "domain", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "path", "type": { "name": "string", @@ -6612,18 +7076,22 @@ "spec": [ { "type": "text", - "text": "Optional either url or domain / path are required" + "text": "" } ], - "required": false, - "comment": "Optional either url or domain / path are required", + "required": true, + "comment": "", "deprecated": false, "async": false, - "alias": "path" + "alias": "path", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "expires", "type": { "name": "float", @@ -6632,18 +7100,22 @@ "spec": [ { "type": "text", - "text": "Optional Unix time in seconds." + "text": "Unix time in seconds." } ], - "required": false, - "comment": "Optional Unix time in seconds.", + "required": true, + "comment": "Unix time in seconds.", "deprecated": false, "async": false, - "alias": "expires" + "alias": "expires", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "httpOnly", "type": { "name": "boolean", @@ -6652,18 +7124,22 @@ "spec": [ { "type": "text", - "text": "Optional httpOnly flag" + "text": "" } ], - "required": false, - "comment": "Optional httpOnly flag", + "required": true, + "comment": "", "deprecated": false, "async": false, - "alias": "httpOnly" + "alias": "httpOnly", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "secure", "type": { "name": "boolean", @@ -6672,18 +7148,22 @@ "spec": [ { "type": "text", - "text": "Optional secure flag" + "text": "" } ], - "required": false, - "comment": "Optional secure flag", + "required": true, + "comment": "", "deprecated": false, "async": false, - "alias": "secure" + "alias": "secure", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "sameSite", "type": { "name": "SameSiteAttribute", @@ -6703,14 +7183,16 @@ "spec": [ { "type": "text", - "text": "Optional sameSite flag" + "text": "" } ], - "required": false, - "comment": "Optional sameSite flag", + "required": true, + "comment": "", "deprecated": false, "async": false, - "alias": "sameSite" + "alias": "sameSite", + "overloadIndex": 0, + "paramOrOption": null } ] } @@ -6720,18 +7202,22 @@ "spec": [ { "type": "text", - "text": "Optional cookies to set for context" + "text": "" } ], - "required": false, - "comment": "Optional cookies to set for context", + "required": true, + "comment": "", "deprecated": false, "async": false, - "alias": "cookies" + "alias": "cookies", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "origins", "type": { "name": "Array", @@ -6742,6 +7228,8 @@ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "origin", "type": { "name": "string", @@ -6757,11 +7245,15 @@ "comment": "", "deprecated": false, "async": false, - "alias": "origin" + "alias": "origin", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "localStorage", "type": { "name": "Array", @@ -6772,6 +7264,8 @@ { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "name", "type": { "name": "string", @@ -6787,11 +7281,15 @@ "comment": "", "deprecated": false, "async": false, - "alias": "name" + "alias": "name", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "value", "type": { "name": "string", @@ -6807,7 +7305,9 @@ "comment": "", "deprecated": false, "async": false, - "alias": "value" + "alias": "value", + "overloadIndex": 0, + "paramOrOption": null } ] } @@ -6824,7 +7324,9 @@ "comment": "", "deprecated": false, "async": false, - "alias": "localStorage" + "alias": "localStorage", + "overloadIndex": 0, + "paramOrOption": null } ] } @@ -6834,14 +7336,16 @@ "spec": [ { "type": "text", - "text": "Optional localStorage to set for context" + "text": "" } ], - "required": false, - "comment": "Optional localStorage to set for context", + "required": true, + "comment": "", "deprecated": false, "async": false, - "alias": "origins" + "alias": "origins", + "overloadIndex": 0, + "paramOrOption": null } ] } @@ -6851,26 +7355,30 @@ "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:" + "text": "Populates context with given storage state. This option can be used to initialize context with logged-in information obtained via [`method: BrowserContext.storageState`] or [`method: APIRequestContext.storageState`]. Either a path to the file with saved storage, or the value returned by one of [`method: BrowserContext.storageState`] or [`method: APIRequestContext.storageState`] methods." } ], "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:", + "comment": "Populates context with given storage state. This option can be used to initialize context with logged-in information\nobtained via [`method: BrowserContext.storageState`] or [`method: APIRequestContext.storageState`]. Either a path to the\nfile with saved storage, or the value returned by one of [`method: BrowserContext.storageState`] or\n[`method: APIRequestContext.storageState`] methods.", "deprecated": false, "async": false, - "alias": "storageState" + "alias": "storageState", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": { "only": [ - "csharp", - "java" + "java", + "csharp" ], "aliases": {}, "types": {}, "overrides": {} }, + "experimental": false, + "since": "v1.16", "name": "storageState", "type": { "name": "string", @@ -6879,14 +7387,16 @@ "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`]." + "text": "Populates context with given storage state. This option can be used to initialize context with logged-in information obtained via [`method: BrowserContext.storageState`] or [`method: APIRequestContext.storageState`]. Either a path to the file with saved storage, or the value returned by one of [`method: BrowserContext.storageState`] or [`method: APIRequestContext.storageState`] methods." } ], "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`].", + "comment": "Populates context with given storage state. This option can be used to initialize context with logged-in information\nobtained via [`method: BrowserContext.storageState`] or [`method: APIRequestContext.storageState`]. Either a path to the\nfile with saved storage, or the value returned by one of [`method: BrowserContext.storageState`] or\n[`method: APIRequestContext.storageState`] methods.", "deprecated": false, "async": false, - "alias": "storageState" + "alias": "storageState", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", @@ -6899,6 +7409,8 @@ "types": {}, "overrides": {} }, + "experimental": false, + "since": "v1.18", "name": "storageStatePath", "type": { "name": "path", @@ -6914,31 +7426,39 @@ "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" + "alias": "storageStatePath", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, - "name": "timezoneId", + "experimental": false, + "since": "v1.16", + "name": "timeout", "type": { - "name": "string", - "expression": "[string]" + "name": "float", + "expression": "[float]" }, "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." + "text": "Maximum time in milliseconds to wait for the response. Defaults to `30000` (30 seconds). Pass `0` to disable timeout." } ], "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.", + "comment": "Maximum time in milliseconds to wait for the response. Defaults to `30000` (30 seconds). Pass `0` to disable timeout.", "deprecated": false, "async": false, - "alias": "timezoneId" + "alias": "timeout", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.16", "name": "userAgent", "type": { "name": "string", @@ -6954,183 +7474,404 @@ "comment": "Specific user agent to use in this context.", "deprecated": false, "async": false, - "alias": "userAgent" - }, + "alias": "userAgent", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + "required": false, + "comment": "", + "deprecated": false, + "async": false, + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null + } + ] + } + ] + }, + { + "name": "APIRequestContext", + "spec": [ + { + "type": "text", + "text": "This API is used for the Web API testing. You can use it to trigger API endpoints, configure micro-services, prepare environment or the service to your e2e test." + }, + { + "type": "text", + "text": "Each Playwright browser context has associated with it `APIRequestContext` instance which shares cookie storage with the browser context and can be accessed via [`property: BrowserContext.request`] or [`property: Page.request`]. It is also possible to create a new APIRequestContext instance manually by calling [`method: APIRequest.newContext`]." + }, + { + "type": "text", + "text": "**Cookie management**" + }, + { + "type": "text", + "text": "`APIRequestContext` retuned by [`property: BrowserContext.request`] and [`property: Page.request`] shares cookie storage with the corresponding `BrowserContext`. Each API request will have `Cookie` header populated with the values from the browser context. If the API response contains `Set-Cookie` header it will automatically update `BrowserContext` cookies and requests made from the page will pick them up. This means that if you log in using this API, your e2e test will be logged in and vice versa." + }, + { + "type": "text", + "text": "If you want API requests to not interfere with the browser cookies you shoud create a new `APIRequestContext` by calling [`method: APIRequest.newContext`]. Such `APIRequestContext` object will have its own isolated cookie storage." + }, + { + "type": "code", + "lines": [ + "import os", + "import asyncio", + "from playwright.async_api import async_playwright, Playwright", + "", + "REPO = \"test-repo-1\"", + "USER = \"github-username\"", + "API_TOKEN = os.getenv(\"GITHUB_API_TOKEN\")", + "", + "async def run(playwright: Playwright):", + " # This will launch a new browser, create a context and page. When making HTTP", + " # requests with the internal APIRequestContext (e.g. `context.request` or `page.request`)", + " # it will automatically set the cookies to the browser page and vise versa.", + " browser = await playwright.chromium.launch()", + " context = await browser.new_context(base_url=\"https://api.github.com\")", + " api_request_context = context.request", + " page = await context.new_page()", + "", + " # Alternatively you can create a APIRequestContext manually without having a browser context attached:", + " # api_request_context = await playwright.request.new_context(base_url=\"https://api.github.com\")", + "", + " # Create a repository.", + " response = await api_request_context.post(", + " \"/user/repos\",", + " headers={", + " \"Accept\": \"application/vnd.github.v3+json\",", + " # Add GitHub personal access token.", + " \"Authorization\": f\"token {API_TOKEN}\",", + " },", + " data={\"name\": REPO},", + " )", + " assert response.ok", + " assert response.json()[\"name\"] == REPO", + "", + " # Delete a repository.", + " response = await api_request_context.delete(", + " f\"/repos/{USER}/{REPO}\",", + " headers={", + " \"Accept\": \"application/vnd.github.v3+json\",", + " # Add GitHub personal access token.", + " \"Authorization\": f\"token {API_TOKEN}\",", + " },", + " )", + " assert response.ok", + " assert await response.body() == '{\"status\": \"ok\"}'", + "", + "async def main():", + " async with async_playwright() as playwright:", + " await run(playwright)", + "", + "asyncio.run(main())" + ], + "codeLang": "python async" + }, + { + "type": "code", + "lines": [ + "import os", + "from playwright.sync_api import sync_playwright", + "", + "REPO = \"test-repo-1\"", + "USER = \"github-username\"", + "API_TOKEN = os.getenv(\"GITHUB_API_TOKEN\")", + "", + "with sync_playwright() as p:", + " # This will launch a new browser, create a context and page. When making HTTP", + " # requests with the internal APIRequestContext (e.g. `context.request` or `page.request`)", + " # it will automatically set the cookies to the browser page and vise versa.", + " browser = p.chromium.launch()", + " context = browser.new_context(base_url=\"https://api.github.com\")", + " api_request_context = context.request", + " page = context.new_page()", + "", + " # Alternatively you can create a APIRequestContext manually without having a browser context attached:", + " # api_request_context = p.request.new_context(base_url=\"https://api.github.com\")", + "", + "", + " # Create a repository.", + " response = api_request_context.post(", + " \"/user/repos\",", + " headers={", + " \"Accept\": \"application/vnd.github.v3+json\",", + " # Add GitHub personal access token.", + " \"Authorization\": f\"token {API_TOKEN}\",", + " },", + " data={\"name\": REPO},", + " )", + " assert response.ok", + " assert response.json()[\"name\"] == REPO", + "", + " # Delete a repository.", + " response = api_request_context.delete(", + " f\"/repos/{USER}/{REPO}\",", + " headers={", + " \"Accept\": \"application/vnd.github.v3+json\",", + " # Add GitHub personal access token.", + " \"Authorization\": f\"token {API_TOKEN}\",", + " },", + " )", + " assert response.ok", + " assert await response.body() == '{\"status\": \"ok\"}'" + ], + "codeLang": "python sync" + } + ], + "langs": {}, + "comment": "This API is used for the Web API testing. You can use it to trigger API endpoints, configure micro-services, prepare\nenvironment or the service to your e2e test.\n\nEach Playwright browser context has associated with it `APIRequestContext` instance which shares cookie storage with the\nbrowser context and can be accessed via [`property: BrowserContext.request`] or [`property: Page.request`]. It is also\npossible to create a new APIRequestContext instance manually by calling [`method: APIRequest.newContext`].\n\n**Cookie management**\n\n`APIRequestContext` retuned by [`property: BrowserContext.request`] and [`property: Page.request`] shares cookie storage\nwith the corresponding `BrowserContext`. Each API request will have `Cookie` header populated with the values from the\nbrowser context. If the API response contains `Set-Cookie` header it will automatically update `BrowserContext` cookies\nand requests made from the page will pick them up. This means that if you log in using this API, your e2e test will be\nlogged in and vice versa.\n\nIf you want API requests to not interfere with the browser cookies you shoud create a new `APIRequestContext` by calling\n[`method: APIRequest.newContext`]. Such `APIRequestContext` object will have its own isolated cookie storage.\n\n```python async\nimport os\nimport asyncio\nfrom playwright.async_api import async_playwright, Playwright\n\nREPO = \"test-repo-1\"\nUSER = \"github-username\"\nAPI_TOKEN = os.getenv(\"GITHUB_API_TOKEN\")\n\nasync def run(playwright: Playwright):\n # This will launch a new browser, create a context and page. When making HTTP\n # requests with the internal APIRequestContext (e.g. `context.request` or `page.request`)\n # it will automatically set the cookies to the browser page and vise versa.\n browser = await playwright.chromium.launch()\n context = await browser.new_context(base_url=\"https://api.github.com\")\n api_request_context = context.request\n page = await context.new_page()\n\n # Alternatively you can create a APIRequestContext manually without having a browser context attached:\n # api_request_context = await playwright.request.new_context(base_url=\"https://api.github.com\")\n\n # Create a repository.\n response = await api_request_context.post(\n \"/user/repos\",\n headers={\n \"Accept\": \"application/vnd.github.v3+json\",\n # Add GitHub personal access token.\n \"Authorization\": f\"token {API_TOKEN}\",\n },\n data={\"name\": REPO},\n )\n assert response.ok\n assert response.json()[\"name\"] == REPO\n\n # Delete a repository.\n response = await api_request_context.delete(\n f\"/repos/{USER}/{REPO}\",\n headers={\n \"Accept\": \"application/vnd.github.v3+json\",\n # Add GitHub personal access token.\n \"Authorization\": f\"token {API_TOKEN}\",\n },\n )\n assert response.ok\n assert await response.body() == '{\"status\": \"ok\"}'\n\nasync def main():\n async with async_playwright() as playwright:\n await run(playwright)\n\nasyncio.run(main())\n```\n\n```python sync\nimport os\nfrom playwright.sync_api import sync_playwright\n\nREPO = \"test-repo-1\"\nUSER = \"github-username\"\nAPI_TOKEN = os.getenv(\"GITHUB_API_TOKEN\")\n\nwith sync_playwright() as p:\n # This will launch a new browser, create a context and page. When making HTTP\n # requests with the internal APIRequestContext (e.g. `context.request` or `page.request`)\n # it will automatically set the cookies to the browser page and vise versa.\n browser = p.chromium.launch()\n context = browser.new_context(base_url=\"https://api.github.com\")\n api_request_context = context.request\n page = context.new_page()\n\n # Alternatively you can create a APIRequestContext manually without having a browser context attached:\n # api_request_context = p.request.new_context(base_url=\"https://api.github.com\")\n\n\n # Create a repository.\n response = api_request_context.post(\n \"/user/repos\",\n headers={\n \"Accept\": \"application/vnd.github.v3+json\",\n # Add GitHub personal access token.\n \"Authorization\": f\"token {API_TOKEN}\",\n },\n data={\"name\": REPO},\n )\n assert response.ok\n assert response.json()[\"name\"] == REPO\n\n # Delete a repository.\n response = api_request_context.delete(\n f\"/repos/{USER}/{REPO}\",\n headers={\n \"Accept\": \"application/vnd.github.v3+json\",\n # Add GitHub personal access token.\n \"Authorization\": f\"token {API_TOKEN}\",\n },\n )\n assert response.ok\n assert await response.body() == '{\"status\": \"ok\"}'\n```\n", + "members": [ + { + "kind": "method", + "langs": { + "only": [ + "csharp" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.23", + "name": "createFormData", + "type": { + "name": "FormData", + "expression": "[FormData]" + }, + "spec": [ + { + "type": "text", + "text": "Creates a new `FormData` instance which is used for providing form and multipart data when making HTTP requests." + } + ], + "required": true, + "comment": "Creates a new `FormData` instance which is used for providing form and multipart data when making HTTP requests.", + "deprecated": false, + "async": false, + "alias": "createFormData", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.16", + "name": "delete", + "type": { + "name": "APIResponse", + "expression": "[APIResponse]" + }, + "spec": [ + { + "type": "text", + "text": "Sends HTTP(S) [DELETE](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/DELETE) request and returns its response. The method will populate request cookies from the context and update context cookies from the response. The method will automatically follow redirects." + } + ], + "required": true, + "comment": "Sends HTTP(S) [DELETE](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/DELETE) request and returns its\nresponse. The method will populate request cookies from the context and update context cookies from the response. The\nmethod will automatically follow redirects.", + "deprecated": false, + "async": true, + "alias": "delete", + "overloadIndex": 0, + "paramOrOption": null, + "args": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.16", + "name": "url", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "Target URL." + } + ], + "required": true, + "comment": "Target URL.", + "deprecated": false, + "async": false, + "alias": "url", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "java" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.18", + "name": "params", + "type": { + "name": "RequestOptions", + "expression": "[RequestOptions]" + }, + "spec": [ + { + "type": "text", + "text": "Optional request parameters." + } + ], + "required": false, + "comment": "Optional request parameters.", + "deprecated": false, + "async": false, + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "options", + "type": { + "name": "Object", + "properties": [ { "kind": "property", "langs": { "only": [ - "js" + "js", + "python", + "csharp" ], "aliases": {}, "types": {}, "overrides": {} }, - "name": "videoSize", + "experimental": false, + "since": "v1.17", + "name": "data", "type": { - "name": "Object", - "properties": [ + "name": "", + "union": [ { - "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" + "name": "string" }, { - "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" + "name": "Buffer" + }, + { + "name": "Serializable" } ], - "expression": "[Object]" + "expression": "[string]|[Buffer]|[Serializable]" }, "spec": [ { "type": "text", - "text": "**DEPRECATED** Use `recordVideo` instead." + "text": "Allows to set post data of the request. If the data parameter is an object, it will be serialized to json string and `content-type` header will be set to `application/json` if not explicitly set. Otherwise the `content-type` header will be set to `application/octet-stream` if not explicitly set." } ], "required": false, - "comment": "**DEPRECATED** Use `recordVideo` instead.", - "deprecated": true, + "comment": "Allows to set post data of the request. If the data parameter is an object, it will be serialized to json string and\n`content-type` header will be set to `application/json` if not explicitly set. Otherwise the `content-type` header will\nbe set to `application/octet-stream` if not explicitly set.", + "deprecated": false, "async": false, - "alias": "videoSize" + "alias": "data", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": { "only": [ - "js" + "js", + "python", + "csharp" ], "aliases": {}, "types": {}, "overrides": {} }, - "name": "videosPath", + "experimental": false, + "since": "v1.16", + "name": "failOnStatusCode", "type": { - "name": "path", - "expression": "[path]" + "name": "boolean", + "expression": "[boolean]" }, "spec": [ { "type": "text", - "text": "**DEPRECATED** Use `recordVideo` instead." + "text": "Whether to throw on response codes other than 2xx and 3xx. By default response object is returned for all status codes." } ], "required": false, - "comment": "**DEPRECATED** Use `recordVideo` instead.", - "deprecated": true, + "comment": "Whether to throw on response codes other than 2xx and 3xx. By default response object is returned for all status codes.", + "deprecated": false, "async": false, - "alias": "videosPath" + "alias": "failOnStatusCode", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": { "only": [ "js", - "java" + "python" ], - "aliases": { - "java": "viewportSize" - }, + "aliases": {}, "types": {}, "overrides": {} }, - "name": "viewport", + "experimental": false, + "since": "v1.17", + "name": "form", "type": { - "name": "", - "union": [ + "name": "Object", + "templates": [ { - "name": "null" + "name": "string" }, { - "name": "Object", - "properties": [ + "name": "", + "union": [ { - "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" + "name": "string" }, { - "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" + "name": "float" + }, + { + "name": "boolean" } ] } ], - "expression": "[null]|[Object]" + "expression": "[Object]<[string], [string]|[float]|[boolean]>" }, "spec": [ { "type": "text", - "text": "Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. `null` disables the default viewport." + "text": "Provides an object that will be serialized as html form using `application/x-www-form-urlencoded` encoding and sent as this request body. If this parameter is specified `content-type` header will be set to `application/x-www-form-urlencoded` unless explicitly provided." } ], "required": false, - "comment": "Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. `null` disables the default viewport.", + "comment": "Provides an object that will be serialized as html form using `application/x-www-form-urlencoded` encoding and sent as\nthis request body. If this parameter is specified `content-type` header will be set to\n`application/x-www-form-urlencoded` unless explicitly provided.", "deprecated": false, "async": false, - "alias": "viewport" + "alias": "form", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", @@ -7138,593 +7879,663 @@ "only": [ "csharp" ], - "aliases": { - "csharp": "viewportSize" - }, + "aliases": {}, "types": {}, "overrides": {} }, - "name": "viewport", + "experimental": false, + "since": "v1.17", + "name": "form", "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]" + "name": "FormData", + "expression": "[FormData]" }, "spec": [ { "type": "text", - "text": "Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use `ViewportSize.NoViewport` to disable the default viewport." + "text": "Provides an object that will be serialized as html form using `application/x-www-form-urlencoded` encoding and sent as this request body. If this parameter is specified `content-type` header will be set to `application/x-www-form-urlencoded` unless explicitly provided." + }, + { + "type": "text", + "text": "An instance of `FormData` can be created via [`method: APIRequestContext.createFormData`]." } ], "required": false, - "comment": "Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use `ViewportSize.NoViewport` to disable\nthe default viewport.", + "comment": "Provides an object that will be serialized as html form using `application/x-www-form-urlencoded` encoding and sent as\nthis request body. If this parameter is specified `content-type` header will be set to\n`application/x-www-form-urlencoded` unless explicitly provided.\n\nAn instance of `FormData` can be created via [`method: APIRequestContext.createFormData`].", "deprecated": false, "async": false, - "alias": "viewport" + "alias": "form", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": { "only": [ - "python" + "js", + "python", + "csharp" ], "aliases": {}, "types": {}, "overrides": {} }, - "name": "viewport", + "experimental": false, + "since": "v1.16", + "name": "headers", "type": { - "name": "", - "union": [ + "name": "Object", + "templates": [ { - "name": "null" + "name": "string" }, { - "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" - } - ] + "name": "string" } ], - "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]" + "expression": "[Object]<[string], [string]>" }, "spec": [ { "type": "text", - "text": "Toggles bypassing page's Content-Security-Policy." + "text": "Allows to set HTTP headers." } ], "required": false, - "comment": "Toggles bypassing page's Content-Security-Policy.", + "comment": "Allows to set HTTP headers.", "deprecated": false, "async": false, - "alias": "bypassCSP" + "alias": "headers", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", - "langs": {}, - "name": "colorScheme", - "type": { - "name": "ColorScheme", - "union": [ - { - "name": "\"light\"" - }, - { - "name": "\"dark\"" - }, - { - "name": "\"no-preference\"" - } + "langs": { + "only": [ + "js", + "python", + "csharp" ], - "expression": "[ColorScheme]<\"light\"|\"dark\"|\"no-preference\">" + "aliases": {}, + "types": {}, + "overrides": {} }, - "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", + "experimental": false, + "since": "v1.16", + "name": "ignoreHTTPSErrors", "type": { - "name": "float", - "expression": "[float]" + "name": "boolean", + "expression": "[boolean]" }, "spec": [ { "type": "text", - "text": "Specify device scale factor (can be thought of as dpr). Defaults to `1`." + "text": "Whether to ignore HTTPS errors when sending network requests. Defaults to `false`." } ], "required": false, - "comment": "Specify device scale factor (can be thought of as dpr). Defaults to `1`.", + "comment": "Whether to ignore HTTPS errors when sending network requests. Defaults to `false`.", "deprecated": false, "async": false, - "alias": "deviceScaleFactor" + "alias": "ignoreHTTPSErrors", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", - "langs": {}, - "name": "extraHTTPHeaders", - "type": { - "name": "Object", - "templates": [ - { - "name": "string" - }, - { - "name": "string" - } + "langs": { + "only": [ + "js", + "python" ], - "expression": "[Object]<[string], [string]>" + "aliases": {}, + "types": {}, + "overrides": {} }, - "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", + "experimental": false, + "since": "v1.17", + "name": "multipart", "type": { "name": "Object", "properties": [ { "kind": "property", "langs": {}, - "name": "latitude", + "experimental": false, + "since": "v1.0", + "name": "name", "type": { - "name": "float", - "expression": "[float]" + "name": "string", + "expression": "[string]" }, "spec": [ { "type": "text", - "text": "Latitude between -90 and 90." + "text": "File name" } ], "required": true, - "comment": "Latitude between -90 and 90.", + "comment": "File name", "deprecated": false, "async": false, - "alias": "latitude" + "alias": "name", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, - "name": "longitude", + "experimental": false, + "since": "v1.0", + "name": "mimeType", "type": { - "name": "float", - "expression": "[float]" + "name": "string", + "expression": "[string]" }, "spec": [ { "type": "text", - "text": "Longitude between -180 and 180." + "text": "File type" } ], "required": true, - "comment": "Longitude between -180 and 180.", + "comment": "File type", "deprecated": false, "async": false, - "alias": "longitude" + "alias": "mimeType", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, - "name": "accuracy", + "experimental": false, + "since": "v1.0", + "name": "buffer", "type": { - "name": "float", - "expression": "[float]" + "name": "Buffer", + "expression": "[Buffer]" }, "spec": [ { "type": "text", - "text": "Non-negative accuracy value. Defaults to `0`." + "text": "File content" } ], - "required": false, - "comment": "Non-negative accuracy value. Defaults to `0`.", + "required": true, + "comment": "File content", "deprecated": false, "async": false, - "alias": "accuracy" + "alias": "buffer", + "overloadIndex": 0, + "paramOrOption": null } ], - "expression": "[Object]" + "templates": [ + { + "name": "string" + }, + { + "name": "", + "union": [ + { + "name": "string" + }, + { + "name": "float" + }, + { + "name": "boolean" + }, + { + "name": "ReadStream" + }, + { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "name", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "File name" + } + ], + "required": true, + "comment": "File name", + "deprecated": false, + "async": false, + "alias": "name", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "mimeType", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "File type" + } + ], + "required": true, + "comment": "File type", + "deprecated": false, + "async": false, + "alias": "mimeType", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "buffer", + "type": { + "name": "Buffer", + "expression": "[Buffer]" + }, + "spec": [ + { + "type": "text", + "text": "File content" + } + ], + "required": true, + "comment": "File content", + "deprecated": false, + "async": false, + "alias": "buffer", + "overloadIndex": 0, + "paramOrOption": null + } + ] + } + ] + } + ], + "expression": "[Object]<[string], [string]|[float]|[boolean]|[ReadStream]|[Object]>" }, - "spec": [], + "spec": [ + { + "type": "text", + "text": "Provides an object that will be serialized as html form using `multipart/form-data` encoding and sent as this request body. If this parameter is specified `content-type` header will be set to `multipart/form-data` unless explicitly provided. File values can be passed either as [`fs.ReadStream`](https://nodejs.org/api/fs.html#fs_class_fs_readstream) or as file-like object containing file name, mime-type and its content." + } + ], "required": false, - "comment": "", + "comment": "Provides an object that will be serialized as html form using `multipart/form-data` encoding and sent as this request\nbody. If this parameter is specified `content-type` header will be set to `multipart/form-data` unless explicitly\nprovided. File values can be passed either as [`fs.ReadStream`](https://nodejs.org/api/fs.html#fs_class_fs_readstream)\nor as file-like object containing file name, mime-type and its content.", "deprecated": false, "async": false, - "alias": "geolocation" + "alias": "multipart", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", - "langs": {}, - "name": "hasTouch", + "langs": { + "only": [ + "csharp" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.17", + "name": "multipart", "type": { - "name": "boolean", - "expression": "[boolean]" + "name": "FormData", + "expression": "[FormData]" }, "spec": [ { "type": "text", - "text": "Specifies if viewport supports touch events. Defaults to false." + "text": "Provides an object that will be serialized as html form using `multipart/form-data` encoding and sent as this request body. If this parameter is specified `content-type` header will be set to `multipart/form-data` unless explicitly provided. File values can be passed either as [`fs.ReadStream`](https://nodejs.org/api/fs.html#fs_class_fs_readstream) or as file-like object containing file name, mime-type and its content." + }, + { + "type": "text", + "text": "An instance of `FormData` can be created via [`method: APIRequestContext.createFormData`]." } ], "required": false, - "comment": "Specifies if viewport supports touch events. Defaults to false.", + "comment": "Provides an object that will be serialized as html form using `multipart/form-data` encoding and sent as this request\nbody. If this parameter is specified `content-type` header will be set to `multipart/form-data` unless explicitly\nprovided. File values can be passed either as [`fs.ReadStream`](https://nodejs.org/api/fs.html#fs_class_fs_readstream)\nor as file-like object containing file name, mime-type and its content.\n\nAn instance of `FormData` can be created via [`method: APIRequestContext.createFormData`].", "deprecated": false, "async": false, - "alias": "hasTouch" + "alias": "multipart", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", - "langs": {}, - "name": "httpCredentials", + "langs": { + "only": [ + "js", + "python" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.16", + "name": "params", "type": { "name": "Object", - "properties": [ + "templates": [ { - "kind": "property", - "langs": {}, - "name": "username", - "type": { - "name": "string", - "expression": "[string]" - }, - "spec": [ - { - "type": "text", - "text": "" - } - ], - "required": true, - "comment": "", - "deprecated": false, - "async": false, - "alias": "username" + "name": "string" }, { - "kind": "property", - "langs": {}, - "name": "password", - "type": { - "name": "string", - "expression": "[string]" - }, - "spec": [ + "name": "", + "union": [ { - "type": "text", - "text": "" + "name": "string" + }, + { + "name": "float" + }, + { + "name": "boolean" } - ], - "required": true, - "comment": "", - "deprecated": false, - "async": false, - "alias": "password" + ] } ], - "expression": "[Object]" + "expression": "[Object]<[string], [string]|[float]|[boolean]>" }, "spec": [ { "type": "text", - "text": "Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication)." + "text": "Query parameters to be sent with the URL." } ], "required": false, - "comment": "Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication).", + "comment": "Query parameters to be sent with the URL.", "deprecated": false, "async": false, - "alias": "httpCredentials" + "alias": "params", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", - "langs": {}, - "name": "ignoreHTTPSErrors", - "type": { - "name": "boolean", - "expression": "[boolean]" + "langs": { + "only": [ + "csharp" + ], + "aliases": {}, + "types": {}, + "overrides": {} }, - "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", + "experimental": false, + "since": "v1.16", + "name": "params", "type": { - "name": "boolean", - "expression": "[boolean]" + "name": "Object", + "templates": [ + { + "name": "string" + }, + { + "name": "Serializable" + } + ], + "expression": "[Object]<[string], [Serializable]>" }, "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." + "text": "Query parameters to be sent with the URL." } ], "required": false, - "comment": "Whether the `meta viewport` tag is taken into account and touch events are enabled. Defaults to `false`. Not supported\nin Firefox.", + "comment": "Query parameters to be sent with the URL.", "deprecated": false, "async": false, - "alias": "isMobile" + "alias": "params", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", - "langs": {}, - "name": "javaScriptEnabled", + "langs": { + "only": [ + "js", + "python", + "csharp" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.16", + "name": "timeout", "type": { - "name": "boolean", - "expression": "[boolean]" + "name": "float", + "expression": "[float]" }, "spec": [ { "type": "text", - "text": "Whether or not to enable JavaScript in the context. Defaults to `true`." + "text": "Request timeout in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout." } ], "required": false, - "comment": "Whether or not to enable JavaScript in the context. Defaults to `true`.", + "comment": "Request timeout in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout.", "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" + "alias": "timeout", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + "required": false, + "comment": "", + "deprecated": false, + "async": false, + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.16", + "name": "dispose", + "type": { + "name": "void" + }, + "spec": [ + { + "type": "text", + "text": "All responses returned by [`method: APIRequestContext.get`] and similar methods are stored in the memory, so that you can later call [`method: APIResponse.body`]. This method discards all stored responses, and makes [`method: APIResponse.body`] throw \"Response disposed\" error." + } + ], + "required": true, + "comment": "All responses returned by [`method: APIRequestContext.get`] and similar methods are stored in the memory, so that you\ncan later call [`method: APIResponse.body`]. This method discards all stored responses, and makes\n[`method: APIResponse.body`] throw \"Response disposed\" error.", + "deprecated": false, + "async": true, + "alias": "dispose", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.16", + "name": "fetch", + "type": { + "name": "APIResponse", + "expression": "[APIResponse]" + }, + "spec": [ + { + "type": "text", + "text": "Sends HTTP(S) request and returns its response. The method will populate request cookies from the context and update context cookies from the response. The method will automatically follow redirects." + } + ], + "required": true, + "comment": "Sends HTTP(S) request and returns its response. The method will populate request cookies from the context and update\ncontext cookies from the response. The method will automatically follow redirects.", + "deprecated": false, + "async": true, + "alias": "fetch", + "overloadIndex": 0, + "paramOrOption": null, + "args": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.16", + "name": "urlOrRequest", + "type": { + "name": "", + "union": [ + { + "name": "string" }, + { + "name": "Request" + } + ], + "expression": "[string]|[Request]" + }, + "spec": [ + { + "type": "text", + "text": "Target URL or Request to get all parameters from." + } + ], + "required": true, + "comment": "Target URL or Request to get all parameters from.", + "deprecated": false, + "async": false, + "alias": "urlOrRequest", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "java" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.18", + "name": "params", + "type": { + "name": "RequestOptions", + "expression": "[RequestOptions]" + }, + "spec": [ + { + "type": "text", + "text": "Optional request parameters." + } + ], + "required": false, + "comment": "Optional request parameters.", + "deprecated": false, + "async": false, + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "options", + "type": { + "name": "Object", + "properties": [ { "kind": "property", "langs": { "only": [ - "js" + "js", + "python", + "csharp" ], "aliases": {}, "types": {}, "overrides": {} }, - "name": "logger", + "experimental": false, + "since": "v1.16", + "name": "data", "type": { - "name": "Logger", - "expression": "[Logger]" + "name": "", + "union": [ + { + "name": "string" + }, + { + "name": "Buffer" + }, + { + "name": "Serializable" + } + ], + "expression": "[string]|[Buffer]|[Serializable]" }, "spec": [ { "type": "text", - "text": "Logger sink for Playwright logging." + "text": "Allows to set post data of the request. If the data parameter is an object, it will be serialized to json string and `content-type` header will be set to `application/json` if not explicitly set. Otherwise the `content-type` header will be set to `application/octet-stream` if not explicitly set." } ], "required": false, - "comment": "Logger sink for Playwright logging.", + "comment": "Allows to set post data of the request. If the data parameter is an object, it will be serialized to json string and\n`content-type` header will be set to `application/json` if not explicitly set. Otherwise the `content-type` header will\nbe set to `application/octet-stream` if not explicitly set.", "deprecated": false, "async": false, - "alias": "logger" + "alias": "data", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": { "only": [ - "python" + "js", + "python", + "csharp" ], "aliases": {}, "types": {}, "overrides": {} }, - "name": "noViewport", + "experimental": false, + "since": "v1.16", + "name": "failOnStatusCode", "type": { "name": "boolean", "expression": "[boolean]" @@ -7732,251 +8543,159 @@ "spec": [ { "type": "text", - "text": "Does not enforce fixed viewport, allows resizing window in the headed mode." + "text": "Whether to throw on response codes other than 2xx and 3xx. By default response object is returned for all status codes." } ], "required": false, - "comment": "Does not enforce fixed viewport, allows resizing window in the headed mode.", + "comment": "Whether to throw on response codes other than 2xx and 3xx. By default response object is returned for all status codes.", "deprecated": false, "async": false, - "alias": "noViewport" + "alias": "failOnStatusCode", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", - "langs": {}, - "name": "offline", - "type": { - "name": "boolean", - "expression": "[boolean]" + "langs": { + "only": [ + "js", + "python" + ], + "aliases": {}, + "types": {}, + "overrides": {} }, - "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", + "experimental": false, + "since": "v1.16", + "name": "form", "type": { - "name": "Array", + "name": "Object", "templates": [ { "name": "string" + }, + { + "name": "", + "union": [ + { + "name": "string" + }, + { + "name": "float" + }, + { + "name": "boolean" + } + ] } ], - "expression": "[Array]<[string]>" + "expression": "[Object]<[string], [string]|[float]|[boolean]>" }, "spec": [ { "type": "text", - "text": "A list of permissions to grant to all pages in this context. See [`method: BrowserContext.grantPermissions`] for more details." + "text": "Provides an object that will be serialized as html form using `application/x-www-form-urlencoded` encoding and sent as this request body. If this parameter is specified `content-type` header will be set to `application/x-www-form-urlencoded` unless explicitly provided." } ], "required": false, - "comment": "A list of permissions to grant to all pages in this context. See [`method: BrowserContext.grantPermissions`] for more\ndetails.", + "comment": "Provides an object that will be serialized as html form using `application/x-www-form-urlencoded` encoding and sent as\nthis request body. If this parameter is specified `content-type` header will be set to\n`application/x-www-form-urlencoded` unless explicitly provided.", "deprecated": false, "async": false, - "alias": "permissions" + "alias": "form", + "overloadIndex": 0, + "paramOrOption": null }, { "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" - } + "langs": { + "only": [ + "csharp" ], - "expression": "[Object]" + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.16", + "name": "form", + "type": { + "name": "FormData", + "expression": "[FormData]" }, "spec": [ { "type": "text", - "text": "Network proxy settings to use with this context." + "text": "Provides an object that will be serialized as html form using `application/x-www-form-urlencoded` encoding and sent as this request body. If this parameter is specified `content-type` header will be set to `application/x-www-form-urlencoded` unless explicitly provided." }, { - "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' } })`." + "type": "text", + "text": "An instance of `FormData` can be created via [`method: APIRequestContext.createFormData`]." } ], "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' } })`.", + "comment": "Provides an object that will be serialized as html form using `application/x-www-form-urlencoded` encoding and sent as\nthis request body. If this parameter is specified `content-type` header will be set to\n`application/x-www-form-urlencoded` unless explicitly provided.\n\nAn instance of `FormData` can be created via [`method: APIRequestContext.createFormData`].", "deprecated": false, "async": false, - "alias": "proxy" + "alias": "form", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": { "only": [ - "js" + "js", + "python", + "csharp" ], "aliases": {}, "types": {}, "overrides": {} }, - "name": "recordHar", + "experimental": false, + "since": "v1.16", + "name": "headers", "type": { "name": "Object", - "properties": [ + "templates": [ { - "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" + "name": "string" }, { - "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" + "name": "string" } ], - "expression": "[Object]" + "expression": "[Object]<[string], [string]>" }, "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." + "text": "Allows to set HTTP headers." } ], "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.", + "comment": "Allows to set HTTP headers.", "deprecated": false, "async": false, - "alias": "recordHar" + "alias": "headers", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": { "only": [ - "csharp", - "java", - "python" + "js", + "python", + "csharp" ], - "aliases": { - "python": "record_har_omit_content" - }, + "aliases": {}, "types": {}, "overrides": {} }, - "name": "recordHarOmitContent", + "experimental": false, + "since": "v1.16", + "name": "ignoreHTTPSErrors", "type": { "name": "boolean", "expression": "[boolean]" @@ -7984,1127 +8703,1072 @@ "spec": [ { "type": "text", - "text": "Optional setting to control whether to omit request content from the HAR. Defaults to `false`." + "text": "Whether to ignore HTTPS errors when sending network requests. Defaults to `false`." } ], "required": false, - "comment": "Optional setting to control whether to omit request content from the HAR. Defaults to `false`.", + "comment": "Whether to ignore HTTPS errors when sending network requests. Defaults to `false`.", "deprecated": false, "async": false, - "alias": "recordHarOmitContent" + "alias": "ignoreHTTPSErrors", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": { "only": [ - "csharp", - "java", - "python" + "js", + "python", + "csharp" ], - "aliases": { - "python": "record_har_path" - }, + "aliases": {}, "types": {}, "overrides": {} }, - "name": "recordHarPath", + "experimental": false, + "since": "v1.16", + "name": "method", "type": { - "name": "path", - "expression": "[path]" + "name": "string", + "expression": "[string]" }, "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." + "text": "If set changes the fetch method (e.g. [PUT](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PUT) or [POST](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST)). If not specified, GET method is used." } ], "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.", + "comment": "If set changes the fetch method (e.g. [PUT](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PUT) or\n[POST](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST)). If not specified, GET method is used.", "deprecated": false, "async": false, - "alias": "recordHarPath" + "alias": "method", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": { "only": [ - "js" + "js", + "python" ], "aliases": {}, "types": {}, "overrides": {} }, - "name": "recordVideo", + "experimental": false, + "since": "v1.16", + "name": "multipart", "type": { "name": "Object", "properties": [ { "kind": "property", "langs": {}, - "name": "dir", + "experimental": false, + "since": "v1.0", + "name": "name", "type": { - "name": "path", - "expression": "[path]" + "name": "string", + "expression": "[string]" }, "spec": [ { "type": "text", - "text": "Path to the directory to put videos into." + "text": "File name" } ], "required": true, - "comment": "Path to the directory to put videos into.", + "comment": "File name", "deprecated": false, "async": false, - "alias": "dir" + "alias": "name", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, - "name": "size", + "experimental": false, + "since": "v1.0", + "name": "mimeType", "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]" + "name": "string", + "expression": "[string]" }, "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." + "text": "File type" } ], - "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.", + "required": true, + "comment": "File type", + "deprecated": false, + "async": false, + "alias": "mimeType", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "buffer", + "type": { + "name": "Buffer", + "expression": "[Buffer]" + }, + "spec": [ + { + "type": "text", + "text": "File content" + } + ], + "required": true, + "comment": "File content", "deprecated": false, "async": false, - "alias": "size" + "alias": "buffer", + "overloadIndex": 0, + "paramOrOption": null } ], - "expression": "[Object]" + "templates": [ + { + "name": "string" + }, + { + "name": "", + "union": [ + { + "name": "string" + }, + { + "name": "float" + }, + { + "name": "boolean" + }, + { + "name": "ReadStream" + }, + { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "name", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "File name" + } + ], + "required": true, + "comment": "File name", + "deprecated": false, + "async": false, + "alias": "name", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "mimeType", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "File type" + } + ], + "required": true, + "comment": "File type", + "deprecated": false, + "async": false, + "alias": "mimeType", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "buffer", + "type": { + "name": "Buffer", + "expression": "[Buffer]" + }, + "spec": [ + { + "type": "text", + "text": "File content" + } + ], + "required": true, + "comment": "File content", + "deprecated": false, + "async": false, + "alias": "buffer", + "overloadIndex": 0, + "paramOrOption": null + } + ] + } + ] + } + ], + "expression": "[Object]<[string], [string]|[float]|[boolean]|[ReadStream]|[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." + "text": "Provides an object that will be serialized as html form using `multipart/form-data` encoding and sent as this request body. If this parameter is specified `content-type` header will be set to `multipart/form-data` unless explicitly provided. File values can be passed either as [`fs.ReadStream`](https://nodejs.org/api/fs.html#fs_class_fs_readstream) or as file-like object containing file name, mime-type and its content." } ], "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.", + "comment": "Provides an object that will be serialized as html form using `multipart/form-data` encoding and sent as this request\nbody. If this parameter is specified `content-type` header will be set to `multipart/form-data` unless explicitly\nprovided. File values can be passed either as [`fs.ReadStream`](https://nodejs.org/api/fs.html#fs_class_fs_readstream)\nor as file-like object containing file name, mime-type and its content.", "deprecated": false, "async": false, - "alias": "recordVideo" + "alias": "multipart", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": { "only": [ - "csharp", - "java", - "python" + "csharp" ], - "aliases": { - "python": "record_video_dir" - }, + "aliases": {}, "types": {}, "overrides": {} }, - "name": "recordVideoDir", + "experimental": false, + "since": "v1.16", + "name": "multipart", "type": { - "name": "path", - "expression": "[path]" + "name": "FormData", + "expression": "[FormData]" }, "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." + "text": "Provides an object that will be serialized as html form using `multipart/form-data` encoding and sent as this request body. If this parameter is specified `content-type` header will be set to `multipart/form-data` unless explicitly provided. File values can be passed either as [`fs.ReadStream`](https://nodejs.org/api/fs.html#fs_class_fs_readstream) or as file-like object containing file name, mime-type and its content." + }, + { + "type": "text", + "text": "An instance of `FormData` can be created via [`method: APIRequestContext.createFormData`]." } ], "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.", + "comment": "Provides an object that will be serialized as html form using `multipart/form-data` encoding and sent as this request\nbody. If this parameter is specified `content-type` header will be set to `multipart/form-data` unless explicitly\nprovided. File values can be passed either as [`fs.ReadStream`](https://nodejs.org/api/fs.html#fs_class_fs_readstream)\nor as file-like object containing file name, mime-type and its content.\n\nAn instance of `FormData` can be created via [`method: APIRequestContext.createFormData`].", "deprecated": false, "async": false, - "alias": "recordVideoDir" + "alias": "multipart", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": { "only": [ - "csharp", - "java", + "js", "python" ], - "aliases": { - "python": "record_video_size" - }, + "aliases": {}, "types": {}, "overrides": {} }, - "name": "recordVideoSize", + "experimental": false, + "since": "v1.16", + "name": "params", "type": { "name": "Object", - "properties": [ + "templates": [ { - "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" + "name": "string" }, { - "kind": "property", - "langs": {}, - "name": "height", - "type": { - "name": "int", - "expression": "[int]" - }, - "spec": [ + "name": "", + "union": [ { - "type": "text", - "text": "Video frame height." - } - ], - "required": true, - "comment": "Video frame height.", - "deprecated": false, - "async": false, - "alias": "height" + "name": "string" + }, + { + "name": "float" + }, + { + "name": "boolean" + } + ] } ], - "expression": "[Object]" + "expression": "[Object]<[string], [string]|[float]|[boolean]>" }, "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." + "text": "Query parameters to be sent with the URL." } ], "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.", + "comment": "Query parameters to be sent with the URL.", "deprecated": false, "async": false, - "alias": "recordVideoSize" + "alias": "params", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": { - "aliases": { - "java": "screenSize", - "csharp": "screenSize" - }, + "only": [ + "csharp" + ], + "aliases": {}, "types": {}, "overrides": {} }, - "name": "screen", + "experimental": false, + "since": "v1.16", + "name": "params", "type": { "name": "Object", - "properties": [ + "templates": [ { - "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" + "name": "string" }, { - "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" + "name": "Serializable" } ], - "expression": "[Object]" + "expression": "[Object]<[string], [Serializable]>" }, "spec": [ { "type": "text", - "text": "Emulates consistent window screen size available inside web page via `window.screen`. Is only used when the `viewport` is set." + "text": "Query parameters to be sent with the URL." } ], "required": false, - "comment": "Emulates consistent window screen size available inside web page via `window.screen`. Is only used when the `viewport`\nis set.", + "comment": "Query parameters to be sent with the URL.", "deprecated": false, "async": false, - "alias": "screen" + "alias": "params", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": { "only": [ "js", - "python" + "python", + "csharp" ], "aliases": {}, "types": {}, "overrides": {} }, - "name": "storageState", + "experimental": false, + "since": "v1.16", + "name": "timeout", "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]" + "name": "float", + "expression": "[float]" }, "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:" + "text": "Request timeout in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout." } ], "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:", + "comment": "Request timeout in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout.", "deprecated": false, "async": false, - "alias": "storageState" - }, + "alias": "timeout", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + "required": false, + "comment": "", + "deprecated": false, + "async": false, + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.16", + "name": "get", + "type": { + "name": "APIResponse", + "expression": "[APIResponse]" + }, + "spec": [ + { + "type": "text", + "text": "Sends HTTP(S) [GET](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/GET) request and returns its response. The method will populate request cookies from the context and update context cookies from the response. The method will automatically follow redirects." + } + ], + "required": true, + "comment": "Sends HTTP(S) [GET](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/GET) request and returns its response. The\nmethod will populate request cookies from the context and update context cookies from the response. The method will\nautomatically follow redirects.", + "deprecated": false, + "async": true, + "alias": "get", + "overloadIndex": 0, + "paramOrOption": null, + "args": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.16", + "name": "url", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "Target URL." + } + ], + "required": true, + "comment": "Target URL.", + "deprecated": false, + "async": false, + "alias": "url", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "java" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.18", + "name": "params", + "type": { + "name": "RequestOptions", + "expression": "[RequestOptions]" + }, + "spec": [ + { + "type": "text", + "text": "Optional request parameters." + } + ], + "required": false, + "comment": "Optional request parameters.", + "deprecated": false, + "async": false, + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "options", + "type": { + "name": "Object", + "properties": [ { "kind": "property", "langs": { "only": [ - "csharp", - "java" + "js", + "python", + "csharp" ], "aliases": {}, "types": {}, "overrides": {} }, - "name": "storageState", + "experimental": false, + "since": "v1.16", + "name": "failOnStatusCode", "type": { - "name": "string", - "expression": "[string]" + "name": "boolean", + "expression": "[boolean]" }, "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`]." + "text": "Whether to throw on response codes other than 2xx and 3xx. By default response object is returned for all status codes." } ], "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`].", + "comment": "Whether to throw on response codes other than 2xx and 3xx. By default response object is returned for all status codes.", "deprecated": false, "async": false, - "alias": "storageState" + "alias": "failOnStatusCode", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": { "only": [ - "csharp", - "java" + "js", + "python", + "csharp" ], "aliases": {}, "types": {}, "overrides": {} }, - "name": "storageStatePath", + "experimental": false, + "since": "v1.16", + "name": "headers", "type": { - "name": "path", - "expression": "[path]" + "name": "Object", + "templates": [ + { + "name": "string" + }, + { + "name": "string" + } + ], + "expression": "[Object]<[string], [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`]. Path to the file with saved storage state." + "text": "Allows to set HTTP headers." } ], "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.", + "comment": "Allows to set HTTP headers.", "deprecated": false, "async": false, - "alias": "storageStatePath" + "alias": "headers", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", - "langs": {}, - "name": "timezoneId", + "langs": { + "only": [ + "js", + "python", + "csharp" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.16", + "name": "ignoreHTTPSErrors", "type": { - "name": "string", - "expression": "[string]" + "name": "boolean", + "expression": "[boolean]" }, "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." + "text": "Whether to ignore HTTPS errors when sending network requests. Defaults to `false`." } ], "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.", + "comment": "Whether to ignore HTTPS errors when sending network requests. Defaults to `false`.", "deprecated": false, "async": false, - "alias": "timezoneId" + "alias": "ignoreHTTPSErrors", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", - "langs": {}, - "name": "userAgent", - "type": { - "name": "string", - "expression": "[string]" + "langs": { + "only": [ + "js", + "python" + ], + "aliases": {}, + "types": {}, + "overrides": {} }, - "spec": [ - { - "type": "text", - "text": "Specific user agent to use in this context." + "experimental": false, + "since": "v1.16", + "name": "params", + "type": { + "name": "Object", + "templates": [ + { + "name": "string" + }, + { + "name": "", + "union": [ + { + "name": "string" + }, + { + "name": "float" + }, + { + "name": "boolean" + } + ] + } + ], + "expression": "[Object]<[string], [string]|[float]|[boolean]>" + }, + "spec": [ + { + "type": "text", + "text": "Query parameters to be sent with the URL." } ], "required": false, - "comment": "Specific user agent to use in this context.", + "comment": "Query parameters to be sent with the URL.", "deprecated": false, "async": false, - "alias": "userAgent" + "alias": "params", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": { "only": [ - "js" + "csharp" ], "aliases": {}, "types": {}, "overrides": {} }, - "name": "videoSize", + "experimental": false, + "since": "v1.16", + "name": "params", "type": { "name": "Object", - "properties": [ + "templates": [ { - "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" + "name": "string" }, { - "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" + "name": "Serializable" } ], - "expression": "[Object]" + "expression": "[Object]<[string], [Serializable]>" }, "spec": [ { "type": "text", - "text": "**DEPRECATED** Use `recordVideo` instead." + "text": "Query parameters to be sent with the URL." } ], "required": false, - "comment": "**DEPRECATED** Use `recordVideo` instead.", - "deprecated": true, + "comment": "Query parameters to be sent with the URL.", + "deprecated": false, "async": false, - "alias": "videoSize" + "alias": "params", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": { "only": [ - "js" + "js", + "python", + "csharp" ], "aliases": {}, "types": {}, "overrides": {} }, - "name": "videosPath", + "experimental": false, + "since": "v1.16", + "name": "timeout", "type": { - "name": "path", - "expression": "[path]" + "name": "float", + "expression": "[float]" }, "spec": [ { "type": "text", - "text": "**DEPRECATED** Use `recordVideo` instead." + "text": "Request timeout in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout." } ], "required": false, - "comment": "**DEPRECATED** Use `recordVideo` instead.", - "deprecated": true, + "comment": "Request timeout in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout.", + "deprecated": false, + "async": false, + "alias": "timeout", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + "required": false, + "comment": "", + "deprecated": false, + "async": false, + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.16", + "name": "head", + "type": { + "name": "APIResponse", + "expression": "[APIResponse]" + }, + "spec": [ + { + "type": "text", + "text": "Sends HTTP(S) [HEAD](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/HEAD) request and returns its response. The method will populate request cookies from the context and update context cookies from the response. The method will automatically follow redirects." + } + ], + "required": true, + "comment": "Sends HTTP(S) [HEAD](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/HEAD) request and returns its response.\nThe method will populate request cookies from the context and update context cookies from the response. The method will\nautomatically follow redirects.", + "deprecated": false, + "async": true, + "alias": "head", + "overloadIndex": 0, + "paramOrOption": null, + "args": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.16", + "name": "url", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "Target URL." + } + ], + "required": true, + "comment": "Target URL.", + "deprecated": false, + "async": false, + "alias": "url", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "java" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.18", + "name": "params", + "type": { + "name": "RequestOptions", + "expression": "[RequestOptions]" + }, + "spec": [ + { + "type": "text", + "text": "Optional request parameters." + } + ], + "required": false, + "comment": "Optional request parameters.", + "deprecated": false, + "async": false, + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "options", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": { + "only": [ + "js", + "python", + "csharp" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.16", + "name": "failOnStatusCode", + "type": { + "name": "boolean", + "expression": "[boolean]" + }, + "spec": [ + { + "type": "text", + "text": "Whether to throw on response codes other than 2xx and 3xx. By default response object is returned for all status codes." + } + ], + "required": false, + "comment": "Whether to throw on response codes other than 2xx and 3xx. By default response object is returned for all status codes.", + "deprecated": false, "async": false, - "alias": "videosPath" + "alias": "failOnStatusCode", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": { "only": [ "js", - "java" + "python", + "csharp" ], - "aliases": { - "java": "viewportSize" - }, + "aliases": {}, "types": {}, "overrides": {} }, - "name": "viewport", + "experimental": false, + "since": "v1.16", + "name": "headers", "type": { - "name": "", - "union": [ + "name": "Object", + "templates": [ { - "name": "null" + "name": "string" }, { - "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" - } - ] + "name": "string" } ], - "expression": "[null]|[Object]" + "expression": "[Object]<[string], [string]>" }, "spec": [ { "type": "text", - "text": "Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. `null` disables the default viewport." + "text": "Allows to set HTTP headers." } ], "required": false, - "comment": "Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. `null` disables the default viewport.", + "comment": "Allows to set HTTP headers.", "deprecated": false, "async": false, - "alias": "viewport" + "alias": "headers", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": { "only": [ + "js", + "python", "csharp" ], - "aliases": { - "csharp": "viewportSize" - }, + "aliases": {}, "types": {}, "overrides": {} }, - "name": "viewport", + "experimental": false, + "since": "v1.16", + "name": "ignoreHTTPSErrors", "type": { - "name": "", - "union": [ + "name": "boolean", + "expression": "[boolean]" + }, + "spec": [ + { + "type": "text", + "text": "Whether to ignore HTTPS errors when sending network requests. Defaults to `false`." + } + ], + "required": false, + "comment": "Whether to ignore HTTPS errors when sending network requests. Defaults to `false`.", + "deprecated": false, + "async": false, + "alias": "ignoreHTTPSErrors", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js", + "python" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.16", + "name": "params", + "type": { + "name": "Object", + "templates": [ { - "name": "null" + "name": "string" }, { - "name": "Object", - "properties": [ + "name": "", + "union": [ { - "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" + "name": "string" }, { - "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" + "name": "float" + }, + { + "name": "boolean" } ] } ], - "expression": "[null]|[Object]" + "expression": "[Object]<[string], [string]|[float]|[boolean]>" }, "spec": [ { "type": "text", - "text": "Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use `ViewportSize.NoViewport` to disable the default viewport." + "text": "Query parameters to be sent with the URL." } ], "required": false, - "comment": "Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use `ViewportSize.NoViewport` to disable\nthe default viewport.", + "comment": "Query parameters to be sent with the URL.", "deprecated": false, "async": false, - "alias": "viewport" + "alias": "params", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": { "only": [ - "python" + "csharp" ], "aliases": {}, "types": {}, "overrides": {} }, - "name": "viewport", + "experimental": false, + "since": "v1.16", + "name": "params", "type": { - "name": "", - "union": [ + "name": "Object", + "templates": [ { - "name": "null" + "name": "string" }, { - "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" - } - ] + "name": "Serializable" } ], - "expression": "[null]|[Object]" + "expression": "[Object]<[string], [Serializable]>" }, "spec": [ { "type": "text", - "text": "Sets a consistent viewport for each page. Defaults to an 1280x720 viewport. `no_viewport` disables the fixed viewport." + "text": "Query parameters to be sent with the URL." } ], "required": false, - "comment": "Sets a consistent viewport for each page. Defaults to an 1280x720 viewport. `no_viewport` disables the fixed viewport.", + "comment": "Query parameters to be sent with the URL.", + "deprecated": false, + "async": false, + "alias": "params", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js", + "python", + "csharp" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.16", + "name": "timeout", + "type": { + "name": "float", + "expression": "[float]" + }, + "spec": [ + { + "type": "text", + "text": "Request timeout in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout." + } + ], + "required": false, + "comment": "Request timeout in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout.", "deprecated": false, "async": false, - "alias": "viewport" + "alias": "timeout", + "overloadIndex": 0, + "paramOrOption": null } ] }, @@ -9112,156 +9776,319 @@ "comment": "", "deprecated": false, "async": false, - "alias": "options" + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null } ] }, { "kind": "method", - "langs": { - "only": [ - "java", - "js", - "python" - ], - "aliases": {}, - "types": {}, - "overrides": {} - }, - "name": "startTracing", + "langs": {}, + "experimental": false, + "since": "v1.16", + "name": "patch", "type": { - "name": "void" + "name": "APIResponse", + "expression": "[APIResponse]" }, "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" + "text": "Sends HTTP(S) [PATCH](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PATCH) request and returns its response. The method will populate request cookies from the context and update context cookies from the response. The method will automatically follow redirects." } ], "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", + "comment": "Sends HTTP(S) [PATCH](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PATCH) request and returns its response.\nThe method will populate request cookies from the context and update context cookies from the response. The method will\nautomatically follow redirects.", "deprecated": false, "async": true, - "alias": "startTracing", + "alias": "patch", + "overloadIndex": 0, + "paramOrOption": null, "args": [ { "kind": "property", "langs": {}, - "name": "page", + "experimental": false, + "since": "v1.16", + "name": "url", "type": { - "name": "Page", - "expression": "[Page]" + "name": "string", + "expression": "[string]" }, "spec": [ { "type": "text", - "text": "Optional, if specified, tracing includes screenshots of the given page." + "text": "Target URL." + } + ], + "required": true, + "comment": "Target URL.", + "deprecated": false, + "async": false, + "alias": "url", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "java" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.18", + "name": "params", + "type": { + "name": "RequestOptions", + "expression": "[RequestOptions]" + }, + "spec": [ + { + "type": "text", + "text": "Optional request parameters." } ], "required": false, - "comment": "Optional, if specified, tracing includes screenshots of the given page.", + "comment": "Optional request parameters.", "deprecated": false, "async": false, - "alias": "page" + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", "langs": {}, + "experimental": false, + "since": "v1.0", "name": "options", "type": { "name": "Object", "properties": [ { "kind": "property", - "langs": {}, - "name": "categories", + "langs": { + "only": [ + "js", + "python", + "csharp" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.16", + "name": "data", "type": { - "name": "Array", - "templates": [ + "name": "", + "union": [ { "name": "string" + }, + { + "name": "Buffer" + }, + { + "name": "Serializable" } ], - "expression": "[Array]<[string]>" + "expression": "[string]|[Buffer]|[Serializable]" }, "spec": [ { "type": "text", - "text": "specify custom categories to use instead of default." + "text": "Allows to set post data of the request. If the data parameter is an object, it will be serialized to json string and `content-type` header will be set to `application/json` if not explicitly set. Otherwise the `content-type` header will be set to `application/octet-stream` if not explicitly set." } ], "required": false, - "comment": "specify custom categories to use instead of default.", + "comment": "Allows to set post data of the request. If the data parameter is an object, it will be serialized to json string and\n`content-type` header will be set to `application/json` if not explicitly set. Otherwise the `content-type` header will\nbe set to `application/octet-stream` if not explicitly set.", "deprecated": false, "async": false, - "alias": "categories" + "alias": "data", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", - "langs": {}, - "name": "path", + "langs": { + "only": [ + "js", + "python", + "csharp" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.16", + "name": "failOnStatusCode", "type": { - "name": "path", - "expression": "[path]" + "name": "boolean", + "expression": "[boolean]" }, "spec": [ { "type": "text", - "text": "A path to write the trace file to." + "text": "Whether to throw on response codes other than 2xx and 3xx. By default response object is returned for all status codes." } ], "required": false, - "comment": "A path to write the trace file to.", + "comment": "Whether to throw on response codes other than 2xx and 3xx. By default response object is returned for all status codes.", "deprecated": false, "async": false, - "alias": "path" + "alias": "failOnStatusCode", + "overloadIndex": 0, + "paramOrOption": null }, { "kind": "property", - "langs": {}, - "name": "screenshots", + "langs": { + "only": [ + "js", + "python" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.16", + "name": "form", + "type": { + "name": "Object", + "templates": [ + { + "name": "string" + }, + { + "name": "", + "union": [ + { + "name": "string" + }, + { + "name": "float" + }, + { + "name": "boolean" + } + ] + } + ], + "expression": "[Object]<[string], [string]|[float]|[boolean]>" + }, + "spec": [ + { + "type": "text", + "text": "Provides an object that will be serialized as html form using `application/x-www-form-urlencoded` encoding and sent as this request body. If this parameter is specified `content-type` header will be set to `application/x-www-form-urlencoded` unless explicitly provided." + } + ], + "required": false, + "comment": "Provides an object that will be serialized as html form using `application/x-www-form-urlencoded` encoding and sent as\nthis request body. If this parameter is specified `content-type` header will be set to\n`application/x-www-form-urlencoded` unless explicitly provided.", + "deprecated": false, + "async": false, + "alias": "form", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.16", + "name": "form", + "type": { + "name": "FormData", + "expression": "[FormData]" + }, + "spec": [ + { + "type": "text", + "text": "Provides an object that will be serialized as html form using `application/x-www-form-urlencoded` encoding and sent as this request body. If this parameter is specified `content-type` header will be set to `application/x-www-form-urlencoded` unless explicitly provided." + }, + { + "type": "text", + "text": "An instance of `FormData` can be created via [`method: APIRequestContext.createFormData`]." + } + ], + "required": false, + "comment": "Provides an object that will be serialized as html form using `application/x-www-form-urlencoded` encoding and sent as\nthis request body. If this parameter is specified `content-type` header will be set to\n`application/x-www-form-urlencoded` unless explicitly provided.\n\nAn instance of `FormData` can be created via [`method: APIRequestContext.createFormData`].", + "deprecated": false, + "async": false, + "alias": "form", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js", + "python", + "csharp" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.16", + "name": "headers", + "type": { + "name": "Object", + "templates": [ + { + "name": "string" + }, + { + "name": "string" + } + ], + "expression": "[Object]<[string], [string]>" + }, + "spec": [ + { + "type": "text", + "text": "Allows to set HTTP headers." + } + ], + "required": false, + "comment": "Allows to set HTTP headers.", + "deprecated": false, + "async": false, + "alias": "headers", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js", + "python", + "csharp" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.16", + "name": "ignoreHTTPSErrors", "type": { "name": "boolean", "expression": "[boolean]" @@ -9269,14 +10096,379 @@ "spec": [ { "type": "text", - "text": "captures screenshots in the trace." + "text": "Whether to ignore HTTPS errors when sending network requests. Defaults to `false`." } ], "required": false, - "comment": "captures screenshots in the trace.", + "comment": "Whether to ignore HTTPS errors when sending network requests. Defaults to `false`.", + "deprecated": false, + "async": false, + "alias": "ignoreHTTPSErrors", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js", + "python" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.16", + "name": "multipart", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "name", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "File name" + } + ], + "required": true, + "comment": "File name", + "deprecated": false, + "async": false, + "alias": "name", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "mimeType", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "File type" + } + ], + "required": true, + "comment": "File type", + "deprecated": false, + "async": false, + "alias": "mimeType", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "buffer", + "type": { + "name": "Buffer", + "expression": "[Buffer]" + }, + "spec": [ + { + "type": "text", + "text": "File content" + } + ], + "required": true, + "comment": "File content", + "deprecated": false, + "async": false, + "alias": "buffer", + "overloadIndex": 0, + "paramOrOption": null + } + ], + "templates": [ + { + "name": "string" + }, + { + "name": "", + "union": [ + { + "name": "string" + }, + { + "name": "float" + }, + { + "name": "boolean" + }, + { + "name": "ReadStream" + }, + { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "name", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "File name" + } + ], + "required": true, + "comment": "File name", + "deprecated": false, + "async": false, + "alias": "name", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "mimeType", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "File type" + } + ], + "required": true, + "comment": "File type", + "deprecated": false, + "async": false, + "alias": "mimeType", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "buffer", + "type": { + "name": "Buffer", + "expression": "[Buffer]" + }, + "spec": [ + { + "type": "text", + "text": "File content" + } + ], + "required": true, + "comment": "File content", + "deprecated": false, + "async": false, + "alias": "buffer", + "overloadIndex": 0, + "paramOrOption": null + } + ] + } + ] + } + ], + "expression": "[Object]<[string], [string]|[float]|[boolean]|[ReadStream]|[Object]>" + }, + "spec": [ + { + "type": "text", + "text": "Provides an object that will be serialized as html form using `multipart/form-data` encoding and sent as this request body. If this parameter is specified `content-type` header will be set to `multipart/form-data` unless explicitly provided. File values can be passed either as [`fs.ReadStream`](https://nodejs.org/api/fs.html#fs_class_fs_readstream) or as file-like object containing file name, mime-type and its content." + } + ], + "required": false, + "comment": "Provides an object that will be serialized as html form using `multipart/form-data` encoding and sent as this request\nbody. If this parameter is specified `content-type` header will be set to `multipart/form-data` unless explicitly\nprovided. File values can be passed either as [`fs.ReadStream`](https://nodejs.org/api/fs.html#fs_class_fs_readstream)\nor as file-like object containing file name, mime-type and its content.", + "deprecated": false, + "async": false, + "alias": "multipart", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.16", + "name": "multipart", + "type": { + "name": "FormData", + "expression": "[FormData]" + }, + "spec": [ + { + "type": "text", + "text": "Provides an object that will be serialized as html form using `multipart/form-data` encoding and sent as this request body. If this parameter is specified `content-type` header will be set to `multipart/form-data` unless explicitly provided. File values can be passed either as [`fs.ReadStream`](https://nodejs.org/api/fs.html#fs_class_fs_readstream) or as file-like object containing file name, mime-type and its content." + }, + { + "type": "text", + "text": "An instance of `FormData` can be created via [`method: APIRequestContext.createFormData`]." + } + ], + "required": false, + "comment": "Provides an object that will be serialized as html form using `multipart/form-data` encoding and sent as this request\nbody. If this parameter is specified `content-type` header will be set to `multipart/form-data` unless explicitly\nprovided. File values can be passed either as [`fs.ReadStream`](https://nodejs.org/api/fs.html#fs_class_fs_readstream)\nor as file-like object containing file name, mime-type and its content.\n\nAn instance of `FormData` can be created via [`method: APIRequestContext.createFormData`].", + "deprecated": false, + "async": false, + "alias": "multipart", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js", + "python" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.16", + "name": "params", + "type": { + "name": "Object", + "templates": [ + { + "name": "string" + }, + { + "name": "", + "union": [ + { + "name": "string" + }, + { + "name": "float" + }, + { + "name": "boolean" + } + ] + } + ], + "expression": "[Object]<[string], [string]|[float]|[boolean]>" + }, + "spec": [ + { + "type": "text", + "text": "Query parameters to be sent with the URL." + } + ], + "required": false, + "comment": "Query parameters to be sent with the URL.", + "deprecated": false, + "async": false, + "alias": "params", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.16", + "name": "params", + "type": { + "name": "Object", + "templates": [ + { + "name": "string" + }, + { + "name": "Serializable" + } + ], + "expression": "[Object]<[string], [Serializable]>" + }, + "spec": [ + { + "type": "text", + "text": "Query parameters to be sent with the URL." + } + ], + "required": false, + "comment": "Query parameters to be sent with the URL.", + "deprecated": false, + "async": false, + "alias": "params", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js", + "python", + "csharp" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.16", + "name": "timeout", + "type": { + "name": "float", + "expression": "[float]" + }, + "spec": [ + { + "type": "text", + "text": "Request timeout in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout." + } + ], + "required": false, + "comment": "Request timeout in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout.", "deprecated": false, "async": false, - "alias": "screenshots" + "alias": "timeout", + "overloadIndex": 0, + "paramOrOption": null } ] }, @@ -9284,929 +10476,27431 @@ "comment": "", "deprecated": false, "async": false, - "alias": "options" + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null } ] }, - { - "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", + "experimental": false, + "since": "v1.16", + "name": "post", "type": { - "name": "string", - "expression": "[string]" + "name": "APIResponse", + "expression": "[APIResponse]" }, "spec": [ { "type": "text", - "text": "Returns the browser version." + "text": "Sends HTTP(S) [POST](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST) request and returns its response. The method will populate request cookies from the context and update context cookies from the response. The method will automatically follow redirects." } ], "required": true, - "comment": "Returns the browser version.", + "comment": "Sends HTTP(S) [POST](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST) request and returns its response.\nThe method will populate request cookies from the context and update context cookies from the response. The method will\nautomatically follow redirects.", "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\"s 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\"s 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\"s no longer needed.", - "context.close()" - ], - "codeLang": "python sync" - } - ], - "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\"s 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\"s 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\"s no longer needed.\ncontext.close()\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." - }, + "async": true, + "alias": "post", + "overloadIndex": 0, + "paramOrOption": null, + "args": [ { - "type": "text", - "text": "Emitted when new background page is created in the context." + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.16", + "name": "url", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "Target URL." + } + ], + "required": true, + "comment": "Target URL.", + "deprecated": false, + "async": false, + "alias": "url", + "overloadIndex": 0, + "paramOrOption": null }, { - "type": "code", - "lines": [ - "const backgroundPage = await context.waitForEvent('backgroundpage');" + "kind": "property", + "langs": { + "only": [ + "java" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.18", + "name": "params", + "type": { + "name": "RequestOptions", + "expression": "[RequestOptions]" + }, + "spec": [ + { + "type": "text", + "text": "Optional request parameters." + } ], - "codeLang": "js" + "required": false, + "comment": "Optional request parameters.", + "deprecated": false, + "async": false, + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null }, { - "type": "code", - "lines": [ - "background_page = await context.wait_for_event(\"backgroundpage\")" + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "options", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": { + "only": [ + "js", + "python", + "csharp" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.16", + "name": "data", + "type": { + "name": "", + "union": [ + { + "name": "string" + }, + { + "name": "Buffer" + }, + { + "name": "Serializable" + } + ], + "expression": "[string]|[Buffer]|[Serializable]" + }, + "spec": [ + { + "type": "text", + "text": "Allows to set post data of the request. If the data parameter is an object, it will be serialized to json string and `content-type` header will be set to `application/json` if not explicitly set. Otherwise the `content-type` header will be set to `application/octet-stream` if not explicitly set." + } + ], + "required": false, + "comment": "Allows to set post data of the request. If the data parameter is an object, it will be serialized to json string and\n`content-type` header will be set to `application/json` if not explicitly set. Otherwise the `content-type` header will\nbe set to `application/octet-stream` if not explicitly set.", + "deprecated": false, + "async": false, + "alias": "data", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js", + "python", + "csharp" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.16", + "name": "failOnStatusCode", + "type": { + "name": "boolean", + "expression": "[boolean]" + }, + "spec": [ + { + "type": "text", + "text": "Whether to throw on response codes other than 2xx and 3xx. By default response object is returned for all status codes." + } + ], + "required": false, + "comment": "Whether to throw on response codes other than 2xx and 3xx. By default response object is returned for all status codes.", + "deprecated": false, + "async": false, + "alias": "failOnStatusCode", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js", + "python" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.16", + "name": "form", + "type": { + "name": "Object", + "templates": [ + { + "name": "string" + }, + { + "name": "", + "union": [ + { + "name": "string" + }, + { + "name": "float" + }, + { + "name": "boolean" + } + ] + } + ], + "expression": "[Object]<[string], [string]|[float]|[boolean]>" + }, + "spec": [ + { + "type": "text", + "text": "Provides an object that will be serialized as html form using `application/x-www-form-urlencoded` encoding and sent as this request body. If this parameter is specified `content-type` header will be set to `application/x-www-form-urlencoded` unless explicitly provided." + } + ], + "required": false, + "comment": "Provides an object that will be serialized as html form using `application/x-www-form-urlencoded` encoding and sent as\nthis request body. If this parameter is specified `content-type` header will be set to\n`application/x-www-form-urlencoded` unless explicitly provided.", + "deprecated": false, + "async": false, + "alias": "form", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.16", + "name": "form", + "type": { + "name": "FormData", + "expression": "[FormData]" + }, + "spec": [ + { + "type": "text", + "text": "Provides an object that will be serialized as html form using `application/x-www-form-urlencoded` encoding and sent as this request body. If this parameter is specified `content-type` header will be set to `application/x-www-form-urlencoded` unless explicitly provided." + }, + { + "type": "text", + "text": "An instance of `FormData` can be created via [`method: APIRequestContext.createFormData`]." + } + ], + "required": false, + "comment": "Provides an object that will be serialized as html form using `application/x-www-form-urlencoded` encoding and sent as\nthis request body. If this parameter is specified `content-type` header will be set to\n`application/x-www-form-urlencoded` unless explicitly provided.\n\nAn instance of `FormData` can be created via [`method: APIRequestContext.createFormData`].", + "deprecated": false, + "async": false, + "alias": "form", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js", + "python", + "csharp" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.16", + "name": "headers", + "type": { + "name": "Object", + "templates": [ + { + "name": "string" + }, + { + "name": "string" + } + ], + "expression": "[Object]<[string], [string]>" + }, + "spec": [ + { + "type": "text", + "text": "Allows to set HTTP headers." + } + ], + "required": false, + "comment": "Allows to set HTTP headers.", + "deprecated": false, + "async": false, + "alias": "headers", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js", + "python", + "csharp" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.16", + "name": "ignoreHTTPSErrors", + "type": { + "name": "boolean", + "expression": "[boolean]" + }, + "spec": [ + { + "type": "text", + "text": "Whether to ignore HTTPS errors when sending network requests. Defaults to `false`." + } + ], + "required": false, + "comment": "Whether to ignore HTTPS errors when sending network requests. Defaults to `false`.", + "deprecated": false, + "async": false, + "alias": "ignoreHTTPSErrors", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js", + "python" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.16", + "name": "multipart", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "name", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "File name" + } + ], + "required": true, + "comment": "File name", + "deprecated": false, + "async": false, + "alias": "name", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "mimeType", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "File type" + } + ], + "required": true, + "comment": "File type", + "deprecated": false, + "async": false, + "alias": "mimeType", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "buffer", + "type": { + "name": "Buffer", + "expression": "[Buffer]" + }, + "spec": [ + { + "type": "text", + "text": "File content" + } + ], + "required": true, + "comment": "File content", + "deprecated": false, + "async": false, + "alias": "buffer", + "overloadIndex": 0, + "paramOrOption": null + } + ], + "templates": [ + { + "name": "string" + }, + { + "name": "", + "union": [ + { + "name": "string" + }, + { + "name": "float" + }, + { + "name": "boolean" + }, + { + "name": "ReadStream" + }, + { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "name", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "File name" + } + ], + "required": true, + "comment": "File name", + "deprecated": false, + "async": false, + "alias": "name", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "mimeType", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "File type" + } + ], + "required": true, + "comment": "File type", + "deprecated": false, + "async": false, + "alias": "mimeType", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "buffer", + "type": { + "name": "Buffer", + "expression": "[Buffer]" + }, + "spec": [ + { + "type": "text", + "text": "File content" + } + ], + "required": true, + "comment": "File content", + "deprecated": false, + "async": false, + "alias": "buffer", + "overloadIndex": 0, + "paramOrOption": null + } + ] + } + ] + } + ], + "expression": "[Object]<[string], [string]|[float]|[boolean]|[ReadStream]|[Object]>" + }, + "spec": [ + { + "type": "text", + "text": "Provides an object that will be serialized as html form using `multipart/form-data` encoding and sent as this request body. If this parameter is specified `content-type` header will be set to `multipart/form-data` unless explicitly provided. File values can be passed either as [`fs.ReadStream`](https://nodejs.org/api/fs.html#fs_class_fs_readstream) or as file-like object containing file name, mime-type and its content." + } + ], + "required": false, + "comment": "Provides an object that will be serialized as html form using `multipart/form-data` encoding and sent as this request\nbody. If this parameter is specified `content-type` header will be set to `multipart/form-data` unless explicitly\nprovided. File values can be passed either as [`fs.ReadStream`](https://nodejs.org/api/fs.html#fs_class_fs_readstream)\nor as file-like object containing file name, mime-type and its content.", + "deprecated": false, + "async": false, + "alias": "multipart", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.16", + "name": "multipart", + "type": { + "name": "FormData", + "expression": "[FormData]" + }, + "spec": [ + { + "type": "text", + "text": "Provides an object that will be serialized as html form using `multipart/form-data` encoding and sent as this request body. If this parameter is specified `content-type` header will be set to `multipart/form-data` unless explicitly provided. File values can be passed either as [`fs.ReadStream`](https://nodejs.org/api/fs.html#fs_class_fs_readstream) or as file-like object containing file name, mime-type and its content." + }, + { + "type": "text", + "text": "An instance of `FormData` can be created via [`method: APIRequestContext.createFormData`]." + } + ], + "required": false, + "comment": "Provides an object that will be serialized as html form using `multipart/form-data` encoding and sent as this request\nbody. If this parameter is specified `content-type` header will be set to `multipart/form-data` unless explicitly\nprovided. File values can be passed either as [`fs.ReadStream`](https://nodejs.org/api/fs.html#fs_class_fs_readstream)\nor as file-like object containing file name, mime-type and its content.\n\nAn instance of `FormData` can be created via [`method: APIRequestContext.createFormData`].", + "deprecated": false, + "async": false, + "alias": "multipart", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js", + "python" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.16", + "name": "params", + "type": { + "name": "Object", + "templates": [ + { + "name": "string" + }, + { + "name": "", + "union": [ + { + "name": "string" + }, + { + "name": "float" + }, + { + "name": "boolean" + } + ] + } + ], + "expression": "[Object]<[string], [string]|[float]|[boolean]>" + }, + "spec": [ + { + "type": "text", + "text": "Query parameters to be sent with the URL." + } + ], + "required": false, + "comment": "Query parameters to be sent with the URL.", + "deprecated": false, + "async": false, + "alias": "params", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.16", + "name": "params", + "type": { + "name": "Object", + "templates": [ + { + "name": "string" + }, + { + "name": "Serializable" + } + ], + "expression": "[Object]<[string], [Serializable]>" + }, + "spec": [ + { + "type": "text", + "text": "Query parameters to be sent with the URL." + } + ], + "required": false, + "comment": "Query parameters to be sent with the URL.", + "deprecated": false, + "async": false, + "alias": "params", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js", + "python", + "csharp" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.16", + "name": "timeout", + "type": { + "name": "float", + "expression": "[float]" + }, + "spec": [ + { + "type": "text", + "text": "Request timeout in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout." + } + ], + "required": false, + "comment": "Request timeout in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout.", + "deprecated": false, + "async": false, + "alias": "timeout", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + "required": false, + "comment": "", + "deprecated": false, + "async": false, + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.16", + "name": "put", + "type": { + "name": "APIResponse", + "expression": "[APIResponse]" + }, + "spec": [ + { + "type": "text", + "text": "Sends HTTP(S) [PUT](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PUT) request and returns its response. The method will populate request cookies from the context and update context cookies from the response. The method will automatically follow redirects." + } + ], + "required": true, + "comment": "Sends HTTP(S) [PUT](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PUT) request and returns its response. The\nmethod will populate request cookies from the context and update context cookies from the response. The method will\nautomatically follow redirects.", + "deprecated": false, + "async": true, + "alias": "put", + "overloadIndex": 0, + "paramOrOption": null, + "args": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.16", + "name": "url", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "Target URL." + } ], - "codeLang": "python async" + "required": true, + "comment": "Target URL.", + "deprecated": false, + "async": false, + "alias": "url", + "overloadIndex": 0, + "paramOrOption": null }, { - "type": "code", - "lines": [ - "background_page = context.wait_for_event(\"backgroundpage\")" + "kind": "property", + "langs": { + "only": [ + "java" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.18", + "name": "params", + "type": { + "name": "RequestOptions", + "expression": "[RequestOptions]" + }, + "spec": [ + { + "type": "text", + "text": "Optional request parameters." + } ], - "codeLang": "python sync" + "required": false, + "comment": "Optional request parameters.", + "deprecated": false, + "async": false, + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "options", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": { + "only": [ + "js", + "python", + "csharp" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.16", + "name": "data", + "type": { + "name": "", + "union": [ + { + "name": "string" + }, + { + "name": "Buffer" + }, + { + "name": "Serializable" + } + ], + "expression": "[string]|[Buffer]|[Serializable]" + }, + "spec": [ + { + "type": "text", + "text": "Allows to set post data of the request. If the data parameter is an object, it will be serialized to json string and `content-type` header will be set to `application/json` if not explicitly set. Otherwise the `content-type` header will be set to `application/octet-stream` if not explicitly set." + } + ], + "required": false, + "comment": "Allows to set post data of the request. If the data parameter is an object, it will be serialized to json string and\n`content-type` header will be set to `application/json` if not explicitly set. Otherwise the `content-type` header will\nbe set to `application/octet-stream` if not explicitly set.", + "deprecated": false, + "async": false, + "alias": "data", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js", + "python", + "csharp" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.16", + "name": "failOnStatusCode", + "type": { + "name": "boolean", + "expression": "[boolean]" + }, + "spec": [ + { + "type": "text", + "text": "Whether to throw on response codes other than 2xx and 3xx. By default response object is returned for all status codes." + } + ], + "required": false, + "comment": "Whether to throw on response codes other than 2xx and 3xx. By default response object is returned for all status codes.", + "deprecated": false, + "async": false, + "alias": "failOnStatusCode", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js", + "python" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.16", + "name": "form", + "type": { + "name": "Object", + "templates": [ + { + "name": "string" + }, + { + "name": "", + "union": [ + { + "name": "string" + }, + { + "name": "float" + }, + { + "name": "boolean" + } + ] + } + ], + "expression": "[Object]<[string], [string]|[float]|[boolean]>" + }, + "spec": [ + { + "type": "text", + "text": "Provides an object that will be serialized as html form using `application/x-www-form-urlencoded` encoding and sent as this request body. If this parameter is specified `content-type` header will be set to `application/x-www-form-urlencoded` unless explicitly provided." + } + ], + "required": false, + "comment": "Provides an object that will be serialized as html form using `application/x-www-form-urlencoded` encoding and sent as\nthis request body. If this parameter is specified `content-type` header will be set to\n`application/x-www-form-urlencoded` unless explicitly provided.", + "deprecated": false, + "async": false, + "alias": "form", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.16", + "name": "form", + "type": { + "name": "FormData", + "expression": "[FormData]" + }, + "spec": [ + { + "type": "text", + "text": "Provides an object that will be serialized as html form using `application/x-www-form-urlencoded` encoding and sent as this request body. If this parameter is specified `content-type` header will be set to `application/x-www-form-urlencoded` unless explicitly provided." + }, + { + "type": "text", + "text": "An instance of `FormData` can be created via [`method: APIRequestContext.createFormData`]." + } + ], + "required": false, + "comment": "Provides an object that will be serialized as html form using `application/x-www-form-urlencoded` encoding and sent as\nthis request body. If this parameter is specified `content-type` header will be set to\n`application/x-www-form-urlencoded` unless explicitly provided.\n\nAn instance of `FormData` can be created via [`method: APIRequestContext.createFormData`].", + "deprecated": false, + "async": false, + "alias": "form", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js", + "python", + "csharp" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.16", + "name": "headers", + "type": { + "name": "Object", + "templates": [ + { + "name": "string" + }, + { + "name": "string" + } + ], + "expression": "[Object]<[string], [string]>" + }, + "spec": [ + { + "type": "text", + "text": "Allows to set HTTP headers." + } + ], + "required": false, + "comment": "Allows to set HTTP headers.", + "deprecated": false, + "async": false, + "alias": "headers", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js", + "python", + "csharp" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.16", + "name": "ignoreHTTPSErrors", + "type": { + "name": "boolean", + "expression": "[boolean]" + }, + "spec": [ + { + "type": "text", + "text": "Whether to ignore HTTPS errors when sending network requests. Defaults to `false`." + } + ], + "required": false, + "comment": "Whether to ignore HTTPS errors when sending network requests. Defaults to `false`.", + "deprecated": false, + "async": false, + "alias": "ignoreHTTPSErrors", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js", + "python" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.16", + "name": "multipart", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "name", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "File name" + } + ], + "required": true, + "comment": "File name", + "deprecated": false, + "async": false, + "alias": "name", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "mimeType", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "File type" + } + ], + "required": true, + "comment": "File type", + "deprecated": false, + "async": false, + "alias": "mimeType", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "buffer", + "type": { + "name": "Buffer", + "expression": "[Buffer]" + }, + "spec": [ + { + "type": "text", + "text": "File content" + } + ], + "required": true, + "comment": "File content", + "deprecated": false, + "async": false, + "alias": "buffer", + "overloadIndex": 0, + "paramOrOption": null + } + ], + "templates": [ + { + "name": "string" + }, + { + "name": "", + "union": [ + { + "name": "string" + }, + { + "name": "float" + }, + { + "name": "boolean" + }, + { + "name": "ReadStream" + }, + { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "name", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "File name" + } + ], + "required": true, + "comment": "File name", + "deprecated": false, + "async": false, + "alias": "name", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "mimeType", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "File type" + } + ], + "required": true, + "comment": "File type", + "deprecated": false, + "async": false, + "alias": "mimeType", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "buffer", + "type": { + "name": "Buffer", + "expression": "[Buffer]" + }, + "spec": [ + { + "type": "text", + "text": "File content" + } + ], + "required": true, + "comment": "File content", + "deprecated": false, + "async": false, + "alias": "buffer", + "overloadIndex": 0, + "paramOrOption": null + } + ] + } + ] + } + ], + "expression": "[Object]<[string], [string]|[float]|[boolean]|[ReadStream]|[Object]>" + }, + "spec": [ + { + "type": "text", + "text": "Provides an object that will be serialized as html form using `multipart/form-data` encoding and sent as this request body. If this parameter is specified `content-type` header will be set to `multipart/form-data` unless explicitly provided. File values can be passed either as [`fs.ReadStream`](https://nodejs.org/api/fs.html#fs_class_fs_readstream) or as file-like object containing file name, mime-type and its content." + } + ], + "required": false, + "comment": "Provides an object that will be serialized as html form using `multipart/form-data` encoding and sent as this request\nbody. If this parameter is specified `content-type` header will be set to `multipart/form-data` unless explicitly\nprovided. File values can be passed either as [`fs.ReadStream`](https://nodejs.org/api/fs.html#fs_class_fs_readstream)\nor as file-like object containing file name, mime-type and its content.", + "deprecated": false, + "async": false, + "alias": "multipart", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.16", + "name": "multipart", + "type": { + "name": "FormData", + "expression": "[FormData]" + }, + "spec": [ + { + "type": "text", + "text": "Provides an object that will be serialized as html form using `multipart/form-data` encoding and sent as this request body. If this parameter is specified `content-type` header will be set to `multipart/form-data` unless explicitly provided. File values can be passed either as [`fs.ReadStream`](https://nodejs.org/api/fs.html#fs_class_fs_readstream) or as file-like object containing file name, mime-type and its content." + }, + { + "type": "text", + "text": "An instance of `FormData` can be created via [`method: APIRequestContext.createFormData`]." + } + ], + "required": false, + "comment": "Provides an object that will be serialized as html form using `multipart/form-data` encoding and sent as this request\nbody. If this parameter is specified `content-type` header will be set to `multipart/form-data` unless explicitly\nprovided. File values can be passed either as [`fs.ReadStream`](https://nodejs.org/api/fs.html#fs_class_fs_readstream)\nor as file-like object containing file name, mime-type and its content.\n\nAn instance of `FormData` can be created via [`method: APIRequestContext.createFormData`].", + "deprecated": false, + "async": false, + "alias": "multipart", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js", + "python" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.16", + "name": "params", + "type": { + "name": "Object", + "templates": [ + { + "name": "string" + }, + { + "name": "", + "union": [ + { + "name": "string" + }, + { + "name": "float" + }, + { + "name": "boolean" + } + ] + } + ], + "expression": "[Object]<[string], [string]|[float]|[boolean]>" + }, + "spec": [ + { + "type": "text", + "text": "Query parameters to be sent with the URL." + } + ], + "required": false, + "comment": "Query parameters to be sent with the URL.", + "deprecated": false, + "async": false, + "alias": "params", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.16", + "name": "params", + "type": { + "name": "Object", + "templates": [ + { + "name": "string" + }, + { + "name": "Serializable" + } + ], + "expression": "[Object]<[string], [Serializable]>" + }, + "spec": [ + { + "type": "text", + "text": "Query parameters to be sent with the URL." + } + ], + "required": false, + "comment": "Query parameters to be sent with the URL.", + "deprecated": false, + "async": false, + "alias": "params", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js", + "python", + "csharp" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.16", + "name": "timeout", + "type": { + "name": "float", + "expression": "[float]" + }, + "spec": [ + { + "type": "text", + "text": "Request timeout in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout." + } + ], + "required": false, + "comment": "Request timeout in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout.", + "deprecated": false, + "async": false, + "alias": "timeout", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + "required": false, + "comment": "", + "deprecated": false, + "async": false, + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + { + "kind": "method", + "langs": { + "types": { + "java": { + "name": "string", + "expression": "[string]" + }, + "csharp": { + "name": "string", + "expression": "[string]" + } + } + }, + "experimental": false, + "since": "v1.16", + "name": "storageState", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "cookies", + "type": { + "name": "Array", + "templates": [ + { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "name", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "name", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "value", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "value", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "domain", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "domain", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "path", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "path", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "httpOnly", + "type": { + "name": "boolean", + "expression": "[boolean]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "httpOnly", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "secure", + "type": { + "name": "boolean", + "expression": "[boolean]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "secure", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + } + ], + "expression": "[Array]<[Object]>" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "cookies", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "origins", + "type": { + "name": "Array", + "templates": [ + { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "origin", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "origin", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "localStorage", + "type": { + "name": "Array", + "templates": [ + { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "name", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "name", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "value", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "value", + "overloadIndex": 0, + "paramOrOption": null + } + ] + } + ], + "expression": "[Array]<[Object]>" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "localStorage", + "overloadIndex": 0, + "paramOrOption": null + } + ] + } + ], + "expression": "[Array]<[Object]>" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "origins", + "overloadIndex": 0, + "paramOrOption": null + } + ], + "expression": "[Object]" + }, + "spec": [ + { + "type": "text", + "text": "Returns storage state for this request context, contains current cookies and local storage snapshot if it was passed to the constructor." + } + ], + "required": true, + "comment": "Returns storage state for this request context, contains current cookies and local storage snapshot if it was passed to\nthe constructor.", + "deprecated": false, + "async": true, + "alias": "storageState", + "overloadIndex": 0, + "paramOrOption": null, + "args": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "options", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.16", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + "required": false, + "comment": "", + "deprecated": false, + "async": false, + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null + } + ] + } + ] + }, + { + "name": "APIResponse", + "spec": [ + { + "type": "text", + "text": "`APIResponse` class represents responses returned by [`method: APIRequestContext.get`] and similar methods." + }, + { + "type": "code", + "lines": [ + "import asyncio", + "from playwright.async_api import async_playwright, Playwright", + "", + "async def run(playwright: Playwright):", + " context = await playwright.request.new_context()", + " response = await context.get(\"https://example.com/user/repos\")", + " assert response.ok", + " assert response.status == 200", + " assert response.headers[\"content-type\"] == \"application/json; charset=utf-8\"", + " assert response.json()[\"name\"] == \"foobar\"", + " assert await response.body() == '{\"status\": \"ok\"}'", + "", + "", + "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", + "", + "with sync_playwright() as p:", + " context = playwright.request.new_context()", + " response = context.get(\"https://example.com/user/repos\")", + " assert response.ok", + " assert response.status == 200", + " assert response.headers[\"content-type\"] == \"application/json; charset=utf-8\"", + " assert response.json()[\"name\"] == \"foobar\"", + " assert response.body() == '{\"status\": \"ok\"}'" + ], + "codeLang": "python sync" + } + ], + "langs": {}, + "comment": "`APIResponse` class represents responses returned by [`method: APIRequestContext.get`] and similar methods.\n\n```python async\nimport asyncio\nfrom playwright.async_api import async_playwright, Playwright\n\nasync def run(playwright: Playwright):\n context = await playwright.request.new_context()\n response = await context.get(\"https://example.com/user/repos\")\n assert response.ok\n assert response.status == 200\n assert response.headers[\"content-type\"] == \"application/json; charset=utf-8\"\n assert response.json()[\"name\"] == \"foobar\"\n assert await response.body() == '{\"status\": \"ok\"}'\n\n\nasync def main():\n async with async_playwright() as playwright:\n await run(playwright)\n\nasyncio.run(main())\n```\n\n```python sync\nfrom playwright.sync_api import sync_playwright\n\nwith sync_playwright() as p:\n context = playwright.request.new_context()\n response = context.get(\"https://example.com/user/repos\")\n assert response.ok\n assert response.status == 200\n assert response.headers[\"content-type\"] == \"application/json; charset=utf-8\"\n assert response.json()[\"name\"] == \"foobar\"\n assert response.body() == '{\"status\": \"ok\"}'\n```\n", + "members": [ + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.16", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.16", + "name": "dispose", + "type": { + "name": "void" + }, + "spec": [ + { + "type": "text", + "text": "Disposes the body of this response. If not called then the body will stay in memory until the context closes." + } + ], + "required": true, + "comment": "Disposes the body of this response. If not called then the body will stay in memory until the context closes.", + "deprecated": false, + "async": true, + "alias": "dispose", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.16", + "name": "headers", + "type": { + "name": "Object", + "templates": [ + { + "name": "string" + }, + { + "name": "string" + } + ], + "expression": "[Object]<[string], [string]>" + }, + "spec": [ + { + "type": "text", + "text": "An object with all the response HTTP headers associated with this response." + } + ], + "required": true, + "comment": "An object with all the response HTTP headers associated with this response.", + "deprecated": false, + "async": false, + "alias": "headers", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.16", + "name": "headersArray", + "type": { + "name": "Array", + "templates": [ + { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "name", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "Name of the header." + } + ], + "required": true, + "comment": "Name of the header.", + "deprecated": false, + "async": false, + "alias": "name", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "value", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "Value of the header." + } + ], + "required": true, + "comment": "Value of the header.", + "deprecated": false, + "async": false, + "alias": "value", + "overloadIndex": 0, + "paramOrOption": null + } + ] + } + ], + "expression": "[Array]<[Object]>" + }, + "spec": [ + { + "type": "text", + "text": "An array with all the request HTTP headers associated with this response. Header names are not lower-cased. Headers with multiple entries, such as `Set-Cookie`, appear in the array multiple times." + } + ], + "required": true, + "comment": "An array with all the request HTTP headers associated with this response. Header names are not lower-cased. Headers with\nmultiple entries, such as `Set-Cookie`, appear in the array multiple times.", + "deprecated": false, + "async": false, + "alias": "headersArray", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": { + "only": [ + "js", + "python" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.16", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": { + "only": [ + "csharp" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.16", + "name": "json", + "type": { + "name": "", + "union": [ + { + "name": "null" + }, + { + "name": "JsonElement" + } + ], + "expression": "[null]|[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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.16", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.16", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.16", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.16", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.16", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + } + ] + }, + { + "name": "APIResponseAssertions", + "spec": [ + { + "type": "text", + "text": "The `APIResponseAssertions` class provides assertion methods that can be used to make assertions about the `APIResponse` in the tests. A new instance of `APIResponseAssertions` is created by calling [`method: PlaywrightAssertions.expectAPIResponse`]:" + }, + { + "type": "code", + "lines": [ + "import { test, expect } from '@playwright/test';", + "", + "test('navigates to login', async ({ page }) => {", + " // ...", + " const response = await page.request.get('https://playwright.dev');", + " await expect(response).toBeOK();", + "});" + ], + "codeLang": "js" + }, + { + "type": "code", + "lines": [ + "...", + "import static com.microsoft.playwright.assertions.PlaywrightAssertions.assertThat;", + "", + "public class TestPage {", + " ...", + " @Test", + " void navigatesToLoginPage() {", + " ...", + " APIResponse response = page.request().get('https://playwright.dev');", + " assertThat(response).isOK();", + " }", + "}" + ], + "codeLang": "java" + }, + { + "type": "code", + "lines": [ + "from playwright.async_api import Page, expect", + "", + "async def test_navigates_to_login_page(page: Page) -> None:", + " # ..", + " response = await page.request.get('https://playwright.dev')", + " await expect(response).to_be_ok()" + ], + "codeLang": "python async" + }, + { + "type": "code", + "lines": [ + "from playwright.sync_api import Page, expect", + "", + "def test_navigates_to_login_page(page: Page) -> None:", + " # ..", + " response = page.request.get('https://playwright.dev')", + " expect(response).to_be_ok()" + ], + "codeLang": "python sync" + } + ], + "langs": { + "only": [ + "js", + "java", + "python" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "comment": "The `APIResponseAssertions` class provides assertion methods that can be used to make assertions about the `APIResponse`\nin the tests. A new instance of `APIResponseAssertions` is created by calling\n[`method: PlaywrightAssertions.expectAPIResponse`]:\n\n```js\nimport { test, expect } from '@playwright/test';\n\ntest('navigates to login', async ({ page }) => {\n // ...\n const response = await page.request.get('https://playwright.dev');\n await expect(response).toBeOK();\n});\n```\n\n```java\n...\nimport static com.microsoft.playwright.assertions.PlaywrightAssertions.assertThat;\n\npublic class TestPage {\n ...\n @Test\n void navigatesToLoginPage() {\n ...\n APIResponse response = page.request().get('https://playwright.dev');\n assertThat(response).isOK();\n }\n}\n```\n\n```python async\nfrom playwright.async_api import Page, expect\n\nasync def test_navigates_to_login_page(page: Page) -> None:\n # ..\n response = await page.request.get('https://playwright.dev')\n await expect(response).to_be_ok()\n```\n\n```python sync\nfrom playwright.sync_api import Page, expect\n\ndef test_navigates_to_login_page(page: Page) -> None:\n # ..\n response = page.request.get('https://playwright.dev')\n expect(response).to_be_ok()\n```\n", + "members": [ + { + "kind": "property", + "langs": { + "only": [ + "java", + "js" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.20", + "name": "not", + "type": { + "name": "APIResponseAssertions", + "expression": "[APIResponseAssertions]" + }, + "spec": [ + { + "type": "text", + "text": "Makes the assertion check for the opposite condition. For example, this code tests that the response status is not successful:" + }, + { + "type": "code", + "lines": [ + "await expect(response).not.toBeOK();" + ], + "codeLang": "js" + }, + { + "type": "code", + "lines": [ + "assertThat(response).not().isOK();" + ], + "codeLang": "java" + } + ], + "required": true, + "comment": "Makes the assertion check for the opposite condition. For example, this code tests that the response status is not\nsuccessful:\n\n```js\nawait expect(response).not.toBeOK();\n```\n\n```java\nassertThat(response).not().isOK();\n```\n", + "deprecated": false, + "async": false, + "alias": "not", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": { + "only": [ + "python" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.19", + "name": "NotToBeOK", + "type": { + "name": "void" + }, + "spec": [ + { + "type": "text", + "text": "The opposite of [`method: APIResponseAssertions.toBeOK`]." + } + ], + "required": true, + "comment": "The opposite of [`method: APIResponseAssertions.toBeOK`].", + "deprecated": false, + "async": true, + "alias": "NotToBeOK", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": { + "aliases": { + "java": "isOK" + }, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.18", + "name": "toBeOK", + "type": { + "name": "void" + }, + "spec": [ + { + "type": "text", + "text": "Ensures the response status code is within [200..299] range." + }, + { + "type": "code", + "lines": [ + "await expect(response).toBeOK();" + ], + "codeLang": "js" + }, + { + "type": "code", + "lines": [ + "assertThat(response).isOK();" + ], + "codeLang": "java" + }, + { + "type": "code", + "lines": [ + "from playwright.async_api import expect", + "", + "# ...", + "await expect(response).to_be_ok()" + ], + "codeLang": "python async" + }, + { + "type": "code", + "lines": [ + "import re", + "from playwright.sync_api import expect", + "", + "# ...", + "expect(response).to_be_ok()" + ], + "codeLang": "python sync" + } + ], + "required": true, + "comment": "Ensures the response status code is within [200..299] range.\n\n```js\nawait expect(response).toBeOK();\n```\n\n```java\nassertThat(response).isOK();\n```\n\n```python async\nfrom playwright.async_api import expect\n\n# ...\nawait expect(response).to_be_ok()\n```\n\n```python sync\nimport re\nfrom playwright.sync_api import expect\n\n# ...\nexpect(response).to_be_ok()\n```\n", + "deprecated": false, + "async": true, + "alias": "toBeOK", + "overloadIndex": 0, + "paramOrOption": null, + "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 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;\n\nusing var playwright = await Playwright.CreateAsync();\nvar firefox = playwright.Firefox;\nvar browser = await firefox.LaunchAsync(new BrowserTypeLaunchOptions { Headless = false });\nvar page = await browser.NewPageAsync();\nawait page.GotoAsync(\"https://www.bing.com\");\nawait browser.CloseAsync();\n```\n", + "members": [ + { + "kind": "event", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.23", + "name": "browserType", + "type": { + "name": "BrowserType", + "expression": "[BrowserType]" + }, + "spec": [ + { + "type": "text", + "text": "Get the browser type (chromium, firefox or webkit) that the browser belongs to." + } + ], + "required": true, + "comment": "Get the browser type (chromium, firefox or webkit) that the browser belongs to.", + "deprecated": false, + "async": false, + "alias": "browserType", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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": "note", + "noteType": "note", + "text": "This is similar to force quitting the browser. Therefore, you should call [`method: BrowserContext.close`] on any `BrowserContext`'s you explicitly created earlier with [`method: Browser.newContext`] **before** calling [`method: Browser.close`]." + }, + { + "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\n> NOTE: This is similar to force quitting the browser. Therefore, you should call [`method: BrowserContext.close`] on\nany `BrowserContext`'s you explicitly created earlier with [`method: Browser.newContext`] **before** calling\n[`method: Browser.close`].\n\nThe `Browser` object itself is considered to be disposed and cannot be used anymore.", + "deprecated": false, + "async": true, + "alias": "close", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": { + "only": [ + "js", + "python" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.11", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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": "note", + "noteType": "note", + "text": "If directly using this method to create `BrowserContext`s, it is best practice to explicilty close the returned context via [`method: BrowserContext.close`] when your code is done with the `BrowserContext`, and before calling [`method: Browser.close`]. This will ensure the `context` is closed gracefully and any artifacts—like HARs and videos—are fully flushed and saved." + }, + { + "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');", + "", + " // Gracefully close up everything", + " await context.close();", + " await browser.close();", + "})();" + ], + "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');", + "", + "// Gracefull close up everything", + "context.close();", + "browser.close();" + ], + "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\")", + "", + "# gracefully close up everything", + "await context.close()", + "await browser.close()" + ], + "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\")", + "", + "# gracefully close up everything", + "context.close()", + "browser.close()" + ], + "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\");", + "", + "// Gracefully close up everything", + "await context.CloseAsync();", + "await browser.CloseAsync();" + ], + "codeLang": "csharp" + } + ], + "required": true, + "comment": "Creates a new browser context. It won't share cookies/cache with other browser contexts.\n\n> NOTE: If directly using this method to create `BrowserContext`s, it is best practice to explicilty close the returned\ncontext via [`method: BrowserContext.close`] when your code is done with the `BrowserContext`, and before calling\n[`method: Browser.close`]. This will ensure the `context` is closed gracefully and any artifacts—like HARs and\nvideos—are fully flushed and saved.\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 // Gracefully close up everything\n await context.close();\n await browser.close();\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// Gracefull close up everything\ncontext.close();\nbrowser.close();\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# gracefully close up everything\nawait context.close()\nawait browser.close()\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# gracefully close up everything\ncontext.close()\nbrowser.close()\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// Gracefully close up everything\nawait context.CloseAsync();\nawait browser.CloseAsync();\n```\n", + "deprecated": false, + "async": true, + "alias": "newContext", + "overloadIndex": 0, + "paramOrOption": null, + "args": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "options", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "name": "acceptDownloads", + "type": { + "name": "boolean", + "expression": "[boolean]" + }, + "spec": [ + { + "type": "text", + "text": "Whether to automatically download all the attachments. Defaults to `true` where all the downloads are accepted." + } + ], + "required": false, + "comment": "Whether to automatically download all the attachments. Defaults to `true` where all the downloads are accepted.", + "deprecated": false, + "async": false, + "alias": "acceptDownloads", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "name": "baseURL", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "When using [`method: Page.goto`], [`method: Page.route`], [`method: Page.waitForURL`], [`method: Page.waitForRequest`], or [`method: Page.waitForResponse`] it takes the base URL in consideration by using the [`URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor for building the corresponding URL. Examples:" + }, + { + "type": "li", + "text": "baseURL: `http://localhost:3000` and navigating to `/bar.html` results in `http://localhost:3000/bar.html`", + "liType": "bullet" + }, + { + "type": "li", + "text": "baseURL: `http://localhost:3000/foo/` and navigating to `./bar.html` results in `http://localhost:3000/foo/bar.html`", + "liType": "bullet" + }, + { + "type": "li", + "text": "baseURL: `http://localhost:3000/foo` (without trailing slash) and navigating to `./bar.html` results in `http://localhost:3000/bar.html`", + "liType": "bullet" + } + ], + "required": false, + "comment": "When using [`method: Page.goto`], [`method: Page.route`], [`method: Page.waitForURL`], [`method: Page.waitForRequest`],\nor [`method: Page.waitForResponse`] it takes the base URL in consideration by using the\n[`URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor for building the corresponding URL.\nExamples:\n- baseURL: `http://localhost:3000` and navigating to `/bar.html` results in `http://localhost:3000/bar.html`\n- baseURL: `http://localhost:3000/foo/` and navigating to `./bar.html` results in `http://localhost:3000/foo/bar.html`\n- baseURL: `http://localhost:3000/foo` (without trailing slash) and navigating to `./bar.html` results in\n `http://localhost:3000/bar.html`", + "deprecated": false, + "async": false, + "alias": "baseURL", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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." + } + ], + "required": false, + "comment": "An object containing additional HTTP headers to be sent with every request.", + "deprecated": false, + "async": false, + "alias": "extraHTTPHeaders", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "name": "forcedColors", + "type": { + "name": "ForcedColors", + "union": [ + { + "name": "\"active\"" + }, + { + "name": "\"none\"" + } + ], + "expression": "[ForcedColors]<\"active\"|\"none\">" + }, + "spec": [ + { + "type": "text", + "text": "Emulates `'forced-colors'` media feature, supported values are `'active'`, `'none'`. See [`method: Page.emulateMedia`] for more details. Defaults to `'none'`." + }, + { + "type": "note", + "noteType": "note", + "text": "It's not supported in WebKit, see [here](https://bugs.webkit.org/show_bug.cgi?id=225281) in their issue tracker." + } + ], + "required": false, + "comment": "Emulates `'forced-colors'` media feature, supported values are `'active'`, `'none'`. See [`method: Page.emulateMedia`]\nfor more details. Defaults to `'none'`.\n\n> NOTE: It's not supported in WebKit, see [here](https://bugs.webkit.org/show_bug.cgi?id=225281) in their issue tracker.", + "deprecated": false, + "async": false, + "alias": "forcedColors", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "name": "geolocation", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ], + "expression": "[Object]" + }, + "spec": [], + "required": false, + "comment": "", + "deprecated": false, + "async": false, + "alias": "geolocation", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "name": "httpCredentials", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "username", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "username", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "password", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "password", + "overloadIndex": 0, + "paramOrOption": null + } + ], + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "name": "ignoreHTTPSErrors", + "type": { + "name": "boolean", + "expression": "[boolean]" + }, + "spec": [ + { + "type": "text", + "text": "Whether to ignore HTTPS errors when sending network requests. Defaults to `false`." + } + ], + "required": false, + "comment": "Whether to ignore HTTPS errors when sending network requests. Defaults to `false`.", + "deprecated": false, + "async": false, + "alias": "ignoreHTTPSErrors", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "python" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "name": "proxy", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "bypass", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "Optional comma-separated domains to bypass proxy, for example `\".com, chromium.org, .domain.com\"`." + } + ], + "required": false, + "comment": "Optional comma-separated domains to bypass proxy, for example `\".com, chromium.org, .domain.com\"`.", + "deprecated": false, + "async": false, + "alias": "bypass", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ], + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "name": "recordHar", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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`. Deprecated, use `content` policy instead." + } + ], + "required": false, + "comment": "Optional setting to control whether to omit request content from the HAR. Defaults to `false`. Deprecated, use `content`\npolicy instead.", + "deprecated": false, + "async": false, + "alias": "omitContent", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "content", + "type": { + "name": "HarContentPolicy", + "union": [ + { + "name": "\"omit\"" + }, + { + "name": "\"embed\"" + }, + { + "name": "\"attach\"" + } + ], + "expression": "[HarContentPolicy]<\"omit\"|\"embed\"|\"attach\">" + }, + "spec": [ + { + "type": "text", + "text": "Optional setting to control resource content management. If `omit` is specified, content is not persisted. If `attach` is specified, resources are persistet as separate files or entries in the ZIP archive. If `embed` is specified, content is stored inline the HAR file as per HAR specification. Defaults to `attach` for `.zip` output files and to `embed` for all other file extensions." + } + ], + "required": false, + "comment": "Optional setting to control resource content management. If `omit` is specified, content is not persisted. If `attach`\nis specified, resources are persistet as separate files or entries in the ZIP archive. If `embed` is specified, content\nis stored inline the HAR file as per HAR specification. Defaults to `attach` for `.zip` output files and to `embed` for\nall other file extensions.", + "deprecated": false, + "async": false, + "alias": "content", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "path", + "type": { + "name": "path", + "expression": "[path]" + }, + "spec": [ + { + "type": "text", + "text": "Path on the filesystem to write the HAR file to. If the file name ends with `.zip`, `content: 'attach'` is used by default." + } + ], + "required": true, + "comment": "Path on the filesystem to write the HAR file to. If the file name ends with `.zip`, `content: 'attach'` is used by\ndefault.", + "deprecated": false, + "async": false, + "alias": "path", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "mode", + "type": { + "name": "HarMode", + "union": [ + { + "name": "\"full\"" + }, + { + "name": "\"minimal\"" + } + ], + "expression": "[HarMode]<\"full\"|\"minimal\">" + }, + "spec": [ + { + "type": "text", + "text": "When set to `minimal`, only record information necessary for routing from HAR. This omits sizes, timing, page, cookies, security and other types of HAR information that are not used when replaying from HAR. Defaults to `full`." + } + ], + "required": false, + "comment": "When set to `minimal`, only record information necessary for routing from HAR. This omits sizes, timing, page, cookies,\nsecurity and other types of HAR information that are not used when replaying from HAR. Defaults to `full`.", + "deprecated": false, + "async": false, + "alias": "mode", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "urlFilter", + "type": { + "name": "", + "union": [ + { + "name": "string" + }, + { + "name": "RegExp" + } + ], + "expression": "[string]|[RegExp]" + }, + "spec": [ + { + "type": "text", + "text": "A glob or regex pattern to filter requests that are stored in the HAR. When a `baseURL` via the context options was provided and the passed URL is a path, it gets merged via the [`new URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor." + } + ], + "required": false, + "comment": "A glob or regex pattern to filter requests that are stored in the HAR. When a `baseURL` via the context options was\nprovided and the passed URL is a path, it gets merged via the\n[`new URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor.", + "deprecated": false, + "async": false, + "alias": "urlFilter", + "overloadIndex": 0, + "paramOrOption": null + } + ], + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp", + "java", + "python" + ], + "aliases": { + "python": "record_har_content" + }, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "name": "recordHarContent", + "type": { + "name": "HarContentPolicy", + "union": [ + { + "name": "\"omit\"" + }, + { + "name": "\"embed\"" + }, + { + "name": "\"attach\"" + } + ], + "expression": "[HarContentPolicy]<\"omit\"|\"embed\"|\"attach\">" + }, + "spec": [ + { + "type": "text", + "text": "Optional setting to control resource content management. If `omit` is specified, content is not persisted. If `attach` is specified, resources are persistet as separate files and all of these files are archived along with the HAR file. Defaults to `embed`, which stores content inline the HAR file as per HAR specification." + } + ], + "required": false, + "comment": "Optional setting to control resource content management. If `omit` is specified, content is not persisted. If `attach`\nis specified, resources are persistet as separate files and all of these files are archived along with the HAR file.\nDefaults to `embed`, which stores content inline the HAR file as per HAR specification.", + "deprecated": false, + "async": false, + "alias": "recordHarContent", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp", + "java", + "python" + ], + "aliases": { + "python": "record_har_mode" + }, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "name": "recordHarMode", + "type": { + "name": "HarMode", + "union": [ + { + "name": "\"full\"" + }, + { + "name": "\"minimal\"" + } + ], + "expression": "[HarMode]<\"full\"|\"minimal\">" + }, + "spec": [ + { + "type": "text", + "text": "When set to `minimal`, only record information necessary for routing from HAR. This omits sizes, timing, page, cookies, security and other types of HAR information that are not used when replaying from HAR. Defaults to `full`." + } + ], + "required": false, + "comment": "When set to `minimal`, only record information necessary for routing from HAR. This omits sizes, timing, page, cookies,\nsecurity and other types of HAR information that are not used when replaying from HAR. Defaults to `full`.", + "deprecated": false, + "async": false, + "alias": "recordHarMode", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp", + "java", + "python" + ], + "aliases": { + "python": "record_har_omit_content" + }, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp", + "java", + "python" + ], + "aliases": { + "python": "record_har_path" + }, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp", + "java", + "python" + ], + "aliases": { + "python": "record_har_url_filter" + }, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "name": "recordHarUrlFilter", + "type": { + "name": "", + "union": [ + { + "name": "string" + }, + { + "name": "RegExp" + } + ], + "expression": "[string]|[RegExp]" + }, + "spec": [], + "required": false, + "comment": "", + "deprecated": false, + "async": false, + "alias": "recordHarUrlFilter", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "name": "recordVideo", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "size", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ], + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ], + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp", + "java", + "python" + ], + "aliases": { + "python": "record_video_dir" + }, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp", + "java", + "python" + ], + "aliases": { + "python": "record_video_size" + }, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "name": "recordVideoSize", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ], + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "aliases": { + "java": "screenSize", + "csharp": "screenSize" + }, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "name": "screen", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ], + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "name": "serviceWorkers", + "type": { + "name": "ServiceWorkerPolicy", + "union": [ + { + "name": "\"allow\"" + }, + { + "name": "\"block\"" + } + ], + "expression": "[ServiceWorkerPolicy]<\"allow\"|\"block\">" + }, + "spec": [ + { + "type": "text", + "text": "Whether to allow sites to register Service workers. Defaults to `'allow'`." + }, + { + "type": "li", + "text": "`'allow'`: [Service Workers](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API) can be registered.", + "liType": "bullet" + }, + { + "type": "li", + "text": "`'block'`: Playwright will block all registration of Service Workers.", + "liType": "bullet" + } + ], + "required": false, + "comment": "Whether to allow sites to register Service workers. Defaults to `'allow'`.\n- `'allow'`: [Service Workers](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API) can be registered.\n- `'block'`: Playwright will block all registration of Service Workers.", + "deprecated": false, + "async": false, + "alias": "serviceWorkers", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js", + "python" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "name": "storageState", + "type": { + "name": "", + "union": [ + { + "name": "path" + }, + { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "cookies", + "type": { + "name": "Array", + "templates": [ + { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "name", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "name", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "value", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "value", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "domain", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "domain and path are required" + } + ], + "required": true, + "comment": "domain and path are required", + "deprecated": false, + "async": false, + "alias": "domain", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "path", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "domain and path are required" + } + ], + "required": true, + "comment": "domain and path are required", + "deprecated": false, + "async": false, + "alias": "path", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "httpOnly", + "type": { + "name": "boolean", + "expression": "[boolean]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "httpOnly", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "secure", + "type": { + "name": "boolean", + "expression": "[boolean]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "secure", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "sameSite", + "type": { + "name": "SameSiteAttribute", + "union": [ + { + "name": "\"Strict\"" + }, + { + "name": "\"Lax\"" + }, + { + "name": "\"None\"" + } + ], + "expression": "[SameSiteAttribute]<\"Strict\"|\"Lax\"|\"None\">" + }, + "spec": [ + { + "type": "text", + "text": "sameSite flag" + } + ], + "required": true, + "comment": "sameSite flag", + "deprecated": false, + "async": false, + "alias": "sameSite", + "overloadIndex": 0, + "paramOrOption": null + } + ] + } + ], + "expression": "[Array]<[Object]>" + }, + "spec": [ + { + "type": "text", + "text": "cookies to set for context" + } + ], + "required": true, + "comment": "cookies to set for context", + "deprecated": false, + "async": false, + "alias": "cookies", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "origins", + "type": { + "name": "Array", + "templates": [ + { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "origin", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "origin", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "localStorage", + "type": { + "name": "Array", + "templates": [ + { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "name", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "name", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "value", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "value", + "overloadIndex": 0, + "paramOrOption": null + } + ] + } + ], + "expression": "[Array]<[Object]>" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "localStorage", + "overloadIndex": 0, + "paramOrOption": null + } + ] + } + ], + "expression": "[Array]<[Object]>" + }, + "spec": [ + { + "type": "text", + "text": "localStorage to set for context" + } + ], + "required": true, + "comment": "localStorage to set for context", + "deprecated": false, + "async": false, + "alias": "origins", + "overloadIndex": 0, + "paramOrOption": null + } + ] + } + ], + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp", + "java" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp", + "java" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.9", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "name": "strictSelectors", + "type": { + "name": "boolean", + "expression": "[boolean]" + }, + "spec": [ + { + "type": "text", + "text": "If specified, enables strict selectors mode for this context. In the strict selectors mode all operations on selectors that imply single target DOM element will throw when more than one element matches the selector. See `Locator` to learn more about the strict mode." + } + ], + "required": false, + "comment": "If specified, enables strict selectors mode for this context. In the strict selectors mode all operations on selectors\nthat imply single target DOM element will throw when more than one element matches the selector. See `Locator` to learn\nmore about the strict mode.", + "deprecated": false, + "async": false, + "alias": "strictSelectors", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "name": "videoSize", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ], + "expression": "[Object]" + }, + "spec": [ + { + "type": "text", + "text": "**DEPRECATED** Use `recordVideo` instead." + } + ], + "required": false, + "comment": "**DEPRECATED** Use `recordVideo` instead.", + "deprecated": true, + "async": false, + "alias": "videoSize", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js", + "java" + ], + "aliases": { + "java": "viewportSize" + }, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "name": "viewport", + "type": { + "name": "", + "union": [ + { + "name": "null" + }, + { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + } + ], + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp" + ], + "aliases": { + "csharp": "viewportSize" + }, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "name": "viewport", + "type": { + "name": "", + "union": [ + { + "name": "null" + }, + { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + } + ], + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "python" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "name": "viewport", + "type": { + "name": "", + "union": [ + { + "name": "null" + }, + { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + } + ], + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + "required": false, + "comment": "", + "deprecated": false, + "async": false, + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "options", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "name": "acceptDownloads", + "type": { + "name": "boolean", + "expression": "[boolean]" + }, + "spec": [ + { + "type": "text", + "text": "Whether to automatically download all the attachments. Defaults to `true` where all the downloads are accepted." + } + ], + "required": false, + "comment": "Whether to automatically download all the attachments. Defaults to `true` where all the downloads are accepted.", + "deprecated": false, + "async": false, + "alias": "acceptDownloads", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "name": "baseURL", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "When using [`method: Page.goto`], [`method: Page.route`], [`method: Page.waitForURL`], [`method: Page.waitForRequest`], or [`method: Page.waitForResponse`] it takes the base URL in consideration by using the [`URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor for building the corresponding URL. Examples:" + }, + { + "type": "li", + "text": "baseURL: `http://localhost:3000` and navigating to `/bar.html` results in `http://localhost:3000/bar.html`", + "liType": "bullet" + }, + { + "type": "li", + "text": "baseURL: `http://localhost:3000/foo/` and navigating to `./bar.html` results in `http://localhost:3000/foo/bar.html`", + "liType": "bullet" + }, + { + "type": "li", + "text": "baseURL: `http://localhost:3000/foo` (without trailing slash) and navigating to `./bar.html` results in `http://localhost:3000/bar.html`", + "liType": "bullet" + } + ], + "required": false, + "comment": "When using [`method: Page.goto`], [`method: Page.route`], [`method: Page.waitForURL`], [`method: Page.waitForRequest`],\nor [`method: Page.waitForResponse`] it takes the base URL in consideration by using the\n[`URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor for building the corresponding URL.\nExamples:\n- baseURL: `http://localhost:3000` and navigating to `/bar.html` results in `http://localhost:3000/bar.html`\n- baseURL: `http://localhost:3000/foo/` and navigating to `./bar.html` results in `http://localhost:3000/foo/bar.html`\n- baseURL: `http://localhost:3000/foo` (without trailing slash) and navigating to `./bar.html` results in\n `http://localhost:3000/bar.html`", + "deprecated": false, + "async": false, + "alias": "baseURL", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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." + } + ], + "required": false, + "comment": "An object containing additional HTTP headers to be sent with every request.", + "deprecated": false, + "async": false, + "alias": "extraHTTPHeaders", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "name": "forcedColors", + "type": { + "name": "ForcedColors", + "union": [ + { + "name": "\"active\"" + }, + { + "name": "\"none\"" + } + ], + "expression": "[ForcedColors]<\"active\"|\"none\">" + }, + "spec": [ + { + "type": "text", + "text": "Emulates `'forced-colors'` media feature, supported values are `'active'`, `'none'`. See [`method: Page.emulateMedia`] for more details. Defaults to `'none'`." + }, + { + "type": "note", + "noteType": "note", + "text": "It's not supported in WebKit, see [here](https://bugs.webkit.org/show_bug.cgi?id=225281) in their issue tracker." + } + ], + "required": false, + "comment": "Emulates `'forced-colors'` media feature, supported values are `'active'`, `'none'`. See [`method: Page.emulateMedia`]\nfor more details. Defaults to `'none'`.\n\n> NOTE: It's not supported in WebKit, see [here](https://bugs.webkit.org/show_bug.cgi?id=225281) in their issue tracker.", + "deprecated": false, + "async": false, + "alias": "forcedColors", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "name": "geolocation", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ], + "expression": "[Object]" + }, + "spec": [], + "required": false, + "comment": "", + "deprecated": false, + "async": false, + "alias": "geolocation", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "name": "httpCredentials", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "username", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "username", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "password", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "password", + "overloadIndex": 0, + "paramOrOption": null + } + ], + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "name": "ignoreHTTPSErrors", + "type": { + "name": "boolean", + "expression": "[boolean]" + }, + "spec": [ + { + "type": "text", + "text": "Whether to ignore HTTPS errors when sending network requests. Defaults to `false`." + } + ], + "required": false, + "comment": "Whether to ignore HTTPS errors when sending network requests. Defaults to `false`.", + "deprecated": false, + "async": false, + "alias": "ignoreHTTPSErrors", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "python" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "name": "proxy", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "bypass", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "Optional comma-separated domains to bypass proxy, for example `\".com, chromium.org, .domain.com\"`." + } + ], + "required": false, + "comment": "Optional comma-separated domains to bypass proxy, for example `\".com, chromium.org, .domain.com\"`.", + "deprecated": false, + "async": false, + "alias": "bypass", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ], + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "name": "recordHar", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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`. Deprecated, use `content` policy instead." + } + ], + "required": false, + "comment": "Optional setting to control whether to omit request content from the HAR. Defaults to `false`. Deprecated, use `content`\npolicy instead.", + "deprecated": false, + "async": false, + "alias": "omitContent", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "content", + "type": { + "name": "HarContentPolicy", + "union": [ + { + "name": "\"omit\"" + }, + { + "name": "\"embed\"" + }, + { + "name": "\"attach\"" + } + ], + "expression": "[HarContentPolicy]<\"omit\"|\"embed\"|\"attach\">" + }, + "spec": [ + { + "type": "text", + "text": "Optional setting to control resource content management. If `omit` is specified, content is not persisted. If `attach` is specified, resources are persistet as separate files or entries in the ZIP archive. If `embed` is specified, content is stored inline the HAR file as per HAR specification. Defaults to `attach` for `.zip` output files and to `embed` for all other file extensions." + } + ], + "required": false, + "comment": "Optional setting to control resource content management. If `omit` is specified, content is not persisted. If `attach`\nis specified, resources are persistet as separate files or entries in the ZIP archive. If `embed` is specified, content\nis stored inline the HAR file as per HAR specification. Defaults to `attach` for `.zip` output files and to `embed` for\nall other file extensions.", + "deprecated": false, + "async": false, + "alias": "content", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "path", + "type": { + "name": "path", + "expression": "[path]" + }, + "spec": [ + { + "type": "text", + "text": "Path on the filesystem to write the HAR file to. If the file name ends with `.zip`, `content: 'attach'` is used by default." + } + ], + "required": true, + "comment": "Path on the filesystem to write the HAR file to. If the file name ends with `.zip`, `content: 'attach'` is used by\ndefault.", + "deprecated": false, + "async": false, + "alias": "path", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "mode", + "type": { + "name": "HarMode", + "union": [ + { + "name": "\"full\"" + }, + { + "name": "\"minimal\"" + } + ], + "expression": "[HarMode]<\"full\"|\"minimal\">" + }, + "spec": [ + { + "type": "text", + "text": "When set to `minimal`, only record information necessary for routing from HAR. This omits sizes, timing, page, cookies, security and other types of HAR information that are not used when replaying from HAR. Defaults to `full`." + } + ], + "required": false, + "comment": "When set to `minimal`, only record information necessary for routing from HAR. This omits sizes, timing, page, cookies,\nsecurity and other types of HAR information that are not used when replaying from HAR. Defaults to `full`.", + "deprecated": false, + "async": false, + "alias": "mode", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "urlFilter", + "type": { + "name": "", + "union": [ + { + "name": "string" + }, + { + "name": "RegExp" + } + ], + "expression": "[string]|[RegExp]" + }, + "spec": [ + { + "type": "text", + "text": "A glob or regex pattern to filter requests that are stored in the HAR. When a `baseURL` via the context options was provided and the passed URL is a path, it gets merged via the [`new URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor." + } + ], + "required": false, + "comment": "A glob or regex pattern to filter requests that are stored in the HAR. When a `baseURL` via the context options was\nprovided and the passed URL is a path, it gets merged via the\n[`new URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor.", + "deprecated": false, + "async": false, + "alias": "urlFilter", + "overloadIndex": 0, + "paramOrOption": null + } + ], + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp", + "java", + "python" + ], + "aliases": { + "python": "record_har_content" + }, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "name": "recordHarContent", + "type": { + "name": "HarContentPolicy", + "union": [ + { + "name": "\"omit\"" + }, + { + "name": "\"embed\"" + }, + { + "name": "\"attach\"" + } + ], + "expression": "[HarContentPolicy]<\"omit\"|\"embed\"|\"attach\">" + }, + "spec": [ + { + "type": "text", + "text": "Optional setting to control resource content management. If `omit` is specified, content is not persisted. If `attach` is specified, resources are persistet as separate files and all of these files are archived along with the HAR file. Defaults to `embed`, which stores content inline the HAR file as per HAR specification." + } + ], + "required": false, + "comment": "Optional setting to control resource content management. If `omit` is specified, content is not persisted. If `attach`\nis specified, resources are persistet as separate files and all of these files are archived along with the HAR file.\nDefaults to `embed`, which stores content inline the HAR file as per HAR specification.", + "deprecated": false, + "async": false, + "alias": "recordHarContent", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp", + "java", + "python" + ], + "aliases": { + "python": "record_har_mode" + }, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "name": "recordHarMode", + "type": { + "name": "HarMode", + "union": [ + { + "name": "\"full\"" + }, + { + "name": "\"minimal\"" + } + ], + "expression": "[HarMode]<\"full\"|\"minimal\">" + }, + "spec": [ + { + "type": "text", + "text": "When set to `minimal`, only record information necessary for routing from HAR. This omits sizes, timing, page, cookies, security and other types of HAR information that are not used when replaying from HAR. Defaults to `full`." + } + ], + "required": false, + "comment": "When set to `minimal`, only record information necessary for routing from HAR. This omits sizes, timing, page, cookies,\nsecurity and other types of HAR information that are not used when replaying from HAR. Defaults to `full`.", + "deprecated": false, + "async": false, + "alias": "recordHarMode", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp", + "java", + "python" + ], + "aliases": { + "python": "record_har_omit_content" + }, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp", + "java", + "python" + ], + "aliases": { + "python": "record_har_path" + }, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp", + "java", + "python" + ], + "aliases": { + "python": "record_har_url_filter" + }, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "name": "recordHarUrlFilter", + "type": { + "name": "", + "union": [ + { + "name": "string" + }, + { + "name": "RegExp" + } + ], + "expression": "[string]|[RegExp]" + }, + "spec": [], + "required": false, + "comment": "", + "deprecated": false, + "async": false, + "alias": "recordHarUrlFilter", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "name": "recordVideo", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "size", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ], + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ], + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp", + "java", + "python" + ], + "aliases": { + "python": "record_video_dir" + }, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp", + "java", + "python" + ], + "aliases": { + "python": "record_video_size" + }, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "name": "recordVideoSize", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ], + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "aliases": { + "java": "screenSize", + "csharp": "screenSize" + }, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "name": "screen", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ], + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "name": "serviceWorkers", + "type": { + "name": "ServiceWorkerPolicy", + "union": [ + { + "name": "\"allow\"" + }, + { + "name": "\"block\"" + } + ], + "expression": "[ServiceWorkerPolicy]<\"allow\"|\"block\">" + }, + "spec": [ + { + "type": "text", + "text": "Whether to allow sites to register Service workers. Defaults to `'allow'`." + }, + { + "type": "li", + "text": "`'allow'`: [Service Workers](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API) can be registered.", + "liType": "bullet" + }, + { + "type": "li", + "text": "`'block'`: Playwright will block all registration of Service Workers.", + "liType": "bullet" + } + ], + "required": false, + "comment": "Whether to allow sites to register Service workers. Defaults to `'allow'`.\n- `'allow'`: [Service Workers](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API) can be registered.\n- `'block'`: Playwright will block all registration of Service Workers.", + "deprecated": false, + "async": false, + "alias": "serviceWorkers", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js", + "python" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "name": "storageState", + "type": { + "name": "", + "union": [ + { + "name": "path" + }, + { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "cookies", + "type": { + "name": "Array", + "templates": [ + { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "name", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "name", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "value", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "value", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "domain", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "domain and path are required" + } + ], + "required": true, + "comment": "domain and path are required", + "deprecated": false, + "async": false, + "alias": "domain", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "path", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "domain and path are required" + } + ], + "required": true, + "comment": "domain and path are required", + "deprecated": false, + "async": false, + "alias": "path", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "httpOnly", + "type": { + "name": "boolean", + "expression": "[boolean]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "httpOnly", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "secure", + "type": { + "name": "boolean", + "expression": "[boolean]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "secure", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "sameSite", + "type": { + "name": "SameSiteAttribute", + "union": [ + { + "name": "\"Strict\"" + }, + { + "name": "\"Lax\"" + }, + { + "name": "\"None\"" + } + ], + "expression": "[SameSiteAttribute]<\"Strict\"|\"Lax\"|\"None\">" + }, + "spec": [ + { + "type": "text", + "text": "sameSite flag" + } + ], + "required": true, + "comment": "sameSite flag", + "deprecated": false, + "async": false, + "alias": "sameSite", + "overloadIndex": 0, + "paramOrOption": null + } + ] + } + ], + "expression": "[Array]<[Object]>" + }, + "spec": [ + { + "type": "text", + "text": "cookies to set for context" + } + ], + "required": true, + "comment": "cookies to set for context", + "deprecated": false, + "async": false, + "alias": "cookies", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "origins", + "type": { + "name": "Array", + "templates": [ + { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "origin", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "origin", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "localStorage", + "type": { + "name": "Array", + "templates": [ + { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "name", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "name", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "value", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "value", + "overloadIndex": 0, + "paramOrOption": null + } + ] + } + ], + "expression": "[Array]<[Object]>" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "localStorage", + "overloadIndex": 0, + "paramOrOption": null + } + ] + } + ], + "expression": "[Array]<[Object]>" + }, + "spec": [ + { + "type": "text", + "text": "localStorage to set for context" + } + ], + "required": true, + "comment": "localStorage to set for context", + "deprecated": false, + "async": false, + "alias": "origins", + "overloadIndex": 0, + "paramOrOption": null + } + ] + } + ], + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp", + "java" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp", + "java" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.9", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "name": "strictSelectors", + "type": { + "name": "boolean", + "expression": "[boolean]" + }, + "spec": [ + { + "type": "text", + "text": "If specified, enables strict selectors mode for this context. In the strict selectors mode all operations on selectors that imply single target DOM element will throw when more than one element matches the selector. See `Locator` to learn more about the strict mode." + } + ], + "required": false, + "comment": "If specified, enables strict selectors mode for this context. In the strict selectors mode all operations on selectors\nthat imply single target DOM element will throw when more than one element matches the selector. See `Locator` to learn\nmore about the strict mode.", + "deprecated": false, + "async": false, + "alias": "strictSelectors", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "name": "videoSize", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ], + "expression": "[Object]" + }, + "spec": [ + { + "type": "text", + "text": "**DEPRECATED** Use `recordVideo` instead." + } + ], + "required": false, + "comment": "**DEPRECATED** Use `recordVideo` instead.", + "deprecated": true, + "async": false, + "alias": "videoSize", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js", + "java" + ], + "aliases": { + "java": "viewportSize" + }, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "name": "viewport", + "type": { + "name": "", + "union": [ + { + "name": "null" + }, + { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + } + ], + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp" + ], + "aliases": { + "csharp": "viewportSize" + }, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "name": "viewport", + "type": { + "name": "", + "union": [ + { + "name": "null" + }, + { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + } + ], + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "python" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "name": "viewport", + "type": { + "name": "", + "union": [ + { + "name": "null" + }, + { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + } + ], + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + "required": false, + "comment": "", + "deprecated": false, + "async": false, + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + { + "kind": "method", + "langs": { + "only": [ + "java", + "js", + "python" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.11", + "name": "startTracing", + "type": { + "name": "void" + }, + "spec": [ + { + "type": "note", + "noteType": "note", + "text": "This API controls [Chromium Tracing](https://www.chromium.org/developers/how-tos/trace-event-profiling-tool) which is a low-level chromium-specific debugging tool. API to control [Playwright Tracing](../trace-viewer) could be found [here](./class-tracing)." + }, + { + "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: This API controls [Chromium Tracing](https://www.chromium.org/developers/how-tos/trace-event-profiling-tool)\nwhich is a low-level chromium-specific debugging tool. API to control [Playwright Tracing](../trace-viewer) could be\nfound [here](./class-tracing).\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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.11", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "options", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.11", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.11", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.11", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + "required": false, + "comment": "", + "deprecated": false, + "async": false, + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + { + "kind": "method", + "langs": { + "only": [ + "java", + "js", + "python" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.11", + "name": "stopTracing", + "type": { + "name": "Buffer", + "expression": "[Buffer]" + }, + "spec": [ + { + "type": "note", + "noteType": "note", + "text": "This API controls [Chromium Tracing](https://www.chromium.org/developers/how-tos/trace-event-profiling-tool) which is a low-level chromium-specific debugging tool. API to control [Playwright Tracing](../trace-viewer) could be found [here](./class-tracing)." + }, + { + "type": "text", + "text": "Returns the buffer with trace data." + } + ], + "required": true, + "comment": "> NOTE: This API controls [Chromium Tracing](https://www.chromium.org/developers/how-tos/trace-event-profiling-tool)\nwhich is a low-level chromium-specific debugging tool. API to control [Playwright Tracing](../trace-viewer) could be\nfound [here](./class-tracing).\n\nReturns the buffer with trace data.", + "deprecated": false, + "async": true, + "alias": "stopTracing", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "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 creating \"incognito\" browser contexts with [`method: 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 creating \"incognito\" browser contexts with [`method: 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": {} + }, + "experimental": false, + "since": "v1.11", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "event", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "event", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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.locator('a[target=_blank]').click(),", + "]);", + "console.log(await newPage.evaluate('location.href'));" + ], + "codeLang": "js" + }, + { + "type": "code", + "lines": [ + "Page newPage = context.waitForPage(() -> {", + " page.locator(\"a[target=_blank]\").click();", + "});", + "System.out.println(newPage.evaluate(\"location.href\"));" + ], + "codeLang": "java" + }, + { + "type": "code", + "lines": [ + "async with context.expect_page() as page_info:", + " await page.locator(\"a[target=_blank]\").click(),", + "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.locator(\"a[target=_blank]\").click(),", + "page = page_info.value", + "print(page.evaluate(\"location.href\"))" + ], + "codeLang": "python sync" + }, + { + "type": "code", + "lines": [ + "var popup = await context.RunAndWaitForPageAsync(async =>", + "{", + " await page.Locator(\"a\").ClickAsync();", + "});", + "Console.WriteLine(await popup.EvaluateAsync(\"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.locator('a[target=_blank]').click(),\n]);\nconsole.log(await newPage.evaluate('location.href'));\n```\n\n```java\nPage newPage = context.waitForPage(() -> {\n page.locator(\"a[target=_blank]\").click();\n});\nSystem.out.println(newPage.evaluate(\"location.href\"));\n```\n\n```python async\nasync with context.expect_page() as page_info:\n await page.locator(\"a[target=_blank]\").click(),\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.locator(\"a[target=_blank]\").click(),\npage = page_info.value\nprint(page.evaluate(\"location.href\"))\n```\n\n```csharp\nvar popup = await context.RunAndWaitForPageAsync(async =>\n{\n await page.Locator(\"a\").ClickAsync();\n});\nConsole.WriteLine(await popup.EvaluateAsync(\"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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "event", + "langs": {}, + "experimental": false, + "since": "v1.12", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "event", + "langs": {}, + "experimental": false, + "since": "v1.12", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "event", + "langs": {}, + "experimental": false, + "since": "v1.12", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "event", + "langs": {}, + "experimental": false, + "since": "v1.12", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "event", + "langs": { + "only": [ + "js", + "python" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.11", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "name": "cookies", + "type": { + "name": "Array", + "templates": [ + { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "name", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "name", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "value", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "value", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "httpOnly", + "type": { + "name": "boolean", + "expression": "[boolean]" + }, + "spec": [ + { + "type": "text", + "text": "Optional." + } + ], + "required": false, + "comment": "Optional.", + "deprecated": false, + "async": false, + "alias": "httpOnly", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "secure", + "type": { + "name": "boolean", + "expression": "[boolean]" + }, + "spec": [ + { + "type": "text", + "text": "Optional." + } + ], + "required": false, + "comment": "Optional.", + "deprecated": false, + "async": false, + "alias": "secure", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + } + ], + "expression": "[Array]<[Object]>" + }, + "spec": [], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "cookies", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [ + { + "kind": "property", + "langs": { + "only": [ + "js" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "name": "script", + "type": { + "name": "", + "union": [ + { + "name": "function" + }, + { + "name": "string" + }, + { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + } + ], + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp", + "java" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "python" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "python" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + { + "kind": "method", + "langs": { + "only": [ + "js", + "python" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.11", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "name": "clearCookies", + "type": { + "name": "void" + }, + "spec": [ + { + "type": "text", + "text": "Clears context cookies." + } + ], + "required": true, + "comment": "Clears context cookies.", + "deprecated": false, + "async": true, + "alias": "clearCookies", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "name": "cookies", + "type": { + "name": "Array", + "templates": [ + { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "name", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "name", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "value", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "value", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "domain", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "domain", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "path", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "path", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "httpOnly", + "type": { + "name": "boolean", + "expression": "[boolean]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "httpOnly", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "secure", + "type": { + "name": "boolean", + "expression": "[boolean]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "secure", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + } + ], + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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(`", + " ", + " ", + "
", + " `);", + " await page.locator('button').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 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(\"\\n\" +", + " \"\\n\" +", + " \"
\");", + " page.locator(\"button\").click();", + " }", + " }", + "}" + ], + "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(\"\"\"", + " ", + " ", + "
", + " \"\"\")", + " await page.locator(\"button\").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):", + " 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(\"\"\"", + " ", + " ", + "
", + " \"\"\")", + " page.locator(\"button\").click()", + "", + "with sync_playwright() as playwright:", + " run(playwright)" + ], + "codeLang": "python sync" + }, + { + "type": "code", + "lines": [ + "using Microsoft.Playwright;", + "", + "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(\"\\n\" +", + "\"\\n\" +", + "\"
\");", + "await page.Locator(\"button\").ClickAsync();" + ], + "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(`", + " ", + "
Click me
", + "
Or click me
", + "`);" + ], + "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(\"\" +", + " \"\\n\" +", + " \"
Click me
\\n\" +", + " \"
Or click me
\\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(\"\"\"", + " ", + "
Click me
", + "
Or click me
", + "\"\"\")" + ], + "codeLang": "python async" + }, + { + "type": "code", + "lines": [ + "def print(source, element):", + " print(element.text_content())", + "", + "context.expose_binding(\"clicked\", print, handle=true)", + "page.set_content(\"\"\"", + " ", + "
Click me
", + "
Or click me
", + "\"\"\")" + ], + "codeLang": "python sync" + }, + { + "type": "code", + "lines": [ + "var result = new TaskCompletionSource();", + "var page = await Context.NewPageAsync();", + "await Context.ExposeBindingAsync(\"clicked\", async (BindingSource _, IJSHandle t) =>", + "{", + " return result.TrySetResult(await t.AsElement().TextContentAsync());", + "});", + "", + "await page.SetContentAsync(\"\\n\" +", + " \"
Click me
\\n\" +", + " \"
Or click me
\\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.AreEqual(\"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 \n \n
\n `);\n await page.locator('button').click();\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(\"\\n\" +\n \"\\n\" +\n \"
\");\n page.locator(\"button\").click();\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 \n \n
\n \"\"\")\n await page.locator(\"button\").click()\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 \n \n
\n \"\"\")\n page.locator(\"button\").click()\n\nwith sync_playwright() as playwright:\n run(playwright)\n```\n\n```csharp\nusing Microsoft.Playwright;\n\nusing var playwright = await Playwright.CreateAsync();\nvar browser = await playwright.Webkit.LaunchAsync(new BrowserTypeLaunchOptions { Headless = false });\nvar context = await browser.NewContextAsync();\n\nawait context.ExposeBindingAsync(\"pageURL\", source => source.Page.Url);\nvar page = await context.NewPageAsync();\nawait page.SetContentAsync(\"\\n\" +\n\"\\n\" +\n\"
\");\nawait page.Locator(\"button\").ClickAsync();\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 \n
Click me
\n
Or click me
\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 \"\\n\" +\n \"
Click me
\\n\" +\n \"
Or click me
\\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 \n
Click me
\n
Or click me
\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 \n
Click me
\n
Or click me
\n\"\"\")\n```\n\n```csharp\nvar result = new TaskCompletionSource();\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(\"\\n\" +\n \"
Click me
\\n\" +\n \"
Or click me
\\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.AreEqual(\"Click me\", await result.Task);\n```\n", + "deprecated": false, + "async": true, + "alias": "exposeBinding", + "overloadIndex": 0, + "paramOrOption": null, + "args": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "options", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + "required": false, + "comment": "", + "deprecated": false, + "async": false, + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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(`", + " ", + " ", + "
", + " `);", + " await page.locator('button').click();", + "})();" + ], + "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(\"\\n\" +", + " \"\\n\" +", + " \"
\\n\");", + " page.locator(\"button\").click();", + " }", + " }", + "}" + ], + "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(\"\"\"", + " ", + " ", + "
", + " \"\"\")", + " await page.locator(\"button\").click()", + "", + "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(\"\"\"", + " ", + " ", + "
", + " \"\"\")", + " page.locator(\"button\").click()", + "", + "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(\"\\n\" +", + " \"\\n\" +", + " \"
\");", + "", + " await page.Locator(\"button\").ClickAsync();", + " 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 \n \n
\n `);\n await page.locator('button').click();\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(\"\\n\" +\n \"\\n\" +\n \"
\\n\");\n page.locator(\"button\").click();\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 \n \n
\n \"\"\")\n await page.locator(\"button\").click()\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 \n \n
\n \"\"\")\n page.locator(\"button\").click()\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(\"\\n\" +\n \"\\n\" +\n \"
\");\n\n await page.Locator(\"button\").ClickAsync();\n Console.WriteLine(await page.TextContentAsync(\"div\"));\n }\n}\n```\n", + "deprecated": false, + "async": true, + "alias": "exposeFunction", + "overloadIndex": 0, + "paramOrOption": null, + "args": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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": "`'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- `'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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "options", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + "required": false, + "comment": "", + "deprecated": false, + "async": false, + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + { + "kind": "method", + "langs": { + "only": [ + "js", + "python" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.11", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.11", + "name": "page", + "type": { + "name": "", + "union": [ + { + "name": "Page" + }, + { + "name": "Frame" + } + ], + "expression": "[Page]|[Frame]" + }, + "spec": [ + { + "type": "text", + "text": "Target to create new session for. For backwards-compatibility, this parameter is named `page`, but it can be a `Page` or `Frame` type." + } + ], + "required": true, + "comment": "Target to create new session for. For backwards-compatibility, this parameter is named `page`, but it can be a `Page` or\n`Frame` type.", + "deprecated": false, + "async": false, + "alias": "page", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "property", + "langs": { + "aliases": { + "csharp": "APIRequest" + }, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.16", + "name": "request", + "type": { + "name": "APIRequestContext", + "expression": "[APIRequestContext]" + }, + "spec": [ + { + "type": "text", + "text": "API testing helper associated with this context. Requests made with this API will use context cookies." + } + ], + "required": true, + "comment": "API testing helper associated with this context. Requests made with this API will use context cookies.", + "deprecated": false, + "async": false, + "alias": "request", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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": "note", + "noteType": "note", + "text": "[`method: BrowserContext.route`] will not intercept requests intercepted by Service Worker. See [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using request interception by setting `Browser.newContext.serviceWorkers` to `'block'`." + }, + { + "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\n> NOTE: [`method: BrowserContext.route`] will not intercept requests intercepted by Service Worker. See\n[this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using\nrequest interception by setting `Browser.newContext.serviceWorkers` to `'block'`.\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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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. When a `baseURL` via the context options was provided and the passed URL is a path, it gets merged via the [`new URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor." + } + ], + "required": true, + "comment": "A glob pattern, regex pattern or predicate receiving [URL] to match while routing. When a `baseURL` via the context\noptions was provided and the passed URL is a path, it gets merged via the\n[`new URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor.", + "deprecated": false, + "async": false, + "alias": "url", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js", + "python" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp", + "java" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "options", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.15", + "name": "times", + "type": { + "name": "int", + "expression": "[int]" + }, + "spec": [ + { + "type": "text", + "text": "How often a route should be used. By default it will be used every time." + } + ], + "required": false, + "comment": "How often a route should be used. By default it will be used every time.", + "deprecated": false, + "async": false, + "alias": "times", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + "required": false, + "comment": "", + "deprecated": false, + "async": false, + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.23", + "name": "routeFromHAR", + "type": { + "name": "void" + }, + "spec": [ + { + "type": "text", + "text": "If specified the network requests that are made in the context will be served from the HAR file. Read more about [Replaying from HAR](../network.md#replaying-from-har)." + }, + { + "type": "text", + "text": "Playwright will not serve requests intercepted by Service Worker from the HAR file. See [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using request interception by setting `Browser.newContext.serviceWorkers` to `'block'`." + } + ], + "required": true, + "comment": "If specified the network requests that are made in the context will be served from the HAR file. Read more about\n[Replaying from HAR](../network.md#replaying-from-har).\n\nPlaywright will not serve requests intercepted by Service Worker from the HAR file. See\n[this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using\nrequest interception by setting `Browser.newContext.serviceWorkers` to `'block'`.", + "deprecated": false, + "async": true, + "alias": "routeFromHAR", + "overloadIndex": 0, + "paramOrOption": null, + "args": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.23", + "name": "har", + "type": { + "name": "path", + "expression": "[path]" + }, + "spec": [ + { + "type": "text", + "text": "Path to a [HAR](http://www.softwareishard.com/blog/har-12-spec) file with prerecorded network data. If `path` is a relative path, then it is resolved relative to the current working directory." + } + ], + "required": true, + "comment": "Path to a [HAR](http://www.softwareishard.com/blog/har-12-spec) file with prerecorded network data. If `path` is a\nrelative path, then it is resolved relative to the current working directory.", + "deprecated": false, + "async": false, + "alias": "har", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "options", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.23", + "name": "notFound", + "type": { + "name": "HarNotFound", + "union": [ + { + "name": "\"abort\"" + }, + { + "name": "\"fallback\"" + } + ], + "expression": "[HarNotFound]<\"abort\"|\"fallback\">" + }, + "spec": [ + { + "type": "li", + "text": "If set to 'abort' any request not found in the HAR file will be aborted.", + "liType": "bullet" + }, + { + "type": "li", + "text": "If set to 'fallback' falls through to the next route handler in the handler chain.", + "liType": "bullet" + }, + { + "type": "text", + "text": "Defaults to abort." + } + ], + "required": false, + "comment": "- If set to 'abort' any request not found in the HAR file will be aborted.\n- If set to 'fallback' falls through to the next route handler in the handler chain.\n\nDefaults to abort.", + "deprecated": false, + "async": false, + "alias": "notFound", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.23", + "name": "update", + "type": { + "name": "boolean", + "expression": "boolean" + }, + "spec": [ + { + "type": "text", + "text": "If specified, updates the given HAR with the actual network information instead of serving from file." + } + ], + "required": false, + "comment": "If specified, updates the given HAR with the actual network information instead of serving from file.", + "deprecated": false, + "async": false, + "alias": "update", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.23", + "name": "url", + "type": { + "name": "", + "union": [ + { + "name": "string" + }, + { + "name": "RegExp" + } + ], + "expression": "[string]|[RegExp]" + }, + "spec": [ + { + "type": "text", + "text": "A glob pattern, regular expression or predicate to match the request URL. Only requests with URL matching the pattern will be served from the HAR file. If not specified, all requests are served from the HAR file." + } + ], + "required": false, + "comment": "A glob pattern, regular expression or predicate to match the request URL. Only requests with URL matching the pattern\nwill be served from the HAR file. If not specified, all requests are served from the HAR file.", + "deprecated": false, + "async": false, + "alias": "url", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + "required": false, + "comment": "", + "deprecated": false, + "async": false, + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + { + "kind": "method", + "langs": { + "only": [ + "js", + "python" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.11", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "name": "geolocation", + "type": { + "name": "", + "union": [ + { + "name": "null" + }, + { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + } + ], + "expression": "[null]|[Object]" + }, + "spec": [], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "geolocation", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + { + "kind": "method", + "langs": { + "only": [ + "js" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "name": "httpCredentials", + "type": { + "name": "", + "union": [ + { + "name": "null" + }, + { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "username", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "username", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "password", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "password", + "overloadIndex": 0, + "paramOrOption": null + } + ] + } + ], + "expression": "[null]|[Object]" + }, + "spec": [], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "httpCredentials", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "name": "setOffline", + "type": { + "name": "void" + }, + "spec": [], + "required": true, + "comment": "", + "deprecated": false, + "async": true, + "alias": "setOffline", + "overloadIndex": 0, + "paramOrOption": null, + "args": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + { + "kind": "method", + "langs": { + "types": { + "csharp": { + "name": "string", + "expression": "[string]" + }, + "java": { + "name": "string", + "expression": "[string]" + } + } + }, + "experimental": false, + "since": "v1.8", + "name": "storageState", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "cookies", + "type": { + "name": "Array", + "templates": [ + { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "name", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "name", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "value", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "value", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "domain", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "domain", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "path", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "path", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "httpOnly", + "type": { + "name": "boolean", + "expression": "[boolean]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "httpOnly", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "secure", + "type": { + "name": "boolean", + "expression": "[boolean]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "secure", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + } + ], + "expression": "[Array]<[Object]>" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "cookies", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "origins", + "type": { + "name": "Array", + "templates": [ + { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "origin", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "origin", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "localStorage", + "type": { + "name": "Array", + "templates": [ + { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "name", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "name", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "value", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "value", + "overloadIndex": 0, + "paramOrOption": null + } + ] + } + ], + "expression": "[Array]<[Object]>" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "localStorage", + "overloadIndex": 0, + "paramOrOption": null + } + ] + } + ], + "expression": "[Array]<[Object]>" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "origins", + "overloadIndex": 0, + "paramOrOption": null + } + ], + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "options", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + "required": false, + "comment": "", + "deprecated": false, + "async": false, + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.12", + "name": "tracing", + "type": { + "name": "Tracing", + "expression": "[Tracing]" + }, + "spec": [], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "tracing", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js", + "python" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp", + "java" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + { + "kind": "method", + "langs": { + "only": [ + "js", + "python" + ], + "aliases": { + "python": "expect_event" + }, + "types": { + "python": { + "name": "EventContextManager", + "expression": "[EventContextManager]" + } + }, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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.locator('button').click()", + "]);" + ], + "codeLang": "js" + }, + { + "type": "code", + "lines": [ + "Page newPage = context.waitForPage(() -> page.locator(\"button\").click());" + ], + "codeLang": "java" + }, + { + "type": "code", + "lines": [ + "async with context.expect_event(\"page\") as event_info:", + " await page.locator(\"button\").click()", + "page = await event_info.value" + ], + "codeLang": "python async" + }, + { + "type": "code", + "lines": [ + "with context.expect_event(\"page\") as event_info:", + " page.locator(\"button\").click()", + "page = event_info.value" + ], + "codeLang": "python sync" + }, + { + "type": "code", + "lines": [ + "var page = await context.RunAndWaitForPageAsync(async () =>", + "{", + " await page.Locator(\"button\").ClickAsync();", + "});" + ], + "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.locator('button').click()\n]);\n```\n\n```java\nPage newPage = context.waitForPage(() -> page.locator(\"button\").click());\n```\n\n```python async\nasync with context.expect_event(\"page\") as event_info:\n await page.locator(\"button\").click()\npage = await event_info.value\n```\n\n```python sync\nwith context.expect_event(\"page\") as event_info:\n page.locator(\"button\").click()\npage = event_info.value\n```\n\n```csharp\nvar page = await context.RunAndWaitForPageAsync(async () =>\n{\n await page.Locator(\"button\").ClickAsync();\n});\n```\n", + "deprecated": false, + "async": true, + "alias": "waitForEvent", + "overloadIndex": 0, + "paramOrOption": null, + "args": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "name": "optionsOrPredicate", + "type": { + "name": "", + "union": [ + { + "name": "function" + }, + { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + } + ], + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "options", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp", + "java", + "python" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + "required": false, + "comment": "", + "deprecated": false, + "async": false, + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + { + "kind": "method", + "langs": { + "only": [ + "java", + "python", + "csharp" + ], + "aliases": { + "python": "expect_page", + "csharp": "RunAndWaitForPage" + }, + "types": { + "python": { + "name": "EventContextManager", + "templates": [ + { + "name": "Page" + } + ], + "expression": "[EventContextManager]<[Page]>" + } + }, + "overrides": {} + }, + "experimental": false, + "since": "v1.9", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "options", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": { + "only": [ + "csharp", + "java", + "python" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.9", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp", + "java", + "python" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.9", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + "required": false, + "comment": "", + "deprecated": false, + "async": false, + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.12", + "name": "action", + "type": { + "name": "Func", + "templates": [ + { + "name": "Task" + } + ], + "expression": "[Func]" + }, + "spec": [ + { + "type": "text", + "text": "Action that triggers the event." + } + ], + "required": true, + "comment": "Action that triggers the event.", + "deprecated": false, + "async": false, + "alias": "action", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "java" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.9", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + { + "kind": "method", + "langs": { + "only": [ + "python" + ], + "aliases": { + "python": "wait_for_event" + }, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [ + { + "kind": "property", + "langs": { + "only": [ + "js", + "python", + "java" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "options", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp", + "java", + "python" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + "required": false, + "comment": "", + "deprecated": false, + "async": false, + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null + } + ] + } + ] + }, + { + "name": "BrowserServer", + "spec": [], + "langs": { + "only": [ + "js" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "members": [ + { + "kind": "event", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "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": {}, + "experimental": false, + "since": "v1.8", + "name": "connect", + "type": { + "name": "Browser", + "expression": "[Browser]" + }, + "spec": [ + { + "type": "text", + "text": "This method attaches Playwright to an existing browser instance." + } + ], + "required": true, + "comment": "This method attaches Playwright to an existing browser instance.", + "deprecated": false, + "async": true, + "alias": "connect", + "overloadIndex": 0, + "paramOrOption": null, + "args": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.10", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "options", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.11", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.14", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.10", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.10", + "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 `0` (no timeout)." + } + ], + "required": false, + "comment": "Maximum time in milliseconds to wait for the connection to be established. Defaults to `0` (no timeout).", + "deprecated": false, + "async": false, + "alias": "timeout", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + "required": false, + "comment": "", + "deprecated": false, + "async": false, + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.9", + "name": "connectOverCDP", + "type": { + "name": "Browser", + "expression": "[Browser]" + }, + "spec": [ + { + "type": "text", + "text": "This method 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 method 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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.11", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "options", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": { + "only": [ + "js" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.14", + "name": "endpointURL", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "Deprecated, use the first argument instead. Optional." + } + ], + "required": false, + "comment": "Deprecated, use the first argument instead. Optional.", + "deprecated": false, + "async": false, + "alias": "endpointURL", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.11", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.14", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.11", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.11", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + "required": false, + "comment": "", + "deprecated": false, + "async": false, + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "options", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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. In either case, the downloads are deleted when the browser context they were created in 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. In either case, the downloads are deleted when the browser context they were created in\nis closed.", + "deprecated": false, + "async": false, + "alias": "downloadsPath", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp", + "java" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js", + "python" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js", + "python" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp", + "java" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp", + "java" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.9", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js", + "python" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp", + "java" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "name": "proxy", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "bypass", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "Optional comma-separated domains to bypass proxy, for example `\".com, chromium.org, .domain.com\"`." + } + ], + "required": false, + "comment": "Optional comma-separated domains to bypass proxy, for example `\".com, chromium.org, .domain.com\"`.", + "deprecated": false, + "async": false, + "alias": "bypass", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ], + "expression": "[Object]" + }, + "spec": [ + { + "type": "text", + "text": "Network proxy settings." + } + ], + "required": false, + "comment": "Network proxy settings.", + "deprecated": false, + "async": false, + "alias": "proxy", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + "required": false, + "comment": "", + "deprecated": false, + "async": false, + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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`. Pass an empty string to use a temporary directory instead." + } + ], + "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`. Pass an empty string to use\na temporary directory instead.", + "deprecated": false, + "async": false, + "alias": "userDataDir", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "options", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "name": "acceptDownloads", + "type": { + "name": "boolean", + "expression": "[boolean]" + }, + "spec": [ + { + "type": "text", + "text": "Whether to automatically download all the attachments. Defaults to `true` where all the downloads are accepted." + } + ], + "required": false, + "comment": "Whether to automatically download all the attachments. Defaults to `true` where all the downloads are accepted.", + "deprecated": false, + "async": false, + "alias": "acceptDownloads", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "name": "baseURL", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "When using [`method: Page.goto`], [`method: Page.route`], [`method: Page.waitForURL`], [`method: Page.waitForRequest`], or [`method: Page.waitForResponse`] it takes the base URL in consideration by using the [`URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor for building the corresponding URL. Examples:" + }, + { + "type": "li", + "text": "baseURL: `http://localhost:3000` and navigating to `/bar.html` results in `http://localhost:3000/bar.html`", + "liType": "bullet" + }, + { + "type": "li", + "text": "baseURL: `http://localhost:3000/foo/` and navigating to `./bar.html` results in `http://localhost:3000/foo/bar.html`", + "liType": "bullet" + }, + { + "type": "li", + "text": "baseURL: `http://localhost:3000/foo` (without trailing slash) and navigating to `./bar.html` results in `http://localhost:3000/bar.html`", + "liType": "bullet" + } + ], + "required": false, + "comment": "When using [`method: Page.goto`], [`method: Page.route`], [`method: Page.waitForURL`], [`method: Page.waitForRequest`],\nor [`method: Page.waitForResponse`] it takes the base URL in consideration by using the\n[`URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor for building the corresponding URL.\nExamples:\n- baseURL: `http://localhost:3000` and navigating to `/bar.html` results in `http://localhost:3000/bar.html`\n- baseURL: `http://localhost:3000/foo/` and navigating to `./bar.html` results in `http://localhost:3000/foo/bar.html`\n- baseURL: `http://localhost:3000/foo` (without trailing slash) and navigating to `./bar.html` results in\n `http://localhost:3000/bar.html`", + "deprecated": false, + "async": false, + "alias": "baseURL", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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. In either case, the downloads are deleted when the browser context they were created in 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. In either case, the downloads are deleted when the browser context they were created in\nis closed.", + "deprecated": false, + "async": false, + "alias": "downloadsPath", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp", + "java" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js", + "python" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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." + } + ], + "required": false, + "comment": "An object containing additional HTTP headers to be sent with every request.", + "deprecated": false, + "async": false, + "alias": "extraHTTPHeaders", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "name": "forcedColors", + "type": { + "name": "ForcedColors", + "union": [ + { + "name": "\"active\"" + }, + { + "name": "\"none\"" + } + ], + "expression": "[ForcedColors]<\"active\"|\"none\">" + }, + "spec": [ + { + "type": "text", + "text": "Emulates `'forced-colors'` media feature, supported values are `'active'`, `'none'`. See [`method: Page.emulateMedia`] for more details. Defaults to `'none'`." + }, + { + "type": "note", + "noteType": "note", + "text": "It's not supported in WebKit, see [here](https://bugs.webkit.org/show_bug.cgi?id=225281) in their issue tracker." + } + ], + "required": false, + "comment": "Emulates `'forced-colors'` media feature, supported values are `'active'`, `'none'`. See [`method: Page.emulateMedia`]\nfor more details. Defaults to `'none'`.\n\n> NOTE: It's not supported in WebKit, see [here](https://bugs.webkit.org/show_bug.cgi?id=225281) in their issue tracker.", + "deprecated": false, + "async": false, + "alias": "forcedColors", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "name": "geolocation", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ], + "expression": "[Object]" + }, + "spec": [], + "required": false, + "comment": "", + "deprecated": false, + "async": false, + "alias": "geolocation", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "name": "httpCredentials", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "username", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "username", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "password", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "password", + "overloadIndex": 0, + "paramOrOption": null + } + ], + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp", + "java" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.9", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js", + "python" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp", + "java" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "name": "ignoreHTTPSErrors", + "type": { + "name": "boolean", + "expression": "[boolean]" + }, + "spec": [ + { + "type": "text", + "text": "Whether to ignore HTTPS errors when sending network requests. Defaults to `false`." + } + ], + "required": false, + "comment": "Whether to ignore HTTPS errors when sending network requests. Defaults to `false`.", + "deprecated": false, + "async": false, + "alias": "ignoreHTTPSErrors", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "python" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "name": "proxy", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "bypass", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "Optional comma-separated domains to bypass proxy, for example `\".com, chromium.org, .domain.com\"`." + } + ], + "required": false, + "comment": "Optional comma-separated domains to bypass proxy, for example `\".com, chromium.org, .domain.com\"`.", + "deprecated": false, + "async": false, + "alias": "bypass", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ], + "expression": "[Object]" + }, + "spec": [ + { + "type": "text", + "text": "Network proxy settings." + } + ], + "required": false, + "comment": "Network proxy settings.", + "deprecated": false, + "async": false, + "alias": "proxy", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "name": "recordHar", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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`. Deprecated, use `content` policy instead." + } + ], + "required": false, + "comment": "Optional setting to control whether to omit request content from the HAR. Defaults to `false`. Deprecated, use `content`\npolicy instead.", + "deprecated": false, + "async": false, + "alias": "omitContent", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "content", + "type": { + "name": "HarContentPolicy", + "union": [ + { + "name": "\"omit\"" + }, + { + "name": "\"embed\"" + }, + { + "name": "\"attach\"" + } + ], + "expression": "[HarContentPolicy]<\"omit\"|\"embed\"|\"attach\">" + }, + "spec": [ + { + "type": "text", + "text": "Optional setting to control resource content management. If `omit` is specified, content is not persisted. If `attach` is specified, resources are persistet as separate files or entries in the ZIP archive. If `embed` is specified, content is stored inline the HAR file as per HAR specification. Defaults to `attach` for `.zip` output files and to `embed` for all other file extensions." + } + ], + "required": false, + "comment": "Optional setting to control resource content management. If `omit` is specified, content is not persisted. If `attach`\nis specified, resources are persistet as separate files or entries in the ZIP archive. If `embed` is specified, content\nis stored inline the HAR file as per HAR specification. Defaults to `attach` for `.zip` output files and to `embed` for\nall other file extensions.", + "deprecated": false, + "async": false, + "alias": "content", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "path", + "type": { + "name": "path", + "expression": "[path]" + }, + "spec": [ + { + "type": "text", + "text": "Path on the filesystem to write the HAR file to. If the file name ends with `.zip`, `content: 'attach'` is used by default." + } + ], + "required": true, + "comment": "Path on the filesystem to write the HAR file to. If the file name ends with `.zip`, `content: 'attach'` is used by\ndefault.", + "deprecated": false, + "async": false, + "alias": "path", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "mode", + "type": { + "name": "HarMode", + "union": [ + { + "name": "\"full\"" + }, + { + "name": "\"minimal\"" + } + ], + "expression": "[HarMode]<\"full\"|\"minimal\">" + }, + "spec": [ + { + "type": "text", + "text": "When set to `minimal`, only record information necessary for routing from HAR. This omits sizes, timing, page, cookies, security and other types of HAR information that are not used when replaying from HAR. Defaults to `full`." + } + ], + "required": false, + "comment": "When set to `minimal`, only record information necessary for routing from HAR. This omits sizes, timing, page, cookies,\nsecurity and other types of HAR information that are not used when replaying from HAR. Defaults to `full`.", + "deprecated": false, + "async": false, + "alias": "mode", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "urlFilter", + "type": { + "name": "", + "union": [ + { + "name": "string" + }, + { + "name": "RegExp" + } + ], + "expression": "[string]|[RegExp]" + }, + "spec": [ + { + "type": "text", + "text": "A glob or regex pattern to filter requests that are stored in the HAR. When a `baseURL` via the context options was provided and the passed URL is a path, it gets merged via the [`new URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor." + } + ], + "required": false, + "comment": "A glob or regex pattern to filter requests that are stored in the HAR. When a `baseURL` via the context options was\nprovided and the passed URL is a path, it gets merged via the\n[`new URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor.", + "deprecated": false, + "async": false, + "alias": "urlFilter", + "overloadIndex": 0, + "paramOrOption": null + } + ], + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp", + "java", + "python" + ], + "aliases": { + "python": "record_har_content" + }, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "name": "recordHarContent", + "type": { + "name": "HarContentPolicy", + "union": [ + { + "name": "\"omit\"" + }, + { + "name": "\"embed\"" + }, + { + "name": "\"attach\"" + } + ], + "expression": "[HarContentPolicy]<\"omit\"|\"embed\"|\"attach\">" + }, + "spec": [ + { + "type": "text", + "text": "Optional setting to control resource content management. If `omit` is specified, content is not persisted. If `attach` is specified, resources are persistet as separate files and all of these files are archived along with the HAR file. Defaults to `embed`, which stores content inline the HAR file as per HAR specification." + } + ], + "required": false, + "comment": "Optional setting to control resource content management. If `omit` is specified, content is not persisted. If `attach`\nis specified, resources are persistet as separate files and all of these files are archived along with the HAR file.\nDefaults to `embed`, which stores content inline the HAR file as per HAR specification.", + "deprecated": false, + "async": false, + "alias": "recordHarContent", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp", + "java", + "python" + ], + "aliases": { + "python": "record_har_mode" + }, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "name": "recordHarMode", + "type": { + "name": "HarMode", + "union": [ + { + "name": "\"full\"" + }, + { + "name": "\"minimal\"" + } + ], + "expression": "[HarMode]<\"full\"|\"minimal\">" + }, + "spec": [ + { + "type": "text", + "text": "When set to `minimal`, only record information necessary for routing from HAR. This omits sizes, timing, page, cookies, security and other types of HAR information that are not used when replaying from HAR. Defaults to `full`." + } + ], + "required": false, + "comment": "When set to `minimal`, only record information necessary for routing from HAR. This omits sizes, timing, page, cookies,\nsecurity and other types of HAR information that are not used when replaying from HAR. Defaults to `full`.", + "deprecated": false, + "async": false, + "alias": "recordHarMode", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp", + "java", + "python" + ], + "aliases": { + "python": "record_har_omit_content" + }, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp", + "java", + "python" + ], + "aliases": { + "python": "record_har_path" + }, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp", + "java", + "python" + ], + "aliases": { + "python": "record_har_url_filter" + }, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "name": "recordHarUrlFilter", + "type": { + "name": "", + "union": [ + { + "name": "string" + }, + { + "name": "RegExp" + } + ], + "expression": "[string]|[RegExp]" + }, + "spec": [], + "required": false, + "comment": "", + "deprecated": false, + "async": false, + "alias": "recordHarUrlFilter", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "name": "recordVideo", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "size", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ], + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ], + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp", + "java", + "python" + ], + "aliases": { + "python": "record_video_dir" + }, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp", + "java", + "python" + ], + "aliases": { + "python": "record_video_size" + }, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "name": "recordVideoSize", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ], + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "aliases": { + "java": "screenSize", + "csharp": "screenSize" + }, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "name": "screen", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ], + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "name": "serviceWorkers", + "type": { + "name": "ServiceWorkerPolicy", + "union": [ + { + "name": "\"allow\"" + }, + { + "name": "\"block\"" + } + ], + "expression": "[ServiceWorkerPolicy]<\"allow\"|\"block\">" + }, + "spec": [ + { + "type": "text", + "text": "Whether to allow sites to register Service workers. Defaults to `'allow'`." + }, + { + "type": "li", + "text": "`'allow'`: [Service Workers](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API) can be registered.", + "liType": "bullet" + }, + { + "type": "li", + "text": "`'block'`: Playwright will block all registration of Service Workers.", + "liType": "bullet" + } + ], + "required": false, + "comment": "Whether to allow sites to register Service workers. Defaults to `'allow'`.\n- `'allow'`: [Service Workers](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API) can be registered.\n- `'block'`: Playwright will block all registration of Service Workers.", + "deprecated": false, + "async": false, + "alias": "serviceWorkers", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "name": "strictSelectors", + "type": { + "name": "boolean", + "expression": "[boolean]" + }, + "spec": [ + { + "type": "text", + "text": "If specified, enables strict selectors mode for this context. In the strict selectors mode all operations on selectors that imply single target DOM element will throw when more than one element matches the selector. See `Locator` to learn more about the strict mode." + } + ], + "required": false, + "comment": "If specified, enables strict selectors mode for this context. In the strict selectors mode all operations on selectors\nthat imply single target DOM element will throw when more than one element matches the selector. See `Locator` to learn\nmore about the strict mode.", + "deprecated": false, + "async": false, + "alias": "strictSelectors", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "name": "videoSize", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ], + "expression": "[Object]" + }, + "spec": [ + { + "type": "text", + "text": "**DEPRECATED** Use `recordVideo` instead." + } + ], + "required": false, + "comment": "**DEPRECATED** Use `recordVideo` instead.", + "deprecated": true, + "async": false, + "alias": "videoSize", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js", + "java" + ], + "aliases": { + "java": "viewportSize" + }, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "name": "viewport", + "type": { + "name": "", + "union": [ + { + "name": "null" + }, + { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + } + ], + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp" + ], + "aliases": { + "csharp": "viewportSize" + }, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "name": "viewport", + "type": { + "name": "", + "union": [ + { + "name": "null" + }, + { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + } + ], + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "python" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "name": "viewport", + "type": { + "name": "", + "union": [ + { + "name": "null" + }, + { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + } + ], + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + "required": false, + "comment": "", + "deprecated": false, + "async": false, + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + { + "kind": "method", + "langs": { + "only": [ + "js" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "options", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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. In either case, the downloads are deleted when the browser context they were created in 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. In either case, the downloads are deleted when the browser context they were created in\nis closed.", + "deprecated": false, + "async": false, + "alias": "downloadsPath", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp", + "java" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js", + "python" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js", + "python" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp", + "java" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js", + "python" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "name": "proxy", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "bypass", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "Optional comma-separated domains to bypass proxy, for example `\".com, chromium.org, .domain.com\"`." + } + ], + "required": false, + "comment": "Optional comma-separated domains to bypass proxy, for example `\".com, chromium.org, .domain.com\"`.", + "deprecated": false, + "async": false, + "alias": "bypass", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ], + "expression": "[Object]" + }, + "spec": [ + { + "type": "text", + "text": "Network proxy settings." + } + ], + "required": false, + "comment": "Network proxy settings.", + "deprecated": false, + "async": false, + "alias": "proxy", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.15", + "name": "wsPath", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "Path at which to serve the Browser Server. For security, this defaults to an unguessable string." + }, + { + "type": "note", + "noteType": "warning", + "text": "Any process or web page (including those running in Playwright) with knowledge of the `wsPath` can take control of the OS user. For this reason, you should use an unguessable token when using this option." + } + ], + "required": false, + "comment": "Path at which to serve the Browser Server. For security, this defaults to an unguessable string.\n\n> NOTE: Any process or web page (including those running in Playwright) with knowledge of the `wsPath` can take control\nof the OS user. For this reason, you should use an unguessable token when using this option.", + "deprecated": false, + "async": false, + "alias": "wsPath", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + "required": false, + "comment": "", + "deprecated": false, + "async": false, + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "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.animationCreated\", lambda: print(\"animation created!\"))", + "response = await client.send(\"Animation.getPlaybackRate\")", + "print(\"playback rate is \" + str(response[\"playbackRate\"]))", + "await client.send(\"Animation.setPlaybackRate\", {", + " playbackRate: response[\"playbackRate\"] / 2", + "})" + ], + "codeLang": "python async" + }, + { + "type": "code", + "lines": [ + "client = page.context.new_cdp_session(page)", + "client.send(\"Animation.enable\")", + "client.on(\"Animation.animationCreated\", lambda: print(\"animation created!\"))", + "response = client.send(\"Animation.getPlaybackRate\")", + "print(\"playback rate is \" + str(response[\"playbackRate\"]))", + "client.send(\"Animation.setPlaybackRate\", {", + " playbackRate: response[\"playbackRate\"] / 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.animationCreated\", lambda: print(\"animation created!\"))\nresponse = await client.send(\"Animation.getPlaybackRate\")\nprint(\"playback rate is \" + str(response[\"playbackRate\"]))\nawait client.send(\"Animation.setPlaybackRate\", {\n playbackRate: response[\"playbackRate\"] / 2\n})\n```\n\n```python sync\nclient = page.context.new_cdp_session(page)\nclient.send(\"Animation.enable\")\nclient.on(\"Animation.animationCreated\", lambda: print(\"animation created!\"))\nresponse = client.send(\"Animation.getPlaybackRate\")\nprint(\"playback rate is \" + str(response[\"playbackRate\"]))\nclient.send(\"Animation.setPlaybackRate\", {\n playbackRate: response[\"playbackRate\"] / 2\n})\n```\n", + "members": [ + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "name": "send", + "type": { + "name": "Object", + "expression": "[Object]" + }, + "spec": [], + "required": true, + "comment": "", + "deprecated": false, + "async": true, + "alias": "send", + "overloadIndex": 0, + "paramOrOption": null, + "args": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + } + ] + }, + { + "name": "ConsoleMessage", + "spec": [ + { + "type": "text", + "text": "`ConsoleMessage` objects are dispatched by page via the [`event: Page.console`] event. For each console messages logged in the page there will be corresponding event in the Playwright context." + }, + { + "type": "code", + "lines": [ + "// Listen for all console logs", + "page.on('console', msg => console.log(msg.text()))", + "", + "// Listen for all console events and handle errors", + "page.on('console', msg => {", + " if (msg.type() === 'error')", + " console.log(`Error text: \"${msg.text()}\"`);", + "});", + "", + "// Get the next console log", + "const [msg] = await Promise.all([", + " page.waitForEvent('console'),", + " // Issue console.log inside the page", + " page.evaluate(() => {", + " console.log('hello', 42, { foo: 'bar' });", + " }),", + "]);", + "", + "// Deconstruct console log arguments", + "await msg.args[0].jsonValue() // hello", + "await msg.args[1].jsonValue() // 42" + ], + "codeLang": "js" + }, + { + "type": "code", + "lines": [ + "// Listen for all System.out.printlns", + "page.onConsoleMessage(msg -> System.out.println(msg.text()));", + "", + "// Listen for all console events and handle errors", + "page.onConsoleMessage(msg -> {", + " if (\"error\".equals(msg.type()))", + " System.out.println(\"Error text: \" + msg.text());", + "});", + "", + "// Get the next System.out.println", + "ConsoleMessage msg = page.waitForConsoleMessage(() -> {", + " // Issue console.log inside the page", + " page.evaluate(\"console.log('hello', 42, { foo: 'bar' });\");", + "});", + "", + "// Deconstruct console.log arguments", + "msg.args().get(0).jsonValue() // hello", + "msg.args().get(1).jsonValue() // 42" + ], + "codeLang": "java" + }, + { + "type": "code", + "lines": [ + "# Listen for all console logs", + "page.on(\"console\", lambda msg: print(msg.text))", + "", + "# Listen for all console events and handle errors", + "page.on(\"console\", lambda msg: print(f\"error: {msg.text}\") if msg.type == \"error\" else None)", + "", + "# Get the next console log", + "async with page.expect_console_message() as msg_info:", + " # Issue console.log inside the page", + " await page.evaluate(\"console.log('hello', 42, { foo: 'bar' })\")", + "msg = await msg_info.value", + "", + "# Deconstruct print arguments", + "await msg.args[0].json_value() # hello", + "await msg.args[1].json_value() # 42" + ], + "codeLang": "python async" + }, + { + "type": "code", + "lines": [ + "# Listen for all console logs", + "page.on(\"console\", lambda msg: print(msg.text))", + "", + "# Listen for all console events and handle errors", + "page.on(\"console\", lambda msg: print(f\"error: {msg.text}\") if msg.type == \"error\" else None)", + "", + "# Get the next console log", + "with page.expect_console_message() as msg_info:", + " # Issue console.log inside the page", + " page.evaluate(\"console.log('hello', 42, { foo: 'bar' })\")", + "msg = msg_info.value", + "", + "# Deconstruct print arguments", + "msg.args[0].json_value() # hello", + "msg.args[1].json_value() # 42" + ], + "codeLang": "python sync" + }, + { + "type": "code", + "lines": [ + "// Listen for all System.out.printlns", + "page.Console += (_, msg) => Console.WriteLine(msg.Text);", + "", + "// Listen for all console events and handle errors", + "page.Console += (_, msg) =>", + "{", + " if (\"error\".Equals(msg.Type))", + " Console.WriteLine(\"Error text: \" + msg.Text);", + "};", + "", + "// Get the next System.out.println", + "var waitForMessageTask = page.WaitForConsoleMessageAsync();", + "await page.EvaluateAsync(\"console.log('hello', 42, { foo: 'bar' });\");", + "var message = await waitForMessageTask;", + "// Deconstruct console.log arguments", + "await message.Args.ElementAt(0).JsonValueAsync(); // hello", + "await message.Args.ElementAt(1).JsonValueAsync(); // 42" + ], + "codeLang": "csharp" + } + ], + "langs": {}, + "comment": "`ConsoleMessage` objects are dispatched by page via the [`event: Page.console`] event. For each console messages logged\nin the page there will be corresponding event in the Playwright context.\n\n```js\n// Listen for all console logs\npage.on('console', msg => console.log(msg.text()))\n\n// Listen for all console events and handle errors\npage.on('console', msg => {\n if (msg.type() === 'error')\n console.log(`Error text: \"${msg.text()}\"`);\n});\n\n// Get the next console log\nconst [msg] = await Promise.all([\n page.waitForEvent('console'),\n // Issue console.log inside the page\n page.evaluate(() => {\n console.log('hello', 42, { foo: 'bar' });\n }),\n]);\n\n// Deconstruct console log arguments\nawait msg.args[0].jsonValue() // hello\nawait msg.args[1].jsonValue() // 42\n```\n\n```java\n// Listen for all System.out.printlns\npage.onConsoleMessage(msg -> System.out.println(msg.text()));\n\n// Listen for all console events and handle errors\npage.onConsoleMessage(msg -> {\n if (\"error\".equals(msg.type()))\n System.out.println(\"Error text: \" + msg.text());\n});\n\n// Get the next System.out.println\nConsoleMessage msg = page.waitForConsoleMessage(() -> {\n // Issue console.log inside the page\n page.evaluate(\"console.log('hello', 42, { foo: 'bar' });\");\n});\n\n// Deconstruct console.log arguments\nmsg.args().get(0).jsonValue() // hello\nmsg.args().get(1).jsonValue() // 42\n```\n\n```python async\n# Listen for all console logs\npage.on(\"console\", lambda msg: print(msg.text))\n\n# Listen for all console events and handle errors\npage.on(\"console\", lambda msg: print(f\"error: {msg.text}\") if msg.type == \"error\" else None)\n\n# Get the next console log\nasync with page.expect_console_message() as msg_info:\n # Issue console.log inside the page\n await page.evaluate(\"console.log('hello', 42, { foo: 'bar' })\")\nmsg = await msg_info.value\n\n# Deconstruct print arguments\nawait msg.args[0].json_value() # hello\nawait msg.args[1].json_value() # 42\n```\n\n```python sync\n# Listen for all console logs\npage.on(\"console\", lambda msg: print(msg.text))\n\n# Listen for all console events and handle errors\npage.on(\"console\", lambda msg: print(f\"error: {msg.text}\") if msg.type == \"error\" else None)\n\n# Get the next console log\nwith page.expect_console_message() as msg_info:\n # Issue console.log inside the page\n page.evaluate(\"console.log('hello', 42, { foo: 'bar' })\")\nmsg = msg_info.value\n\n# Deconstruct print arguments\nmsg.args[0].json_value() # hello\nmsg.args[1].json_value() # 42\n```\n\n```csharp\n// Listen for all System.out.printlns\npage.Console += (_, msg) => Console.WriteLine(msg.Text);\n\n// Listen for all console events and handle errors\npage.Console += (_, msg) =>\n{\n if (\"error\".Equals(msg.Type))\n Console.WriteLine(\"Error text: \" + msg.Text);\n};\n\n// Get the next System.out.println\nvar waitForMessageTask = page.WaitForConsoleMessageAsync();\nawait page.EvaluateAsync(\"console.log('hello', 42, { foo: 'bar' });\");\nvar message = await waitForMessageTask;\n// Deconstruct console.log arguments\nawait message.Args.ElementAt(0).JsonValueAsync(); // hello\nawait message.Args.ElementAt(1).JsonValueAsync(); // 42\n```\n", + "members": [ + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": { + "only": [ + "js", + "python" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "name": "location", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ], + "expression": "[Object]" + }, + "spec": [], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "location", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": { + "only": [ + "csharp", + "java" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "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 = 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 = 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": {}, + "experimental": false, + "since": "v1.11", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "options", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.11", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + "required": false, + "comment": "", + "deprecated": false, + "async": false, + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.11", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "options", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.11", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.11", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + "required": false, + "comment": "", + "deprecated": false, + "async": false, + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.11", + "name": "stopCSSCoverage", + "type": { + "name": "Array", + "templates": [ + { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "url", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "StyleSheet URL" + } + ], + "required": true, + "comment": "StyleSheet URL", + "deprecated": false, + "async": false, + "alias": "url", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "ranges", + "type": { + "name": "Array", + "templates": [ + { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + } + ], + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + } + ], + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.11", + "name": "stopJSCoverage", + "type": { + "name": "Array", + "templates": [ + { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "url", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "Script URL" + } + ], + "required": true, + "comment": "Script URL", + "deprecated": false, + "async": false, + "alias": "url", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "scriptId", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "Script ID" + } + ], + "required": true, + "comment": "Script ID", + "deprecated": false, + "async": false, + "alias": "scriptId", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "functions", + "type": { + "name": "Array", + "templates": [ + { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "functionName", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "functionName", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "isBlockCoverage", + "type": { + "name": "boolean", + "expression": "[boolean]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "isBlockCoverage", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "ranges", + "type": { + "name": "Array", + "templates": [ + { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "count", + "type": { + "name": "int", + "expression": "[int]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "count", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "startOffset", + "type": { + "name": "int", + "expression": "[int]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "startOffset", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "endOffset", + "type": { + "name": "int", + "expression": "[int]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "endOffset", + "overloadIndex": 0, + "paramOrOption": null + } + ] + } + ], + "expression": "[Array]<[Object]>" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "ranges", + "overloadIndex": 0, + "paramOrOption": null + } + ] + } + ], + "expression": "[Array]<[Object]>" + }, + "spec": [ + { + "type": "text", + "text": "V8-specific coverage format." + } + ], + "required": true, + "comment": "V8-specific coverage format.", + "deprecated": false, + "async": false, + "alias": "functions", + "overloadIndex": 0, + "paramOrOption": null + } + ] + } + ], + "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", + "overloadIndex": 0, + "paramOrOption": null, + "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": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + } + ] + }, + { + "name": "Download", + "spec": [ + { + "type": "text", + "text": "`Download` objects are dispatched by page via the [`event: Page.download`] event." + }, + { + "type": "text", + "text": "All the downloaded files belonging to the browser context are deleted when the browser context is closed." + }, + { + "type": "text", + "text": "Download event is emitted once the download starts. Download path becomes available once download completes:" + }, + { + "type": "code", + "lines": [ + "// Note that Promise.all prevents a race condition", + "// between clicking and waiting for the download.", + "const [ download ] = await Promise.all([", + " // It is important to call waitForEvent before click to set up waiting.", + " page.waitForEvent('download'),", + " // Triggers the download.", + " page.locator('text=Download file').click(),", + "]);", + "// 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.locator(\"a\").click());", + "// wait for download to complete", + "Path path = download.path();" + ], + "codeLang": "java" + }, + { + "type": "code", + "lines": [ + "// wait for download to start", + "Download download = page.waitForDownload(() -> {", + " page.locator(\"a\").click();", + "});", + "// wait for download to complete", + "Path path = download.path();" + ], + "codeLang": "java" + }, + { + "type": "code", + "lines": [ + "async with page.expect_download() as download_info:", + " await page.locator(\"a\").click()", + "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.locator(\"a\").click()", + "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.Locator(\"#downloadButton\").ClickAsync();", + "});", + "Console.WriteLine(await download.PathAsync());" + ], + "codeLang": "csharp" + } + ], + "langs": {}, + "comment": "`Download` objects are dispatched by page via the [`event: Page.download`] event.\n\nAll the downloaded files belonging to the browser context are deleted when the browser context is closed.\n\nDownload event is emitted once the download starts. Download path becomes available once download completes:\n\n```js\n// Note that Promise.all prevents a race condition\n// between clicking and waiting for the download.\nconst [ download ] = await Promise.all([\n // It is important to call waitForEvent before click to set up waiting.\n page.waitForEvent('download'),\n // Triggers the download.\n page.locator('text=Download file').click(),\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.locator(\"a\").click());\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.locator(\"a\").click();\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.locator(\"a\").click()\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.locator(\"a\").click()\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.Locator(\"#downloadButton\").ClickAsync();\n});\nConsole.WriteLine(await download.PathAsync());\n```\n", + "members": [ + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.13", + "name": "cancel", + "type": { + "name": "void" + }, + "spec": [ + { + "type": "text", + "text": "Cancels a download. Will not fail if the download is already finished or canceled. Upon successful cancellations, `download.failure()` would resolve to `'canceled'`." + } + ], + "required": true, + "comment": "Cancels a download. Will not fail if the download is already finished or canceled. Upon successful cancellations,\n`download.failure()` would resolve to `'canceled'`.", + "deprecated": false, + "async": true, + "alias": "cancel", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": { + "only": [ + "java", + "js", + "csharp" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.12", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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." + }, + { + "type": "text", + "text": "Note that the download's file name is a random GUID, use [`method: Download.suggestedFilename`] to get suggested file name." + } + ], + "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.\n\nNote that the download's file name is a random GUID, use [`method: Download.suggestedFilename`] to get suggested file\nname.", + "deprecated": false, + "async": true, + "alias": "path", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "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" + }, + { + "type": "text", + "text": "**Supported Electron versions are:**" + }, + { + "type": "li", + "text": "v12.2.0+", + "liType": "bullet" + }, + { + "type": "li", + "text": "v13.4.0+", + "liType": "bullet" + }, + { + "type": "li", + "text": "v14+", + "liType": "bullet" + } + ], + "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\n**Supported Electron versions are:**\n- v12.2.0+\n- v13.4.0+\n- v14+", + "members": [ + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.9", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "options", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.12", + "name": "acceptDownloads", + "type": { + "name": "boolean", + "expression": "[boolean]" + }, + "spec": [ + { + "type": "text", + "text": "Whether to automatically download all the attachments. Defaults to `true` where all the downloads are accepted." + } + ], + "required": false, + "comment": "Whether to automatically download all the attachments. Defaults to `true` where all the downloads are accepted.", + "deprecated": false, + "async": false, + "alias": "acceptDownloads", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.9", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.12", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.12", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.9", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.9", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.9", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.12", + "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." + } + ], + "required": false, + "comment": "An object containing additional HTTP headers to be sent with every request.", + "deprecated": false, + "async": false, + "alias": "extraHTTPHeaders", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.12", + "name": "geolocation", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ], + "expression": "[Object]" + }, + "spec": [], + "required": false, + "comment": "", + "deprecated": false, + "async": false, + "alias": "geolocation", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.12", + "name": "httpCredentials", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "username", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "username", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "password", + "type": { + "name": "string", + "expression": "[string]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "password", + "overloadIndex": 0, + "paramOrOption": null + } + ], + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.12", + "name": "ignoreHTTPSErrors", + "type": { + "name": "boolean", + "expression": "[boolean]" + }, + "spec": [ + { + "type": "text", + "text": "Whether to ignore HTTPS errors when sending network requests. Defaults to `false`." + } + ], + "required": false, + "comment": "Whether to ignore HTTPS errors when sending network requests. Defaults to `false`.", + "deprecated": false, + "async": false, + "alias": "ignoreHTTPSErrors", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.12", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.12", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.12", + "name": "recordHar", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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`. Deprecated, use `content` policy instead." + } + ], + "required": false, + "comment": "Optional setting to control whether to omit request content from the HAR. Defaults to `false`. Deprecated, use `content`\npolicy instead.", + "deprecated": false, + "async": false, + "alias": "omitContent", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "content", + "type": { + "name": "HarContentPolicy", + "union": [ + { + "name": "\"omit\"" + }, + { + "name": "\"embed\"" + }, + { + "name": "\"attach\"" + } + ], + "expression": "[HarContentPolicy]<\"omit\"|\"embed\"|\"attach\">" + }, + "spec": [ + { + "type": "text", + "text": "Optional setting to control resource content management. If `omit` is specified, content is not persisted. If `attach` is specified, resources are persistet as separate files or entries in the ZIP archive. If `embed` is specified, content is stored inline the HAR file as per HAR specification. Defaults to `attach` for `.zip` output files and to `embed` for all other file extensions." + } + ], + "required": false, + "comment": "Optional setting to control resource content management. If `omit` is specified, content is not persisted. If `attach`\nis specified, resources are persistet as separate files or entries in the ZIP archive. If `embed` is specified, content\nis stored inline the HAR file as per HAR specification. Defaults to `attach` for `.zip` output files and to `embed` for\nall other file extensions.", + "deprecated": false, + "async": false, + "alias": "content", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "path", + "type": { + "name": "path", + "expression": "[path]" + }, + "spec": [ + { + "type": "text", + "text": "Path on the filesystem to write the HAR file to. If the file name ends with `.zip`, `content: 'attach'` is used by default." + } + ], + "required": true, + "comment": "Path on the filesystem to write the HAR file to. If the file name ends with `.zip`, `content: 'attach'` is used by\ndefault.", + "deprecated": false, + "async": false, + "alias": "path", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "mode", + "type": { + "name": "HarMode", + "union": [ + { + "name": "\"full\"" + }, + { + "name": "\"minimal\"" + } + ], + "expression": "[HarMode]<\"full\"|\"minimal\">" + }, + "spec": [ + { + "type": "text", + "text": "When set to `minimal`, only record information necessary for routing from HAR. This omits sizes, timing, page, cookies, security and other types of HAR information that are not used when replaying from HAR. Defaults to `full`." + } + ], + "required": false, + "comment": "When set to `minimal`, only record information necessary for routing from HAR. This omits sizes, timing, page, cookies,\nsecurity and other types of HAR information that are not used when replaying from HAR. Defaults to `full`.", + "deprecated": false, + "async": false, + "alias": "mode", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "urlFilter", + "type": { + "name": "", + "union": [ + { + "name": "string" + }, + { + "name": "RegExp" + } + ], + "expression": "[string]|[RegExp]" + }, + "spec": [ + { + "type": "text", + "text": "A glob or regex pattern to filter requests that are stored in the HAR. When a `baseURL` via the context options was provided and the passed URL is a path, it gets merged via the [`new URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor." + } + ], + "required": false, + "comment": "A glob or regex pattern to filter requests that are stored in the HAR. When a `baseURL` via the context options was\nprovided and the passed URL is a path, it gets merged via the\n[`new URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor.", + "deprecated": false, + "async": false, + "alias": "urlFilter", + "overloadIndex": 0, + "paramOrOption": null + } + ], + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp", + "java", + "python" + ], + "aliases": { + "python": "record_har_omit_content" + }, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.12", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp", + "java", + "python" + ], + "aliases": { + "python": "record_har_path" + }, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.12", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.12", + "name": "recordVideo", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "size", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ], + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ], + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp", + "java", + "python" + ], + "aliases": { + "python": "record_video_dir" + }, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.12", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "csharp", + "java", + "python" + ], + "aliases": { + "python": "record_video_size" + }, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.12", + "name": "recordVideoSize", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ], + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.15", + "name": "timeout", + "type": { + "name": "float", + "expression": "[float]" + }, + "spec": [ + { + "type": "text", + "text": "Maximum time in milliseconds to wait for the application to start. Defaults to `30000` (30 seconds). Pass `0` to disable timeout." + } + ], + "required": false, + "comment": "Maximum time in milliseconds to wait for the application to start. Defaults to `30000` (30 seconds). Pass `0` to disable\ntimeout.", + "deprecated": false, + "async": false, + "alias": "timeout", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.12", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + "required": false, + "comment": "", + "deprecated": false, + "async": false, + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null + } + ] + } + ] + }, + { + "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": {}, + "experimental": false, + "since": "v1.9", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "event", + "langs": {}, + "experimental": false, + "since": "v1.9", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.11", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.11", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.9", + "name": "close", + "type": { + "name": "void" + }, + "spec": [ + { + "type": "text", + "text": "Closes Electron application." + } + ], + "required": true, + "comment": "Closes Electron application.", + "deprecated": false, + "async": true, + "alias": "close", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.9", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.9", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [ + { + "kind": "property", + "langs": { + "overrides": { + "js": { + "kind": "property", + "langs": { + "only": [ + "js" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.9", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + } + }, + "experimental": false, + "since": "v1.9", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.9", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.9", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [ + { + "kind": "property", + "langs": { + "overrides": { + "js": { + "kind": "property", + "langs": { + "only": [ + "js" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.9", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + } + }, + "experimental": false, + "since": "v1.9", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.9", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.9", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.21", + "name": "process", + "type": { + "name": "ChildProcess", + "expression": "[ChildProcess]" + }, + "spec": [ + { + "type": "text", + "text": "Returns the main process for this Electron Application." + } + ], + "required": true, + "comment": "Returns the main process for this Electron Application.", + "deprecated": false, + "async": false, + "alias": "process", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.9", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [ + { + "kind": "property", + "langs": { + "only": [ + "js", + "python", + "java" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.9", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "only": [ + "js" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.9", + "name": "optionsOrPredicate", + "type": { + "name": "", + "union": [ + { + "name": "function" + }, + { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + } + ], + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.9", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "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": "note", + "noteType": "caution Discouraged", + "text": "The use of ElementHandle is discouraged, use `Locator` objects and web-first assertions instead." + }, + { + "type": "code", + "lines": [ + "const hrefElement = await page.$('a');", + "await hrefElement.click();" + ], + "codeLang": "js" + }, + { + "type": "code", + "lines": [ + "ElementHandle hrefElement = page.querySelector(\"a\");", + "hrefElement.click();" + ], + "codeLang": "java" + }, + { + "type": "code", + "lines": [ + "href_element = await page.query_selector(\"a\")", + "await href_element.click()" + ], + "codeLang": "python async" + }, + { + "type": "code", + "lines": [ + "href_element = page.query_selector(\"a\")", + "href_element.click()" + ], + "codeLang": "python sync" + }, + { + "type": "code", + "lines": [ + "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." + }, + { + "type": "text", + "text": "The difference between the `Locator` and ElementHandle is that the ElementHandle points to a particular element, while `Locator` captures the logic of how to retrieve an element." + }, + { + "type": "text", + "text": "In the example below, handle points to a particular DOM element on page. If that element changes text or is used by React to render an entirely different component, handle is still pointing to that very DOM element. This can lead to unexpected behaviors." + }, + { + "type": "code", + "lines": [ + "const handle = await page.$('text=Submit');", + "// ...", + "await handle.hover();", + "await handle.click();" + ], + "codeLang": "js" + }, + { + "type": "code", + "lines": [ + "ElementHandle handle = page.querySelector(\"text=Submit\");", + "handle.hover();", + "handle.click();" + ], + "codeLang": "java" + }, + { + "type": "code", + "lines": [ + "handle = await page.query_selector(\"text=Submit\")", + "await handle.hover()", + "await handle.click()" + ], + "codeLang": "python async" + }, + { + "type": "code", + "lines": [ + "handle = page.query_selector(\"text=Submit\")", + "handle.hover()", + "handle.click()" + ], + "codeLang": "python sync" + }, + { + "type": "code", + "lines": [ + "var handle = await page.QuerySelectorAsync(\"text=Submit\");", + "await handle.HoverAsync();", + "await handle.ClickAsync();" + ], + "codeLang": "csharp" + }, + { + "type": "text", + "text": "With the locator, every time the `element` is used, up-to-date DOM element is located in the page using the selector. So in the snippet below, underlying DOM element is going to be located twice." + }, + { + "type": "code", + "lines": [ + "const locator = page.locator('text=Submit');", + "// ...", + "await locator.hover();", + "await locator.click();" + ], + "codeLang": "js" + }, + { + "type": "code", + "lines": [ + "Locator locator = page.locator(\"text=Submit\");", + "locator.hover();", + "locator.click();" + ], + "codeLang": "java" + }, + { + "type": "code", + "lines": [ + "locator = page.locator(\"text=Submit\")", + "await locator.hover()", + "await locator.click()" + ], + "codeLang": "python async" + }, + { + "type": "code", + "lines": [ + "locator = page.locator(\"text=Submit\")", + "locator.hover()", + "locator.click()" + ], + "codeLang": "python sync" + }, + { + "type": "code", + "lines": [ + "var locator = page.Locator(\"text=Submit\");", + "await locator.HoverAsync();", + "await locator.ClickAsync();" + ], + "codeLang": "csharp" + } + ], + "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> NOTE: The use of ElementHandle is discouraged, use `Locator` objects and web-first assertions instead.\n\n```js\nconst hrefElement = await page.$('a');\nawait hrefElement.click();\n```\n\n```java\nElementHandle hrefElement = page.querySelector(\"a\");\nhrefElement.click();\n```\n\n```python async\nhref_element = await page.query_selector(\"a\")\nawait href_element.click()\n```\n\n```python sync\nhref_element = page.query_selector(\"a\")\nhref_element.click()\n```\n\n```csharp\nvar handle = await page.QuerySelectorAsync(\"a\");\nawait handle.ClickAsync();\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.\n\nThe difference between the `Locator` and ElementHandle is that the ElementHandle points to a particular element, while\n`Locator` captures the logic of how to retrieve an element.\n\nIn the example below, handle points to a particular DOM element on page. If that element changes text or is used by\nReact to render an entirely different component, handle is still pointing to that very DOM element. This can lead to\nunexpected behaviors.\n\n```js\nconst handle = await page.$('text=Submit');\n// ...\nawait handle.hover();\nawait handle.click();\n```\n\n```java\nElementHandle handle = page.querySelector(\"text=Submit\");\nhandle.hover();\nhandle.click();\n```\n\n```python async\nhandle = await page.query_selector(\"text=Submit\")\nawait handle.hover()\nawait handle.click()\n```\n\n```python sync\nhandle = page.query_selector(\"text=Submit\")\nhandle.hover()\nhandle.click()\n```\n\n```csharp\nvar handle = await page.QuerySelectorAsync(\"text=Submit\");\nawait handle.HoverAsync();\nawait handle.ClickAsync();\n```\n\nWith the locator, every time the `element` is used, up-to-date DOM element is located in the page using the selector. So\nin the snippet below, underlying DOM element is going to be located twice.\n\n```js\nconst locator = page.locator('text=Submit');\n// ...\nawait locator.hover();\nawait locator.click();\n```\n\n```java\nLocator locator = page.locator(\"text=Submit\");\nlocator.hover();\nlocator.click();\n```\n\n```python async\nlocator = page.locator(\"text=Submit\")\nawait locator.hover()\nawait locator.click()\n```\n\n```python sync\nlocator = page.locator(\"text=Submit\")\nlocator.hover()\nlocator.click()\n```\n\n```csharp\nvar locator = page.Locator(\"text=Submit\");\nawait locator.HoverAsync();\nawait locator.ClickAsync();\n```\n", + "members": [ + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "name": "boundingBox", + "type": { + "name": "", + "union": [ + { + "name": "null" + }, + { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + } + ], + "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 bounding 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 bounding 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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "options", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.11", + "name": "position", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "x", + "type": { + "name": "float", + "expression": "[float]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "x", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "y", + "type": { + "name": "float", + "expression": "[float]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "y", + "overloadIndex": 0, + "paramOrOption": null + } + ], + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.11", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + "required": false, + "comment": "", + "deprecated": false, + "async": false, + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "options", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "name": "position", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "x", + "type": { + "name": "float", + "expression": "[float]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "x", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "y", + "type": { + "name": "float", + "expression": "[float]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "y", + "overloadIndex": 0, + "paramOrOption": null + } + ], + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.11", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + "required": false, + "comment": "", + "deprecated": false, + "async": false, + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [] + }, + { + "kind": "method", + "langs": { + "aliases": { + "csharp": "DblClickAsync" + }, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null, + "args": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "options", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "name": "position", + "type": { + "name": "Object", + "properties": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "x", + "type": { + "name": "float", + "expression": "[float]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "x", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.0", + "name": "y", + "type": { + "name": "float", + "expression": "[float]" + }, + "spec": [ + { + "type": "text", + "text": "" + } + ], + "required": true, + "comment": "", + "deprecated": false, + "async": false, + "alias": "y", + "overloadIndex": 0, + "paramOrOption": null + } + ], + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.11", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + "required": false, + "comment": "", + "deprecated": false, + "async": false, + "alias": "options", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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 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 dataTransfer = await page.EvaluateHandleAsync(\"() => new DataTransfer()\");", + "await elementHandle.DispatchEventAsync(\"dragstart\", new Dictionary", + "{", + " { \"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 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 dataTransfer = await page.EvaluateHandleAsync(\"() => new DataTransfer()\");\nawait elementHandle.DispatchEventAsync(\"dragstart\", new Dictionary\n{\n { \"dataTransfer\", dataTransfer }\n});\n```\n", + "deprecated": false, + "async": true, + "alias": "dispatchEvent", + "overloadIndex": 0, + "paramOrOption": null, + "args": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + { + "kind": "method", + "langs": { + "aliases": { + "python": "eval_on_selector", + "js": "$eval" + }, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.9", + "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.AreEqual(\"100\", await tweetHandle.EvalOnSelectorAsync(\".like\", \"node => node.innerText\"));", + "Assert.AreEqual(\"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.AreEqual(\"100\", await tweetHandle.EvalOnSelectorAsync(\".like\", \"node => node.innerText\"));\nAssert.AreEqual(\"10\", await tweetHandle.EvalOnSelectorAsync(\".retweets\", \"node => node.innerText\"));\n```\n", + "deprecated": false, + "async": true, + "alias": "evalOnSelector", + "overloadIndex": 0, + "paramOrOption": null, + "args": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.9", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "overrides": { + "js": { + "kind": "property", + "langs": { + "only": [ + "js" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.9", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + } + }, + "experimental": false, + "since": "v1.9", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.9", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + { + "kind": "method", + "langs": { + "aliases": { + "python": "eval_on_selector_all", + "js": "$$eval" + }, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.9", + "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": [ + "
", + "
Hello!
", + "
Hi!
", + "
" + ], + "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.AreEqual(new [] { \"Hello!\", \"Hi!\" }, await feedHandle.EvalOnSelectorAllAsync(\".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
\n
Hello!
\n
Hi!
\n
\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.AreEqual(new [] { \"Hello!\", \"Hi!\" }, await feedHandle.EvalOnSelectorAllAsync(\".tweet\", \"nodes => nodes.map(n => n.innerText)\"));\n```\n", + "deprecated": false, + "async": true, + "alias": "evalOnSelectorAll", + "overloadIndex": 0, + "paramOrOption": null, + "args": [ + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.9", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": { + "overrides": { + "js": { + "kind": "property", + "langs": { + "only": [ + "js" + ], + "aliases": {}, + "types": {}, + "overrides": {} + }, + "experimental": false, + "since": "v1.9", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + } + }, + "experimental": false, + "since": "v1.9", + "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", + "overloadIndex": 0, + "paramOrOption": null + }, + { + "kind": "property", + "langs": {}, + "experimental": false, + "since": "v1.9", + "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", + "overloadIndex": 0, + "paramOrOption": null + } + ] + }, + { + "kind": "method", + "langs": {}, + "experimental": false, + "since": "v1.8", + "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 ``, `