Playwright

Latest version: v1.49.0

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

Scan your dependencies

Page 13 of 32

1.23.1

Bug Fixes

- [BUG] Frame is emitted on Page events domcontentloaded/load 1399
- [Question]: Task was destroyed but it is pending! in route.abort() 1402

1.23

Browser Versions

- Chromium 104.0.5112.20
- Mozilla Firefox 100.0.2
- WebKit 15.4

This version was also tested against the following stable channels:

- Google Chrome 103
- Microsoft Edge 103

1.23.0

Highlights

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:

bash
npx playwright open --save-har=github.har.zip https://github.com/microsoft


Alternatively, you can record HAR programmatically:

python sync
context = browser.new_context(record_har_path="github.har.zip")
... do stuff ...
context.close()


Use the new methods [`method: Page.route_from_har`](https://playwright.dev/python/docs/api/class-page#page-route-from-har) or [`method: BrowserContext.route_from_har`](https://playwright.dev/python/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:

python sync
context.route_from_har("github.har.zip")


Read more in [our documentation](https://playwright.dev/python/docs/network#record-and-replay-requests).


Advanced Routing

You can now use [`method: Route.fallback`](https://playwright.dev/python/docs/api/class-route#route-fallback) to defer routing to other handlers.

Consider the following example:

python sync
Remove a header from all requests
def remove_header_handler(route: Route) -> None:
headers = route.request.all_headers()
if "if-none-match" in headers:
del headers["if-none-match"]
route.fallback(headers=headers)

page.route("**/*", remove_header_handler)

Abort all images
def abort_images_handler(route: Route) -> None:
if route.request.resource_type == "image":
route.abort()
else:
route.fallback()

page.route("**/*", abort_images_handler)


Note that the new methods [`method: Page.route_from_har`](https://playwright.dev/python/docs/api/class-page#page-route-from-har) or [`method: BrowserContext.route_from_har`](https://playwright.dev/python/docs/api/class-browsercontext#browser-context-route-from-har) also participate in routing and could be deferred to.

Web-First Assertions Update

* New method [`method: LocatorAssertions.to_have_values`](https://playwright.dev/python/docs/test-assertions#locator-assertions-to-have-values) that asserts all selected values of `<select multiple>` element.
* Methods [`method: LocatorAssertions.to_contain_text`](https://playwright.dev/python/docs/test-assertions#locator-assertions-to-contain-text) and [`method: LocatorAssertions.to_have_text`](https://playwright.dev/python/docs/test-assertions#locator-assertions-to-have-text) now accept `ignore_case` option.

Miscellaneous

* If there's a service worker that's in your way, you can now easily disable it with a new context option `service_workers`:

python sync
context = browser.new_context(service_workers="block")
page = context.new_page()


* Using `.zip` path for `recordHar` context option automatically zips the resulting HAR:

python sync
context = browser.new_context(record_har_path="github.har.zip")


* If you intend to edit HAR by hand, consider using the `"minimal"` HAR recording mode
that only records information that is essential for replaying:

python sync
context = browser.new_context(record_har_mode="minimal", record_har_path="har.har")


* Playwright now runs on Ubuntu 22 amd64 and Ubuntu 22 arm64.

1.22.2

Highlights

This patch includes the following bug fixes:

https://github.com/microsoft/playwright/issues/14254 - [BUG] focus() function in version 1.22 closes dropdown (not of select type) instead of just focus on the option

Browser Versions

- Chromium 102.0.5005.40
- Mozilla Firefox 99.0.1
- WebKit 15.4

This version was also tested against the following stable channels:

- Google Chrome 101
- Microsoft Edge 101

1.22.1

Highlights

This patch includes the following bug fixes:

https://github.com/microsoft/playwright/issues/14186 - [BUG] expect.toHaveScreenshot() generates an argument error

Browser Versions

- Chromium 102.0.5005.40
- Mozilla Firefox 99.0.1
- WebKit 15.4

This version was also tested against the following stable channels:

- Google Chrome 101
- Microsoft Edge 101

1.22.0

Highlights

- Role selectors that allow selecting elements by their [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).

py
Click a button with accessible name "log in"
page.click("role=button[name='log in']")


Read more in [our documentation](https://playwright.dev/docs/selectors#role-selector).

- New [`method: Locator.filter`] API to filter an existing locator

py
buttons = page.locator("role=button")
...
submit_button = buttons.filter(has_text="Submit")
submit_button.click()


- Codegen now supports generating Pytest Tests

![Graphics](https://user-images.githubusercontent.com/746130/168098384-40784024-6c26-4426-8255-e714862af6fc.png)

Browser Versions

- Chromium 102.0.5005.40
- Mozilla Firefox 99.0.1
- WebKit 15.4

This version was also tested against the following stable channels:

- Google Chrome 101
- Microsoft Edge 101

Page 13 of 32

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.