v1.44.0
New APIs
Accessibility assertions
-
assertThat(locator).toHaveAccessibleName() checks if the element has the specified accessible name:
Locator locator = page.getByRole(AriaRole.BUTTON); assertThat(locator).hasAccessibleName("Submit");
-
assertThat(locator).toHaveAccessibleDescription() checks if the element has the specified accessible description:
Locator locator = page.getByRole(AriaRole.BUTTON); assertThat(locator).hasAccessibleDescription("Upload a photo");
-
assertThat(locator).toHaveRole() checks if the element has the specified ARIA role:
Locator locator = page.getByTestId("save-button"); assertThat(locator).hasRole(AriaRole.BUTTON);
Locator handler
- After executing the handler added with page.addLocatorHandler(), 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
setNoWaitAfter
option. - You can use new
setTimes
option in page.addLocatorHandler() to specify maximum number of times the handler should be run. - The handler in page.addLocatorHandler() now accepts the locator as argument.
- New page.removeLocatorHandler() method for removing previously added locator handlers.
Locator locator = page.getByText("This interstitial covers the button");
page.addLocatorHandler(locator, overlay -> {
overlay.locator("#close").click();
}, new Page.AddLocatorHandlerOptions().setTimes(3).setNoWaitAfter(true));
// Run your tests that can be interrupted by the overlay.
// ...
page.removeLocatorHandler(locator);
Miscellaneous options
-
New method formData.append() allows to specify repeating fields with the same name in
setMultipart
option inRequestOptions
:FormData formData = FormData.create(); formData.append("file", new FilePayload("f1.js", "text/javascript", "var x = 2024;".getBytes(StandardCharsets.UTF_8))); formData.append("file", new FilePayload("f2.txt", "text/plain", "hello".getBytes(StandardCharsets.UTF_8))); APIResponse response = context.request().post("https://example.com/uploadFile", RequestOptions.create().setMultipart(formData));
-
expect(page).toHaveURL(url)
now supportssetIgnoreCase
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