github microsoft/playwright-dotnet v1.14.0

latest releases: v1.48.0, v1.47.0, v1.46.0...
3 years ago

⚡️ 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.

Pass Strict = true into your action calls to opt in.

// This will throw if you have more than one button!
await page.ClickAsync("button", new () { Strict = 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!

var locator = page.Locator("button");
await locator.ClickAsync();

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.

await page.ClickAsync("_react=SubmitButton[enabled=true]");
await page.ClickAsync("_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
await button.ClickAsync("button >> nth=0");
// or if you are using locators, you can use first(), nth() and last()
await page.Locator("button").First.ClickAsync();

// click a visible button
await button.ClickAsync("button >> visible=true");

.NET Specific Features

  • 🧪 SkipAttribute We now have a NUnit attribute that can be used to skip various combinations of browser and/or platforms.

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

Don't miss a new playwright-dotnet release

NewReleases is sending notifications on new releases.