Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
chore: inline docs from python.md (#20792)
Dmitry Gozman56276184ae00
diff --git a/docs/src/api/class-browsercontext.md b/docs/src/api/class-browsercontext.mdindex 16f12aca48..4c72fd83fc 100644--- a/docs/src/api/class-browsercontext.md+++ b/docs/src/api/class-browsercontext.md@@ -312,6 +312,20 @@ Script to be evaluated in all pages in the browser context.Optional argument to pass to [`param: script`] (only supported when passing a function).+### param: BrowserContext.addInitScript.path+* since: v1.8+* langs: python+- `path` ?<[path]>++Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the current working directory. Optional.++### param: BrowserContext.addInitScript.script+* since: v1.8+* langs: python+- `script` ?<[string]>++Script to be evaluated in all pages in the browser context. Optional.+## method: BrowserContext.backgroundPages* since: v1.11* langs: js, python@@ -1338,6 +1352,11 @@ var page = await context.RunAndWaitForPageAsync(async () =>});```+## async method: BrowserContext.waitForEvent+* since: v1.8+* langs: python+- returns: <[EventContextManager]>+### param: BrowserContext.waitForEvent.event* since: v1.8- `event` <[string]>@@ -1354,6 +1373,12 @@ Event name, same one would pass into `browserContext.on(event)`.Either a predicate that receives an event or an options object. Optional.+### option: BrowserContext.waitForEvent.predicate = %%-wait-for-event-predicate-%%+* since: v1.8++### option: BrowserContext.waitForEvent.timeout = %%-wait-for-event-timeout-%%+* since: v1.8+## async method: BrowserContext.waitForPage* since: v1.9* langs: java, python, csharp@@ -1365,7 +1390,12 @@ Performs action and waits for a new [Page] to be created in the context. If pred[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.-### option: BrowserContext.waitForPage.predicate =+## async method: BrowserContext.waitForPage+* since: v1.9+* langs: python+- returns: <[EventContextManager]<[Page]>>++### option: BrowserContext.waitForPage.predicate* since: v1.9* langs: csharp, java, python- `predicate` <[function]\([Page]\):[boolean]>diff --git a/docs/src/api/class-elementhandle.md b/docs/src/api/class-elementhandle.mdindex 1b5f2621ff..403bb63e86 100644--- a/docs/src/api/class-elementhandle.md+++ b/docs/src/api/class-elementhandle.md@@ -799,6 +799,18 @@ await handle.SelectOptionAsync(new[] {### option: ElementHandle.selectOption.timeout = %%-input-timeout-%%* since: v1.8+### param: ElementHandle.selectOption.element = %%-python-select-options-element-%%+* since: v1.8++### param: ElementHandle.selectOption.index = %%-python-select-options-index-%%+* since: v1.8++### param: ElementHandle.selectOption.value = %%-python-select-options-value-%%+* since: v1.8++### param: ElementHandle.selectOption.label = %%-python-select-options-label-%%+* since: v1.8+## async method: ElementHandle.selectText* since: v1.8diff --git a/docs/src/api/class-frame.md b/docs/src/api/class-frame.mdindex 49b77defd3..e5be5dc965 100644--- a/docs/src/api/class-frame.md+++ b/docs/src/api/class-frame.md@@ -1475,6 +1475,18 @@ await frame.SelectOptionAsync("select#colors", new[] { "red", "green", "blue" })### option: Frame.selectOption.timeout = %%-input-timeout-%%* since: v1.8+### param: Frame.selectOption.element = %%-python-select-options-element-%%+* since: v1.8++### param: Frame.selectOption.index = %%-python-select-options-index-%%+* since: v1.8++### param: Frame.selectOption.value = %%-python-select-options-value-%%+* since: v1.8++### param: Frame.selectOption.label = %%-python-select-options-label-%%+* since: v1.8+## async method: Frame.setChecked* since: v1.15* discouraged: Use locator-based [`method: Locator.setChecked`] instead. Read more about [locators](../locators.md).@@ -1966,6 +1978,11 @@ Usage of the [History API](https://developer.mozilla.org/en-US/docs/Web/API/Hista navigation.:::+## async method: Frame.waitForNavigation+* since: v1.8+* langs: python+- returns: <[EventContextManager]<[Response]>>+### option: Frame.waitForNavigation.url = %%-wait-for-navigation-url-%%* since: v1.8diff --git a/docs/src/api/class-locator.md b/docs/src/api/class-locator.mdindex a1a530ab7e..9c2e64492b 100644--- a/docs/src/api/class-locator.md+++ b/docs/src/api/class-locator.md@@ -1653,6 +1653,18 @@ await element.SelectOptionAsync(new[] { "red", "green", "blue" });### option: Locator.selectOption.timeout = %%-input-timeout-%%* since: v1.14+### param: Locator.selectOption.element = %%-python-select-options-element-%%+* since: v1.14++### param: Locator.selectOption.index = %%-python-select-options-index-%%+* since: v1.14++### param: Locator.selectOption.value = %%-python-select-options-value-%%+* since: v1.14++### param: Locator.selectOption.label = %%-python-select-options-label-%%+* since: v1.14+## async method: Locator.selectText* since: v1.14diff --git a/docs/src/api/class-page.md b/docs/src/api/class-page.mdindex 2fc55bb2f2..98b4341d83 100644--- a/docs/src/api/class-page.md+++ b/docs/src/api/class-page.md@@ -631,6 +631,20 @@ Script to be evaluated in all pages in the browser context.Optional argument to pass to [`param: script`] (only supported when passing a function).+### param: Page.addInitScript.path+* since: v1.8+* langs: python+- `path` ?<[path]>++Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the current working directory. Optional.++### param: Page.addInitScript.script+* since: v1.8+* langs: python+- `script` ?<[string]>++Script to be evaluated in all pages in the browser context. Optional.+## async method: Page.addScriptTag* since: v1.8- returns: <[ElementHandle]>@@ -2138,6 +2152,20 @@ Frame name or other frame lookup options.Frame name specified in the `iframe`'s `name` attribute.+### option: Page.frame.name+* since: v1.8+* langs: python+- `name` ?<[string]>++Frame name specified in the `iframe`'s `name` attribute. Optional.++### option: Page.frame.url+* since: v1.8+* langs: python+- `url` ?<[string]|[RegExp]|[function]\([URL]\):[boolean]>++A glob pattern, regex pattern or predicate receiving frame's `url` as a [URL] object. Optional.+## method: Page.frameByUrl* since: v1.9* langs: csharp, java@@ -3284,6 +3312,18 @@ await page.SelectOptionAsync("select#colors", new[] { "red", "green", "blue" });### option: Page.selectOption.timeout = %%-input-timeout-%%* since: v1.8+### param: Page.selectOption.element = %%-python-select-options-element-%%+* since: v1.8++### param: Page.selectOption.index = %%-python-select-options-index-%%+* since: v1.8++### param: Page.selectOption.value = %%-python-select-options-value-%%+* since: v1.8++### param: Page.selectOption.label = %%-python-select-options-label-%%+* since: v1.8+## async method: Page.setChecked* since: v1.15* discouraged: Use locator-based [`method: Locator.setChecked`] instead. Read more about [locators](../locators.md).@@ -3716,7 +3756,12 @@ Performs action and waits for a [ConsoleMessage] to be logged by in the page. If[ConsoleMessage] value into the `predicate` function and waits for `predicate(message)` to return a truthy value.Will throw an error if the page is closed before the [`event: Page.console`] event is fired.-### option: Page.waitForConsoleMessage.predicate =+## async method: Page.waitForConsoleMessage+* since: v1.9+* langs: python+- returns: <[EventContextManager]<[ConsoleMessage]>>++### option: Page.waitForConsoleMessage.predicate* since: v1.9- `predicate` <[function]\([ConsoleMessage]\):[boolean]>@@ -3736,7 +3781,12 @@ Performs action and waits for a new [Download]. If predicate is provided, it pas[Download] value into the `predicate` function and waits for `predicate(download)` to return a truthy value.Will throw an error if the page is closed before the download event is fired.-### option: Page.waitForDownload.predicate =+## async method: Page.waitForDownload+* since: v1.9+* langs: python+- returns: <[EventContextManager]<[Download]>>++### option: Page.waitForDownload.predicate* since: v1.9- `predicate` <[function]\([Download]\):[boolean]>@@ -3775,6 +3825,11 @@ with page.expect_event("framenavigated") as event_info:frame = event_info.value```+## async method: Page.waitForEvent+* since: v1.8+* langs: python+- returns: <[EventContextManager]>+### param: Page.waitForEvent.event = %%-wait-for-event-event-%%* since: v1.8@@ -3788,6 +3843,12 @@ frame = event_info.valueEither a predicate that receives an event or an options object. Optional.+### option: Page.waitForEvent.predicate = %%-wait-for-event-predicate-%%+* since: v1.8++### option: Page.waitForEvent.timeout = %%-wait-for-event-timeout-%%+* since: v1.8+## async method: Page.waitForFileChooser* since: v1.9* langs: java, python, csharp@@ -3799,7 +3860,12 @@ Performs action and waits for a new [FileChooser] to be created. If predicate is[FileChooser] value into the `predicate` function and waits for `predicate(fileChooser)` to return a truthy value.Will throw an error if the page is closed before the file chooser is opened.-### option: Page.waitForFileChooser.predicate =+## async method: Page.waitForFileChooser+* since: v1.9+* langs: python+- returns: <[EventContextManager]<[FileChooser]>>++### option: Page.waitForFileChooser.predicate* since: v1.9- `predicate` <[function]\([FileChooser]\):[boolean]>@@ -4091,6 +4157,11 @@ Usage of the [History API](https://developer.mozilla.org/en-US/docs/Web/API/Hista navigation.:::+## async method: Page.waitForNavigation+* since: v1.8+* langs: python+- returns: <[EventContextManager]<[Response]>>+### option: Page.waitForNavigation.url = %%-wait-for-navigation-url-%%* since: v1.8@@ -4111,7 +4182,12 @@ Performs action and waits for a popup [Page]. If predicate is provided, it passe[Popup] value into the `predicate` function and waits for `predicate(page)` to return a truthy value.Will throw an error if the page is closed before the popup event is fired.-### option: Page.waitForPopup.predicate =+## async method: Page.waitForPopup+* since: v1.9+* langs: python+- returns: <[EventContextManager]<[Page]>>++### option: Page.waitForPopup.predicate* since: v1.9- `predicate` <[function]\([Page]\):[boolean]>@@ -4193,6 +4269,11 @@ await page.RunAndWaitForRequestAsync(async () =>}, request => request.Url == "https://example.com" && request.Method == "GET");```+## async method: Page.waitForRequest+* since: v1.8+* langs: python+- returns: <[EventContextManager]<[Request]>>+### param: Page.waitForRequest.action = %%-csharp-wait-for-event-action-%%* since: v1.12@@ -4229,7 +4310,12 @@ Performs action and waits for a [Request] to finish loading. If predicate is pro[Request] value into the `predicate` function and waits for `predicate(request)` to return a truthy value.Will throw an error if the page is closed before the [`event: Page.requestFinished`] event is fired.-### option: Page.waitForRequestFinished.predicate =+## async method: Page.waitForRequestFinished+* since: v1.12+* langs: python+- returns: <[EventContextManager]<[Request]>>++### option: Page.waitForRequestFinished.predicate* since: v1.12- `predicate` <[function]\([Request]\):[boolean]>@@ -4315,6 +4401,11 @@ await page.RunAndWaitForResponseAsync(async () =>}, response => response.Url == "https://example.com" && response.Status == 200);```+## async method: Page.waitForResponse+* since: v1.8+* langs: python+- returns: <[EventContextManager]<[Response]>>+### param: Page.waitForResponse.action = %%-csharp-wait-for-event-action-%%* since: v1.12@@ -4565,7 +4656,12 @@ Performs action and waits for a new [WebSocket]. If predicate is provided, it pa[WebSocket] value into the `predicate` function and waits for `predicate(webSocket)` to return a truthy value.Will throw an error if the page is closed before the WebSocket event is fired.-### option: Page.waitForWebSocket.predicate =+## async method: Page.waitForWebSocket+* since: v1.9+* langs: python+- returns: <[EventContextManager]<[WebSocket]>>++### option: Page.waitForWebSocket.predicate* since: v1.9- `predicate` <[function]\([WebSocket]\):[boolean]>@@ -4585,7 +4681,12 @@ Performs action and waits for a new [Worker]. If predicate is provided, it passe[Worker] value into the `predicate` function and waits for `predicate(worker)` to return a truthy value.Will throw an error if the page is closed before the worker event is fired.-### option: Page.waitForWorker.predicate =+## async method: Page.waitForWorker+* since: v1.9+* langs: python+- returns: <[EventContextManager]<[Worker]>>++### option: Page.waitForWorker.predicate* since: v1.9- `predicate` <[function]\([Worker]\):[boolean]>diff --git a/docs/src/api/class-playwright.md b/docs/src/api/class-playwright.mdindex 8d9a9235f2..fff291cb08 100644--- a/docs/src/api/class-playwright.md+++ b/docs/src/api/class-playwright.md@@ -240,3 +240,23 @@ Selectors can be used to install custom selector engines. See- type: <[BrowserType]>This object can be used to launch or connect to WebKit, returning instances of [Browser].++## async method: Playwright.stop+* since: v1.8+* langs: python++Terminates this instance of Playwright in case it was created bypassing the Python context manager. This is useful in REPL applications.++```py+>>> from playwright.sync_api import sync_playwright++>>> playwright = sync_playwright().start()++>>> browser = playwright.chromium.launch()+>>> page = browser.new_page()+>>> page.goto("http://whatsmyuseragent.org/")+>>> page.screenshot(path="example.png")+>>> browser.close()++>>> playwright.stop()+```diff --git a/docs/src/api/class-selectors.md b/docs/src/api/class-selectors.mdindex a068414a38..c86cae8c7b 100644--- a/docs/src/api/class-selectors.md+++ b/docs/src/api/class-selectors.md@@ -202,6 +202,13 @@ Script that evaluates to a selector engine instance. The script is evaluated inScript that evaluates to a selector engine instance. The script is evaluated in the page context.+### param: Selectors.register.script+* since: v1.8+* langs: python+- `script` <[string]>++Raw script content.+### option: Selectors.register.script* since: v1.8* langs: csharp@@ -209,6 +216,13 @@ Script that evaluates to a selector engine instance. The script is evaluated inScript that evaluates to a selector engine instance. The script is evaluated in the page context.+### option: Selectors.register.path+* since: v1.8+* langs: python+- `path` <[path]>++Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the current working directory.+### option: Selectors.register.path* since: v1.8* langs: csharpdiff --git a/docs/src/api/class-websocket.md b/docs/src/api/class-websocket.mdindex 95157bddd3..d0fa493b7e 100644--- a/docs/src/api/class-websocket.md+++ b/docs/src/api/class-websocket.md@@ -60,6 +60,11 @@ Contains the URL of the WebSocket.Waits for event to fire and passes its value into the predicate function. Returns when the predicate returns truthyvalue. Will throw an error if the webSocket is closed before the event is fired. Returns the event data value.+## async method: WebSocket.waitForEvent+* since: v1.8+* langs: python+- returns: <[EventContextManager]>+### param: WebSocket.waitForEvent.event* since: v1.8- `event` <[string]>@@ -75,6 +80,12 @@ Event name, same one would pass into `webSocket.on(event)`.Either a predicate that receives an event or an options object. Optional.+### option: WebSocket.waitForEvent.predicate = %%-wait-for-event-predicate-%%+* since: v1.8++### option: WebSocket.waitForEvent.timeout = %%-wait-for-event-timeout-%%+* since: v1.8+## async method: WebSocket.waitForFrameReceived* since: v1.10* langs: javadiff --git a/docs/src/api/python.md b/docs/src/api/python.mddeleted file mode 100644index 7d9aa1ae4c..0000000000--- a/docs/src/api/python.md+++ /dev/null@@ -1,199 +0,0 @@-## async method: Playwright.stop-* since: v1.8-* langs: python--Terminates this instance of Playwright in case it was created bypassing the Python context manager. This is useful in REPL applications.--```py->>> from playwright.sync_api import sync_playwright-->>> playwright = sync_playwright().start()-->>> browser = playwright.chromium.launch()->>> page = browser.new_page()->>> page.goto("http://whatsmyuseragent.org/")->>> page.screenshot(path="example.png")->>> browser.close()-->>> playwright.stop()-```--### param: BrowserContext.addInitScript.path-* since: v1.8-* langs: python-- `path` ?<[path]>--Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the current working directory. Optional.---### param: BrowserContext.addInitScript.script-* since: v1.8-* langs: python-- `script` ?<[string]>--Script to be evaluated in all pages in the browser context. Optional.--### param: Page.addInitScript.path-* since: v1.8-* langs: python-- `path` ?<[path]>--Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the current working directory. Optional.--### param: Page.addInitScript.script-* since: v1.8-* langs: python-- `script` ?<[string]>--Script to be evaluated in all pages in the browser context. Optional.--### param: ElementHandle.selectOption.element = %%-python-select-options-element-%%-* since: v1.8-### param: ElementHandle.selectOption.index = %%-python-select-options-index-%%-* since: v1.8-### param: ElementHandle.selectOption.value = %%-python-select-options-value-%%-* since: v1.8-### param: ElementHandle.selectOption.label = %%-python-select-options-label-%%-* since: v1.8--### param: Frame.selectOption.element = %%-python-select-options-element-%%-* since: v1.8-### param: Frame.selectOption.index = %%-python-select-options-index-%%-* since: v1.8-### param: Frame.selectOption.value = %%-python-select-options-value-%%-* since: v1.8-### param: Frame.selectOption.label = %%-python-select-options-label-%%-* since: v1.8--### param: Page.selectOption.element = %%-python-select-options-element-%%-* since: v1.8-### param: Page.selectOption.index = %%-python-select-options-index-%%-* since: v1.8-### param: Page.selectOption.value = %%-python-select-options-value-%%-* since: v1.8-### param: Page.selectOption.label = %%-python-select-options-label-%%-* since: v1.8--### param: Locator.selectOption.element = %%-python-select-options-element-%%-* since: v1.14-### param: Locator.selectOption.index = %%-python-select-options-index-%%-* since: v1.14-### param: Locator.selectOption.value = %%-python-select-options-value-%%-* since: v1.14-### param: Locator.selectOption.label = %%-python-select-options-label-%%-* since: v1.14--### option: Page.frame.name-* since: v1.8-* langs: python-- `name` ?<[string]>--Frame name specified in the `iframe`'s `name` attribute. Optional.--### option: Page.frame.url-* since: v1.8-* langs: python-- `url` ?<[string]|[RegExp]|[function]\([URL]\):[boolean]>--A glob pattern, regex pattern or predicate receiving frame's `url` as a [URL] object. Optional.--### option: Selectors.register.script-* since: v1.8-* langs: python-- `path` <[path]>--Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the current working directory.--### option: Selectors.register.script-* since: v1.8-* langs: python-- `script` <[string]>--Raw script content.--## async method: Page.waitForEvent-* since: v1.8-* langs: python-- returns: <[EventContextManager]>-### option: Page.waitForEvent.predicate = %%-wait-for-event-predicate-%%-* since: v1.8-### option: Page.waitForEvent.timeout = %%-wait-for-event-timeout-%%-* since: v1.8--## async method: BrowserContext.waitForEvent-* since: v1.8-* langs: python-- returns: <[EventContextManager]>-### option: BrowserContext.waitForEvent.predicate = %%-wait-for-event-predicate-%%-* since: v1.8-### option: BrowserContext.waitForEvent.timeout = %%-wait-for-event-timeout-%%-* since: v1.8--## async method: WebSocket.waitForEvent-* since: v1.8-* langs: python-- returns: <[EventContextManager]>-### option: WebSocket.waitForEvent.predicate = %%-wait-for-event-predicate-%%-* since: v1.8-### option: WebSocket.waitForEvent.timeout = %%-wait-for-event-timeout-%%-* since: v1.8--## async method: Page.waitForDownload-* since: v1.9-* langs: python-- returns: <[EventContextManager]<[Download]>>--## async method: Page.waitForPopup-* since: v1.9-* langs: python-- returns: <[EventContextManager]<[Page]>>--## async method: Page.waitForWebSocket-* since: v1.9-* langs: python-- returns: <[EventContextManager]<[WebSocket]>>--## async method: Page.waitForWorker-* since: v1.9-* langs: python-- returns: <[EventContextManager]<[Worker]>>--## async method: Page.waitForConsoleMessage-* since: v1.9-* langs: python-- returns: <[EventContextManager]<[ConsoleMessage]>>--## async method: Page.waitForFileChooser-* since: v1.9-* langs: python-- returns: <[EventContextManager]<[FileChooser]>>--## async method: BrowserContext.waitForPage-* since: v1.9-* langs: python-- returns: <[EventContextManager]<[Page]>>--## async method: Frame.waitForNavigation-* since: v1.8-* langs: python-- returns: <[EventContextManager]<[Response]>>--## async method: Page.waitForNavigation-* since: v1.8-* langs: python-- returns: <[EventContextManager]<[Response]>>--## async method: Page.waitForRequest-* since: v1.8-* langs: python-- returns: <[EventContextManager]<[Request]>>--## async method: Page.waitForRequestFinished-* since: v1.12-* langs: python-- returns: <[EventContextManager]<[Request]>>--## async method: Page.waitForResponse-* since: v1.8-* langs: python-- returns: <[EventContextManager]<[Response]>>