🧾 Locator code in C#
A locator from Locator.NormalizeAsync() now converts to a string as C# code. Use it with Page.GetByRef() to turn an element that an agent picks from a Page.AriaSnapshotAsync() in the "ai" mode into code for your test:
var normalized = await page.GetByRef("e2").NormalizeAsync();
Console.WriteLine(normalized.ToString());
// GetByRole(AriaRole.Button, new() { Name = "Submit" })New APIs
-
New option
Timeoutin CDPSession.SendAsync(). -
New PlaywrightAssertionException is thrown when a Playwright assertion is not met. It extends PlaywrightException, so
catch (PlaywrightException)blocks catch it as well. -
New
ActionTimeoutandNavigationTimeoutrun settings set the default timeouts of every context that the NUnit, MSTest, xUnit and xUnit v3 base classes create. Set them in the.runsettingsfile or on the command line:<RunSettings> <Playwright> <ActionTimeout>10000</ActionTimeout> <NavigationTimeout>60000</NavigationTimeout> </Playwright> </RunSettings>
dotnet test -- Playwright.ActionTimeout=10000 Playwright.NavigationTimeout=60000
Breaking Changes ⚠️
-
Actions such as Locator.ClickAsync(), Locator.CheckAsync(), Locator.TapAsync(), Locator.FillAsync(), Locator.ClearAsync() and Locator.SelectOptionAsync() now wait for the element to be not inert. An action on an element with the
inertattribute, or inside such an element, now times out if the element stays inert. -
Cookie matching now follows RFC 6265. With a URL, BrowserContext.CookiesAsync() and APIRequestContext.CookiesAsync() no longer return host-only cookies for subdomains or
Path=/apicookies for/apiv2, and aPath=/foo/cookie does not match/foo. APIRequestContext sends a cookie without a name asCookie: xinstead ofCookie: =x, and storesSet-Cookie: tokenas a cookie without a name. -
Proxy credentials are no longer sent to websites. The credentials in the
Proxyoption now answer only proxy challenges. To authenticate on a website, useHttpCredentials. -
Text that the browser does not render, such as text that is not assigned to a slot or text directly inside a closed
<details>, is no longer part of accessible names and aria snapshots. This can change the results of Page.GetByRole() with a name, Locator.AriaSnapshotAsync() and Expect(Locator).ToMatchAriaSnapshotAsync(). -
The
ParamsStringoption in APIRequestContext requests is now appended to the query that the URL already has, instead of replacing it.
Announcements
- ⚠️ Playwright for .NET now bundles Node.js 26 instead of Node.js 24. On Linux, Node.js 26 needs the
libatomic1library.
Browser Versions
- Chromium 158.0.8127.18
- Mozilla Firefox 159.0
- WebKit 27.2
This version was also tested against the following stable channels:
- Google Chrome 157
- Microsoft Edge 156