NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
NuGet
NuGet, #755 most downloaded on NuGet
Playwright enables reliable end-to-end testing for modern web apps. It is built to enable cross-browser web automation that is ever-green, capable, reliable and fast. Learn more at https://playwright.dev/dotnet/.
Latest stable
1.64.1
Last release 1 months ago
22 Oct 2026
Ships fairly regularly
a new release about every 6 weeks
Nearly every release is documented
notes for 60 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
6 years old
106 releases · first in 2021
Drag across the ruler to compare, or tap a release to open it.
This version was also tested against the following stable channels:
#3391 - chore(driver): bump bundled Node.js to 24.22.1
This version was also tested against the following stable channels:
It replaces the FontSize option, which is now deprecated.
New page.Webmcp and frame.Webmcp give access to the tools that a page registers through the experimental WebMCP browser API, so you can test them like any other part of your app:
var browser = await playwright.Chromium.LaunchAsync(new() { Args = new[] { "--enable-features=WebMCP" } });
var page = await browser.NewPageAsync();
await page.GotoAsync("https://example.com");
foreach (var tool in await page.Webmcp.ToolsAsync())
Console.WriteLine($"{tool.Name}: {tool.Description}");
var result = await page.Webmcp.CallToolAsync("add", new { a = 2, b = 40 });
Console.WriteLine(result?.GetProperty("content")[0].GetProperty("text")); // "42"
Playwright MCP also supports WebMCP by default, with page-defined tools offered to the agent as webmcp_<tool>. Pass --no-webmcp to opt out.
playwright-cli exposes them as well:
playwright-cli webmcp-list
playwright-cli webmcp-call search_catalog --params '{"query":"cats"}'
Videos can now be recorded at a custom frame rate, and the decorations for actions are styled with plain CSS:
await page.Screencast.StartAsync(new()
{
Path = "video.webm",
Size = new() { Width = 1920, Height = 1080 },
Fps = 60,
});
await page.Screencast.ShowActionsAsync(new()
{
Style = new()
{
Point = "width: 20px; height: 20px; border-radius: 50%; background: red",
Highlight = "outline: 2px solid #333; background: rgba(0, 128, 255, .15)",
Title = "font-size: 16px",
},
});
RecordVideoFps option and new Fps option in Screencast.StartAsync(). Firefox and WebKit currently capture up to 25 frames per second.Style option takes CSS declarations for the Point marker, the target Highlight and the action Title. It replaces the FontSize option, which is now deprecated.playwright-cli.New Locator.Within() combines two locators that you already have, reading in the natural order - "this button, within that dialog":
var saveButton = page.GetByRole(AriaRole.Button, new() { Name = "Save" });
var dialog = page.GetByTestId("settings-dialog");
await saveButton.Within(dialog).ClickAsync();
Relative locators such as Locator.Nth() or Locator.First are resolved inside each parent separately, which makes column-like queries straightforward:
// The third cell of every row, not the third cell in the table.
var thirdColumn = page.GetByRole(AriaRole.Cell).Nth(2).Within(page.GetByRole(AriaRole.Row));
await Expect(thirdColumn).ToHaveTextAsync(new[] { "Apple", "Banana", "Cherry" });
New Page.GetByRef() locates an element by its aria ref, such as e2, reported by Page.AriaSnapshotAsync() in the AriaSnapshotMode.Ai mode.
New option IncludeShadow in Page.ContentAsync() and Frame.ContentAsync() serializes open shadow roots as declarative shadow DOM.
New option SignCount sets the initial signature counter of a virtual credential. Credentials.CreateAsync() and Credentials.GetAsync() return the current SignCount, and it is saved and restored together with the credentials in the storage state.
New APIRequestContext.AddCookiesAsync(), APIRequestContext.CookiesAsync() and APIRequestContext.ClearCookiesAsync() manage cookies of a request context, mirroring the BrowserContext methods:
await request.AddCookiesAsync(new[]
{
new Cookie { Name = "session-id", Value = "42", Url = "https://example.com" },
});
Console.WriteLine(await request.CookiesAsync("https://example.com"));
await request.ClearCookiesAsync(new() { Name = "session-id" });
visibility: hidden, are now considered hidden by actions, Locator.IsVisibleAsync() and Expect(locator).ToBeVisibleAsync().This version was also tested against the following stable channels:
Your coding agent can read these notes before it upgrades. Set up the MCP server →
Page.FrameLocator() and Frame.FrameLocator() called without a selector search in any frame of the subtree, so you no longer need to locate the iframe
Page.FrameLocator() and Frame.FrameLocator() called without a selector search in any frame of the subtree, so you no longer need to locate the iframe first:
// Finds the button in any frame on the page.
await Page.FrameLocator().GetByRole(AriaRole.Button).ClickAsync();
The rest of the locator resolves inside a single frame, just like a regular locator, and an error is thrown when it matches elements in several frames.
New Locator.Visible returns a locator that matches only visible elements. It is the recommended
replacement for the :visible CSS pseudo-class:
await Page.Locator("button").Visible.ClickAsync();
New AriaSnapshots and ScreenSnapshots options of Tracing.StartAsync() capture an aria snapshot and a screenshot of the page on every action:
await context.Tracing.StartAsync(new()
{
Snapshots = true,
AriaSnapshots = true,
ScreenSnapshots = true
});
With aria and screen snapshots recorded, the new Display Aria mode in the trace viewer shows the action screenshot side by side with the aria snapshot, and hovering an aria node highlights it on the screenshot.
HttpCredentialsList now also accepts an array of credentials. The first entry matching the request origin is used, and entries without an origin match any request.Opfs includes the origin private file system in the storage state, so it can be persisted and restored into later contexts.pwsh bin/Debug/netX/playwright.ps1 install --no-remove keeps the browsers of other Playwright installations instead of removing them.pwsh bin/Debug/netX/playwright.ps1 codegen --http-credentials records against pages behind HTTP authentication.This version was also tested against the following stable channels:
page.screenshot() and locator.screenshot() can now capture screenshots in the WebP format — Playwright infers the format from a .webp file extension,
page.screenshot() and locator.screenshot() can now capture screenshots in the WebP format — Playwright infers the format from a .webp file extension, or you can set the type explicitly. Quality 100 (the default) is lossless, while lower values use lossy compression:
await Page.ScreenshotAsync(new() { Path = "homepage.webp", Quality = 50 });
Scroll option (Auto | None) on actions to opt out of Playwright's automatic scroll-into-view.navigator.clipboard no longer read or overwrite the clipboard of the machine running them.This version was also tested against the following stable channels:
New Credentials virtual authenticator, available via BrowserContext.Credentials, lets tests register passkeys and answer navigator.credentials.create(
New Credentials virtual authenticator, available via BrowserContext.Credentials, lets tests register passkeys and answer navigator.credentials.create() / navigator.credentials.get() ceremonies in the page — no real hardware key required, works in all browsers:
var context = await browser.NewContextAsync();
// Seed a passkey your backend provisioned for a test user.
await context.Credentials.CreateAsync("example.com", new()
{
Id = credentialId,
UserHandle = userHandle,
PrivateKey = privateKey,
PublicKey = publicKey,
});
await context.Credentials.InstallAsync();
var page = await context.NewPageAsync();
await page.GotoAsync("https://example.com/login");
// The page's navigator.credentials.get() is answered with the seeded passkey.
You can also let the app register a passkey once in a setup test, read it back with Credentials.GetAsync(), and seed it into later tests — see Credentials for details.
New WebStorage API, available via Page.LocalStorage and Page.SessionStorage, reads and writes the page's storage for the current origin:
await page.LocalStorage.SetItemAsync("token", "abc");
var token = await page.LocalStorage.GetItemAsync("token");
var items = await page.SessionStorage.ItemsAsync();
ArtifactsDir in BrowserType.ConnectOverCDPAsync() controls where artifacts such as traces and downloads are stored when attached to an existing browser.Cursor in Screencast.ShowActionsAsync() controls the cursor decoration rendered for pointer actions.OnFrame callback in Screencast.StartAsync() now receives a Timestamp of when the frame was presented by the browser.This version was also tested against the following stable channels:
Removed long-deprecated Handle option on BrowserContext.ExposeBindingAsync and Page.ExposeBindingAsync.
Expect() overloads now accept a custom message that is prepended to any failure, giving extra context in test reports:
await Expect(page.Locator("#status"), "Should be logged in").ToBeVisibleAsync();
When the assertion fails, the message is prefixed:
Should be logged in
Locator expected to be visible
Tracing.StartHarAsync() / Tracing.StopHarAsync() expose HAR recording as a first-class tracing API, with the same Content, Mode and UrlFilter options as RecordHar:
await context.Tracing.StartHarAsync("trace.har");
var page = await context.NewPageAsync();
await page.GotoAsync("https://playwright.dev");
await context.Tracing.StopHarAsync();
New Locator.DropAsync() simulates an external drag-and-drop of files or clipboard-like data onto an element. Playwright dispatches dragenter, dragover, and drop with a synthetic [DataTransfer] in the page context — works cross-browser and is great for testing upload zones:
await page.Locator("#dropzone").DropAsync(new() {
Files = new FilePayload() {
Name = "note.txt",
MimeType = "text/plain",
Buffer = Encoding.UTF8.GetBytes("hello"),
},
});
await page.Locator("#dropzone").DropAsync(new() {
Data = new Dictionary<string, string> {
["text/plain"] = "hello world",
["text/uri-list"] = "https://example.com",
},
});
Page.Locator("body").Boxes option on Locator.AriaSnapshotAsync() / Page.AriaSnapshotAsync() appends each element's bounding box as [box=x,y,width,height], useful for AI consumption.Page now implements IAsyncDisposable — pages can be used with await using for automatic cleanup.Description in Page.GetByRole() / Locator.GetByRole() / Frame.GetByRole() / FrameLocator.GetByRole() for matching the accessible description.Pseudo in Expect(locator).ToHaveCSSAsync() reads computed styles from ::before or ::after.Style in Locator.HighlightAsync() applies extra inline CSS to the highlight overlay, plus new Page.HideHighlightAsync() to clear all highlights.NoDefaults in BrowserType.ConnectOverCDPAsync() disables Playwright's default overrides on the default context (download behavior, focus emulation, media emulation), so attaching to a user's daily-driver browser doesn't disturb its state.Handle option on BrowserContext.ExposeBindingAsync and Page.ExposeBindingAsync.This version was also tested against the following stable channels:
New Page.Screencast API provides a unified interface for capturing page content with:
New Page.Screencast API provides a unified interface for capturing page content with:
<center>
<img src="https://raw.githubusercontent.com/microsoft/playwright/main/docs/src/images/release-notes-1.59-screencast-demo.gif" alt="Demo" width="500" height="313" />
</center>
Screencast recording — record video with precise start/stop control, as an alternative to the recordVideoDir option:
await page.Screencast.StartAsync(new() { Path = "video.webm" });
// ... perform actions ...
await page.Screencast.StopAsync();
Action annotations — enable built-in visual annotations that highlight interacted elements and display action titles during recording:
await page.Screencast.ShowActionsAsync(new() { Position = "top-right" });
ShowActionsAsync accepts Position ("top-left", "top", "top-right", "bottom-left", "bottom", "bottom-right"), Duration (ms per annotation), and FontSize (px). Returns a disposable to stop showing actions.
Visual overlays — add chapter titles and custom HTML overlays on top of the page for richer narration:
await page.Screencast.ShowChapterAsync("Adding TODOs", new() {
Description = "Type and press enter for each TODO",
Duration = 1000,
});
await page.Screencast.ShowOverlayAsync("<div style=\"color: red\">Recording</div>");
Real-time frame capture — stream JPEG-encoded frames for custom processing like thumbnails, live previews, AI vision, and more:
await page.Screencast.StartAsync(new() {
OnFrame = frame => SendToVisionModel(frame.Data),
});
Agentic video receipts — coding agents can produce video evidence of their work. After completing a task, an agent can record a walkthrough video with rich annotations for human review:
await page.Screencast.StartAsync(new() { Path = "receipt.webm" });
await page.Screencast.ShowActionsAsync(new() { Position = "top-right" });
await page.Screencast.ShowChapterAsync("Verifying checkout flow", new() {
Description = "Added coupon code support per ticket #1234",
});
// Agent performs the verification steps...
await page.Locator("#coupon").FillAsync("SAVE20");
await page.Locator("#apply-coupon").ClickAsync();
await Expect(page.Locator(".discount")).ToContainTextAsync("20%");
await page.Screencast.ShowChapterAsync("Done", new() {
Description = "Coupon applied, discount reflected in total",
});
await page.Screencast.StopAsync();
The resulting video serves as a receipt: chapter titles provide context, action annotations highlight each interaction, and the visual walkthrough is faster to review than text logs.
Page.Locator("body").AriaSnapshotAsync().Depth and Mode in Locator.AriaSnapshotAsync().Filter in Page.ConsoleMessagesAsync() and page.pageErrors() controls which messages are returned.Live in Tracing.StartAsync() for real-time trace updates.ArtifactsDir in BrowserType.LaunchAsync() to configure the artifacts directory.New Browser.BindAsync() API makes a launched browser available for playwright-cli, @playwright/mcp, and other clients to connect to.
Bind a browser — start a browser and bind it so others can connect:
var serverInfo = await browser.BindAsync("my-session", new() {
WorkspaceDir = "/my/project",
});
Connect from playwright-cli — connect to the running browser from your favorite coding agent.
playwright-cli attach my-session
playwright-cli -s my-session snapshot
Connect from @playwright/mcp — or point your MCP server to the running browser.
@playwright/mcp --endpoint=my-session
Connect from a Playwright client — use API to connect to the browser. Multiple clients at a time are supported!
var browser = await chromium.ConnectAsync(serverInfo.Endpoint);
Pass Host and Port options to bind over WebSocket instead of a named pipe:
var serverInfo = await browser.BindAsync("my-session", new() {
Host = "localhost",
Port = 0,
});
// serverInfo.Endpoint is a ws:// URL
Call Browser.UnbindAsync() to stop accepting new connections.
Run npx playwright-cli show to open the Dashboard that lists all the bound browsers, their statuses, and allows interacting with them:
<center>
<img src="https://raw.githubusercontent.com/microsoft/playwright/main/docs/src/images/release-notes-1.59-dashboard.png" alt="Demo" width="1169" height="835" />
</center>
This version was also tested against the following stable channels:
New 'system' theme option follows your OS dark/light mode preference
Thanks to @cpAdm for contributing these improvements!
BrowserType.ConnectOverCDPAsync() now accepts an IsLocal option. When set to true, it tells Playwright that it runs on the same host as the CDP server, enabling file system optimizations.
_react and _vue selectors. See locators guide for alternatives.:light selector engine suffix. Use standard CSS selectors instead.Devtools from BrowserType.LaunchAsync() has been removed. Use Args = new[] { "--auto-open-devtools-for-tabs" } instead.After 3 years of being deprecated, we removed Page.Accessibility from our API. Please use other libraries such as Axe if you need to test page accessi…
Starting with this release, Playwright switches from Chromium, to using Chrome for Testing builds. Both headed and headless browsers are subject to this. Your tests should still be passing after upgrading to Playwright 1.57.
We're expecting no functional changes to come from this switch. The biggest change is the new icon and title in your toolbar.
<img width="500" alt="new and old logo" src="https://github.com/user-attachments/assets/e9a5c4f2-9f35-4c27-9382-0f5eda377097" />
If you still see an unexpected behaviour change, please file an issue.
On Arm64 Linux, Playwright continues to use Chromium.
After 3 years of being deprecated, we removed Page.Accessibility from our API. Please use other libraries such as Axe if you need to test page accessibility. See our Node.js guide for integration with Axe.
Steps in Locator.ClickAsync() and Locator.DragToAsync() that configures the number of mousemove events emitted while moving the mouse pointer to the target element.Event BrowserContext.BackgroundPage has been deprecated and will not be emitted. Property BrowserContext.BackgroundPages will return an empty list
input placeholderAutomatic ToBeVisibleAsync() assertions: Codegen can now generate automatic ToBeVisibleAsync() assertions for common UI interactions. This feature can
ToBeVisibleAsync() assertions: Codegen can now generate automatic ToBeVisibleAsync() assertions for common UI interactions. This feature can be enabled in the Codegen settings UI.Microsoft.Playwright.Xunit.v3Microsoft.Playwright.MSTest.v4This version was also tested against the following stable channels:
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
New cookie property PartitionKey in browserContext.cookies() and browserContext.addCookies(). This property allows to save and restore partitioned coo
New cookie property PartitionKey in browserContext.cookies() and browserContext.addCookies(). 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:
New method Locator.Describe() to describe a locator. Used for trace viewer.
New Steps in Trace Viewer: <img src="https://github.com/user-attachments/assets/1963ff7d-4070-41be-a79b-4333176921a2" alt="New Trace Viewer Steps" height="500">
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:
macOS 13 is now deprecated and will no longer receive WebKit updates. Please upgrade to a more recent macOS version to continue benefiting from the la…
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""
");
MaxRedirects in apiRequest.NewContextAsync() to control the maximum number of redirects.Ref in locator.AriaSnapshotAsync() to generate reference for each element in the snapshot which can later be used to locate the element.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:
New option `IndexedDB` for BrowserContext.StorageStateAsync() allows to save and restore IndexedDB contents. Useful when your application uses Indexed
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.emulateMedia() 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:
Support for xUnit 2.8+ via Microsoft.Playwright.Xunit. Follow our Getting Started guide to learn more.
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:
Nothing published for this version
Nothing published for this version
New assertion Expect(locator).toMatchAriaSnapshot() verifies page structure by comparing to an expected accessibility tree, represented as YAML.
New assertion Expect(locator).toMatchAriaSnapshot() 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.ariaSnapshot().
Learn more in the aria snapshots guide.
New method tracing.group() 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 modeThis 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:
New methods Page.RouteWebSocketAsync() and BrowserContext.RouteWebSocketAsync() allow to intercept, modify and mock WebSocket connections initiated in
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(message => {
if (message.Text == "request")
ws.Send("response");
});
});
See WebSocketRoute for more details.
This version was also tested against the following stable channels:
NoWaitAfter in locator.selectOption() was deprecated.
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.cert and key as byte arrays instead of file paths.NoWaitAfter in locator.selectOption() was deprecated.macos-13. We recommend upgrading GitHub Actions to macos-14.This version was also tested against the following stable channels:
Playwright now allows to supply client-side certificates, so that server can verify them, as specified by TLS Client Authentication.
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",
}
]
});
When using the MSTest or NUnit base-classes, these can be added by using the ContextOptions method.
BaseURL.MaxRetries option in apiRequestContext.FetchAsync() which retries on the ECONNRESET network error.This version was also tested against the following stable channels:
https://github.com/microsoft/playwright-java/issues/1617 - [Bug]: Trace Viewer not reporting all actions https://github.com/microsoft/playwright/issue
https://github.com/microsoft/playwright-java/issues/1617 - [Bug]: Trace Viewer not reporting all actions https://github.com/microsoft/playwright/issues/31764 - [Bug]: some actions do not appear in the trace file
This version was also tested against the following stable channels:
Utilizing the new Clock API allows to manipulate and control time within tests to verify time-related behavior. This API covers many common scenarios,
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:
// 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.
<input type=file webkitdirectory> elements.await page.GetByLabel("Upload directory").SetInputFilesAsync("mydir");
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");
httpCredentials.send in apiRequest.newContext() that allows to either always send the Authorization header or only send it in response to 401 Unauthorized.This version was also tested against the following stable channels:
Expect(locator).ToHaveAccessibleNameAsync() checks if the element has the specified accessible name:
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
NoWaitAfter option.Times option in page.AddLocatorHandlerAsync() to specify maximum number of times the handler should be run.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
Multipart option in APIRequestContext.FetchAsync() supports now repeating fields with the same name using formData.append():
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:
Method BrowserContext.ClearCookiesAsync() now supports filters to remove only some cookies.
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:
New method page.addLocatorHandler(locator, handler, handler, handler) registers a callback that will be invoked when specified element becomes visible
New method page.addLocatorHandler(locator, handler, handler, handler) 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();
tagged and outline.This version was also tested against the following stable channels:
Nothing published for this version
Nothing published for this version
Nothing published for this version
https://github.com/microsoft/playwright/issues/29067 - [REGRESSION] Codegen/Recorder: not all clicks are being actioned nor recorded https://github.co
https://github.com/microsoft/playwright/issues/29067 - [REGRESSION] Codegen/Recorder: not all clicks are being actioned nor recorded https://github.com/microsoft/playwright/issues/29019 - [REGRESSION] trace.playwright.dev does not currently support the loading from URL
This version was also tested against the following stable channels:
[REGRESSION] - ChromiumSandbox protocol mismatch
This version was also tested against the following stable channels:
New method page.UnrouteAllAsync() removes all routes registered by page.RouteAsync(url, handler) and page.RouteFromHARAsync(har). Optionally allows to
style in page.ScreenshotAsync() and locator.ScreenshotAsync() to add custom CSS to the page before taking a screenshot.This version was also tested against the following stable channels:
New tools to generate assertions:
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");
Reason in Page.CloseAsync([options]), BrowserContext.CloseAsync([options]) and Browser.CloseAsync([options]). Close reason is reported for all operations interrupted by the closure.FirefoxUserPrefs in browserType.launchPersistentContext(userDataDir[, options]).When using Microsoft.Playwright.MSTest or Microsoft.Playwright.NUnit, Locale and ColorScheme were taken from the operating system as a default. After v1.40, its now aligned with Playwright for Node.js to en-US and light. In order to opt-in for the previous behaviour, the ContextOptions method can be overidden.
using Microsoft.Playwright.NUnit;
namespace PlaywrightTests;
[Parallelizable(ParallelScope.Self)]
[TestFixture]
public class MyTest : PageTest
{
public override BrowserNewContextOptions ContextOptions()
{
return new BrowserNewContextOptions()
{
Locale = "en-GB",
ColorScheme = ColorScheme.Light,
};
}
}
This version was also tested against the following stable channels:
This version was also tested against the following stable channels:
Evergreen browsers update.
This version was also tested against the following stable channels:
The following methods were deprecated: [Page.TypeAsync()], [Frame.TypeAsync()], [Locator.TypeAsync()] and [ElementHandle.TypeAsync()]. Please use [Loc…
Page.TypeAsync(), Frame.TypeAsync(), Locator.TypeAsync() and ElementHandle.TypeAsync().
Please use Locator.FillAsync() instead which is much faster. Use Locator.PressSequentiallyAsync() only if there is a
special keyboard handling on the page, and you need to press keys one-by-one.This version was also tested against the following stable channels:
[REGRESSION]: Playwright.CreateAsync() did not work in applications without a Console.
Fixes:
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!
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:
This version was also tested against the following stable channels:
🏝️ Summer maintenance release.
This version was also tested against the following stable channels:
Nothing published for this version
New option MaskColor for methods `Page.screenshot()` and `Locator.screenshot()` to change default masking color.
New option MaskColor for methods Page.screenshot() and Locator.screenshot() 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:
New `Locator.And` to create a locator that matches both locators.
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:
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, b
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" });
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 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().ToBeAttachedAsync() to ensure that the element
is present in the page's DOM. Do not confuse with the Expect().ToBeVisibleAsync() that ensures that
element is both attached & visible.
Locator.OrHasNot in Locator.FilterHasNotText in Locator.FilterExpect().ToBeAttachedAsyncTimeout in Route.FetchAsyncmcr.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:
Nothing published for this version
Chaining existing locator objects, see locator docs for details.
UpdateMode and UpdateContent in Page.RouteFromHARAsync() and BrowserContext.RouteFromHARAsync().Name in method Tracing.StartChunkAsync().This version was also tested against the following stable channels:
https://github.com/microsoft/playwright/issues/21093 - [Regression v1.31] Headless Windows shows cascading cmd windows
https://github.com/microsoft/playwright/issues/21093 - [Regression v1.31] Headless Windows shows cascading cmd windows
This version was also tested against the following stable channels:
New assertion `Expect(locator).ToBeInViewportAsync()` ensures that locator points to an element that intersects viewport, according to the intersectio
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(Page) and Browser.NewBrowserCDPSessionAsync() create a Chrome DevTools Protocol session for the page and browser respectively.
MaxRedirects for method Route.FetchAsync.This version was also tested against the following stable channels:
Nothing published for this version
Maintenance release with bugfixes and new browsers only.
Maintenance release with bugfixes and new browsers only.
This version was also tested against the following stable channels:
New method `Route.FetchAsync` and new option Json for `Route.FulfillAsync`:
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.Locator("role=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</div>
<option value="green">Green</div>
<option value="blue">Blue</div>
</select>
await element.SelectOptionAsync("Red");
This version was also tested against the following stable channels:
Live Locators in CodeGen. Generate a locator for any element on the page using "Explore" tool.
This version was also tested against the following stable channels:
This patch release includes the following bug fixes:
This patch release includes the following bug fixes:
https://github.com/microsoft/playwright-dotnet/issues/2345 - [BUG] No Name prop in class PageGetByRoleOptions
This version was also tested against the following stable channels:
This patch release includes the following bug fixes:
This patch release includes the following bug fixes:
https://github.com/microsoft/playwright/pull/18010 - fix(generator): generate nice locators for arbitrary selectors https://github.com/microsoft/playwright/issues/17960 - [BUG] Codegen 1.27 creates NUnit code that does not compile https://github.com/microsoft/playwright/pull/17952 - fix: fix typo in treeitem role typing
This version was also tested against the following stable channels:
With these new APIs writing locators is a joy:
With these new APIs writing locators is a joy:
await Page.GetByLabel("User Name").FillAsync("John");
await Page.GetByLabel("Password").FillAsync("secret-password");
await Page.GetByRole("button", new() { Name = "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(name, value, options) 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("button")).ToHaveAttribute("disabled", "");
This version was also tested against the following stable channels:
New option Enabled for Expect(Locator).ToBeEnabledAsync(options).
Enabled for Expect(Locator).ToBeEnabledAsync(options).Editable for Expect(Locator).ToBeEditableAsync(options).Visible for Expect(Locator).ToBeVisibleAsync(options).MaxRedirects for ApiRequestContext.GetAsync(url, options) and others to limit redirect count.packages.config)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:
🪦 This is the last release with macOS 10.15 support (deprecated as of 1.21).
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:
One column per quarter.