Releases: microsoft/playwright-dotnet
v1.34.0
Highlights
-
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
andBrowserContext.Dialog
to subscribe to any dialogs
and console messages from any page from the given browser context. Use the new methodsConsoleMessage.Page
andDialog.Page
to pin-point event source.
Browser Versions
- Chromium 114.0.5735.26
- Mozilla Firefox 113.0
- WebKit 16.4
This version was also tested against the following stable channels:
- Google Chrome 113
- Microsoft Edge 113
v1.33.0
Highlights
Locators Update
-
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
andHasNotText
inLocator.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 theExpect().ToBeVisibleAsync()
that ensures that
element is both attached & visible.
New APIs
Locator.Or
- New option
HasNot
inLocator.Filter
- New option
HasNotText
inLocator.Filter
Expect().ToBeAttachedAsync
- New option
Timeout
inRoute.FetchAsync
⚠️ Breaking change
- The
mcr.microsoft.com/playwright/dotnet:v1.33.0
now serves a Playwright image based on Ubuntu Jammy.
To use the focal-based image, please usemcr.microsoft.com/playwright/dotnet:v1.33.0-focal
instead.
Browser Versions
- Chromium 113.0.5672.53
- Mozilla Firefox 112.0
- WebKit 16.4
This version was also tested against the following stable channels:
- Google Chrome 112
- Microsoft Edge 112
v1.32.0
v1.32.0
New APIs
- Chaining existing locator objects, see locator docs for details.
- New options
UpdateMode
andUpdateContent
inPage.RouteFromHARAsync()
andBrowserContext.RouteFromHARAsync()
. - New option
Name
in methodTracing.StartChunkAsync()
.
Browser Versions
- Chromium 112.0.5615.29
- Mozilla Firefox 111.0
- WebKit 16.4
This version was also tested against the following stable channels:
- Google Chrome 111
- Microsoft Edge 111
v1.31.1
Highlights
microsoft/playwright#21093 - [Regression v1.31] Headless Windows shows cascading cmd windows
Browser Versions
- Chromium 111.0.5563.19
- Mozilla Firefox 109.0
- WebKit 16.4
This version was also tested against the following stable channels:
- Google Chrome 110
- Microsoft Edge 110
v1.31.0
New APIs
-
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)
andBrowser.NewBrowserCDPSessionAsync()
create a Chrome DevTools Protocol session for the page and browser respectively.
Miscellaneous
- DOM snapshots in trace viewer can be now opened in a separate window.
- New option
MaxRedirects
for methodRoute.FetchAsync
. - Playwright now supports Debian 11 arm64.
Browser Versions
- Chromium 111.0.5563.19
- Mozilla Firefox 109.0
- WebKit 16.4
This version was also tested against the following stable channels:
- Google Chrome 110
- Microsoft Edge 110
v1.30.0
🎉 Happy New Year 🎉
Maintenance release with bugfixes and new browsers only.
Browser Versions
- Chromium 110.0.5481.38
- Mozilla Firefox 108.0.2
- WebKit 16.4
This version was also tested against the following stable channels:
- Google Chrome 109
- Microsoft Edge 109
v1.29.0
Highlights
New APIs
-
New method
Route.FetchAsync
and new optionJson
forRoute.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");
Browser Versions
- Chromium 109.0.5414.46
- Mozilla Firefox 107.0
- WebKit 16.4
This version was also tested against the following stable channels:
- Google Chrome 108
- Microsoft Edge 108
v1.28.0
Highlights
Playwright Tools
- Live Locators in CodeGen. Generate a locator for any element on the page using "Explore" tool.
New APIs
Browser Versions
- Chromium 108.0.5359.29
- Mozilla Firefox 106.0
- WebKit 16.4
This version was also tested against the following stable channels:
- Google Chrome 107
- Microsoft Edge 107
v1.27.2
Highlights
This patch release includes the following bug fixes:
#2345 - [BUG] No Name prop in class PageGetByRoleOptions
Browser Versions
- Chromium 107.0.5304.18
- Mozilla Firefox 105.0.1
- WebKit 16.0
This version was also tested against the following stable channels:
- Google Chrome 106
- Microsoft Edge 106
v1.27.1
Highlights
This patch release includes the following bug fixes:
microsoft/playwright#18010 - fix(generator): generate nice locators for arbitrary selectors
microsoft/playwright#17960 - [BUG] Codegen 1.27 creates NUnit code that does not compile
microsoft/playwright#17952 - fix: fix typo in treeitem role typing
Browser Versions
- Chromium 107.0.5304.18
- Mozilla Firefox 105.0.1
- WebKit 16.0
This version was also tested against the following stable channels:
- Google Chrome 106
- Microsoft Edge 106