Skip to content

v1.14.0

Compare
Choose a tag to compare
@aslushnikov aslushnikov released this 13 Aug 23:42
5f3331a

⚡️ New "strict" mode

Selector ambiguity is a common problem in automation testing. "strict" mode
ensures that your selector points to a single element and throws otherwise.

Use setStrict(true) in your action calls to opt in.

// This will throw if you have more than one button!
page.click("button", new Page.ClickOptions().setStrict(true));

📍 New Locators API

Locator represents a view to the element(s) on the page. It captures the logic sufficient to retrieve the element at any given moment.

The difference between the Locator and ElementHandle is that the latter points to a particular element, while Locator captures the logic of how to retrieve that element.

Also, locators are "strict" by default!

Locator locator = page.locator("button");
locator.click();

Learn more in the documentation.

🧩 Experimental React and Vue selector engines

React and Vue selectors allow selecting elements by its component name and/or property values. The syntax is very similar to attribute selectors and supports all attribute selector operators.

page.click("_react=SubmitButton[enabled=true]");
page.click("_vue=submit-button[enabled=true]");

Learn more in the react selectors documentation and the vue selectors documentation.

✨ New nth and visible selector engines

  • nth selector engine is equivalent to the :nth-match pseudo class, but could be combined with other selector engines.
  • visible selector engine is equivalent to the :visible pseudo class, but could be combined with other selector engines.
// select the first button among all buttons
button.click("button >> nth=0");
// or if you are using locators, you can use first(), nth() and last()
page.locator("button").first().click();
// click a visible button
button.click("button >> visible=true");

Browser Versions

  • Chromium 94.0.4595.0
  • Mozilla Firefox 91.0
  • WebKit 15.0

This version of Playwright was also tested against the following stable channels:

  • Google Chrome 92
  • Microsoft Edge 92