File: release-notes.md | Updated: 11/18/2025
On this page
Version 1.55ā
ToBeVisibleAsync() assertions: Codegen can now generate automatic ToBeVisibleAsync() assertions for common UI interactions. This feature can be enabled in the Codegen settings UI.Added support for Debian 13 "Trixie".
Added support for Xunit v3 as part of Microsoft.Playwright.Xunit.v3
Added support for MSTest v4 as part of Microsoft.Playwright.MSTest.v4
This version was also tested against the following stable channels:
Version 1.54ā
New cookie property PartitionKey in BrowserContext.CookiesAsync()
and BrowserContext.AddCookiesAsync()
. This property allows to save and restore partitioned cookies. See CHIPS MDN article
for more information. Note that browsers have different support and defaults for cookie partitioning.
New option --user-data-dir in multiple commands. You can specify the same user data dir to reuse browsing state, like authentication, between sessions.
pwsh bin/Debug/netX/playwright.ps1 codegen --user-data-dir=./user-data
pwsh bin/Debug/netX/playwright.ps1 open does not open the test recorder anymore. Use pwsh bin/Debug/netX/playwright.ps1 codegen instead.
This version was also tested against the following stable channels:
Version 1.53ā
New Steps in Trace Viewer:
New method Locator.Describe() to describe a locator. Used for trace viewer.
var button = Page.GetByTestId("btn-sub").Describe("Subscribe button");await button.ClickAsync();
pwsh bin/Debug/netX/playwright.ps1 install --list will now list all installed browsers, versions and locations.
This version was also tested against the following stable channels:
Version 1.52ā
New method Expect(Locator).ToContainClassAsync() to ergonomically assert individual class names on the element.
await Expect(Page.GetByRole(AriaRole.Listitem, new() { Name = "Ship v1.52" })).ToContainClassAsync("done");
Aria Snapshots
got two new properties: /children
for strict matching and /url for links.
await Expect(locator).ToMatchAriaSnapshotAsync(@" - list - /children: equal - listitem: Feature A - listitem: - link ""Feature B"": - /url: ""https://playwright.dev""");
? and [] anymore. We recommend using regular expressions instead.Cookie header anymore. If a Cookie header is provided, it will be ignored, and the cookie will be loaded from the browser's cookie store. To set custom cookies, use BrowserContext.AddCookiesAsync()
.This version was also tested against the following stable channels:
Version 1.51ā
New option IndexedDB for BrowserContext.StorageStateAsync() allows to save and restore IndexedDB contents. Useful when your application uses IndexedDB API to store authentication tokens, like Firebase Authentication.
Here is an example following the authentication guide :
// Save storage state into the file. Make sure to include IndexedDB.await context.StorageStateAsync(new(){ Path = "../../../playwright/.auth/state.json", IndexedDB = true});// Create a new context with the saved storage state.var context = await browser.NewContextAsync(new(){ StorageStatePath = "../../../playwright/.auth/state.json"});
New option Visible for Locator.Filter() allows matching only visible elements.
// Ignore invisible todo items.var todoItems = Page.GetByTestId("todo-item").Filter(new() { Visible = true });// Check there are exactly 3 visible ones.await Expect(todoItems).ToHaveCountAsync(3);
New option Contrast for methods Page.EmulateMediaAsync()
and Browser.NewContextAsync()
allows to emulate the prefers-contrast media feature.
New option FailOnStatusCode makes all fetch requests made through the APIRequestContext throw on response codes other than 2xx and 3xx.
This version was also tested against the following stable channels:
Version 1.50ā
canvas content in traces is error-prone. Display is now disabled by default, and can be enabled via the Display canvas content UI setting.Call and Network panels now display additional time information.<input>, <select>, or a number of other editable elements.This version was also tested against the following stable channels:
Version 1.49ā
New assertion Expect(Locator).ToMatchAriaSnapshotAsync() verifies page structure by comparing to an expected accessibility tree, represented as YAML.
await page.GotoAsync("https://playwright.dev");await Expect(page.Locator("body")).ToMatchAriaSnapshotAsync(@" - banner: - heading /Playwright enables reliable/ [level=1] - link ""Get started"" - link ""Star microsoft/playwright on GitHub"" - main: - img ""Browsers (Chromium, Firefox, WebKit)"" - heading ""Any browser ⢠Any platform ⢠One API""");
You can generate this assertion with Test Generator or by calling Locator.AriaSnapshotAsync() .
Learn more in the aria snapshots guide .
New method Tracing.GroupAsync() allows you to visually group actions in the trace viewer.
// All actions between GroupAsync and GroupEndAsync// will be shown in the trace viewer as a group.await Page.Context.Tracing.GroupAsync("Open Playwright.dev > API");await Page.GotoAsync("https://playwright.dev/");await Page.GetByRole(AriaRole.Link, new() { Name = "API" }).ClickAsync();await Page.Context.Tracing.GroupEndAsync();
chrome and msedge channels switch to new headless modeāThis change affects you if you're using one of the following channels in your playwright.config.ts:
chrome, chrome-dev, chrome-beta, or chrome-canarymsedge, msedge-dev, msedge-beta, or msedge-canaryAfter updating to Playwright v1.49, run your test suite. If it still passes, you're good to go. If not, you will probably need to update your snapshots, and adapt some of your test code around PDF viewers and extensions. See issue #33566 for more details.
You can opt into the new headless mode by using 'chromium' channel. As official Chrome documentation puts it
:
New Headless on the other hand is the real Chrome browser, and is thus more authentic, reliable, and offers more features. This makes it more suitable for high-accuracy end-to-end web app testing or browser extension testing.
See issue #33566 for the list of possible breakages you could encounter and more details on Chromium headless. Please file an issue if you see any problems after opting in.
runsettings.xml
<?xml version="1.0" encoding="utf-8"?><RunSettings> <Playwright> <BrowserName>chromium</BrowserName> <LaunchOptions> <Channel>chromium</Channel> </LaunchOptions> </Playwright></RunSettings>
dotnet test -- Playwright.BrowserName=chromium Playwright.LaunchOptions.Channel=chromium
<canvas> elements inside a snapshot now draw a preview.This version was also tested against the following stable channels:
Version 1.48ā
New methods Page.RouteWebSocketAsync()
and BrowserContext.RouteWebSocketAsync()
allow to intercept, modify and mock WebSocket connections initiated in the page. Below is a simple example that mocks WebSocket communication by responding to a "request" with a "response".
await page.RouteWebSocketAsync("/ws", ws => { ws.OnMessage(frame => { if (frame.Text == "request") ws.Send("response"); });});
See WebSocketRoute for more details.
This version was also tested against the following stable channels:
Version 1.47ā
The Network tab in the trace viewer has several nice improvements:
mcr.microsoft.com/playwright/dotnet:v1.47.0 now serves a Playwright image based on Ubuntu 24.04 Noble. To use the 22.04 jammy-based image, please use mcr.microsoft.com/playwright/dotnet:v1.47.0-jammy instead.:latest/:focal/:jammy tag for Playwright Docker images is no longer being published. Pin to a specific version for better stability and reproducibility.macos-13. We recommend upgrading GitHub Actions to macos-14.This version was also tested against the following stable channels:
Version 1.46ā
Playwright now allows to supply client-side certificates, so that server can verify them, as specified by TLS Client Authentication.
You can provide client certificates as a parameter of Browser.NewContextAsync()
and ApiRequest.NewContextAsync()
. The following snippet sets up a client certificate for https://example.com:
var context = await Browser.NewContextAsync(new() { ClientCertificates = [ new() { Origin = "https://example.com", CertPath = "client-certificates/cert.pem", KeyPath = "client-certificates/key.pem", } ]});
BaseURL.maxRetries option in ApiRequestContext.FetchAsync()
which retries on the ECONNRESET network error.This version was also tested against the following stable channels:
Version 1.45ā
Utilizing the new Clock API allows to manipulate and control time within tests to verify time-related behavior. This API covers many common scenarios, including:
testing with predefined time;
keeping consistent time and timers;
monitoring inactivity;
ticking through time manually.
// Initialize clock with some time before the test time and let the page load naturally.// Date.now will progress as the timers fire.await Page.Clock.InstallAsync(new(){ TimeDate = new DateTime(2024, 2, 2, 8, 0, 0)});await Page.GotoAsync("http://localhost:3333");// Pretend that the user closed the laptop lid and opened it again at 10am.// Pause the time once reached that point.await Page.Clock.PauseAtAsync(new DateTime(2024, 2, 2, 10, 0, 0));// Assert the page state.await Expect(Page.GetByTestId("current-time")).ToHaveTextAsync("2/2/2024, 10:00:00 AM");// Close the laptop lid again and open it at 10:30am.await Page.Clock.FastForwardAsync("30:00");await Expect(Page.GetByTestId("current-time")).ToHaveTextAsync("2/2/2024, 10:30:00 AM");
See the clock guide for more details.
Method Locator.SetInputFilesAsync()
now supports uploading a directory for <input type=file webkitdirectory> elements.
await page.GetByLabel("Upload directory").SetInputFilesAsync("mydir");
Multiple methods like Locator.ClickAsync()
or Locator.PressAsync()
now support a ControlOrMeta modifier key. This key maps to Meta on macOS and maps to Control on Windows and Linux.
// Press the common keyboard shortcut Control+S or Meta+S to trigger a "Save" operation.await page.Keyboard.PressAsync("ControlOrMeta+S");
New property httpCredentials.send in ApiRequest.NewContextAsync()
that allows to either always send the Authorization header or only send it in response to 401 Unauthorized.
Playwright now supports Chromium, Firefox and WebKit on Ubuntu 24.04.
v1.45 is the last release to receive WebKit update for macOS 12 Monterey. Please update macOS to keep using the latest WebKit.
This version was also tested against the following stable channels:
Version 1.44ā
Accessibility assertions
Expect(Locator).ToHaveAccessibleNameAsync() checks if the element has the specified accessible name:
var locator = Page.GetByRole(AriaRole.Button);await Expect(locator).ToHaveAccessibleNameAsync("Submit");
Expect(Locator).ToHaveAccessibleDescriptionAsync() checks if the element has the specified accessible description:
var locator = Page.GetByRole(AriaRole.Button);await Expect(locator).ToHaveAccessibleDescriptionAsync("Upload a photo");
Expect(Locator).ToHaveRoleAsync() checks if the element has the specified ARIA role:
var locator = Page.GetByTestId("save-button");await Expect(locator).ToHaveRoleAsync(AriaRole.Button);
Locator handler
After executing the handler added with Page.AddLocatorHandlerAsync()
, Playwright will now wait until the overlay that triggered the handler is not visible anymore. You can opt-out of this behavior with the new NoWaitAfter option.
You can use new Times option in Page.AddLocatorHandlerAsync()
to specify maximum number of times the handler should be run.
The handler in Page.AddLocatorHandlerAsync() now accepts the locator as argument.
New Page.RemoveLocatorHandlerAsync() method for removing previously added locator handlers.
var locator = Page.GetByText("This interstitial covers the button");await Page.AddLocatorHandlerAsync(locator, async (overlay) =>{ await overlay.Locator("#close").ClickAsync();}, new() { Times = 3, NoWaitAfter = true });// Run your tests that can be interrupted by the overlay.// ...await Page.RemoveLocatorHandlerAsync(locator);
Miscellaneous options
New method FormData.Append()
allows to specify repeating fields with the same name in Multipart
option in APIRequestContext.FetchAsync():
var formData = Context.APIRequest.CreateFormData();formData.Append("file", new FilePayload(){ Name = "f1.js", MimeType = "text/javascript", Buffer = System.Text.Encoding.UTF8.GetBytes("var x = 2024;")});formData.Append("file", new FilePayload(){ Name = "f2.txt", MimeType = "text/plain", Buffer = System.Text.Encoding.UTF8.GetBytes("hello")});var response = await Context.APIRequest.PostAsync("https://example.com/uploadFiles", new() { Multipart = formData });
Expect(Page).ToHaveURLAsync()
now supports IgnoreCase option
.
This version was also tested against the following stable channels:
Version 1.43ā
Method BrowserContext.ClearCookiesAsync() now supports filters to remove only some cookies.
// Clear all cookies.await Context.ClearCookiesAsync();// New: clear cookies with a particular name.await Context.ClearCookiesAsync(new() { Name = "session-id" });// New: clear cookies for a particular domain.await Context.ClearCookiesAsync(new() { Domain = "my-origin.com" });
New property Locator.ContentFrame converts a Locator object to a FrameLocator . This can be useful when you have a Locator object obtained somewhere, and later on would like to interact with the content inside the frame.
var locator = Page.Locator("iframe[name='embedded']");// ...var frameLocator = locator.ContentFrame;await frameLocator.GetByRole(AriaRole.Button).ClickAsync();
New property FrameLocator.Owner
converts a FrameLocator
object to a Locator
. This can be useful when you have a FrameLocator
object obtained somewhere, and later on would like to interact with the iframe element.
var frameLocator = page.FrameLocator("iframe[name='embedded']");// ...var locator = frameLocator.Owner;await Expect(locator).ToBeVisibleAsync();
This version was also tested against the following stable channels:
Version 1.42ā
New method Page.AddLocatorHandlerAsync() registers a callback that will be invoked when specified element becomes visible and may block Playwright actions. The callback can get rid of the overlay. Here is an example that closes a cookie dialog when it appears.
// Setup the handler.await Page.AddLocatorHandlerAsync( Page.GetByRole(AriaRole.Heading, new() { Name = "Hej! You are in control of your cookies." }), async () => { await Page.GetByRole(AriaRole.Button, new() { Name = "Accept all" }).ClickAsync(); });// Write the test as usual.await Page.GotoAsync("https://www.ikea.com/");await Page.GetByRole(AriaRole.Link, new() { Name = "Collection of blue and white" }).ClickAsync();await Expect(Page.GetByRole(AriaRole.Heading, new() { Name = "Light and easy" })).ToBeVisibleAsync();
This version was also tested against the following stable channels:
Version 1.41ā
This version was also tested against the following stable channels:
Version 1.40ā
New tools to generate assertions:
Here is an example of a generated test with assertions:
await Page.GotoAsync("https://playwright.dev/");await Page.GetByRole(AriaRole.Link, new() { Name = "Get started" }).ClickAsync();await Expect(Page.GetByLabel("Breadcrumbs").GetByRole(AriaRole.List)).ToContainTextAsync("Installation");await Expect(Page.GetByLabel("Search")).ToBeVisibleAsync();await Page.GetByLabel("Search").ClickAsync();await Page.GetByPlaceholder("Search docs").FillAsync("locator");await Expect(Page.GetByPlaceholder("Search docs")).ToHaveValueAsync("locator");
This version was also tested against the following stable channels:
Version 1.39ā
Evergreen browsers update.
This version was also tested against the following stable channels:
Version 1.38ā
This version was also tested against the following stable channels:
Version 1.37ā
Playwright now supports Debian 12 Bookworm on both x86_64 and arm64 for Chromium, Firefox and WebKit. Let us know if you encounter any issues!
Linux support looks like this:
| | Ubuntu 20.04 | Ubuntu 22.04 | Debian 11 | Debian 12 | | --- | --- | --- | --- | --- | | Chromium | ā | ā | ā | ā | | WebKit | ā | ā | ā | ā | | Firefox | ā | ā | ā | ā |
This version was also tested against the following stable channels:
Version 1.36ā
šļø Summer maintenance release.
This version was also tested against the following stable channels:
Version 1.35ā
New option MaskColor for methods Page.ScreenshotAsync()
and Locator.ScreenshotAsync()
to change default masking color.
New uninstall CLI command to uninstall browser binaries:
$ pwsh bin/Debug/netX/playwright.ps1 uninstall # remove browsers installed by this installation$ pwsh bin/Debug/netX/playwright.ps1 uninstall --all # remove all ever-install Playwright browsers
This version was also tested against the following stable channels:
Version 1.34ā
New Locator.And() to create a locator that matches both locators.
var button = page.GetByRole(AriaRole.BUTTON).And(page.GetByTitle("Subscribe"));
New events BrowserContext.Console and BrowserContext.Dialog to subscribe to any dialogs and console messages from any page from the given browser context. Use the new methods ConsoleMessage.Page and Dialog.Page to pin-point event source.
This version was also tested against the following stable channels:
Version 1.33ā
Use Locator.Or() to create a locator that matches either of the two locators. Consider a scenario where you'd like to click on a "New email" button, but sometimes a security settings dialog shows up instead. In this case, you can wait for either a "New email" button, or a dialog and act accordingly:
var newEmail = Page.GetByRole(AriaRole.Button, new() { Name = "New email" });var dialog = Page.GetByText("Confirm security settings");await Expect(newEmail.Or(dialog)).ToBeVisibleAsync();if (await dialog.IsVisibleAsync()) await Page.GetByRole(AriaRole.Button, new() { Name = "Dismiss" }).ClickAsync();await newEmail.ClickAsync();
Use new options HasNot and HasNotText|HasNotTextRegex in Locator.Filter() to find elements that do not match certain conditions.
var rowLocator = Page.Locator("tr");await rowLocator .Filter(new() { HasNotText = "text in column 1" }) .Filter(new() { HasNot = Page.GetByRole(AriaRole.Button, new() { Name = "column 2 button" })}) .ScreenshotAsync();
Use new web-first assertion Expect(Locator).ToBeAttachedAsync() to ensure that the element is present in the page's DOM. Do not confuse with the Expect(Locator).ToBeVisibleAsync() that ensures that element is both attached & visible.
New option HasNot in Locator.Filter()
New option HasNotText|HasNotTextRegex in Locator.Filter()
New option Timeout in Route.FetchAsync()
mcr.microsoft.com/playwright/dotnet:v1.33.0 now serves a Playwright image based on Ubuntu Jammy. To use the focal-based image, please use mcr.microsoft.com/playwright/dotnet:v1.33.0-focal instead.This version was also tested against the following stable channels:
Version 1.32ā
This version was also tested against the following stable channels:
Version 1.31ā
New assertion Expect(Locator).ToBeInViewportAsync() ensures that locator points to an element that intersects viewport, according to the intersection observer API .
var locator = Page.GetByRole(AriaRole.Button);// Make sure at least some part of element intersects viewport.await Expect(locator).ToBeInViewportAsync();// Make sure element is fully outside of viewport.await Expect(locator).Not.ToBeInViewportAsync();// Make sure that at least half of the element intersects viewport.await Expect(locator).ToBeInViewportAsync(new() { Ratio = 0.5 });
New methods BrowserContext.NewCDPSessionAsync() and Browser.NewBrowserCDPSessionAsync() create a Chrome DevTools Protocol session for the page and browser respectively.
This version was also tested against the following stable channels:
Version 1.30ā
This version was also tested against the following stable channels:
Version 1.29ā
New method Route.FetchAsync()
and new option Json for Route.FulfillAsync()
:
await Page.RouteAsync("**/api/settings", async route => { // Fetch original settings. var response = await route.FetchAsync(); // Force settings theme to a predefined value. var json = await response.JsonAsync<MyDataType>(); json.Theme = "Solarized"; // Fulfill with modified data. await route.FulfillAsync(new() { Json = json });});
New method Locator.AllAsync() to iterate over all matching elements:
// Check all checkboxes!var checkboxes = Page.GetByRole(AriaRole.Checkbox);foreach (var checkbox in await checkboxes.AllAsync()) await checkbox.CheckAsync();
Locator.SelectOptionAsync() matches now by value or label:
<select multiple> <option value="red">Red</option> <option value="green">Green</option> <option value="blue">Blue</option></select>
await element.SelectOptionAsync("Red");
This version was also tested against the following stable channels:
Version 1.28ā

This version was also tested against the following stable channels:
Version 1.27ā
With these new APIs writing locators is a joy:
Page.GetByText() to locate by text content.
Page.GetByRole() to locate by ARIA role , ARIA attributes and accessible name .
Page.GetByLabel() to locate a form control by associated label's text.
Page.GetByTestId()
to locate an element based on its data-testid attribute (other attribute can be configured).
Page.GetByPlaceholder() to locate an input by placeholder.
Page.GetByAltText() to locate an element, usually image, by its text alternative.
Page.GetByTitle() to locate an element by its title.
await page.GetByLabel("User Name").FillAsync("John");await page.GetByLabel("Password").FillAsync("secret-password");await page.GetByRole(AriaRole.Button, new() { NameString = "Sign in" }).ClickAsync();await Expect(Page.GetByText("Welcome, John!")).ToBeVisibleAsync();
All the same methods are also available on Locator , FrameLocator and Frame classes.
Expect(Locator).ToHaveAttributeAsync()
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.
await Expect(Page.GetByRole(AriaRole.Button)).ToHaveAttributeAsync("disabled", "");
This version was also tested against the following stable channels:
Version 1.26ā
Enabled for Expect(Locator).ToBeEnabledAsync()
.Editable for Expect(Locator).ToBeEditableAsync()
.Visible for Expect(Locator).ToBeVisibleAsync()
.MaxRedirects for ApiRequestContext.GetAsync()
and others to limit redirect count.A bunch of Playwright APIs already support the WaitUntil: WaitUntilState.DOMContentLoaded option. For example:
await Page.GotoAsync("https://playwright.dev", new() { WaitUntil = WaitUntilState.DOMContentLoaded });
Prior to 1.26, this would wait for all iframes to fire the DOMContentLoaded event.
To align with web specification, the WaitUntilState.DOMContentLoaded value only waits for the target frame to fire the 'DOMContentLoaded' event. Use WaitUntil: WaitUntilState.Load to wait for all iframes.
This version was also tested against the following stable channels:
Version 1.25ā
Microsoft.Playwright.NUnit and Microsoft.Playwright.MSTest will now consider the .runsettings file and passed settings via the CLI when running end-to-end tests. See in the documentation
for a full list of supported settings.
The following does now work:
<?xml version="1.0" encoding="utf-8"?><RunSettings> <!-- Playwright --> <Playwright> <BrowserName>chromium</BrowserName> <ExpectTimeout>5000</ExpectTimeout> <LaunchOptions> <Headless>true</Headless> <Channel>msedge</Channel> </LaunchOptions> </Playwright> <!-- General run configuration --> <RunConfiguration> <EnvironmentVariables> <!-- For debugging selectors, it's recommend to set the following environment variable --> <DEBUG>pw:api</DEBUG> </EnvironmentVariables> </RunConfiguration></RunSettings>
This version was also tested against the following stable channels:
Version 1.24ā
Playwright now supports Debian 11 Bullseye on x86_64 for Chromium, Firefox and WebKit. Let us know if you encounter any issues!
Linux support looks like this:
| | Ubuntu 20.04 | Ubuntu 22.04 | Debian 11 | :--- | :---: | :---: | :---: | :---: | | Chromium | ā | ā | ā | | WebKit | ā | ā | ā | | Firefox | ā | ā | ā |
We rewrote our Getting Started docs to be more end-to-end testing focused. Check them out on playwright.dev .
Version 1.23ā
Playwright for .NET 1.23 introduces new API Testing that lets you send requests to the server directly from .NET! Now you can:
To do a request on behalf of Playwright's Page, use new Page.APIRequest API:
// Do a GET request on behalf of pagevar response = await Page.APIRequest.GetAsync("http://example.com/foo.json");Console.WriteLine(response.Status);Console.WriteLine(response.StatusText);Console.WriteLine(response.Ok);Console.WriteLine(response.Headers["Content-Type"]);Console.WriteLine(await response.TextAsync());Console.WriteLine((await response.JsonAsync())?.GetProperty("foo").GetString());
Read more about it in our API testing guide .
Now you can record network traffic into a HAR file and re-use this traffic in your tests.
To record network into HAR file:
pwsh bin/Debug/netX/playwright.ps1 open --save-har=example.har --save-har-glob="**/api/**" https://example.com
Alternatively, you can record HAR programmatically:
var context = await browser.NewContextAsync(new(){ RecordHarPath = harPath, RecordHarUrlFilterString = "**/api/**",});// ... Perform actions ...// Close context to ensure HAR is saved to disk.context.CloseAsync();
Use the new methods Page.RouteFromHARAsync() or BrowserContext.RouteFromHARAsync() to serve matching responses from the HAR file:
await context.RouteFromHARAsync("example.har");
Read more in our documentation .
You can now use Route.FallbackAsync() to defer routing to other handlers.
Consider the following example:
// Remove a header from all requests.await page.RouteAsync("**/*", async route =>{ var headers = route.Request.Headers; headers.Remove("X-Secret"); await route.ContinueAsync(new() { Headers = headers });});// Abort all images.await page.RouteAsync("**/*", async route =>{ if (route.Request.ResourceType == "image") { await route.AbortAsync(); } else { await route.FallbackAsync(); }});
Note that the new methods Page.RouteFromHARAsync() and BrowserContext.RouteFromHARAsync() also participate in routing and could be deferred to.
<select multiple> element.ignoreCase option.If there's a service worker that's in your way, you can now easily disable it with a new context option serviceWorkers:
var context = await Browser.NewContextAsync(new(){ ServiceWorkers = ServiceWorkerPolicy.Block});
Using .zip path for recordHar context option automatically zips the resulting HAR:
var context = await Browser.NewContextAsync(new() { RecordHarPath = "example.har.zip" });
If you intend to edit HAR by hand, consider using the "minimal" HAR recording mode that only records information that is essential for replaying:
var context = await Browser.NewContextAsync(new() { RecordHarPath = "example.har", RecordHarMode = HarMode.Minimal });
Playwright now runs on Ubuntu 22 amd64 and Ubuntu 22 arm64.
Playwright for .NET now supports linux-arm64 and provides a arm64 Ubuntu 20.04 Docker image for it.
Version 1.22ā
Role selectors that allow selecting elements by their ARIA role , ARIA attributes and accessible name .
// Click a button with accessible name "log in"await page.Locator("role=button[name='log in']").ClickAsync();
Read more in our documentation .
New Locator.Filter() API to filter an existing locator
var buttons = page.Locator("role=button");// ...var submitLocator = buttons.Filter(new() { HasText = "Sign up" });await submitLocator.ClickAsync();
Version 1.21ā
New role selectors that allow selecting elements by their ARIA role , ARIA attributes and accessible name .
// Click a button with accessible name "log in"await page.Locator("role=button[name='log in']").ClickAsync();
Read more in our documentation .
New scale option in Page.ScreenshotAsync()
for smaller sized screenshots.
New caret option in Page.ScreenshotAsync()
to control text caret. Defaults to "hide".
We now ship a designated .NET docker image mcr.microsoft.com/playwright/dotnet. Read more in our documentation
.
This version was also tested against the following stable channels:
Version 1.20ā
Playwright for .NET 1.20 introduces Web-First Assertions .
Consider the following example:
using System.Threading.Tasks;using Microsoft.Playwright.NUnit;using NUnit.Framework;namespace PlaywrightTests;[TestFixture]public class ExampleTests : PageTest{ [Test] public async Task StatusBecomesSubmitted() { await Expect(Page.Locator(".status")).ToHaveTextAsync("Submitted"); }}
Playwright will be re-testing the node with the selector .status until fetched Node has the "Submitted" text. It will be re-fetching the node and checking it over and over, until the condition is met or until the timeout is reached. You can pass this timeout as an option.
Read more in our documentation .
ScreenshotAnimations.Disabled rewinds all CSS animations and transitions to a consistent statemask: Locator[] masks given elements, overlaying them with pink #FF00FF boxes.This version was also tested against the following stable channels:
Version 1.19ā
Locator now supports a has option that makes sure it contains another locator inside:
await Page.Locator("article", new() { Has = Page.Locator(".highlight") }).ClickAsync();
Read more in locator documentation
New Locator.Page
Page.ScreenshotAsync() and Locator.ScreenshotAsync() now automatically hide blinking caret
Playwright Codegen now generates locators and frame locators
This version was also tested against the following stable channels:
Version 1.18ā
Each locator can now be optionally filtered by the text it contains:
await Page.Locator("li", new() { HasTextString = "My Item" }) .Locator("button").click();
Read more in locator documentation
AcceptDownloads
option now defaults to true.Sources
option to embed sources into traces.This version was also tested against the following stable channels:
Version 1.17ā
Playwright 1.17 introduces frame locators
iframe and then locate elements in that iframe. Frame locators are strict by default, will wait for iframe to appear and can be used in Web-First assertions.
Frame locators can be created with either Page.FrameLocator() or Locator.FrameLocator() method.
var locator = page.FrameLocator("#my-frame").Locator("text=Submit");await locator.ClickAsync();
Read more at our documentation .
Playwright Trace Viewer is now available online at https://trace.playwright.dev
! Just drag-and-drop your trace.zip file to inspect its contents.
NOTE: trace files are not uploaded anywhere; trace.playwright.dev is a progressive web application that processes traces locally.


Playwright now supports Ubuntu 20.04 ARM64. You can now run Playwright tests inside Docker on Apple M1 and on Raspberry Pi.
You can now use Playwright to install stable version of Edge on Linux:
pwsh bin/Debug/netX/playwright.ps1 install msedge
Version 1.16ā
Wait for a locator to resolve to a single element with a given state. Defaults to the state: 'visible'.
var orderSent = page.Locator("#order-sent");orderSent.WaitForAsync();
Read more about Locator.WaitForAsync() .
pwsh bin/Debug/netX/playwright.ps1 show-trace and drop trace files to the trace viewer PWARead more about Trace Viewer .
This version of Playwright was also tested against the following stable channels:
Version 1.15ā
By using Mouse.WheelAsync() you are now able to scroll vertically or horizontally.
Previously it was not possible to get multiple header values of a response. This is now possible and additional helper functions are available:
Its now possible to emulate the forced-colors CSS media feature by passing it in the Browser.NewContextAsync()
or calling Page.EmulateMediaAsync()
.
times option to specify how many times this route should be matched.Version 1.14ā
Selector ambiguity is a common problem in automation testing. "strict" mode ensures that your selector points to a single element and throws otherwise.
Set setStrict(true) in your action calls to opt in.
// This will throw if you have more than one button!await page.Locator("button", new() { Strict = true });
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 .
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.Locator("_react=SubmitButton[enabled=true]").ClickAsync();await page.Locator("_vue=submit-button[enabled=true]").ClickAsync();
Learn more in the react selectors documentation and the vue selectors documentation .
nthand 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 buttonsawait button.ClickAsync("button >> nth=0");// or if you are using locators, you can use First, Nth() and Lastawait page.Locator("button").First.ClickAsync();// click a visible buttonawait button.ClickAsync("button >> visible=true");
Version 1.13ā
recordHar option in Browser.NewContextAsync()
.console.log() calls.new baseURL option in Browser.NewContextAsync()
and Browser.NewPageAsync()
Response.SecurityDetailsAsync() and Response.ServerAddrAsync()
Page.InputValueAsync() , Frame.InputValueAsync() and ElementHandle.InputValueAsync()
new force option in Page.FillAsync()
, Frame.FillAsync()
, and ElementHandle.FillAsync()
new force option in Page.SelectOptionAsync()
, Frame.SelectOptionAsync()
, and ElementHandle.SelectOptionAsync()
Version 1.12ā
This version of Playwright was also tested against the following stable channels:
Google Chrome 91
Microsoft Edge 91