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