v1.44.0
New APIs
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
-
Multipart
option inAPIRequestContext.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.
Browser Versions
- Chromium 125.0.6422.14
- Mozilla Firefox 125.0.1
- WebKit 17.4
This version was also tested against the following stable channels:
- Google Chrome 124
- Microsoft Edge 124