# THIS DOCUMENT CONTAINS THE COMPLETE DOCUMENTATION FOR PLAYWRIGHT NODEJS. # Getting started - VS Code Getting started - VS Code ========================= Introduction[​](#introduction "Direct link to Introduction") ------------------------------------------------------------ The Playwright VS Code extension brings the power of Playwright Test directly into your editor, allowing you to run, debug, and generate tests with a seamless UI-driven experience. This guide will walk you through setting up the extension and using its core features to supercharge your end-to-end testing workflow. Prerequisites[​](#prerequisites "Direct link to Prerequisites") --------------------------------------------------------------- Before you begin, make sure you have the following installed: * [Node.js](https://nodejs.org/) (LTS version recommended) * [Visual Studio Code](https://code.visualstudio.com/) Getting Started[​](#getting-started "Direct link to Getting Started") --------------------------------------------------------------------- ### Installation & Setup[​](#installation--setup "Direct link to Installation & Setup") 1. **Install the Extension**: Open the Extensions view in VS Code (`Ctrl+Shift+X` or `Cmd+Shift+X`) and search for "Playwright". [Install the official extension from Microsoft](https://marketplace.visualstudio.com/items?itemName=ms-playwright.playwright). ![install playwright extension](/assets/images/vscode-extension-ce873e1c0d856b8c255e9de0781eb8d9.png) 1. **Install Playwright**: Once the extension is installed, open the Command Palette (`Ctrl+Shift+P` or `Cmd+Shift+P`) and run the **Test: Install Playwright** command. ![install playwright](/assets/images/install-playwright-f211fc1079a8b3a01bcbd28e711c4eec.png) 3. **Select Browsers**: Choose the browsers you want for your tests (e.g., Chromium, Firefox, WebKit). You can also add a GitHub Actions workflow to run tests in CI. These settings can be changed later in your `playwright.config.ts` file. ![install browsers](/assets/images/install-browsers-f8158381ce036e1299547aed66a4ccf0.png) ### Opening the Testing Sidebar[​](#opening-the-testing-sidebar "Direct link to Opening the Testing Sidebar") Click the **Testing icon** in the VS Code Activity Bar to open the Test Explorer. Here, you'll find your tests, as well as the Playwright sidebar for managing projects, tools, and settings. ![Testing Sidebar](/assets/images/testing-sidebar-25b968f725bc3c175a12a4aa8b662c81.png) Core Features[​](#core-features "Direct link to Core Features") --------------------------------------------------------------- ### Running Your Tests[​](#running-your-tests "Direct link to Running Your Tests") * **Run a Single Test**: Click the green "play" icon next to any test to run it. The play button will change to a green checkmark if the test passes or a red X if the test fails. You'll be able to see how long the test took to run displayed next to the test name. Additionally, the Test Results panel will automatically open at the bottom of VS Code, showing a summary of the test execution including how many tests ran, how many passed, failed, or were skipped, along with the total execution time. ![run a single test](/assets/images/run-single-test-a2c8b8cee4b02a198e11fcc0db4503a8.png) * **Run All Tests**: You can run all tests at different levels. Click the play icon next to a specific test file to run all tests within that file, or click the play icon at the very top of the Test Explorer to run all tests across your entire project. ![run all tests](/assets/images/run-all-tests-e16ffc6a8477c16b38b84dea676d671b.png) * **Run on Multiple Browsers**: In the Playwright sidebar, check the boxes for the projects (browsers) you want to test against. Projects in Playwright represent different browser configurations - each project typically corresponds to a specific browser (like Chromium, Firefox, or WebKit) with its own settings such as viewport size, device emulation, or other browser-specific options. When you run a test, it will execute across all selected projects, allowing you to verify your application works consistently across different browsers and configurations. ![Selecting projects to run tests on](/assets/images/select-projects-a66b52a5cc75100faef51e14e495d460.png) * **Show Browser**: To watch your tests execute in a live browser window, enable the **Show Browser** option in the sidebar. Disable it to run in headless mode (where tests run in the background without opening a visible browser window). ![show browsers while running tests](/assets/images/show-browser-b091435ade8f511a64a9f75c54b52f43.png) ### Debugging Your Tests[​](#debugging-your-tests "Direct link to Debugging Your Tests") The VS Code extension provides powerful debugging tools to help you identify and fix issues in your tests. You can set breakpoints, inspect variables, view detailed error messages, get AI-powered suggestions to resolve test failures, and use the comprehensive trace viewer to analyze test execution step-by-step. * **Using Breakpoints**: Set a breakpoint by clicking in the gutter next to a line number. Right-click the test and select **Debug Test**. The test will pause at your breakpoint, allowing you to inspect variables and step through the code. ![setting debug mode](/assets/images/debug-mode-e145cba936d960900fc79b646016a9ba.png) * **Live Debugging**: With **Show Browsers** enabled, click on a locator in your code. Playwright will highlight the corresponding element in the browser, making it easy to verify locators. ![live debugging in vs code](/assets/images/live-debugging-73579e1b53e40d1e0169fd2254e4336a.png) * **Viewing Error Messages**: If a test fails, the extension displays detailed error messages, including the expected vs. received values and a full call log, directly in the editor. ![error messaging in vs code](/assets/images/error-messaging-74058e7f1bc8b8f8b477b726fa623493.png) * **Fix with AI**: When a test fails, click the sparkle icon next to the error to get an AI-powered fix suggestion from Copilot. Copilot analyzes the error and suggests a code change to resolve the issue. ![fix with ai in vs code](/assets/images/fix-with-ai-011728a352c48c0083ac472fe739815d.png) * **Debugging with Trace Viewer**: For comprehensive debugging, enable the **Show Trace Viewer** option in the Playwright sidebar. When your test finishes, a detailed trace will automatically open, providing you with a complete timeline of your test execution. The trace viewer is particularly useful for: * **Step-by-step analysis**: Navigate through each action your test performed with precise timestamps * **DOM inspection**: View DOM snapshots at any point during test execution to see exactly what the page looked like * **Network monitoring**: Examine all network requests and responses that occurred during the test * **Console logs**: Access all console messages and errors from the browser * **Source mapping**: Jump directly to the source code that executed each action * **Visual debugging**: See screenshots and understand what the user would have seen at each step The trace viewer is especially valuable when debugging flaky tests or understanding complex user interactions. ![trace viewer debugging](/assets/images/trace-viewer-debug-1386da3466791b55394091f252ec2ca9.png) To learn more, see our [Trace Viewer guide](/docs/trace-viewer). ### Generating Tests with CodeGen[​](#generating-tests-with-codegen "Direct link to Generating Tests with CodeGen") CodeGen is Playwright's powerful test generation tool that automatically creates test code by recording your interactions with a web page. Instead of writing tests from scratch, you can simply navigate through your application while CodeGen captures your actions and converts them into reliable test code with proper locators and assertions. * **Record a New Test**: Click **Record new** in the sidebar. A browser window will open. As you interact with the page, Playwright will automatically generate the test code. You can also generate assertions from the recording toolbar. ![record a new test](/assets/images/record-new-test-cafcc94d48bf8ee82af0bc4e90a100ef.png) * **Record at Cursor**: Place your cursor inside an existing test and click **Record at cursor** to add new actions at that specific point. ![record at cursor](/assets/images/record-at-cursor-cc902be640e0c7789eee76efa37fbb53.png) * **Pick a Locator**: Use the **Pick locator** tool to click on any element in the opened browser. Playwright will determine the best locator and copy it to your clipboard, ready to be pasted into your code. ![pick locators](/assets/images/pick-locator-21752d14dc07a83f5fb1bd67b6c0e0c0.png) To learn more, see our [CodeGen guide](/docs/codegen). Advanced Features[​](#advanced-features "Direct link to Advanced Features") --------------------------------------------------------------------------- ### Project Dependencies[​](#project-dependencies "Direct link to Project Dependencies") Use [project dependencies](/docs/test-projects) to define setup tests that run before other tests. For example, you can create a login test that runs first, then reuse that authenticated state across multiple tests without having to log in again for each test. In VS Code, you can see these setup tests in the Test Explorer and run them independently when needed. ![setup tests in vscode](/assets/images/setup-tests-8c128d60e165d9cbf13e0bdd3eb5c411.png) To learn more, see our [Project Dependencies guide](/docs/test-projects). ### Global Setup[​](#global-setup "Direct link to Global Setup") For tasks that need to run only once before all tests (like seeding a database), use **Global Setup**. You can trigger the global setup and teardown manually from the Playwright sidebar. ![running global setup](/assets/images/global-setup-c169662b46ac06131aa560fdf11e4deb.png) ### Multiple Configurations[​](#multiple-configurations "Direct link to Multiple Configurations") If you have multiple `playwright.config.ts` files, you can switch between them using the gear icon in the Playwright sidebar. This allows you to easily work with different test suites or environments. ![Selecting a configuration file](/assets/images/selecting-configuration-8f3a095d5f89449532d3cc0276c29ba7.png) Quick Reference[​](#quick-reference "Direct link to Quick Reference") --------------------------------------------------------------------- Action How to do it in VS Code **Install Playwright** Command Palette → `Test: Install Playwright` **Run a Test** Click the "play" icon next to the test **Debug a Test** Set a breakpoint, right-click the test → `Debug Test` **Show Live Browser** Enable `Show Browsers` in the Playwright sidebar **Record a New Test** Click `Record new` in the Playwright sidebar **Pick a Locator** Click `Pick locator` in the Playwright sidebar **View Test Trace** Enable `Show Trace Viewer` in the Playwright sidebar What's Next[​](#whats-next "Direct link to What's Next") -------------------------------------------------------- * [Write tests using web-first assertions, page fixtures, and locators](/docs/writing-tests) * [Run your tests on CI](/docs/ci-intro) * [Learn more about the Trace Viewer](/docs/trace-viewer) # Release notes Release notes ============= Version 1.56[​](#version-156 "Direct link to Version 1.56") ----------------------------------------------------------- ### Playwright Test Agents[​](#playwright-test-agents "Direct link to Playwright Test Agents") Introducing Playwright Test Agents, three custom agent definitions designed to guide LLMs through the core process of building a Playwright test: * **🎭 planner** explores the app and produces a Markdown test plan * **🎭 generator** transforms the Markdown plan into the Playwright Test files * **🎭 healer** executes the test suite and automatically repairs failing tests Run `npx playwright init-agents` with your client of choice to generate the latest agent definitions: # Generate agent files for each agentic loop# Visual Studio Codenpx playwright init-agents --loop=vscode# Claude Codenpx playwright init-agents --loop=claude# opencodenpx playwright init-agents --loop=opencode [Learn more about Playwright Test Agents](/docs/test-agents) ### New APIs[​](#new-apis "Direct link to New APIs") * New methods [page.consoleMessages()](/docs/api/class-page#page-console-messages) and [page.pageErrors()](/docs/api/class-page#page-page-errors) for retrieving the most recent console messages from the page * New method [page.requests()](/docs/api/class-page#page-requests) for retrieving the most recent network requests from the page * Added [`--test-list` and `--test-list-invert`](/docs/test-cli#test-list) to allow manual specification of specific tests from a file ### UI Mode and HTML Reporter[​](#ui-mode-and-html-reporter "Direct link to UI Mode and HTML Reporter") * Added option to `'html'` reporter to disable the "Copy prompt" button * Added option to `'html'` reporter and UI Mode to merge files, collapsing test and describe blocks into a single unified list * Added option to UI Mode mirroring the `--update-snapshots` options * Added option to UI Mode to run only a single worker at a time ### Breaking Changes[​](#breaking-changes "Direct link to Breaking Changes") * Event [browserContext.on('backgroundpage')](/docs/api/class-browsercontext#browser-context-event-background-page) has been deprecated and will not be emitted. Method [browserContext.backgroundPages()](/docs/api/class-browsercontext#browser-context-background-pages) will return an empty list ### Miscellaneous[​](#miscellaneous "Direct link to Miscellaneous") * Aria snapshots render and compare `input` `placeholder` * Added environment variable `PLAYWRIGHT_TEST` to Playwright worker processes to allow discriminating on testing status ### Browser Versions[​](#browser-versions "Direct link to Browser Versions") * Chromium 141.0.7390.37 * Mozilla Firefox 142.0.1 * WebKit 26.0 Version 1.55[​](#version-155 "Direct link to Version 1.55") ----------------------------------------------------------- ### New APIs[​](#new-apis-1 "Direct link to New APIs") * New Property [testStepInfo.titlePath](/docs/api/class-teststepinfo#test-step-info-title-path) Returns the full title path starting from the test file, including test and step titles. ### Codegen[​](#codegen "Direct link to Codegen") * Automatic `toBeVisible()` assertions: Codegen can now generate automatic `toBeVisible()` assertions for common UI interactions. This feature can be enabled in the Codegen settings UI. ### Breaking Changes[​](#breaking-changes-1 "Direct link to Breaking Changes") * ⚠️ Dropped support for Chromium extension manifest v2. ### Miscellaneous[​](#miscellaneous-1 "Direct link to Miscellaneous") * Added support for Debian 13 "Trixie". ### Browser Versions[​](#browser-versions-1 "Direct link to Browser Versions") * Chromium 140.0.7339.16 * Mozilla Firefox 141.0 * WebKit 26.0 This version was also tested against the following stable channels: * Google Chrome 139 * Microsoft Edge 139 Version 1.54[​](#version-154 "Direct link to Version 1.54") ----------------------------------------------------------- ### Highlights[​](#highlights "Direct link to Highlights") * New cookie property `partitionKey` in [browserContext.cookies()](/docs/api/class-browsercontext#browser-context-cookies) and [browserContext.addCookies()](/docs/api/class-browsercontext#browser-context-add-cookies). This property allows to save and restore partitioned cookies. See [CHIPS MDN article](https://developer.mozilla.org/en-US/docs/Web/Privacy/Guides/Privacy_sandbox/Partitioned_cookies) for more information. Note that browsers have different support and defaults for cookie partitioning. * New option `noSnippets` to disable code snippets in the html report. import { defineConfig } from '@playwright/test';export default defineConfig({ reporter: [['html', { noSnippets: true }]]}); * New property `location` in test annotations, for example in [testResult.annotations](/docs/api/class-testresult#test-result-annotations) and [testInfo.annotations](/docs/api/class-testinfo#test-info-annotations). It shows where the annotation like `test.skip` or `test.fixme` was added. ### Command Line[​](#command-line "Direct link to Command Line") * New option `--user-data-dir` in multiple commands. You can specify the same user data dir to reuse browsing state, like authentication, between sessions. npx playwright codegen --user-data-dir=./user-data * Option `-gv` has been removed from the `npx playwright test` command. Use `--grep-invert` instead. * `npx playwright open` does not open the test recorder anymore. Use `npx playwright codegen` instead. ### Miscellaneous[​](#miscellaneous-2 "Direct link to Miscellaneous") * Support for Node.js 16 has been removed. * Support for Node.js 18 has been deprecated, and will be removed in the future. ### Browser Versions[​](#browser-versions-2 "Direct link to Browser Versions") * Chromium 139.0.7258.5 * Mozilla Firefox 140.0.2 * WebKit 26.0 This version was also tested against the following stable channels: * Google Chrome 140 * Microsoft Edge 140 Version 1.53[​](#version-153 "Direct link to Version 1.53") ----------------------------------------------------------- ### Trace Viewer and HTML Reporter Updates[​](#trace-viewer-and-html-reporter-updates "Direct link to Trace Viewer and HTML Reporter Updates") * New Steps in Trace Viewer and HTML reporter: ![New Trace Viewer Steps](https://github.com/user-attachments/assets/1963ff7d-4070-41be-a79b-4333176921a2) * New option in `'html'` reporter to set the title of a specific test run: import { defineConfig } from '@playwright/test';export default defineConfig({ reporter: [['html', { title: 'Custom test run #1028' }]]}); ### Miscellaneous[​](#miscellaneous-3 "Direct link to Miscellaneous") * New option [kind](/docs/api/class-testinfo#test-info-snapshot-path-option-kind) in [testInfo.snapshotPath()](/docs/api/class-testinfo#test-info-snapshot-path) controls which snapshot path template is used. * New method [locator.describe()](/docs/api/class-locator#locator-describe) to describe a locator. Used for trace viewer and reports. const button = page.getByTestId('btn-sub').describe('Subscribe button');await button.click(); * `npx playwright install --list` will now list all installed browsers, versions and locations. ### Browser Versions[​](#browser-versions-3 "Direct link to Browser Versions") * Chromium 138.0.7204.4 * Mozilla Firefox 139.0 * WebKit 18.5 This version was also tested against the following stable channels: * Google Chrome 137 * Microsoft Edge 137 Version 1.52[​](#version-152 "Direct link to Version 1.52") ----------------------------------------------------------- ### Highlights[​](#highlights-1 "Direct link to Highlights") * New method [expect(locator).toContainClass()](/docs/api/class-locatorassertions#locator-assertions-to-contain-class) to ergonomically assert individual class names on the element. await expect(page.getByRole('listitem', { name: 'Ship v1.52' })).toContainClass('done'); * [Aria Snapshots](/docs/aria-snapshots) got two new properties: [`/children`](/docs/aria-snapshots#strict-matching) for strict matching and `/url` for links. await expect(locator).toMatchAriaSnapshot(` - list - /children: equal - listitem: Feature A - listitem: - link "Feature B": - /url: "https://playwright.dev"`); ### Test Runner[​](#test-runner "Direct link to Test Runner") * New property [testProject.workers](/docs/api/class-testproject#test-project-workers) allows to specify the number of concurrent worker processes to use for a test project. The global limit of property [testConfig.workers](/docs/api/class-testconfig#test-config-workers) still applies. * New [testConfig.failOnFlakyTests](/docs/api/class-testconfig#test-config-fail-on-flaky-tests) option to fail the test run if any flaky tests are detected, similarly to `--fail-on-flaky-tests`. This is useful for CI/CD environments where you want to ensure that all tests are stable before deploying. * New property [testResult.annotations](/docs/api/class-testresult#test-result-annotations) contains annotations for each test retry. ### Miscellaneous[​](#miscellaneous-4 "Direct link to Miscellaneous") * New option [maxRedirects](/docs/api/class-apirequest#api-request-new-context-option-max-redirects) in [apiRequest.newContext()](/docs/api/class-apirequest#api-request-new-context) to control the maximum number of redirects. * HTML reporter now supports _NOT filtering_ via `!@my-tag` or `!my-file.spec.ts` or `!p:my-project`. ### Breaking Changes[​](#breaking-changes-2 "Direct link to Breaking Changes") * Glob URL patterns in methods like [page.route()](/docs/api/class-page#page-route) do not support `?` and `[]` anymore. We recommend using regular expressions instead. * Method [route.continue()](/docs/api/class-route#route-continue) does not allow to override the `Cookie` header anymore. If a `Cookie` header is provided, it will be ignored, and the cookie will be loaded from the browser's cookie store. To set custom cookies, use [browserContext.addCookies()](/docs/api/class-browsercontext#browser-context-add-cookies). * macOS 13 is now deprecated and will no longer receive WebKit updates. Please upgrade to a more recent macOS version to continue benefiting from the latest WebKit improvements. ### Browser Versions[​](#browser-versions-4 "Direct link to Browser Versions") * Chromium 136.0.7103.25 * Mozilla Firefox 137.0 * WebKit 18.4 This version was also tested against the following stable channels: * Google Chrome 135 * Microsoft Edge 135 Version 1.51[​](#version-151 "Direct link to Version 1.51") ----------------------------------------------------------- ### StorageState for indexedDB[​](#storagestate-for-indexeddb "Direct link to StorageState for indexedDB") * New option [indexedDB](/docs/api/class-browsercontext#browser-context-storage-state-option-indexed-db) for [browserContext.storageState()](/docs/api/class-browsercontext#browser-context-storage-state) allows to save and restore IndexedDB contents. Useful when your application uses [IndexedDB API](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API) to store authentication tokens, like Firebase Authentication. Here is an example following the [authentication guide](/docs/auth#basic-shared-account-in-all-tests): tests/auth.setup.ts import { test as setup, expect } from '@playwright/test';import path from 'path';const authFile = path.join(__dirname, '../playwright/.auth/user.json');setup('authenticate', async ({ page }) => { await page.goto('/'); // ... perform authentication steps ... // make sure to save indexedDB await page.context().storageState({ path: authFile, indexedDB: true });}); ### Copy as prompt[​](#copy-as-prompt "Direct link to Copy as prompt") New "Copy prompt" button on errors in the HTML report, trace viewer and UI mode. Click to copy a pre-filled LLM prompt that contains the error message and useful context for fixing the error. ![Copy prompt](https://github.com/user-attachments/assets/f3654407-dd6d-4240-9845-0d96df2bf30a) ### Filter visible elements[​](#filter-visible-elements "Direct link to Filter visible elements") New option [visible](/docs/api/class-locator#locator-filter-option-visible) for [locator.filter()](/docs/api/class-locator#locator-filter) allows matching only visible elements. example.spec.ts test('some test', async ({ page }) => { // Ignore invisible todo items. const todoItems = page.getByTestId('todo-item').filter({ visible: true }); // Check there are exactly 3 visible ones. await expect(todoItems).toHaveCount(3);}); ### Git information in HTML report[​](#git-information-in-html-report "Direct link to Git information in HTML report") Set option [testConfig.captureGitInfo](/docs/api/class-testconfig#test-config-capture-git-info) to capture git information into [testConfig.metadata](/docs/api/class-testconfig#test-config-metadata). playwright.config.ts import { defineConfig } from '@playwright/test';export default defineConfig({ captureGitInfo: { commit: true, diff: true }}); HTML report will show this information when available: ![Git information in the report](https://github.com/user-attachments/assets/f5b3f6f4-aa08-4a24-816c-7edf33ef0c37) ### Test Step improvements[​](#test-step-improvements "Direct link to Test Step improvements") A new [TestStepInfo](/docs/api/class-teststepinfo "TestStepInfo") object is now available in test steps. You can add step attachments or skip the step under some conditions. test('some test', async ({ page, isMobile }) => { // Note the new "step" argument: await test.step('here is my step', async step => { step.skip(isMobile, 'not relevant on mobile layouts'); // ... await step.attach('my attachment', { body: 'some text' }); // ... });}); ### Miscellaneous[​](#miscellaneous-5 "Direct link to Miscellaneous") * New option `contrast` for methods [page.emulateMedia()](/docs/api/class-page#page-emulate-media) and [browser.newContext()](/docs/api/class-browser#browser-new-context) allows to emulate the `prefers-contrast` media feature. * New option [failOnStatusCode](/docs/api/class-apirequest#api-request-new-context-option-fail-on-status-code) makes all fetch requests made through the [APIRequestContext](/docs/api/class-apirequestcontext "APIRequestContext") throw on response codes other than 2xx and 3xx. * Assertion [expect(page).toHaveURL()](/docs/api/class-pageassertions#page-assertions-to-have-url) now supports a predicate. ### Browser Versions[​](#browser-versions-5 "Direct link to Browser Versions") * Chromium 134.0.6998.35 * Mozilla Firefox 135.0 * WebKit 18.4 This version was also tested against the following stable channels: * Google Chrome 133 * Microsoft Edge 133 Version 1.50[​](#version-150 "Direct link to Version 1.50") ----------------------------------------------------------- ### Test runner[​](#test-runner-1 "Direct link to Test runner") * New option [timeout](/docs/api/class-test#test-step-option-timeout) allows specifying a maximum run time for an individual test step. A timed-out step will fail the execution of the test. test('some test', async ({ page }) => { await test.step('a step', async () => { // This step can time out separately from the test }, { timeout: 1000 });}); * New method [test.step.skip()](/docs/api/class-test#test-step-skip) to disable execution of a test step. test('some test', async ({ page }) => { await test.step('before running step', async () => { // Normal step }); await test.step.skip('not yet ready', async () => { // This step is skipped }); await test.step('after running step', async () => { // This step still runs even though the previous one was skipped });}); * Expanded [expect(locator).toMatchAriaSnapshot()](/docs/api/class-locatorassertions#locator-assertions-to-match-aria-snapshot-2) to allow storing of aria snapshots in separate YAML files. * Added method [expect(locator).toHaveAccessibleErrorMessage()](/docs/api/class-locatorassertions#locator-assertions-to-have-accessible-error-message) to assert the Locator points to an element with a given [aria errormessage](https://w3c.github.io/aria/#aria-errormessage). * Option [testConfig.updateSnapshots](/docs/api/class-testconfig#test-config-update-snapshots) added the configuration enum `changed`. `changed` updates only the snapshots that have changed, whereas `all` now updates all snapshots, regardless of whether there are any differences. * New option [testConfig.updateSourceMethod](/docs/api/class-testconfig#test-config-update-source-method) defines the way source code is updated when [testConfig.updateSnapshots](/docs/api/class-testconfig#test-config-update-snapshots) is configured. Added `overwrite` and `3-way` modes that write the changes into source code, on top of existing `patch` mode that creates a patch file. npx playwright test --update-snapshots=changed --update-source-method=3way * Option [testConfig.webServer](/docs/api/class-testconfig#test-config-web-server) added a `gracefulShutdown` field for specifying a process kill signal other than the default `SIGKILL`. * Exposed [testStep.attachments](/docs/api/class-teststep#test-step-attachments) from the reporter API to allow retrieval of all attachments created by that step. * New option `pathTemplate` for `toHaveScreenshot` and `toMatchAriaSnapshot` assertions in the [testConfig.expect](/docs/api/class-testconfig#test-config-expect) configuration. ### UI updates[​](#ui-updates "Direct link to UI updates") * Updated default HTML reporter to improve display of attachments. * New button in Codegen for picking elements to produce aria snapshots. * Additional details (such as keys pressed) are now displayed alongside action API calls in traces. * Display of `canvas` content in traces is error-prone. Display is now disabled by default, and can be enabled via the `Display canvas content` UI setting. * `Call` and `Network` panels now display additional time information. ### Breaking[​](#breaking "Direct link to Breaking") * [expect(locator).toBeEditable()](/docs/api/class-locatorassertions#locator-assertions-to-be-editable) and [locator.isEditable()](/docs/api/class-locator#locator-is-editable) now throw if the target element is not ``, `` elements. await page.getByLabel('Upload directory').setInputFiles(path.join(__dirname, 'mydir')); * Multiple methods like [locator.click()](/docs/api/class-locator#locator-click) or [locator.press()](/docs/api/class-locator#locator-press) now support a `ControlOrMeta` modifier key. This key maps to `Meta` on macOS and maps to `Control` on Windows and Linux. // Press the common keyboard shortcut Control+S or Meta+S to trigger a "Save" operation.await page.keyboard.press('ControlOrMeta+S'); * New property `httpCredentials.send` in [apiRequest.newContext()](/docs/api/class-apirequest#api-request-new-context) that allows to either always send the `Authorization` header or only send it in response to `401 Unauthorized`. * New option `reason` in [apiRequestContext.dispose()](/docs/api/class-apirequestcontext#api-request-context-dispose) that will be included in the error message of ongoing operations interrupted by the context disposal. * New option `host` in [browserType.launchServer()](/docs/api/class-browsertype#browser-type-launch-server) allows to accept websocket connections on a specific address instead of unspecified `0.0.0.0`. * Playwright now supports Chromium, Firefox and WebKit on Ubuntu 24.04. * v1.45 is the last release to receive WebKit update for macOS 12 Monterey. Please update macOS to keep using the latest WebKit. ### Browser Versions[​](#browser-versions-11 "Direct link to Browser Versions") * Chromium 127.0.6533.5 * Mozilla Firefox 127.0 * WebKit 17.4 This version was also tested against the following stable channels: * Google Chrome 126 * Microsoft Edge 126 Version 1.44[​](#version-144 "Direct link to Version 1.44") ----------------------------------------------------------- ### New APIs[​](#new-apis-2 "Direct link to New APIs") **Accessibility assertions** * [expect(locator).toHaveAccessibleName()](/docs/api/class-locatorassertions#locator-assertions-to-have-accessible-name) checks if the element has the specified accessible name: const locator = page.getByRole('button');await expect(locator).toHaveAccessibleName('Submit'); * [expect(locator).toHaveAccessibleDescription()](/docs/api/class-locatorassertions#locator-assertions-to-have-accessible-description) checks if the element has the specified accessible description: const locator = page.getByRole('button');await expect(locator).toHaveAccessibleDescription('Upload a photo'); * [expect(locator).toHaveRole()](/docs/api/class-locatorassertions#locator-assertions-to-have-role) checks if the element has the specified ARIA role: const locator = page.getByTestId('save-button');await expect(locator).toHaveRole('button'); **Locator handler** * After executing the handler added with [page.addLocatorHandler()](/docs/api/class-page#page-add-locator-handler), Playwright will now wait until the overlay that triggered the handler is not visible anymore. You can opt-out of this behavior with the new `noWaitAfter` option. * You can use new `times` option in [page.addLocatorHandler()](/docs/api/class-page#page-add-locator-handler) to specify maximum number of times the handler should be run. * The handler in [page.addLocatorHandler()](/docs/api/class-page#page-add-locator-handler) now accepts the locator as argument. * New [page.removeLocatorHandler()](/docs/api/class-page#page-remove-locator-handler) method for removing previously added locator handlers. const locator = page.getByText('This interstitial covers the button');await page.addLocatorHandler(locator, async overlay => { await overlay.locator('#close').click();}, { times: 3, noWaitAfter: true });// Run your tests that can be interrupted by the overlay.// ...await page.removeLocatorHandler(locator); **Miscellaneous options** * [`multipart`](/docs/api/class-apirequestcontext#api-request-context-fetch-option-multipart) option in `apiRequestContext.fetch()` now accepts [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData) and supports repeating fields with the same name. const formData = new FormData();formData.append('file', new File(['let x = 2024;'], 'f1.js', { type: 'text/javascript' }));formData.append('file', new File(['hello'], 'f2.txt', { type: 'text/plain' }));context.request.post('https://example.com/uploadFiles', { multipart: formData}); * `expect(callback).toPass({ intervals })` can now be configured by `expect.toPass.intervals` option globally in [testConfig.expect](/docs/api/class-testconfig#test-config-expect) or per project in [testProject.expect](/docs/api/class-testproject#test-project-expect). * `expect(page).toHaveURL(url)` now supports `ignoreCase` [option](/docs/api/class-pageassertions#page-assertions-to-have-url-option-ignore-case). * [testProject.ignoreSnapshots](/docs/api/class-testproject#test-project-ignore-snapshots) allows to configure per project whether to skip screenshot expectations. **Reporter API** * New method [suite.entries()](/docs/api/class-suite#suite-entries) returns child test suites and test cases in their declaration order. [suite.type](/docs/api/class-suite#suite-type) and [testCase.type](/docs/api/class-testcase#test-case-type) can be used to tell apart test cases and suites in the list. * [Blob](/docs/test-reporters#blob-reporter) reporter now allows overriding report file path with a single option `outputFile`. The same option can also be specified as `PLAYWRIGHT_BLOB_OUTPUT_FILE` environment variable that might be more convenient on CI/CD. * [JUnit](/docs/test-reporters#junit-reporter) reporter now supports `includeProjectInTestName` option. **Command line** * `--last-failed` CLI option to for running only tests that failed in the previous run. First run all tests: $ npx playwright testRunning 103 tests using 5 workers...2 failed [chromium] › my-test.spec.ts:8:5 › two ───────────────────────────────────────────────────────── [chromium] › my-test.spec.ts:13:5 › three ──────────────────────────────────────────────────────101 passed (30.0s) Now fix the failing tests and run Playwright again with `--last-failed` option: $ npx playwright test --last-failedRunning 2 tests using 2 workers 2 passed (1.2s) ### Browser Versions[​](#browser-versions-12 "Direct link to Browser Versions") * Chromium 125.0.6422.14 * Mozilla Firefox 125.0.1 * WebKit 17.4 This version was also tested against the following stable channels: * Google Chrome 124 * Microsoft Edge 124 Version 1.43[​](#version-143 "Direct link to Version 1.43") ----------------------------------------------------------- ### New APIs[​](#new-apis-3 "Direct link to New APIs") * Method [browserContext.clearCookies()](/docs/api/class-browsercontext#browser-context-clear-cookies) now supports filters to remove only some cookies. // Clear all cookies.await context.clearCookies();// New: clear cookies with a particular name.await context.clearCookies({ name: 'session-id' });// New: clear cookies for a particular domain.await context.clearCookies({ domain: 'my-origin.com' }); * New mode `retain-on-first-failure` for [testOptions.trace](/docs/api/class-testoptions#test-options-trace). In this mode, trace is recorded for the first run of each test, but not for retires. When test run fails, the trace file is retained, otherwise it is removed. import { defineConfig } from '@playwright/test';export default defineConfig({ use: { trace: 'retain-on-first-failure', },}); * New property [testInfo.tags](/docs/api/class-testinfo#test-info-tags) exposes test tags during test execution. test('example', async ({ page }) => { console.log(test.info().tags);}); * New method [locator.contentFrame()](/docs/api/class-locator#locator-content-frame) converts a [Locator](/docs/api/class-locator "Locator") object to a [FrameLocator](/docs/api/class-framelocator "FrameLocator"). This can be useful when you have a [Locator](/docs/api/class-locator "Locator") object obtained somewhere, and later on would like to interact with the content inside the frame. const locator = page.locator('iframe[name="embedded"]');// ...const frameLocator = locator.contentFrame();await frameLocator.getByRole('button').click(); * New method [frameLocator.owner()](/docs/api/class-framelocator#frame-locator-owner) converts a [FrameLocator](/docs/api/class-framelocator "FrameLocator") object to a [Locator](/docs/api/class-locator "Locator"). This can be useful when you have a [FrameLocator](/docs/api/class-framelocator "FrameLocator") object obtained somewhere, and later on would like to interact with the `iframe` element. const frameLocator = page.frameLocator('iframe[name="embedded"]');// ...const locator = frameLocator.owner();await expect(locator).toBeVisible(); ### UI Mode Updates[​](#ui-mode-updates "Direct link to UI Mode Updates") ![Playwright UI Mode](https://github.com/microsoft/playwright/assets/9881434/61ca7cfc-eb7a-4305-8b62-b6c9f098f300) * See tags in the test list. * Filter by tags by typing `@fast` or clicking on the tag itself. * New shortcuts: * "F5" to run tests. * "Shift F5" to stop running tests. * "Ctrl \`" to toggle test output. ### Browser Versions[​](#browser-versions-13 "Direct link to Browser Versions") * Chromium 124.0.6367.8 * Mozilla Firefox 124.0 * WebKit 17.4 This version was also tested against the following stable channels: * Google Chrome 123 * Microsoft Edge 123 Version 1.42[​](#version-142 "Direct link to Version 1.42") ----------------------------------------------------------- ### New APIs[​](#new-apis-4 "Direct link to New APIs") * New method [page.addLocatorHandler()](/docs/api/class-page#page-add-locator-handler) registers a callback that will be invoked when specified element becomes visible and may block Playwright actions. The callback can get rid of the overlay. Here is an example that closes a cookie dialog when it appears: // Setup the handler.await page.addLocatorHandler( page.getByRole('heading', { name: 'Hej! You are in control of your cookies.' }), async () => { await page.getByRole('button', { name: 'Accept all' }).click(); });// Write the test as usual.await page.goto('https://www.ikea.com/');await page.getByRole('link', { name: 'Collection of blue and white' }).click();await expect(page.getByRole('heading', { name: 'Light and easy' })).toBeVisible(); * `expect(callback).toPass()` timeout can now be configured by `expect.toPass.timeout` option [globally](/docs/api/class-testconfig#test-config-expect) or in [project config](/docs/api/class-testproject#test-project-expect) * [electronApplication.on('console')](/docs/api/class-electronapplication#electron-application-event-console) event is emitted when Electron main process calls console API methods. electronApp.on('console', async msg => { const values = []; for (const arg of msg.args()) values.push(await arg.jsonValue()); console.log(...values);});await electronApp.evaluate(() => console.log('hello', 5, { foo: 'bar' })); * [New syntax](/docs/test-annotations#tag-tests) for adding tags to the tests (@-tokens in the test title are still supported): test('test customer login', { tag: ['@fast', '@login'],}, async ({ page }) => { // ...}); Use `--grep` command line option to run only tests with certain tags. npx playwright test --grep @fast * `--project` command line [flag](/docs/test-cli#all-options) now supports '\*' wildcard: npx playwright test --project='*mobile*' * [New syntax](/docs/test-annotations#annotate-tests) for test annotations: test('test full report', { annotation: [ { type: 'issue', description: 'https://github.com/microsoft/playwright/issues/23180' }, { type: 'docs', description: 'https://playwright.dev/docs/test-annotations#tag-tests' }, ],}, async ({ page }) => { // ...}); * [page.pdf()](/docs/api/class-page#page-pdf) accepts two new options [`tagged`](/docs/api/class-page#page-pdf-option-tagged) and [`outline`](/docs/api/class-page#page-pdf-option-outline). ### Announcements[​](#announcements "Direct link to Announcements") * ⚠️ Ubuntu 18 is not supported anymore. ### Browser Versions[​](#browser-versions-14 "Direct link to Browser Versions") * Chromium 123.0.6312.4 * Mozilla Firefox 123.0 * WebKit 17.4 This version was also tested against the following stable channels: * Google Chrome 122 * Microsoft Edge 123 Version 1.41[​](#version-141 "Direct link to Version 1.41") ----------------------------------------------------------- ### New APIs[​](#new-apis-5 "Direct link to New APIs") * New method [page.unrouteAll()](/docs/api/class-page#page-unroute-all) removes all routes registered by [page.route()](/docs/api/class-page#page-route) and [page.routeFromHAR()](/docs/api/class-page#page-route-from-har). Optionally allows to wait for ongoing routes to finish, or ignore any errors from them. * New method [browserContext.unrouteAll()](/docs/api/class-browsercontext#browser-context-unroute-all) removes all routes registered by [browserContext.route()](/docs/api/class-browsercontext#browser-context-route) and [browserContext.routeFromHAR()](/docs/api/class-browsercontext#browser-context-route-from-har). Optionally allows to wait for ongoing routes to finish, or ignore any errors from them. * New options [style](/docs/api/class-page#page-screenshot-option-style) in [page.screenshot()](/docs/api/class-page#page-screenshot) and [style](/docs/api/class-locator#locator-screenshot-option-style) in [locator.screenshot()](/docs/api/class-locator#locator-screenshot) to add custom CSS to the page before taking a screenshot. * New option `stylePath` for methods [expect(page).toHaveScreenshot()](/docs/api/class-pageassertions#page-assertions-to-have-screenshot-1) and [expect(locator).toHaveScreenshot()](/docs/api/class-locatorassertions#locator-assertions-to-have-screenshot-1) to apply a custom stylesheet while making the screenshot. * New `fileName` option for [Blob reporter](/docs/test-reporters#blob-reporter), to specify the name of the report to be created. ### Browser Versions[​](#browser-versions-15 "Direct link to Browser Versions") * Chromium 121.0.6167.57 * Mozilla Firefox 121.0 * WebKit 17.4 This version was also tested against the following stable channels: * Google Chrome 120 * Microsoft Edge 120 Version 1.40[​](#version-140 "Direct link to Version 1.40") ----------------------------------------------------------- ### Test Generator Update[​](#test-generator-update "Direct link to Test Generator Update") ![Playwright Test Generator](https://github.com/microsoft/playwright/assets/9881434/e8d67e2e-f36d-4301-8631-023948d3e190) New tools to generate assertions: * "Assert visibility" tool generates [expect(locator).toBeVisible()](/docs/api/class-locatorassertions#locator-assertions-to-be-visible). * "Assert value" tool generates [expect(locator).toHaveValue()](/docs/api/class-locatorassertions#locator-assertions-to-have-value). * "Assert text" tool generates [expect(locator).toContainText()](/docs/api/class-locatorassertions#locator-assertions-to-contain-text). Here is an example of a generated test with assertions: import { test, expect } from '@playwright/test';test('test', async ({ page }) => { await page.goto('https://playwright.dev/'); await page.getByRole('link', { name: 'Get started' }).click(); await expect(page.getByLabel('Breadcrumbs').getByRole('list')).toContainText('Installation'); await expect(page.getByLabel('Search')).toBeVisible(); await page.getByLabel('Search').click(); await page.getByPlaceholder('Search docs').fill('locator'); await expect(page.getByPlaceholder('Search docs')).toHaveValue('locator');}); ### New APIs[​](#new-apis-6 "Direct link to New APIs") * Options [reason](/docs/api/class-page#page-close-option-reason) in [page.close()](/docs/api/class-page#page-close), [reason](/docs/api/class-browsercontext#browser-context-close-option-reason) in [browserContext.close()](/docs/api/class-browsercontext#browser-context-close) and [reason](/docs/api/class-browser#browser-close-option-reason) in [browser.close()](/docs/api/class-browser#browser-close). Close reason is reported for all operations interrupted by the closure. * Option [firefoxUserPrefs](/docs/api/class-browsertype#browser-type-launch-persistent-context-option-firefox-user-prefs) in [browserType.launchPersistentContext()](/docs/api/class-browsertype#browser-type-launch-persistent-context). ### Other Changes[​](#other-changes "Direct link to Other Changes") * Methods [download.path()](/docs/api/class-download#download-path) and [download.createReadStream()](/docs/api/class-download#download-create-read-stream) throw an error for failed and cancelled downloads. * Playwright [docker image](/docs/docker) now comes with Node.js v20. ### Browser Versions[​](#browser-versions-16 "Direct link to Browser Versions") * Chromium 120.0.6099.28 * Mozilla Firefox 119.0 * WebKit 17.4 This version was also tested against the following stable channels: * Google Chrome 119 * Microsoft Edge 119 Version 1.39[​](#version-139 "Direct link to Version 1.39") ----------------------------------------------------------- ### Add custom matchers to your expect[​](#add-custom-matchers-to-your-expect "Direct link to Add custom matchers to your expect") You can extend Playwright assertions by providing custom matchers. These matchers will be available on the expect object. test.spec.ts import { expect as baseExpect } from '@playwright/test';export const expect = baseExpect.extend({ async toHaveAmount(locator: Locator, expected: number, options?: { timeout?: number }) { // ... see documentation for how to write matchers. },});test('pass', async ({ page }) => { await expect(page.getByTestId('cart')).toHaveAmount(5);}); See the documentation [for a full example](/docs/test-assertions#add-custom-matchers-using-expectextend). ### Merge test fixtures[​](#merge-test-fixtures "Direct link to Merge test fixtures") You can now merge test fixtures from multiple files or modules: fixtures.ts import { mergeTests } from '@playwright/test';import { test as dbTest } from 'database-test-utils';import { test as a11yTest } from 'a11y-test-utils';export const test = mergeTests(dbTest, a11yTest); test.spec.ts import { test } from './fixtures';test('passes', async ({ database, page, a11y }) => { // use database and a11y fixtures.}); ### Merge custom expect matchers[​](#merge-custom-expect-matchers "Direct link to Merge custom expect matchers") You can now merge custom expect matchers from multiple files or modules: fixtures.ts import { mergeTests, mergeExpects } from '@playwright/test';import { test as dbTest, expect as dbExpect } from 'database-test-utils';import { test as a11yTest, expect as a11yExpect } from 'a11y-test-utils';export const test = mergeTests(dbTest, a11yTest);export const expect = mergeExpects(dbExpect, a11yExpect); test.spec.ts import { test, expect } from './fixtures';test('passes', async ({ page, database }) => { await expect(database).toHaveDatabaseUser('admin'); await expect(page).toPassA11yAudit();}); ### Hide implementation details: box test steps[​](#hide-implementation-details-box-test-steps "Direct link to Hide implementation details: box test steps") You can mark a [test.step()](/docs/api/class-test#test-step) as "boxed" so that errors inside it point to the step call site. async function login(page) { await test.step('login', async () => { // ... }, { box: true }); // Note the "box" option here.} Error: Timed out 5000ms waiting for expect(locator).toBeVisible() ... error details omitted ... 14 | await page.goto('https://github.com/login');> 15 | await login(page); | ^ 16 | }); See [test.step()](/docs/api/class-test#test-step) documentation for a full example. ### New APIs[​](#new-apis-7 "Direct link to New APIs") * [expect(locator).toHaveAttribute()](/docs/api/class-locatorassertions#locator-assertions-to-have-attribute-2) ### Browser Versions[​](#browser-versions-17 "Direct link to Browser Versions") * Chromium 119.0.6045.9 * Mozilla Firefox 118.0.1 * WebKit 17.4 This version was also tested against the following stable channels: * Google Chrome 118 * Microsoft Edge 118 Version 1.38[​](#version-138 "Direct link to Version 1.38") ----------------------------------------------------------- ### UI Mode Updates[​](#ui-mode-updates-1 "Direct link to UI Mode Updates") ![Playwright UI Mode](https://github.com/microsoft/playwright/assets/746130/8ba27be0-58fd-4f62-8561-950480610369) 1. Zoom into time range. 2. Network panel redesign. ### New APIs[​](#new-apis-8 "Direct link to New APIs") * [browserContext.on('weberror')](/docs/api/class-browsercontext#browser-context-event-web-error) * [locator.pressSequentially()](/docs/api/class-locator#locator-press-sequentially) * The [reporter.onEnd()](/docs/api/class-reporter#reporter-on-end) now reports `startTime` and total run `duration`. ### Deprecations[​](#deprecations "Direct link to Deprecations") * The following methods were deprecated: [page.type()](/docs/api/class-page#page-type), [frame.type()](/docs/api/class-frame#frame-type), [locator.type()](/docs/api/class-locator#locator-type) and [elementHandle.type()](/docs/api/class-elementhandle#element-handle-type). Please use [locator.fill()](/docs/api/class-locator#locator-fill) instead which is much faster. Use [locator.pressSequentially()](/docs/api/class-locator#locator-press-sequentially) only if there is a special keyboard handling on the page, and you need to press keys one-by-one. ### Breaking Changes: Playwright no longer downloads browsers automatically[​](#breaking-changes-playwright-no-longer-downloads-browsers-automatically "Direct link to Breaking Changes: Playwright no longer downloads browsers automatically") > **Note**: If you are using `@playwright/test` package, this change does not affect you. Playwright recommends to use `@playwright/test` package and download browsers via `npx playwright install` command. If you are following this recommendation, nothing has changed for you. However, up to v1.38, installing the `playwright` package instead of `@playwright/test` did automatically download browsers. This is no longer the case, and we recommend to explicitly download browsers via `npx playwright install` command. **v1.37 and earlier** `playwright` package was downloading browsers during `npm install`, while `@playwright/test` was not. **v1.38 and later** `playwright` and `@playwright/test` packages do not download browsers during `npm install`. **Recommended migration** Run `npx playwright install` to download browsers after `npm install`. For example, in your CI configuration: - run: npm ci- run: npx playwright install --with-deps **Alternative migration option - not recommended** Add `@playwright/browser-chromium`, `@playwright/browser-firefox` and `@playwright/browser-webkit` as a dependency. These packages download respective browsers during `npm install`. Make sure you keep the version of all playwright packages in sync: // package.json{ "devDependencies": { "playwright": "1.38.0", "@playwright/browser-chromium": "1.38.0", "@playwright/browser-firefox": "1.38.0", "@playwright/browser-webkit": "1.38.0" }} ### Browser Versions[​](#browser-versions-18 "Direct link to Browser Versions") * Chromium 117.0.5938.62 * Mozilla Firefox 117.0 * WebKit 17.0 This version was also tested against the following stable channels: * Google Chrome 116 * Microsoft Edge 116 Version 1.37[​](#version-137 "Direct link to Version 1.37") ----------------------------------------------------------- ### New `npx playwright merge-reports` tool[​](#new-npx-playwright-merge-reports-tool "Direct link to new-npx-playwright-merge-reports-tool") If you run tests on multiple shards, you can now merge all reports in a single HTML report (or any other report) using the new `merge-reports` CLI tool. Using `merge-reports` tool requires the following steps: 1. Adding a new "blob" reporter to the config when running on CI: playwright.config.ts export default defineConfig({ testDir: './tests', reporter: process.env.CI ? 'blob' : 'html',}); The "blob" reporter will produce ".zip" files that contain all the information about the test run. 2. Copying all "blob" reports in a single shared location and running `npx playwright merge-reports`: npx playwright merge-reports --reporter html ./all-blob-reports Read more in [our documentation](/docs/test-sharding). ### 📚 Debian 12 Bookworm Support[​](#-debian-12-bookworm-support "Direct link to 📚 Debian 12 Bookworm Support") Playwright now supports Debian 12 Bookworm on both x86\_64 and arm64 for Chromium, Firefox and WebKit. Let us know if you encounter any issues! Linux support looks like this: Ubuntu 20.04 Ubuntu 22.04 Debian 11 Debian 12 Chromium ✅ ✅ ✅ ✅ WebKit ✅ ✅ ✅ ✅ Firefox ✅ ✅ ✅ ✅ ### UI Mode Updates[​](#ui-mode-updates-2 "Direct link to UI Mode Updates") * UI Mode now respects project dependencies. You can control which dependencies to respect by checking/unchecking them in a projects list. * Console logs from the test are now displayed in the Console tab. ### Browser Versions[​](#browser-versions-19 "Direct link to Browser Versions") * Chromium 116.0.5845.82 * Mozilla Firefox 115.0 * WebKit 17.0 This version was also tested against the following stable channels: * Google Chrome 115 * Microsoft Edge 115 Version 1.36[​](#version-136 "Direct link to Version 1.36") ----------------------------------------------------------- 🏝️ Summer maintenance release. ### Browser Versions[​](#browser-versions-20 "Direct link to Browser Versions") * Chromium 115.0.5790.75 * Mozilla Firefox 115.0 * WebKit 17.0 This version was also tested against the following stable channels: * Google Chrome 114 * Microsoft Edge 114 Version 1.35[​](#version-135 "Direct link to Version 1.35") ----------------------------------------------------------- ### Highlights[​](#highlights-2 "Direct link to Highlights") * UI mode is now available in VSCode Playwright extension via a new "Show trace viewer" button: ![Playwright UI Mode](https://github.com/microsoft/playwright/assets/746130/13094128-259b-477a-8bbb-c1181178e8a2) * UI mode and trace viewer mark network requests handled with [page.route()](/docs/api/class-page#page-route) and [browserContext.route()](/docs/api/class-browsercontext#browser-context-route) handlers, as well as those issued via the [API testing](/docs/api-testing): ![Trace Viewer](https://github.com/microsoft/playwright/assets/746130/0df2d4b6-faa3-465c-aff3-c435b430bfe1) * New option `maskColor` for methods [page.screenshot()](/docs/api/class-page#page-screenshot), [locator.screenshot()](/docs/api/class-locator#locator-screenshot), [expect(page).toHaveScreenshot()](/docs/api/class-pageassertions#page-assertions-to-have-screenshot-1) and [expect(locator).toHaveScreenshot()](/docs/api/class-locatorassertions#locator-assertions-to-have-screenshot-1) to change default masking color: await page.goto('https://playwright.dev');await expect(page).toHaveScreenshot({ mask: [page.locator('img')], maskColor: '#00FF00', // green}); * New `uninstall` CLI command to uninstall browser binaries: $ npx playwright uninstall # remove browsers installed by this installation$ npx playwright uninstall --all # remove all ever-install Playwright browsers * Both UI mode and trace viewer now could be opened in a browser tab: $ npx playwright test --ui-port 0 # open UI mode in a tab on a random port$ npx playwright show-trace --port 0 # open trace viewer in tab on a random port ### ⚠️ Breaking changes[​](#️-breaking-changes "Direct link to ⚠️ Breaking changes") * `playwright-core` binary got renamed from `playwright` to `playwright-core`. So if you use `playwright-core` CLI, make sure to update the name: $ npx playwright-core install # the new way to install browsers when using playwright-core This change **does not** affect `@playwright/test` and `playwright` package users. ### Browser Versions[​](#browser-versions-21 "Direct link to Browser Versions") * Chromium 115.0.5790.13 * Mozilla Firefox 113.0 * WebKit 16.4 This version was also tested against the following stable channels: * Google Chrome 114 * Microsoft Edge 114 Version 1.34[​](#version-134 "Direct link to Version 1.34") ----------------------------------------------------------- ### Highlights[​](#highlights-3 "Direct link to Highlights") * UI Mode now shows steps, fixtures and attachments: ![UI Mode attachments](https://github.com/microsoft/playwright/assets/746130/1d280419-d79a-4a56-b2dc-54d631281d56) * New property [testProject.teardown](/docs/api/class-testproject#test-project-teardown) to specify a project that needs to run after this and all dependent projects have finished. Teardown is useful to cleanup any resources acquired by this project. A common pattern would be a `setup` dependency with a corresponding `teardown`: playwright.config.ts import { defineConfig } from '@playwright/test';export default defineConfig({ projects: [ { name: 'setup', testMatch: /global.setup\.ts/, teardown: 'teardown', }, { name: 'teardown', testMatch: /global.teardown\.ts/, }, { name: 'chromium', use: devices['Desktop Chrome'], dependencies: ['setup'], }, { name: 'firefox', use: devices['Desktop Firefox'], dependencies: ['setup'], }, { name: 'webkit', use: devices['Desktop Safari'], dependencies: ['setup'], }, ],}); * New method [`expect.configure`](/docs/test-assertions#expectconfigure) to create pre-configured expect instance with its own defaults such as `timeout` and `soft`. const slowExpect = expect.configure({ timeout: 10000 });await slowExpect(locator).toHaveText('Submit');// Always do soft assertions.const softExpect = expect.configure({ soft: true }); * New options `stderr` and `stdout` in [testConfig.webServer](/docs/api/class-testconfig#test-config-web-server) to configure output handling: playwright.config.ts import { defineConfig } from '@playwright/test';export default defineConfig({ // Run your local dev server before starting the tests webServer: { command: 'npm run start', url: 'http://127.0.0.1:3000', reuseExistingServer: !process.env.CI, stdout: 'pipe', stderr: 'pipe', },}); * New [locator.and()](/docs/api/class-locator#locator-and) to create a locator that matches both locators. const button = page.getByRole('button').and(page.getByTitle('Subscribe')); * New events [browserContext.on('console')](/docs/api/class-browsercontext#browser-context-event-console) and [browserContext.on('dialog')](/docs/api/class-browsercontext#browser-context-event-dialog) to subscribe to any dialogs and console messages from any page from the given browser context. Use the new methods [consoleMessage.page()](/docs/api/class-consolemessage#console-message-page) and [dialog.page()](/docs/api/class-dialog#dialog-page) to pin-point event source. ### ⚠️ Breaking changes[​](#️-breaking-changes-1 "Direct link to ⚠️ Breaking changes") * `npx playwright test` no longer works if you install both `playwright` and `@playwright/test`. There's no need to install both, since you can always import browser automation APIs from `@playwright/test` directly: automation.ts import { chromium, firefox, webkit } from '@playwright/test';/* ... */ * Node.js 14 is no longer supported since it [reached its end-of-life](https://nodejs.dev/en/about/releases/) on April 30, 2023. ### Browser Versions[​](#browser-versions-22 "Direct link to Browser Versions") * Chromium 114.0.5735.26 * Mozilla Firefox 113.0 * WebKit 16.4 This version was also tested against the following stable channels: * Google Chrome 113 * Microsoft Edge 113 Version 1.33[​](#version-133 "Direct link to Version 1.33") ----------------------------------------------------------- ### Locators Update[​](#locators-update "Direct link to Locators Update") * Use [locator.or()](/docs/api/class-locator#locator-or) to create a locator that matches either of the two locators. Consider a scenario where you'd like to click on a "New email" button, but sometimes a security settings dialog shows up instead. In this case, you can wait for either a "New email" button, or a dialog and act accordingly: const newEmail = page.getByRole('button', { name: 'New email' });const dialog = page.getByText('Confirm security settings');await expect(newEmail.or(dialog)).toBeVisible();if (await dialog.isVisible()) await page.getByRole('button', { name: 'Dismiss' }).click();await newEmail.click(); * Use new options [hasNot](/docs/api/class-locator#locator-filter-option-has-not) and [hasNotText](/docs/api/class-locator#locator-filter-option-has-not-text) in [locator.filter()](/docs/api/class-locator#locator-filter) to find elements that **do not match** certain conditions. const rowLocator = page.locator('tr');await rowLocator .filter({ hasNotText: 'text in column 1' }) .filter({ hasNot: page.getByRole('button', { name: 'column 2 button' }) }) .screenshot(); * Use new web-first assertion [expect(locator).toBeAttached()](/docs/api/class-locatorassertions#locator-assertions-to-be-attached) to ensure that the element is present in the page's DOM. Do not confuse with the [expect(locator).toBeVisible()](/docs/api/class-locatorassertions#locator-assertions-to-be-visible) that ensures that element is both attached & visible. ### New APIs[​](#new-apis-9 "Direct link to New APIs") * [locator.or()](/docs/api/class-locator#locator-or) * New option [hasNot](/docs/api/class-locator#locator-filter-option-has-not) in [locator.filter()](/docs/api/class-locator#locator-filter) * New option [hasNotText](/docs/api/class-locator#locator-filter-option-has-not-text) in [locator.filter()](/docs/api/class-locator#locator-filter) * [expect(locator).toBeAttached()](/docs/api/class-locatorassertions#locator-assertions-to-be-attached) * New option [timeout](/docs/api/class-route#route-fetch-option-timeout) in [route.fetch()](/docs/api/class-route#route-fetch) * [reporter.onExit()](/docs/api/class-reporter#reporter-on-exit) ### ⚠️ Breaking change[​](#️-breaking-change "Direct link to ⚠️ Breaking change") * The `mcr.microsoft.com/playwright:v1.33.0` now serves a Playwright image based on Ubuntu Jammy. To use the focal-based image, please use `mcr.microsoft.com/playwright:v1.33.0-focal` instead. ### Browser Versions[​](#browser-versions-23 "Direct link to Browser Versions") * Chromium 113.0.5672.53 * Mozilla Firefox 112.0 * WebKit 16.4 This version was also tested against the following stable channels: * Google Chrome 112 * Microsoft Edge 112 Version 1.32[​](#version-132 "Direct link to Version 1.32") ----------------------------------------------------------- ### Introducing UI Mode (preview)[​](#introducing-ui-mode-preview "Direct link to Introducing UI Mode (preview)") New [UI Mode](/docs/test-ui-mode) lets you explore, run and debug tests. Comes with a built-in watch mode. ![Playwright UI Mode](https://user-images.githubusercontent.com/746130/227004851-3901a691-4f8e-43d6-8d6b-cbfeafaeb999.png) Engage with a new flag `--ui`: npx playwright test --ui ### New APIs[​](#new-apis-10 "Direct link to New APIs") * New options [updateMode](/docs/api/class-page#page-route-from-har-option-update-mode) and [updateContent](/docs/api/class-page#page-route-from-har-option-update-content) in [page.routeFromHAR()](/docs/api/class-page#page-route-from-har) and [browserContext.routeFromHAR()](/docs/api/class-browsercontext#browser-context-route-from-har). * Chaining existing locator objects, see [locator docs](/docs/locators#matching-inside-a-locator) for details. * New property [testInfo.testId](/docs/api/class-testinfo#test-info-test-id). * New option [name](/docs/api/class-tracing#tracing-start-chunk-option-name) in method [tracing.startChunk()](/docs/api/class-tracing#tracing-start-chunk). ### ⚠️ Breaking change in component tests[​](#️-breaking-change-in-component-tests "Direct link to ⚠️ Breaking change in component tests") Note: **component tests only**, does not affect end-to-end tests. * `@playwright/experimental-ct-react` now supports **React 18 only**. * If you're running component tests with React 16 or 17, please replace `@playwright/experimental-ct-react` with `@playwright/experimental-ct-react17`. ### Browser Versions[​](#browser-versions-24 "Direct link to Browser Versions") * Chromium 112.0.5615.29 * Mozilla Firefox 111.0 * WebKit 16.4 This version was also tested against the following stable channels: * Google Chrome 111 * Microsoft Edge 111 Version 1.31[​](#version-131 "Direct link to Version 1.31") ----------------------------------------------------------- ### New APIs[​](#new-apis-11 "Direct link to New APIs") * New property [testProject.dependencies](/docs/api/class-testproject#test-project-dependencies) to configure dependencies between projects. Using dependencies allows global setup to produce traces and other artifacts, see the setup steps in the test report and more. playwright.config.ts import { defineConfig } from '@playwright/test';export default defineConfig({ projects: [ { name: 'setup', testMatch: /global.setup\.ts/, }, { name: 'chromium', use: devices['Desktop Chrome'], dependencies: ['setup'], }, { name: 'firefox', use: devices['Desktop Firefox'], dependencies: ['setup'], }, { name: 'webkit', use: devices['Desktop Safari'], dependencies: ['setup'], }, ],}); * New assertion [expect(locator).toBeInViewport()](/docs/api/class-locatorassertions#locator-assertions-to-be-in-viewport) ensures that locator points to an element that intersects viewport, according to the [intersection observer API](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API). const button = page.getByRole('button');// Make sure at least some part of element intersects viewport.await expect(button).toBeInViewport();// Make sure element is fully outside of viewport.await expect(button).not.toBeInViewport();// Make sure that at least half of the element intersects viewport.await expect(button).toBeInViewport({ ratio: 0.5 }); ### Miscellaneous[​](#miscellaneous-11 "Direct link to Miscellaneous") * DOM snapshots in trace viewer can be now opened in a separate window. * New method `defineConfig` to be used in `playwright.config`. * New option [maxRedirects](/docs/api/class-route#route-fetch-option-max-redirects) for method [route.fetch()](/docs/api/class-route#route-fetch). * Playwright now supports Debian 11 arm64. * Official [docker images](/docs/docker) now include Node 18 instead of Node 16. ### ⚠️ Breaking change in component tests[​](#️-breaking-change-in-component-tests-1 "Direct link to ⚠️ Breaking change in component tests") Note: **component tests only**, does not affect end-to-end tests. `playwright-ct.config` configuration file for [component testing](/docs/test-components) now requires calling `defineConfig`. // Beforeimport { type PlaywrightTestConfig, devices } from '@playwright/experimental-ct-react';const config: PlaywrightTestConfig = { // ... config goes here ...};export default config; Replace `config` variable definition with `defineConfig` call: // Afterimport { defineConfig, devices } from '@playwright/experimental-ct-react';export default defineConfig({ // ... config goes here ...}); ### Browser Versions[​](#browser-versions-25 "Direct link to Browser Versions") * Chromium 111.0.5563.19 * Mozilla Firefox 109.0 * WebKit 16.4 This version was also tested against the following stable channels: * Google Chrome 110 * Microsoft Edge 110 Version 1.30[​](#version-130 "Direct link to Version 1.30") ----------------------------------------------------------- ### Browser Versions[​](#browser-versions-26 "Direct link to Browser Versions") * Chromium 110.0.5481.38 * Mozilla Firefox 108.0.2 * WebKit 16.4 This version was also tested against the following stable channels: * Google Chrome 109 * Microsoft Edge 109 Version 1.29[​](#version-129 "Direct link to Version 1.29") ----------------------------------------------------------- ### New APIs[​](#new-apis-12 "Direct link to New APIs") * New method [route.fetch()](/docs/api/class-route#route-fetch) and new option `json` for [route.fulfill()](/docs/api/class-route#route-fulfill): await page.route('**/api/settings', async route => { // Fetch original settings. const response = await route.fetch(); // Force settings theme to a predefined value. const json = await response.json(); json.theme = 'Solorized'; // Fulfill with modified data. await route.fulfill({ json });}); * New method [locator.all()](/docs/api/class-locator#locator-all) to iterate over all matching elements: // Check all checkboxes!const checkboxes = page.getByRole('checkbox');for (const checkbox of await checkboxes.all()) await checkbox.check(); * [locator.selectOption()](/docs/api/class-locator#locator-select-option) matches now by value or label: await element.selectOption('Red'); * Retry blocks of code until all assertions pass: await expect(async () => { const response = await page.request.get('https://api.example.com'); await expect(response).toBeOK();}).toPass(); Read more in [our documentation](/docs/test-assertions#expecttopass). * Automatically capture **full page screenshot** on test failure: playwright.config.ts import { defineConfig } from '@playwright/test';export default defineConfig({ use: { screenshot: { mode: 'only-on-failure', fullPage: true, } }}); ### Miscellaneous[​](#miscellaneous-12 "Direct link to Miscellaneous") * Playwright Test now respects [`jsconfig.json`](https://code.visualstudio.com/docs/languages/jsconfig). * New options `args` and `proxy` for [androidDevice.launchBrowser()](/docs/api/class-androiddevice#android-device-launch-browser). * Option `postData` in method [route.continue()](/docs/api/class-route#route-continue) now supports [Serializable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#Description "Serializable") values. ### Browser Versions[​](#browser-versions-27 "Direct link to Browser Versions") * Chromium 109.0.5414.46 * Mozilla Firefox 107.0 * WebKit 16.4 This version was also tested against the following stable channels: * Google Chrome 108 * Microsoft Edge 108 Version 1.28[​](#version-128 "Direct link to Version 1.28") ----------------------------------------------------------- ### Playwright Tools[​](#playwright-tools "Direct link to Playwright Tools") * **Record at Cursor in VSCode.** You can run the test, position the cursor at the end of the test and continue generating the test. ![New VSCode Extension](https://user-images.githubusercontent.com/746130/202005839-aba2eeba-217b-424d-8496-8b4f5fa72f41.png) * **Live Locators in VSCode.** You can hover and edit locators in VSCode to get them highlighted in the opened browser. * **Live Locators in CodeGen.** Generate a locator for any element on the page using "Explore" tool. ![Locator Explorer](https://user-images.githubusercontent.com/746130/201796876-01567a0b-ca61-4a9d-b12b-04786c471671.png) * **Codegen and Trace Viewer Dark Theme.** Automatically picked up from operating system settings. ![Dark Theme](https://user-images.githubusercontent.com/746130/201797969-603f74df-d7cf-4c56-befd-798dbd269796.png) ### Test Runner[​](#test-runner-4 "Direct link to Test Runner") * Configure retries and test timeout for a file or a test with [test.describe.configure()](/docs/api/class-test#test-describe-configure). // Each test in the file will be retried twice and have a timeout of 20 seconds.test.describe.configure({ retries: 2, timeout: 20_000 });test('runs first', async ({ page }) => {});test('runs second', async ({ page }) => {}); * Use [testProject.snapshotPathTemplate](/docs/api/class-testproject#test-project-snapshot-path-template) and [testConfig.snapshotPathTemplate](/docs/api/class-testconfig#test-config-snapshot-path-template) to configure a template controlling location of snapshots generated by [expect(page).toHaveScreenshot()](/docs/api/class-pageassertions#page-assertions-to-have-screenshot-1) and [expect(value).toMatchSnapshot()](/docs/api/class-snapshotassertions#snapshot-assertions-to-match-snapshot-1). playwright.config.ts import { defineConfig } from '@playwright/test';export default defineConfig({ testDir: './tests', snapshotPathTemplate: '{testDir}/__screenshots__/{testFilePath}/{arg}{ext}',}); ### New APIs[​](#new-apis-13 "Direct link to New APIs") * [locator.blur()](/docs/api/class-locator#locator-blur) * [locator.clear()](/docs/api/class-locator#locator-clear) * [android.launchServer()](/docs/api/class-android#android-launch-server) and [android.connect()](/docs/api/class-android#android-connect) * [androidDevice.on('close')](/docs/api/class-androiddevice#android-device-event-close) ### Browser Versions[​](#browser-versions-28 "Direct link to Browser Versions") * Chromium 108.0.5359.29 * Mozilla Firefox 106.0 * WebKit 16.4 This version was also tested against the following stable channels: * Google Chrome 107 * Microsoft Edge 107 Version 1.27[​](#version-127 "Direct link to Version 1.27") ----------------------------------------------------------- ### Locators[​](#locators "Direct link to Locators") With these new APIs writing locators is a joy: * [page.getByText()](/docs/api/class-page#page-get-by-text) to locate by text content. * [page.getByRole()](/docs/api/class-page#page-get-by-role) to locate by [ARIA role](https://www.w3.org/TR/wai-aria-1.2/#roles), [ARIA attributes](https://www.w3.org/TR/wai-aria-1.2/#aria-attributes) and [accessible name](https://w3c.github.io/accname/#dfn-accessible-name). * [page.getByLabel()](/docs/api/class-page#page-get-by-label) to locate a form control by associated label's text. * [page.getByTestId()](/docs/api/class-page#page-get-by-test-id) to locate an element based on its `data-testid` attribute (other attribute can be configured). * [page.getByPlaceholder()](/docs/api/class-page#page-get-by-placeholder) to locate an input by placeholder. * [page.getByAltText()](/docs/api/class-page#page-get-by-alt-text) to locate an element, usually image, by its text alternative. * [page.getByTitle()](/docs/api/class-page#page-get-by-title) to locate an element by its title. await page.getByLabel('User Name').fill('John');await page.getByLabel('Password').fill('secret-password');await page.getByRole('button', { name: 'Sign in' }).click();await expect(page.getByText('Welcome, John!')).toBeVisible(); All the same methods are also available on [Locator](/docs/api/class-locator "Locator"), [FrameLocator](/docs/api/class-framelocator "FrameLocator") and [Frame](/docs/api/class-frame "Frame") classes. ### Other highlights[​](#other-highlights "Direct link to Other highlights") * `workers` option in the `playwright.config.ts` now accepts a percentage string to use some of the available CPUs. You can also pass it in the command line: npx playwright test --workers=20% * New options `host` and `port` for the html reporter. import { defineConfig } from '@playwright/test';export default defineConfig({ reporter: [['html', { host: 'localhost', port: '9223' }]],}); * New field `FullConfig.configFile` is available to test reporters, specifying the path to the config file if any. * As announced in v1.25, Ubuntu 18 will not be supported as of Dec 2022. In addition to that, there will be no WebKit updates on Ubuntu 18 starting from the next Playwright release. ### Behavior Changes[​](#behavior-changes "Direct link to Behavior Changes") * [expect(locator).toHaveAttribute()](/docs/api/class-locatorassertions#locator-assertions-to-have-attribute) with an empty value does not match missing attribute anymore. For example, the following snippet will succeed when `button` **does not** have a `disabled` attribute. await expect(page.getByRole('button')).toHaveAttribute('disabled', ''); * Command line options `--grep` and `--grep-invert` previously incorrectly ignored `grep` and `grepInvert` options specified in the config. Now all of them are applied together. ### Browser Versions[​](#browser-versions-29 "Direct link to Browser Versions") * Chromium 107.0.5304.18 * Mozilla Firefox 105.0.1 * WebKit 16.0 This version was also tested against the following stable channels: * Google Chrome 106 * Microsoft Edge 106 Version 1.26[​](#version-126 "Direct link to Version 1.26") ----------------------------------------------------------- ### Assertions[​](#assertions "Direct link to Assertions") * New option `enabled` for [expect(locator).toBeEnabled()](/docs/api/class-locatorassertions#locator-assertions-to-be-enabled). * [expect(locator).toHaveText()](/docs/api/class-locatorassertions#locator-assertions-to-have-text) now pierces open shadow roots. * New option `editable` for [expect(locator).toBeEditable()](/docs/api/class-locatorassertions#locator-assertions-to-be-editable). * New option `visible` for [expect(locator).toBeVisible()](/docs/api/class-locatorassertions#locator-assertions-to-be-visible). ### Other highlights[​](#other-highlights-1 "Direct link to Other highlights") * New option `maxRedirects` for [apiRequestContext.get()](/docs/api/class-apirequestcontext#api-request-context-get) and others to limit redirect count. * New command-line flag `--pass-with-no-tests` that allows the test suite to pass when no files are found. * New command-line flag `--ignore-snapshots` to skip snapshot expectations, such as `expect(value).toMatchSnapshot()` and `expect(page).toHaveScreenshot()`. ### Behavior Change[​](#behavior-change "Direct link to Behavior Change") A bunch of Playwright APIs already support the `waitUntil: 'domcontentloaded'` option. For example: await page.goto('https://playwright.dev', { waitUntil: 'domcontentloaded',}); Prior to 1.26, this would wait for all iframes to fire the `DOMContentLoaded` event. To align with web specification, the `'domcontentloaded'` value only waits for the target frame to fire the `'DOMContentLoaded'` event. Use `waitUntil: 'load'` to wait for all iframes. ### Browser Versions[​](#browser-versions-30 "Direct link to Browser Versions") * Chromium 106.0.5249.30 * Mozilla Firefox 104.0 * WebKit 16.0 This version was also tested against the following stable channels: * Google Chrome 105 * Microsoft Edge 105 Version 1.25[​](#version-125 "Direct link to Version 1.25") ----------------------------------------------------------- ### VSCode Extension[​](#vscode-extension "Direct link to VSCode Extension") * Watch your tests running live & keep devtools open. * Pick selector. * Record new test from current page state. ![vscode extension screenshot](https://user-images.githubusercontent.com/746130/183781999-1b9fdbc5-cfae-47d6-b4f7-5d4ae89716a8.jpg) ### Test Runner[​](#test-runner-5 "Direct link to Test Runner") * [test.step()](/docs/api/class-test#test-step) now returns the value of the step function: test('should work', async ({ page }) => { const pageTitle = await test.step('get title', async () => { await page.goto('https://playwright.dev'); return await page.title(); }); console.log(pageTitle);}); * Added [test.describe.fixme()](/docs/api/class-test#test-describe-fixme). * New `'interrupted'` test status. * Enable tracing via CLI flag: `npx playwright test --trace=on`. ### Announcements[​](#announcements-1 "Direct link to Announcements") * 🎁 We now ship Ubuntu 22.04 Jammy Jellyfish docker image: `mcr.microsoft.com/playwright:v1.34.0-jammy`. * 🪦 This is the last release with macOS 10.15 support (deprecated as of 1.21). * 🪦 This is the last release with Node.js 12 support, we recommend upgrading to Node.js LTS (16). * ⚠️ Ubuntu 18 is now deprecated and will not be supported as of Dec 2022. ### Browser Versions[​](#browser-versions-31 "Direct link to Browser Versions") * Chromium 105.0.5195.19 * Mozilla Firefox 103.0 * WebKit 16.0 This version was also tested against the following stable channels: * Google Chrome 104 * Microsoft Edge 104 Version 1.24[​](#version-124 "Direct link to Version 1.24") ----------------------------------------------------------- ### 🌍 Multiple Web Servers in `playwright.config.ts`[​](#-multiple-web-servers-in-playwrightconfigts "Direct link to -multiple-web-servers-in-playwrightconfigts") Launch multiple web servers, databases, or other processes by passing an array of configurations: playwright.config.ts import { defineConfig } from '@playwright/test';export default defineConfig({ webServer: [ { command: 'npm run start', url: 'http://127.0.0.1:3000', timeout: 120 * 1000, reuseExistingServer: !process.env.CI, }, { command: 'npm run backend', url: 'http://127.0.0.1:3333', timeout: 120 * 1000, reuseExistingServer: !process.env.CI, } ], use: { baseURL: 'http://localhost:3000/', },}); ### 🐂 Debian 11 Bullseye Support[​](#-debian-11-bullseye-support "Direct link to 🐂 Debian 11 Bullseye Support") Playwright now supports Debian 11 Bullseye on x86\_64 for Chromium, Firefox and WebKit. Let us know if you encounter any issues! Linux support looks like this: | | Ubuntu 20.04 | Ubuntu 22.04 | Debian 11 | :--- | :---: | :---: | :---: | :---: | | Chromium | ✅ | ✅ | ✅ | | WebKit | ✅ | ✅ | ✅ | | Firefox | ✅ | ✅ | ✅ | ### 🕵️ Anonymous Describe[​](#️-anonymous-describe "Direct link to 🕵️ Anonymous Describe") It is now possible to call [test.describe()](/docs/api/class-test#test-describe) to create suites without a title. This is useful for giving a group of tests a common option with [test.use()](/docs/api/class-test#test-use). test.describe(() => { test.use({ colorScheme: 'dark' }); test('one', async ({ page }) => { // ... }); test('two', async ({ page }) => { // ... });}); ### 🧩 Component Tests Update[​](#-component-tests-update "Direct link to 🧩 Component Tests Update") Playwright 1.24 Component Tests introduce `beforeMount` and `afterMount` hooks. Use these to configure your app for tests. For example, this could be used to setup App router in Vue.js: src/component.spec.ts import { test } from '@playwright/experimental-ct-vue';import { Component } from './mycomponent';test('should work', async ({ mount }) => { const component = await mount(Component, { hooksConfig: { /* anything to configure your app */ } });}); playwright/index.ts import { router } from '../router';import { beforeMount } from '@playwright/experimental-ct-vue/hooks';beforeMount(async ({ app, hooksConfig }) => { app.use(router);}); A similar configuration in Next.js would look like this: src/component.spec.jsx import { test } from '@playwright/experimental-ct-react';import { Component } from './mycomponent';test('should work', async ({ mount }) => { const component = await mount(, { // Pass mock value from test into `beforeMount`. hooksConfig: { router: { query: { page: 1, per_page: 10 }, asPath: '/posts' } } });}); playwright/index.js import router from 'next/router';import { beforeMount } from '@playwright/experimental-ct-react/hooks';beforeMount(async ({ hooksConfig }) => { // Before mount, redefine useRouter to return mock value from test. router.useRouter = () => hooksConfig.router;}); Version 1.23[​](#version-123 "Direct link to Version 1.23") ----------------------------------------------------------- ### Network Replay[​](#network-replay "Direct link to Network Replay") Now you can record network traffic into a HAR file and re-use this traffic in your tests. To record network into HAR file: npx playwright open --save-har=github.har.zip https://github.com/microsoft Alternatively, you can record HAR programmatically: const context = await browser.newContext({ recordHar: { path: 'github.har.zip' }});// ... do stuff ...await context.close(); Use the new methods [page.routeFromHAR()](/docs/api/class-page#page-route-from-har) or [browserContext.routeFromHAR()](/docs/api/class-browsercontext#browser-context-route-from-har) to serve matching responses from the [HAR](http://www.softwareishard.com/blog/har-12-spec/) file: await context.routeFromHAR('github.har.zip'); Read more in [our documentation](/docs/mock#mocking-with-har-files). ### Advanced Routing[​](#advanced-routing "Direct link to Advanced Routing") You can now use [route.fallback()](/docs/api/class-route#route-fallback) to defer routing to other handlers. Consider the following example: // Remove a header from all requests.test.beforeEach(async ({ page }) => { await page.route('**/*', async route => { const headers = await route.request().allHeaders(); delete headers['if-none-match']; await route.fallback({ headers }); });});test('should work', async ({ page }) => { await page.route('**/*', async route => { if (route.request().resourceType() === 'image') await route.abort(); else await route.fallback(); });}); Note that the new methods [page.routeFromHAR()](/docs/api/class-page#page-route-from-har) and [browserContext.routeFromHAR()](/docs/api/class-browsercontext#browser-context-route-from-har) also participate in routing and could be deferred to. ### Web-First Assertions Update[​](#web-first-assertions-update "Direct link to Web-First Assertions Update") * New method [expect(locator).toHaveValues()](/docs/api/class-locatorassertions#locator-assertions-to-have-values) that asserts all selected values of ``, `