Test Generator Update
New tools to generate assertions:
- "Assert visibility" tool generates expect(locator).to_be_visible().
- "Assert value" tool generates expect(locator).to_have_value(value).
- "Assert text" tool generates expect(locator).to_contain_text(expected).
Here is an example of a generated test with assertions:
from playwright.sync_api import Page, expect
def test_example(page: Page) -> None:
page.goto("https://playwright.dev/")
page.get_by_role("link", name="Get started").click()
expect(page.get_by_label("Breadcrumbs").get_by_role("list")).to_contain_text("Installation")
expect(page.get_by_label("Search")).to_be_visible()
page.get_by_label("Search").click()
page.get_by_placeholder("Search docs").fill("locator")
expect(page.get_by_placeholder("Search docs")).to_have_value("locator");
New APIs
- Option
reason
in page.close([options]), browserContext.close([options]) and browser.close([options]). Close reason is reported for all operations interrupted by the closure. - Option
firefox_user_prefs
in browserType.launch_persistent_context(userDataDir[, options]).
Other Changes
- Method download.path() throws an error for failed and cancelled downloads.
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