Playwright

Latest version: v1.50.0

Safety actively analyzes 715032 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 5 of 28

1.41.2

Highlights

https://github.com/microsoft/playwright/issues/29123 - [REGRESSION] route.continue: Protocol error (Fetch.continueRequest): Invalid InterceptionId.

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

1.41.1

Highlights

https://github.com/microsoft/playwright/issues/29067 - [REGRESSION] Codegen/Recorder: not all clicks are being actioned nor recorded
https://github.com/microsoft/playwright/issues/29028 - [REGRESSION] React component tests throw type error when passing null/undefined to component
https://github.com/microsoft/playwright/issues/29027 - [REGRESSION] React component tests not passing Date prop values
https://github.com/microsoft/playwright/issues/29023 - [REGRESSION] React component tests not rendering children prop
https://github.com/microsoft/playwright/issues/29019 - [REGRESSION] trace.playwright.dev does not currently support the loading from URL

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

1.41.0

New APIs
- New method [page.unrouteAll([options])](https://playwright.dev/docs/api/class-page#page-unroute-all) removes all routes registered by [page.route(url, handler, handler[, options])](https://playwright.dev/docs/api/class-page#page-route) and [page.routeFromHAR(har[, options])](https://playwright.dev/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([options])](https://playwright.dev/docs/api/class-browsercontext#browser-context-unroute-all) removes all routes registered by [browserContext.route(url, handler, handler[, options])](https://playwright.dev/docs/api/class-browsercontext#browser-context-route) and [browserContext.routeFromHAR(har[, options])](https://playwright.dev/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 option `style` in [page.screenshot([options])](https://playwright.dev/docs/api/class-page#page-screenshot) and [locator.screenshot([options])](https://playwright.dev/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(name[, options])](https://playwright.dev/docs/api/class-pageassertions#page-assertions-to-have-screenshot-1) and [expect(locator).toHaveScreenshot(name[, options])](https://playwright.dev/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](https://playwright.dev/docs/test-reporters#blob-reporter), to specify the name of the report to be created.

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

1.40.1

Highlights

https://github.com/microsoft/playwright/issues/28319 - [REGRESSION]: Version 1.40.0 Produces corrupted traces
https://github.com/microsoft/playwright/issues/28371 - [BUG] The color of the 'ok' text did not change to green in the vs code test results section
https://github.com/microsoft/playwright/issues/28321 - [BUG] Ambiguous test outcome and status for serial mode
https://github.com/microsoft/playwright/issues/28362 - [BUG] Merging blobs ends up in Error: Cannot create a string longer than 0x1fffffe8 characters
https://github.com/microsoft/playwright/pull/28239 - fix: collect all errors in removeFolders


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

1.40.0

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()](https://playwright.dev/docs/api/class-locatorassertions#locator-assertions-to-be-visible).
- "Assert value" tool generates [expect(locator).toHaveValue(value)](https://playwright.dev/docs/api/class-locatorassertions#locator-assertions-to-have-value).
- "Assert text" tool generates [expect(locator).toContainText(text)](https://playwright.dev/docs/api/class-locatorassertions#locator-assertions-to-contain-text).

Here is an example of a generated test with assertions:

js
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
- Option `reason` in [page.close()](https://playwright.dev/docs/api/class-page#page-close), [browserContext.close()](https://playwright.dev/docs/api/class-browsercontext#browser-context-close) and [browser.close()](https://playwright.dev/docs/api/class-browser#browser-close). Close reason is reported for all operations interrupted by the closure.
- Option `firefoxUserPrefs` in [browserType.launchPersistentContext(userDataDir)](https://playwright.dev/docs/api/class-browsertype#browser-type-launch-persistent-context).

Other Changes
- Methods [download.path()](https://playwright.dev/docs/api/class-download#download-path) and [download.createReadStream()](https://playwright.dev/docs/api/class-download#download-create-read-stream) throw an error for failed and cancelled downloads.
- Playwright [docker image](https://playwright.dev/docs/docker) now comes with Node.js v20.

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

1.39.0

Add custom matchers to your expect

You can extend Playwright assertions by providing custom matchers. These matchers will be available on the expect object.

js
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](https://playwright.dev/docs/test-configuration#add-custom-matchers-using-expectextend).

Merge test fixtures

You can now merge test fixtures from multiple files or modules:

js
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);


js
import { test } from './fixtures';

test('passes', async ({ database, page, a11y }) => {
// use database and a11y fixtures.
});


Merge custom expect matchers

You can now merge custom expect matchers from multiple files or modules:

js
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);


js
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

You can mark a [`test.step()`](https://playwright.dev/docs/api/class-test#test-step) as "boxed" so that errors inside it point to the step call site.

js
async function login(page) {
await test.step('login', async () => {
// ...
}, { box: true }); // Note the "box" option here.
}


txt
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()`](https://playwright.dev/docs/api/class-test#test-step) documentation for a full example.

New APIs

- [`expect(locator).toHaveAttribute(name)`](https://playwright.dev/docs/api/class-locatorassertions#locator-assertions-to-have-attribute-2)

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

Page 5 of 28

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.