Playwright

Latest version: v1.44.0

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

Scan your dependencies

Page 4 of 17

1.30.0

🎉 Happy New Year 🎉

Maintenance release with bugfixes and new browsers only.

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

1.29.1

Bugfixes

* fix: fulfill with json in https://github.com/microsoft/playwright-python/pull/1701

1.29.0

Highlights

New APIs

- New method [`Route.fetch`](https://playwright.dev/python/docs/api/class-route#route-fetch) and new option `json` for [`Route.fulfill`](https://playwright.dev/python/docs/api/class-route#route-fulfill):

python
def handle_route(route: Route):
Fetch original settings.
response = route.fetch()
Force settings theme to a predefined value.
json = response.json()
json["theme"] = "Solorized"
Fulfill with modified data.
route.fulfill(json=json)
page.route("**/api/settings", handle_route)


- New method [`Locator.all`](https://playwright.dev/python/docs/api/class-locator#locator-all) to iterate over all matching elements:

python
Check all checkboxes!
checkboxes = page.get_by_role("checkbox")
for checkbox in checkboxes.all():
checkbox.check()


- [`Locator.select_option`](https://playwright.dev/python/docs/api/class-locator#locator-select-option) matches now by value or label:

html
<select multiple>
<option value="red">Red</div>
<option value="green">Green</div>
<option value="blue">Blue</div>
</select>


python
element.select_option("Red")


Miscellaneous

- Option `postData` in method [`Route.continue`](https://playwright.dev/python/docs/api/class-route#route-continue) now supports any values.

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

1.28.0

Highlights

Playwright Tools

* **Live Locators in CodeGen.** Generate a locator for any element on the page using "Explore" tool.

![Locator Explorer](https://user-images.githubusercontent.com/9798949/202293514-8e2eade6-c809-4b0a-864b-899dfcee3d84.png)

New APIs

- [`method: Locator.blur`](https://playwright.dev/python/docs/api/class-locator#locator-blur)
- [`method: Locator.clear`](https://playwright.dev/python/docs/api/class-locator#locator-clear)

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/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.get_by_text(text)`](https://playwright.dev/python/docs/api/class-page#page-get-by-text) to locate by text content.
- [`page.get_by_role(role)`](https://playwright.dev/python/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.get_by_label(label)`](https://playwright.dev/python/docs/api/class-page#page-get-by-label) to locate a form control by associated label's text.
- [`page.get_by_placeholder(placeholder)`](https://playwright.dev/python/docs/api/class-page#page-get-by-placeholder) to locate an input by placeholder.
- [`page.get_by_alt_text(altText)`](https://playwright.dev/python/docs/api/class-page#page-get-by-alt-text) to locate an element, usually image, by its text alternative.
- [`page.get_by_title(title)`](https://playwright.dev/python/docs/api/class-page#page-get-by-title) to locate an element by its title.

js
page.get_by_label("User Name").fill("John")

page.get_by_label("Password").fill("secret-password")

page.get_by_role("button", name="Sign in").click()

expect(page.get_by_text("Welcome, John!")).to_be_visible()


All the same methods are also available on [Locator](https://playwright.dev/python/docs/api/class-locator), [FrameLocator](https://playwright.dev/python/docs/api/class-framelocator) and [Frame](https://playwright.dev/python/docs/api/class-frame) classes.

Other highlights

- 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).to_have_attribute(name, value)`](https://playwright.dev/python/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.

python
expect(page.get_by_role("button")).to_have_attribute("disabled", "")


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

Page 4 of 17

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.