Playwright

Latest version: v1.44.0

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

Scan your dependencies

Page 1 of 17

1.44.0

New APIs

**Accessibility assertions**
- [expect(locator).to_have_accessible_name()](https://playwright.dev/python/docs/api/class-locatorassertions#locator-assertions-to-have-accessible-name) checks if the element has the specified accessible name:

python
locator = page.get_by_role("button")
expect(locator).to_have_accessible_name("Submit")


- [expect(locator).to_have_accessible_description()](https://playwright.dev/python/docs/api/class-locatorassertions#locator-assertions-to-have-accessible-description) checks if the element has the specified accessible description:

python
locator = page.get_by_role("button")
expect(locator).to_have_accessible_description("Upload a photo")


- [expect(locator).to_have_role()](https://playwright.dev/python/docs/api/class-locatorassertions#locator-assertions-to-have-role) checks if the element has the specified ARIA role:

python
locator = page.get_by_test_id("save-button")
expect(locator).to_have_role("button")


**Locator handler**
- After executing the handler added with [page.add_locator_handler()](https://playwright.dev/python/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 `no_wait_after` option.
- You can use new `times` option in [page.add_locator_handler()](https://playwright.dev/python/docs/api/class-page#page-add-locator-handler) to specify maximum number of times the handler should be run.
- The handler in [page.add_locator_handler()](https://playwright.dev/python/docs/api/class-page#page-add-locator-handler) now accepts the locator as argument.
- New [page.remove_locator_handler()](https://playwright.dev/python/docs/api/class-page#page-remove-locator-handler) method for removing previously added locator handlers.

python
locator = page.get_by_text("This interstitial covers the button")
page.add_locator_handler(locator, lambda overlay: overlay.locator("close").click(), times=3, no_wait_after=True)
Run your tests that can be interrupted by the overlay.
...
page.remove_locator_handler(locator)


**Miscellaneous options**
- [expect(page).to_have_url()](https://playwright.dev/python/docs/api/class-pageassertions#page-assertions-to-have-url) now supports `ignore_case` [option](https://playwright.dev/python/docs/api/class-pageassertions#page-assertions-to-have-url-option-ignore-case).

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

1.43.0

New APIs
- Method [BrowserContext.clear_cookies([options])](https://playwright.dev/python/docs/api/class-browsercontext#browser-context-clear-cookies) now supports filters to remove only some cookies.

python
Clear all cookies.
context.clear_cookies()
New: clear cookies with a particular name.
context.clear_cookies(name="session-id")
New: clear cookies for a particular domain.
context.clear_cookies(domain="my-origin.com")


- New method [locator.content_frame](https://playwright.dev/python/docs/api/class-locator#locator-content-frame) converts a {link Locator} object to a [FrameLocator](https://playwright.dev/python/docs/api/class-framelocator). This can be useful when you have a [Locator](https://playwright.dev/python/docs/api/class-locator) object obtained somewhere, and later on would like to interact with the content inside the frame.

python
locator = page.locator("iframe[name='embedded']")
...
frame_locator = locator.content_frame
frame_locator.getByRole("button").click()


- New method [frameLocator.owner](https://playwright.dev/python/docs/api/class-framelocator#frame-locator-owner) converts a [FrameLocator](https://playwright.dev/python/docs/api/class-framelocator) object to a [Locator](https://playwright.dev/python/docs/api/class-locator). This can be useful when you have a [FrameLocator](https://playwright.dev/python/docs/api/class-framelocator) object obtained somewhere, and later on would like to interact with the `iframe` element.

python
frame_locator = page.frame_locator("iframe[name='embedded']")
...
locator = frame_locator.owner
expect(locator).to_be_visible()


- Conda builds are now published for macOS-arm64 and Linux-arm64.

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

1.42.0

New Locator Handler

New method [page.add_locator_handler(locator, handler)](https://playwright.dev/python/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.

python
Setup the handler.
page.add_locator_handler(
page.get_by_role("heading", name="Hej! You are in control of your cookies."),
lambda: page.get_by_role("button", name="Accept all").click(),
)
Write the test as usual.
page.goto("https://www.ikea.com/")
page.get_by_role("link", name="Collection of blue and white").click()
expect(page.get_by_role("heading", name="Light and easy")).to_be_visible()


New APIs
- [page.pdf([options])](https://playwright.dev/python/docs/api/class-page#page-pdf) accepts two new options `tagged` and `outline`.

Announcements
* ⚠️ Ubuntu 18 is not supported anymore.

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

1.41.2

Highlights

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/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.unroute_all()](https://playwright.dev/python/docs/api/class-page#page-unroute-all) removes all routes registered by [page.route()](https://playwright.dev/python/docs/api/class-page#page-route) and [page.route_from_har()](https://playwright.dev/python/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.unroute_all()](https://playwright.dev/python/docs/api/class-browsercontext#browser-context-unroute-all) removes all routes registered by [browserContext.route()](https://playwright.dev/python/docs/api/class-browsercontext#browser-context-route) and [browserContext.route_from_har()](https://playwright.dev/python/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()](https://playwright.dev/python/docs/api/class-page#page-screenshot) and [locator.screenshot()](https://playwright.dev/python/docs/api/class-locator#locator-screenshot) to add custom CSS to the page before taking a screenshot.

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

Page 1 of 17

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.