Playwright

Latest version: v1.50.0

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

Scan your dependencies

Page 11 of 28

1.28.0

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.

<img alt="New VSCode Extension" width=600 src="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.

<img alt="Locator Explorer" src="https://user-images.githubusercontent.com/746130/201796876-01567a0b-ca61-4a9d-b12b-04786c471671.png" width=600>

* **Codegen and Trace Viewer Dark Theme.** Automatically picked up from operating system settings.

<img alt="Dark Theme" src="https://user-images.githubusercontent.com/746130/201797969-603f74df-d7cf-4c56-befd-798dbd269796.png" width=600>


Test Runner

* Configure retries and test timeout for a file or a test with [`test.describe.configure([options])`](https://playwright.dev/docs/api/class-test#test-describe-configure).

js
// 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`](https://playwright.dev/docs/api/class-testproject#test-project-snapshot-path-template) and [`testConfig.snapshotPathTemplate`](https://playwright.dev/docs/api/class-testconfig#test-config-snapshot-path-template) to configure a template controlling location of snapshots generated by [`expect(page).toHaveScreenshot(name[, options])`](https://playwright.dev/docs/test-assertions#page-assertions-to-have-screenshot-1) and [`expect(screenshot).toMatchSnapshot(name[, options])`](https://playwright.dev/docs/test-assertions#screenshot-assertions-to-match-snapshot-1).

js
// playwright.config.ts
import type { PlaywrightTestConfig } from 'playwright/test';

const config: PlaywrightTestConfig = {
testDir: './tests',
snapshotPathTemplate: '{testDir}/__screenshots__/{testFilePath}/{arg}{ext}',
};

export default config;


New APIs

- [`locator.blur([options])`](https://playwright.dev/docs/api/class-locator#locator-blur)
- [`locator.clear([options])`](https://playwright.dev/docs/api/class-locator#locator-clear)
- [`android.launchServer([options])`](https://playwright.dev/docs/api/class-android#android-launch-server) and [`android.connect(wsEndpoint[, options])`](https://playwright.dev/docs/api/class-android#android-connect)
- [`androidDevice.on('close')`](https://playwright.dev/docs/api/class-androiddevice#android-device-event-close)

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

1.27.1

Highlights

This patch release includes the following bug fixes:

https://github.com/microsoft/playwright/pull/18010 - fix(generator): generate nice locators for arbitrary selectors
https://github.com/microsoft/playwright/pull/17999 - chore: don't fail on undefined video/trace
https://github.com/microsoft/playwright/issues/17955 - [Question] Github Actions test compatibility check failed mitigation?
https://github.com/microsoft/playwright/issues/17960 - [BUG] Codegen 1.27 creates NUnit code that does not compile
https://github.com/microsoft/playwright/pull/17952 - fix: fix typo in treeitem role typing

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

1.27.0

Locators

With these new APIs, inspired by [Testing Library](https://testing-library.com/), writing locators is a joy:
- [`page.getByText(text, options)`](https://playwright.dev/docs/api/class-page#page-get-by-text) to locate by text content.
- [`page.getByRole(role, options)`](https://playwright.dev/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(label, options)`](https://playwright.dev/docs/api/class-page#page-get-by-label) to locate a form control by associated label's text.
- [`page.getByPlaceholder(placeholder, options)`](https://playwright.dev/docs/api/class-page#page-get-by-placeholder) to locate an input by placeholder.
- [`page.getByAltText(altText, options)`](https://playwright.dev/docs/api/class-page#page-get-by-alt-text) to locate an element, usually image, by its text alternative.
- [`page.getByTitle(title, options)`](https://playwright.dev/docs/api/class-page#page-get-by-title) to locate an element by its title.

js
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](https://playwright.dev/docs/api/class-locator), [FrameLocator](https://playwright.dev/docs/api/class-framelocator) and [Frame](https://playwright.dev/docs/api/class-frame) classes.

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:
bash
npx playwright test --workers=20%


- New options `host` and `port` for the html reporter.
js
reporters: [['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

- [`expect(locator).toHaveAttribute(name, value, options)`](https://playwright.dev/docs/test-assertions#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.

js
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.

- JSON reporter path resolution is performed relative to the config directory instead of the current working directory:

js
["json", { outputFile: "./test-results/results.json" }]]


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

1.26.1

Highlights

This patch includes the following bug fixes:

https://github.com/microsoft/playwright/issues/17500 - [BUG] No tests found using the test explorer - pw/test1.26.0

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

1.26.0

Assertions

* New option enabled for [`expect(locator).toBeEnabled([options])`](https://playwright.dev/docs/test-assertions#locator-assertions-to-be-enabled).
* [`expect(locator).toHaveText(expected[, options])`](https://playwright.dev/docs/test-assertions#locator-assertions-to-have-text) now pierces open shadow roots.
* New option editable for [`expect(locator).toBeEditable([options])`](https://playwright.dev/docs/test-assertions#locator-assertions-to-be-editable).
* New option visible for [`expect(locator).toBeVisible([options])`](https://playwright.dev/docs/test-assertions#locator-assertions-to-be-visible).

Other Highlights

* New option `maxRedirects` for [`apiRequestContext.get(url[, options])`](https://playwright.dev/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

A bunch of Playwright APIs already support the waitUntil: 'domcontentloaded' option. For example:

ts
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

* 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

1.25.2

Highlights

This patch includes the following bug fixes:

https://github.com/microsoft/playwright/issues/16937 - [REGRESSION]: session storage failing >= 1.25.0 in firefox
https://github.com/microsoft/playwright/issues/16955 - Not using channel on config file when Show and Reuse browser is checked

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

Page 11 of 28

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.