Test Generator Update
New tools to generate assertions:
- "Assert visibility" tool generates Expect(locator).ToBeVisibleAsync([options]).
- "Assert value" tool generates Expect(locator).ToHaveValueAsync(value[, options]).
- "Assert text" tool generates Expect(locator).ToContainTextAsync(expected).
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");
New APIs
- Option
Reason
in Page.CloseAsync([options]), BrowserContext.CloseAsync([options]) and Browser.CloseAsync([options]). Close reason is reported for all operations interrupted by the closure. - Option
FirefoxUserPrefs
in browserType.launchPersistentContext(userDataDir[, options]).
Other Changes
- Methods download.PathAsync() throw an error for failed and cancelled downloads.
- Playwright docker image now comes with .NET 8 (new LTS).
Browser Versions
- Chromium 120.0.6099.28
- Mozilla Firefox 119.0
- WebKit 17.4
This version was also tested against the following stable channels:
- Google Chrome 119
- Microsoft Edge 119