diff --git a/dotnet/docs/api/class-browsercontext.mdx b/dotnet/docs/api/class-browsercontext.mdx index 774212a731c..6465fdd3b54 100644 --- a/dotnet/docs/api/class-browsercontext.mdx +++ b/dotnet/docs/api/class-browsercontext.mdx @@ -118,28 +118,6 @@ The order of evaluation of multiple scripts installed via [BrowserContext.AddIni --- -### BackgroundPages {#browser-context-background-pages} - -Added in: v1.11browserContext.BackgroundPages - -:::note - -Background pages are only supported on Chromium-based browsers. -::: - -All existing background pages in the context. - -**Usage** - -```csharp -BrowserContext.BackgroundPages -``` - -**Returns** -- [IReadOnlyList]<[Page]># - ---- - ### Browser {#browser-context-browser} Added before v1.9browserContext.Browser @@ -1042,36 +1020,6 @@ BrowserContext.Tracing ## Events -### event BackgroundPage {#browser-context-event-background-page} - -Added in: v1.11browserContext.event BackgroundPage - -:::note - -Only works with Chromium browser's persistent context. -::: - -Emitted when new background page is created in the context. - -```csharp -context.BackgroundPage += (_, backgroundPage) => -{ - Console.WriteLine(backgroundPage.Url); -}; - -``` - -**Usage** - -```csharp -BrowserContext.BackgroundPage += async (_, page) => {}; -``` - -**Event data** -- [Page] - ---- - ### event Close {#browser-context-event-close} Added before v1.9browserContext.event Close @@ -1262,6 +1210,56 @@ BrowserContext.WebError += async (_, webError) => {}; **Event data** - [WebError] +--- + +## Deprecated + +### event BackgroundPage {#browser-context-event-background-page} + +Added in: v1.11browserContext.event BackgroundPage + +:::warning Deprecated + +Background pages have been removed from Chromium together with Manifest V2 extensions. + +::: + + +This event is not emitted. + +**Usage** + +```csharp +BrowserContext.BackgroundPage += async (_, page) => {}; +``` + +**Event data** +- [Page] + +--- + +### BackgroundPages {#browser-context-background-pages} + +Added in: v1.11browserContext.BackgroundPages + +:::warning Deprecated + +Background pages have been removed from Chromium together with Manifest V2 extensions. + +::: + + +Returns an empty list. + +**Usage** + +```csharp +BrowserContext.BackgroundPages +``` + +**Returns** +- [IReadOnlyList]<[Page]># + [Accessibility]: /api/class-accessibility.mdx "Accessibility" [APIRequest]: /api/class-apirequest.mdx "APIRequest" diff --git a/dotnet/docs/api/class-page.mdx b/dotnet/docs/api/class-page.mdx index 0aa4dfe517c..e3f89690463 100644 --- a/dotnet/docs/api/class-page.mdx +++ b/dotnet/docs/api/class-page.mdx @@ -299,7 +299,7 @@ await Page.CloseAsync(options); Added in: v1.56page.ConsoleMessagesAsync -Returns up to 200 last console messages from this page. See [Page.Console](/api/class-page.mdx#page-event-console) for more details. +Returns up to (currently) 200 last console messages from this page. See [Page.Console](/api/class-page.mdx#page-event-console) for more details. **Usage** @@ -1332,7 +1332,7 @@ await Page.OpenerAsync(); Added in: v1.56page.PageErrorsAsync -Returns up to 200 last page errors from this page. See [Page.PageError](/api/class-page.mdx#page-event-page-error) for more details. +Returns up to (currently) 200 last page errors from this page. See [Page.PageError](/api/class-page.mdx#page-event-page-error) for more details. **Usage** @@ -1575,7 +1575,11 @@ await Page.RequestGCAsync(); Added in: v1.56page.RequestsAsync -Returns up to 100 last network request from this page. See [Page.Request](/api/class-page.mdx#page-event-request) for more details. +Returns up to (currently) 100 last network request from this page. See [Page.Request](/api/class-page.mdx#page-event-request) for more details. + +Returned requests should be accessed immediately, otherwise they might be collected to prevent unbounded memory growth as new requests come in. Once collected, retrieving most information about the request is impossible. + +Note that requests reported through the [Page.Request](/api/class-page.mdx#page-event-request) request are not collected, so there is a trade off between efficient memory usage with [Page.RequestsAsync()](/api/class-page.mdx#page-requests) and the amount of available information reported through [Page.Request](/api/class-page.mdx#page-event-request). **Usage** diff --git a/dotnet/docs/test-runners.mdx b/dotnet/docs/test-runners.mdx index 933482232c6..b2d2c0d9fd6 100644 --- a/dotnet/docs/test-runners.mdx +++ b/dotnet/docs/test-runners.mdx @@ -105,7 +105,7 @@ xUnit v3 uses the [`conservative` parallelism algorithm](https://xunit.net/docs/ -To customize context options, you can override the `ContextOptions` method of your test class derived from `Microsoft.Playwright.MSTest.PageTest` or `Microsoft.Playwright.MSTest.ContextTest`. See the following example: +To customize context options, you can override the `ContextOptions` method of your test class derived from `Microsoft.Playwright.NUnit.PageTest` or `Microsoft.Playwright.NUnit.ContextTest`. See the following example: ```csharp using Microsoft.Playwright.NUnit; diff --git a/java/docs/api/class-browsercontext.mdx b/java/docs/api/class-browsercontext.mdx index a6511761c8c..5963c191cca 100644 --- a/java/docs/api/class-browsercontext.mdx +++ b/java/docs/api/class-browsercontext.mdx @@ -117,28 +117,6 @@ The order of evaluation of multiple scripts installed via [BrowserContext.addIni --- -### backgroundPages {#browser-context-background-pages} - -Added in: v1.11browserContext.backgroundPages - -:::note - -Background pages are only supported on Chromium-based browsers. -::: - -All existing background pages in the context. - -**Usage** - -```java -BrowserContext.backgroundPages(); -``` - -**Returns** -- [List]<[Page]># - ---- - ### browser {#browser-context-browser} Added before v1.9browserContext.browser @@ -1028,34 +1006,6 @@ BrowserContext.tracing() ## Events -### onBackgroundPage(handler) {#browser-context-event-background-page} - -Added in: v1.11browserContext.onBackgroundPage(handler) - -:::note - -Only works with Chromium browser's persistent context. -::: - -Emitted when new background page is created in the context. - -```java -context.onBackgroundPage(backgroundPage -> { - System.out.println(backgroundPage.url()); -}); -``` - -**Usage** - -```java -BrowserContext.onBackgroundPage(handler) -``` - -**Event data** -- [Page] - ---- - ### onClose(handler) {#browser-context-event-close} Added before v1.9browserContext.onClose(handler) @@ -1242,6 +1192,56 @@ BrowserContext.onWebError(handler) **Event data** - [WebError] +--- + +## Deprecated + +### onBackgroundPage(handler) {#browser-context-event-background-page} + +Added in: v1.11browserContext.onBackgroundPage(handler) + +:::warning Deprecated + +Background pages have been removed from Chromium together with Manifest V2 extensions. + +::: + + +This event is not emitted. + +**Usage** + +```java +BrowserContext.onBackgroundPage(handler) +``` + +**Event data** +- [Page] + +--- + +### backgroundPages {#browser-context-background-pages} + +Added in: v1.11browserContext.backgroundPages + +:::warning Deprecated + +Background pages have been removed from Chromium together with Manifest V2 extensions. + +::: + + +Returns an empty list. + +**Usage** + +```java +BrowserContext.backgroundPages(); +``` + +**Returns** +- [List]<[Page]># + [APIRequest]: /api/class-apirequest.mdx "APIRequest" [APIRequestContext]: /api/class-apirequestcontext.mdx "APIRequestContext" diff --git a/java/docs/api/class-page.mdx b/java/docs/api/class-page.mdx index d99a474cce3..c1d1a4d9026 100644 --- a/java/docs/api/class-page.mdx +++ b/java/docs/api/class-page.mdx @@ -303,7 +303,7 @@ Page.close(options); Added in: v1.56page.consoleMessages -Returns up to 200 last console messages from this page. See [Page.onConsoleMessage(handler)](/api/class-page.mdx#page-event-console) for more details. +Returns up to (currently) 200 last console messages from this page. See [Page.onConsoleMessage(handler)](/api/class-page.mdx#page-event-console) for more details. **Usage** @@ -1388,7 +1388,7 @@ Page.opener(); Added in: v1.56page.pageErrors -Returns up to 200 last page errors from this page. See [Page.onPageError(handler)](/api/class-page.mdx#page-event-page-error) for more details. +Returns up to (currently) 200 last page errors from this page. See [Page.onPageError(handler)](/api/class-page.mdx#page-event-page-error) for more details. **Usage** @@ -1632,7 +1632,11 @@ Page.requestGC(); Added in: v1.56page.requests -Returns up to 100 last network request from this page. See [Page.onRequest(handler)](/api/class-page.mdx#page-event-request) for more details. +Returns up to (currently) 100 last network request from this page. See [Page.onRequest(handler)](/api/class-page.mdx#page-event-request) for more details. + +Returned requests should be accessed immediately, otherwise they might be collected to prevent unbounded memory growth as new requests come in. Once collected, retrieving most information about the request is impossible. + +Note that requests reported through the [Page.onRequest(handler)](/api/class-page.mdx#page-event-request) request are not collected, so there is a trade off between efficient memory usage with [Page.requests()](/api/class-page.mdx#page-requests) and the amount of available information reported through [Page.onRequest(handler)](/api/class-page.mdx#page-event-request). **Usage** diff --git a/nodejs/docs/api/class-browsercontext.mdx b/nodejs/docs/api/class-browsercontext.mdx index 9e0ef6e2fe9..fface4605d7 100644 --- a/nodejs/docs/api/class-browsercontext.mdx +++ b/nodejs/docs/api/class-browsercontext.mdx @@ -128,28 +128,6 @@ The order of evaluation of multiple scripts installed via [browserContext.addIni --- -### backgroundPages {#browser-context-background-pages} - -Added in: v1.11browserContext.backgroundPages - -:::note - -Background pages are only supported on Chromium-based browsers. -::: - -All existing background pages in the context. - -**Usage** - -```js -browserContext.backgroundPages(); -``` - -**Returns** -- [Array]<[Page]># - ---- - ### browser {#browser-context-browser} Added before v1.9browserContext.browser @@ -1059,32 +1037,6 @@ browserContext.tracing ## Events -### on('backgroundpage') {#browser-context-event-background-page} - -Added in: v1.11browserContext.on('backgroundpage') - -:::note - -Only works with Chromium browser's persistent context. -::: - -Emitted when new background page is created in the context. - -```js -const backgroundPage = await context.waitForEvent('backgroundpage'); -``` - -**Usage** - -```js -browserContext.on('backgroundpage', data => {}); -``` - -**Event data** -- [Page] - ---- - ### on('close') {#browser-context-event-close} Added before v1.9browserContext.on('close') @@ -1299,6 +1251,54 @@ browserContext.on('weberror', data => {}); ## Deprecated +### on('backgroundpage') {#browser-context-event-background-page} + +Added in: v1.11browserContext.on('backgroundpage') + +:::warning Deprecated + +Background pages have been removed from Chromium together with Manifest V2 extensions. + +::: + + +This event is not emitted. + +**Usage** + +```js +browserContext.on('backgroundpage', data => {}); +``` + +**Event data** +- [Page] + +--- + +### backgroundPages {#browser-context-background-pages} + +Added in: v1.11browserContext.backgroundPages + +:::warning Deprecated + +Background pages have been removed from Chromium together with Manifest V2 extensions. + +::: + + +Returns an empty list. + +**Usage** + +```js +browserContext.backgroundPages(); +``` + +**Returns** +- [Array]<[Page]># + +--- + ### setHTTPCredentials {#browser-context-set-http-credentials} Added before v1.9browserContext.setHTTPCredentials diff --git a/nodejs/docs/api/class-page.mdx b/nodejs/docs/api/class-page.mdx index a4093992703..0279d922582 100644 --- a/nodejs/docs/api/class-page.mdx +++ b/nodejs/docs/api/class-page.mdx @@ -313,7 +313,7 @@ await page.close(options); Added in: v1.56page.consoleMessages -Returns up to 200 last console messages from this page. See [page.on('console')](/api/class-page.mdx#page-event-console) for more details. +Returns up to (currently) 200 last console messages from this page. See [page.on('console')](/api/class-page.mdx#page-event-console) for more details. **Usage** @@ -1324,7 +1324,7 @@ await page.opener(); Added in: v1.56page.pageErrors -Returns up to 200 last page errors from this page. See [page.on('pageerror')](/api/class-page.mdx#page-event-page-error) for more details. +Returns up to (currently) 200 last page errors from this page. See [page.on('pageerror')](/api/class-page.mdx#page-event-page-error) for more details. **Usage** @@ -1602,7 +1602,11 @@ await page.requestGC(); Added in: v1.56page.requests -Returns up to 100 last network request from this page. See [page.on('request')](/api/class-page.mdx#page-event-request) for more details. +Returns up to (currently) 100 last network request from this page. See [page.on('request')](/api/class-page.mdx#page-event-request) for more details. + +Returned requests should be accessed immediately, otherwise they might be collected to prevent unbounded memory growth as new requests come in. Once collected, retrieving most information about the request is impossible. + +Note that requests reported through the [page.on('request')](/api/class-page.mdx#page-event-request) request are not collected, so there is a trade off between efficient memory usage with [page.requests()](/api/class-page.mdx#page-requests) and the amount of available information reported through [page.on('request')](/api/class-page.mdx#page-event-request). **Usage** diff --git a/nodejs/docs/ci.mdx b/nodejs/docs/ci.mdx index 0d8e5185e60..df22cd9b38c 100644 --- a/nodejs/docs/ci.mdx +++ b/nodejs/docs/ci.mdx @@ -102,7 +102,7 @@ jobs: name: 'Playwright Tests' runs-on: ubuntu-latest container: - image: mcr.microsoft.com/playwright:v1.55.0-noble + image: mcr.microsoft.com/playwright:v1.55.1-noble options: --user 1001 steps: - uses: actions/checkout@v4 @@ -336,7 +336,7 @@ trigger: pool: vmImage: ubuntu-latest -container: mcr.microsoft.com/playwright:v1.55.0-noble +container: mcr.microsoft.com/playwright:v1.55.1-noble steps: - task: NodeTool@0 @@ -360,7 +360,7 @@ Running Playwright on CircleCI is very similar to running on GitHub Actions. In executors: pw-noble-development: docker: - - image: mcr.microsoft.com/playwright:v1.55.0-noble + - image: mcr.microsoft.com/playwright:v1.55.1-noble ``` Note: When using the docker agent definition, you are specifying the resource class of where playwright runs to the 'medium' tier [here](https://circleci.com/docs/configuration-reference?#docker-execution-environment). The default behavior of Playwright is to set the number of workers to the detected core count (2 in the case of the medium tier). Overriding the number of workers to greater than this number will cause unnecessary timeouts and failures. @@ -383,7 +383,7 @@ Jenkins supports Docker agents for pipelines. Use the [Playwright Docker image]( ```groovy pipeline { - agent { docker { image 'mcr.microsoft.com/playwright:v1.55.0-noble' } } + agent { docker { image 'mcr.microsoft.com/playwright:v1.55.1-noble' } } stages { stage('e2e-tests') { steps { @@ -400,7 +400,7 @@ pipeline { Bitbucket Pipelines can use public [Docker images as build environments](https://confluence.atlassian.com/bitbucket/use-docker-images-as-build-environments-792298897.html). To run Playwright tests on Bitbucket, use our public Docker image ([see Dockerfile](./docker.mdx)). ```yml -image: mcr.microsoft.com/playwright:v1.55.0-noble +image: mcr.microsoft.com/playwright:v1.55.1-noble ``` ### GitLab CI @@ -413,7 +413,7 @@ stages: tests: stage: test - image: mcr.microsoft.com/playwright:v1.55.0-noble + image: mcr.microsoft.com/playwright:v1.55.1-noble script: ... ``` @@ -428,7 +428,7 @@ stages: tests: stage: test - image: mcr.microsoft.com/playwright:v1.55.0-noble + image: mcr.microsoft.com/playwright:v1.55.1-noble parallel: 7 script: - npm ci @@ -443,7 +443,7 @@ stages: tests: stage: test - image: mcr.microsoft.com/playwright:v1.55.0-noble + image: mcr.microsoft.com/playwright:v1.55.1-noble parallel: matrix: - PROJECT: ['chromium', 'webkit'] @@ -459,7 +459,7 @@ To run Playwright tests on Google Cloud Build, use our public Docker image ([see ```yml steps: -- name: mcr.microsoft.com/playwright:v1.55.0-noble +- name: mcr.microsoft.com/playwright:v1.55.1-noble script: ... env: @@ -477,7 +477,7 @@ type: docker steps: - name: test - image: mcr.microsoft.com/playwright:v1.55.0-noble + image: mcr.microsoft.com/playwright:v1.55.1-noble commands: - npx playwright test ``` diff --git a/nodejs/docs/docker.mdx b/nodejs/docs/docker.mdx index 663ea24f2c4..e79483650a6 100644 --- a/nodejs/docs/docker.mdx +++ b/nodejs/docs/docker.mdx @@ -23,7 +23,7 @@ This Docker image is intended to be used for testing and development purposes on ### Pull the image ```bash -docker pull mcr.microsoft.com/playwright:v1.55.0-noble +docker pull mcr.microsoft.com/playwright:v1.55.1-noble ``` ### Run the image @@ -35,7 +35,7 @@ By default, the Docker image will use the `root` user to run the browsers. This On trusted websites, you can avoid creating a separate user and use root for it since you trust the code which will run on the browsers. ```bash -docker run -it --rm --ipc=host mcr.microsoft.com/playwright:v1.55.0-noble /bin/bash +docker run -it --rm --ipc=host mcr.microsoft.com/playwright:v1.55.1-noble /bin/bash ``` #### Crawling and scraping @@ -43,7 +43,7 @@ docker run -it --rm --ipc=host mcr.microsoft.com/playwright:v1.55.0-noble /bin/b On untrusted websites, it's recommended to use a separate user for launching the browsers in combination with the seccomp profile. Inside the container or if you are using the Docker image as a base image you have to use `adduser` for it. ```bash -docker run -it --rm --ipc=host --user pwuser --security-opt seccomp=seccomp_profile.json mcr.microsoft.com/playwright:v1.55.0-noble /bin/bash +docker run -it --rm --ipc=host --user pwuser --security-opt seccomp=seccomp_profile.json mcr.microsoft.com/playwright:v1.55.1-noble /bin/bash ``` [`seccomp_profile.json`](https://github.com/microsoft/playwright/blob/main/utils/docker/seccomp_profile.json) is needed to run Chromium with sandbox. This is a [default Docker seccomp profile](https://github.com/docker/engine/blob/d0d99b04cf6e00ed3fc27e81fc3d94e7eda70af3/profiles/seccomp/default.json) with extra user namespace cloning permissions: @@ -83,7 +83,7 @@ You can run Playwright Server in Docker while keeping your tests running on the Start the Playwright Server in Docker: ```bash -docker run -p 3000:3000 --rm --init -it --workdir /home/pwuser --user pwuser mcr.microsoft.com/playwright:v1.55.0-noble /bin/sh -c "npx -y playwright@1.55.0 run-server --port 3000 --host 0.0.0.0" +docker run -p 3000:3000 --rm --init -it --workdir /home/pwuser --user pwuser mcr.microsoft.com/playwright:v1.55.1-noble /bin/sh -c "npx -y playwright@1.55.1 run-server --port 3000 --host 0.0.0.0" ``` #### Connecting to the Server @@ -106,7 +106,7 @@ const browser = await playwright['chromium'].connect('ws://127.0.0.1:3000/'); If you need to access local servers from within the Docker container: ```bash -docker run --add-host=hostmachine:host-gateway -p 3000:3000 --rm --init -it --workdir /home/pwuser --user pwuser mcr.microsoft.com/playwright:v1.55.0-noble /bin/sh -c "npx -y playwright@1.55.0 run-server --port 3000 --host 0.0.0.0" +docker run --add-host=hostmachine:host-gateway -p 3000:3000 --rm --init -it --workdir /home/pwuser --user pwuser mcr.microsoft.com/playwright:v1.55.1-noble /bin/sh -c "npx -y playwright@1.55.1 run-server --port 3000 --host 0.0.0.0" ``` This makes `hostmachine` point to the host's localhost. Your tests should use `hostmachine` instead of `localhost` when accessing local servers. @@ -121,9 +121,9 @@ When running tests remotely, ensure the Playwright version in your tests matches See [all available image tags]. We currently publish images with the following tags: -- `:v1.55.0` - Playwright v1.55.0 release docker image based on Ubuntu 24.04 LTS (Noble Numbat). -- `:v1.55.0-noble` - Playwright v1.55.0 release docker image based on Ubuntu 24.04 LTS (Noble Numbat). -- `:v1.55.0-jammy` - Playwright v1.55.0 release docker image based on Ubuntu 22.04 LTS (Jammy Jellyfish). +- `:v1.55.1` - Playwright v1.55.1 release docker image based on Ubuntu 24.04 LTS (Noble Numbat). +- `:v1.55.1-noble` - Playwright v1.55.1 release docker image based on Ubuntu 24.04 LTS (Noble Numbat). +- `:v1.55.1-jammy` - Playwright v1.55.1 release docker image based on Ubuntu 22.04 LTS (Jammy Jellyfish). :::note @@ -147,7 +147,7 @@ To run Playwright inside Docker, you need to have Node.js, [Playwright browsers] ```Dockerfile FROM node:20-bookworm -RUN npx -y playwright@1.55.0 install --with-deps +RUN npx -y playwright@1.55.1 install --with-deps ``` diff --git a/nodejs/docs/test-agents.mdx b/nodejs/docs/test-agents.mdx index ae20dd5af1a..43273d7a7e7 100644 --- a/nodejs/docs/test-agents.mdx +++ b/nodejs/docs/test-agents.mdx @@ -14,18 +14,38 @@ import ProgressiveImage from '@theme/ProgressiveImage'; Playwright’s agentic workflow makes it possible to generate test coverage in three straightforward steps. These steps can be performed independently, manually, or as chained calls in an agentic loop. 1. **Plan**: A planning agent explores the app and produces a test plan in `specs/*.md`. -2. **Generate**: A generating agent transforms the plan into `tests/*.spec.ts` files. It executes actions live to verify selectors and flows, then emits testing code and assertions. +2. **Generate**: A generating agent transforms the plan into `tests/*.spec.ts` files. It executes actions against your site to verify selectors and flows, then emits testing code and assertions. 3. **Heal**: A healing agent executes the test suite and automatically repairs failing tests by applying diffs in place. +### Getting Started + +In order to use Playwright Agents, you must add their definitions to your project using the `init-agents` command. These definitions should be regenerated whenever Playwright is updated. + +You need to run this command for each agentic loop you will be using: + +```bash +# Generate agent files for each agentic loop +# Visual Studio Code +npx playwright init-agents --loop=vscode +# Claude Code +npx playwright init-agents --loop=claude +# opencode +npx playwright init-agents --loop=opencode +``` + +Once the agents have been generated, you can use your AI tool of choice to command these agents to build Playwright Tests. Playwright splits this into three steps with one agent per step: + ## 1. Plan +The planning agent explores your app environment and produces a test plan for one or many scenarios and user flows. + **Input** -* A clear request (e.g., “Generate a plan for guest checkout.”) -* A live entry point (URL) or a seed Playwright test that sets up the environment -* PRD (optional) +* A clear request to the planning agent (e.g., “Generate a plan for guest checkout.”) +* A live app entry point (URL) or a seed Playwright test that sets up the environment necessary to talk to your app +* A Product Requirement Document (PRD) (optional) -**Prompt** +**Example Prompt** ```markdown Generate a test plan for "Guest Checkout" scenario. @@ -33,7 +53,7 @@ Playwright’s agentic workflow makes it possible to generate test coverage in t ``` **Output** -* A Markdown test plan saved to `specs/guest-checkout.md`. The plan is human-readable but precise enough for test generation. +* A Markdown test plan saved to `specs/[scenario name].md`. The plan is human-readable but precise enough for test generation.
@@ -90,7 +110,7 @@ The generating agent uses the Markdown plan to produce executable Playwright tes **Input** * Markdown plan from `specs/` -**Prompt** +**Example Prompt** ```markdown Generate tests for the guest checkout plan under `specs/`. @@ -98,7 +118,7 @@ The generating agent uses the Markdown plan to produce executable Playwright tes **Output** * A test suite under `tests/` -* Tests may include initial errors that can be healed automatically +* Generated tests may include initial errors that can be healed automatically by the healer agent
@@ -162,18 +182,18 @@ When a test fails, the healing agent: **Input** * Failing test name -**Prompt** +**Example Prompt** ```markdown Fix all failing tests for the guest checkout scenario. ``` **Output** -* A passing test, or a skipped test if the functionality is broken +* A passing test, or a skipped test if the healer was unable to ensure correct functionality ## Artifacts and Conventions -Follow a simple, auditable structure: +The static agent definitions and generated files follow a simple, auditable structure: ```bash repo/ @@ -188,7 +208,7 @@ repo/ playwright.config.ts ``` -### Agents definitions +### Agent Definitions Agent definitions are collections of instructions and MCP tools. They are provided by Playwright and should be regenerated whenever Playwright is updated. diff --git a/nodejs/docs/test-cli.mdx b/nodejs/docs/test-cli.mdx index d76a7b48fe8..65a62b630f3 100644 --- a/nodejs/docs/test-cli.mdx +++ b/nodejs/docs/test-cli.mdx @@ -95,7 +95,6 @@ npx playwright test --ui | `--ignore-snapshots` | Ignore screenshot and snapshot expectations. | | `-j ` or `--workers ` | Number of concurrent workers or percentage of logical CPU cores, use 1 to run in a single worker (default: 50%). | | `--last-failed` | Only re-run the failures. | -| `--last-run-file` | Path to the last-run file (default: "test-results/.last-run.json"). This json file is used for the `--last-failed` option. You can also apply a custom filter by providing an array of [testCase.id](/api/class-testcase.mdx#test-case-id) in the `filterTests` property. | | `--list` | Collect all the tests and report them, but do not run. | | `--max-failures ` or `-x` | Stop after the first `N` failures. Passing `-x` stops after the first failure. | | `--no-deps` | Do not run project dependencies. | diff --git a/python/docs/api/class-browsercontext.mdx b/python/docs/api/class-browsercontext.mdx index 177ac6091a2..b718c2b0154 100644 --- a/python/docs/api/class-browsercontext.mdx +++ b/python/docs/api/class-browsercontext.mdx @@ -1332,28 +1332,6 @@ browser_context.wait_for_event(event, **kwargs) ## Properties -### background_pages {#browser-context-background-pages} - -Added in: v1.11browserContext.background_pages - -:::note - -Background pages are only supported on Chromium-based browsers. -::: - -All existing background pages in the context. - -**Usage** - -```python -browser_context.background_pages -``` - -**Returns** -- [List]\[[Page]\]# - ---- - ### browser {#browser-context-browser} Added before v1.9browserContext.browser @@ -1461,52 +1439,6 @@ browser_context.tracing ## Events -### on("backgroundpage") {#browser-context-event-background-page} - -Added in: v1.11browserContext.on("backgroundpage") - -:::note - -Only works with Chromium browser's persistent context. -::: - -Emitted when new background page is created in the context. - - - - -```py -background_page = context.wait_for_event("backgroundpage") -``` - - - - -```py -background_page = await context.wait_for_event("backgroundpage") -``` - - - - -**Usage** - -```python -browser_context.on("backgroundpage", handler) -``` - -**Event data** -- [Page] - ---- - ### on("close") {#browser-context-event-close} Added before v1.9browserContext.on("close") @@ -1765,6 +1697,56 @@ browser_context.on("weberror", handler) **Event data** - [WebError] +--- + +## Deprecated + +### on("backgroundpage") {#browser-context-event-background-page} + +Added in: v1.11browserContext.on("backgroundpage") + +:::warning Deprecated + +Background pages have been removed from Chromium together with Manifest V2 extensions. + +::: + + +This event is not emitted. + +**Usage** + +```python +browser_context.on("backgroundpage", handler) +``` + +**Event data** +- [Page] + +--- + +### background_pages {#browser-context-background-pages} + +Added in: v1.11browserContext.background_pages + +:::warning Deprecated + +Background pages have been removed from Chromium together with Manifest V2 extensions. + +::: + + +Returns an empty list. + +**Usage** + +```python +browser_context.background_pages +``` + +**Returns** +- [List]\[[Page]\]# + [Accessibility]: /api/class-accessibility.mdx "Accessibility" [APIRequest]: /api/class-apirequest.mdx "APIRequest" diff --git a/python/docs/api/class-page.mdx b/python/docs/api/class-page.mdx index 17a21520a82..446174c2159 100644 --- a/python/docs/api/class-page.mdx +++ b/python/docs/api/class-page.mdx @@ -459,7 +459,7 @@ page.close(**kwargs) Added in: v1.56page.console_messages -Returns up to 200 last console messages from this page. See [page.on("console")](/api/class-page.mdx#page-event-console) for more details. +Returns up to (currently) 200 last console messages from this page. See [page.on("console")](/api/class-page.mdx#page-event-console) for more details. **Usage** @@ -2219,7 +2219,7 @@ page.opener() Added in: v1.56page.page_errors -Returns up to 200 last page errors from this page. See [page.on("pageerror")](/api/class-page.mdx#page-event-page-error) for more details. +Returns up to (currently) 200 last page errors from this page. See [page.on("pageerror")](/api/class-page.mdx#page-event-page-error) for more details. **Usage** @@ -2508,7 +2508,11 @@ page.request_gc() Added in: v1.56page.requests -Returns up to 100 last network request from this page. See [page.on("request")](/api/class-page.mdx#page-event-request) for more details. +Returns up to (currently) 100 last network request from this page. See [page.on("request")](/api/class-page.mdx#page-event-request) for more details. + +Returned requests should be accessed immediately, otherwise they might be collected to prevent unbounded memory growth as new requests come in. Once collected, retrieving most information about the request is impossible. + +Note that requests reported through the [page.on("request")](/api/class-page.mdx#page-event-request) request are not collected, so there is a trade off between efficient memory usage with [page.requests()](/api/class-page.mdx#page-requests) and the amount of available information reported through [page.on("request")](/api/class-page.mdx#page-event-request). **Usage** diff --git a/python/docs/test-runners.mdx b/python/docs/test-runners.mdx index 878eb506cf6..93b7dd45b75 100644 --- a/python/docs/test-runners.mdx +++ b/python/docs/test-runners.mdx @@ -69,6 +69,7 @@ def test_my_app_is_working(fixture_name): **Customizing fixture options**: For `browser` and `context` fixtures, use the following fixtures to define custom launch options. - `browser_type_launch_args`: Override launch arguments for [browser_type.launch()](/api/class-browsertype.mdx#browser-type-launch). It should return a Dict. - `browser_context_args`: Override the options for [browser.new_context()](/api/class-browser.mdx#browser-new-context). It should return a Dict. +- `connect_options`: Connect to an existing browser via WebSocket endpoint. It should return a Dict with [browser_type.connect()](/api/class-browsertype.mdx#browser-type-connect) options. Its also possible to override the context options ([browser.new_context()](/api/class-browser.mdx#browser-new-context)) for a single test by using the `browser_context_args` marker: @@ -217,6 +218,18 @@ def browser_context_args(browser_context_args, playwright): Or via the CLI `--device="iPhone 11 Pro"` +### Connect to remote browsers + +```py title="conftest.py" +import pytest + +@pytest.fixture(scope="session") +def connect_options(): + return { + "wsEndpoint": "ws://localhost:8080/ws" + } +``` + ### Using with `unittest.TestCase` See the following example for using it with `unittest.TestCase`. This has a limitation, that only a single browser can be specified and no matrix of multiple browsers gets generated when specifying multiple.