Skip to content

Releases: microsoft/playwright-python

v1.57.0

09 Dec 07:41
732639b

Choose a tag to compare

Chrome for Testing

Starting with this release, Playwright switches from Chromium, to using Chrome for Testing builds. Both headed and headless browsers are subject to this. Your tests should still be passing after upgrading to Playwright 1.57.

We're expecting no functional changes to come from this switch. The biggest change is the new icon and title in your toolbar.

new and old logo

If you still see an unexpected behaviour change, please file an issue.

On Arm64 Linux, Playwright continues to use Chromium.

Breaking Change

After 3 years of being deprecated, we removed page.accessibility from our API. Please use other libraries such as Axe if you need to test page accessibility. See our Node.js guide for integration with Axe.

New APIs

  • worker.on("console") event is emitted when JavaScript within the worker calls one of console API methods, e.g. console.log or console.dir. worker.expect_event() can be used to wait for it.
  • locator.description() returns locator description previously set with locator.describe().
  • New option steps in locator.click() and locator.drag_to() that configures the number of mousemove events emitted while moving the mouse pointer to the target element.
  • Network requests issued by Service Workers are now reported and can be routed through the BrowserContext, only in Chromium. You can opt out using the PLAYWRIGHT_DISABLE_SERVICE_WORKER_NETWORK environment variable.
  • Console messages from Service Workers are dispatched through worker.on("console"). You can opt out of this using the PLAYWRIGHT_DISABLE_SERVICE_WORKER_CONSOLE environment variable.

Browser Versions

  • Chromium 143.0.7499.4
  • Mozilla Firefox 144.0.2
  • WebKit 26.0

v1.56.0

11 Nov 18:13
75ceca0

Choose a tag to compare

New APIs

Breaking Changes

Miscellaneous

  • Aria snapshots render and compare input placeholder

Browser Versions

  • Chromium 141.0.7390.37
  • Mozilla Firefox 142.0.1
  • WebKit 26.0

v1.55.0

28 Aug 10:43
4a03d71

Choose a tag to compare

Codegen

  • Automatic to_be_visible() assertions: Codegen can now generate automatic to_be_visible() assertions for common UI interactions. This feature can be enabled in the Codegen settings UI.

Breaking Changes

  • ⚠️ Dropped support for Chromium extension manifest v2.

Miscellaneous

  • Added support for Debian 13 "Trixie".

Browser Versions

  • Chromium 140.0.7339.16
  • Mozilla Firefox 141.0
  • WebKit 26.0

This version was also tested against the following stable channels:

  • Google Chrome 139
  • Microsoft Edge 139

v1.54.0

22 Jul 13:43
cc27d25

Choose a tag to compare

Highlights

  • New cookie property partition_key in BrowserContext.cookies() and browserContext.add_cookies(). This property allows to save and restore partitioned cookies. See CHIPS MDN article for more information. Note that browsers have different support and defaults for cookie partitioning.

  • New option --user-data-dir in multiple commands. You can specify the same user data dir to reuse browsing state, like authentication, between sessions.

    playwright codegen --user-data-dir=./user-data
  • playwright open does not open the test recorder anymore. Use playwright codegen instead.

Browser Versions

  • Chromium 139.0.7258.5
  • Mozilla Firefox 140.0.2
  • WebKit 26.0

This version was also tested against the following stable channels:

  • Google Chrome 140
  • Microsoft Edge 140

v1.53.0

25 Jun 16:23
3713a32

Choose a tag to compare

Miscellaneous

  • New Steps in Trace Viewer:
    New Trace Viewer Steps

  • New method locator.describe() to describe a locator. Used for trace viewer.

    button = page.get_by_test_id("btn-sub").describe("Subscribe button")
    button.click()
  • python -m playwright install --list will now list all installed browsers, versions and locations.

Browser Versions

  • Chromium 138.0.7204.4
  • Mozilla Firefox 139.0
  • WebKit 18.5

This version was also tested against the following stable channels:

  • Google Chrome 137
  • Microsoft Edge 137

v1.52.0

30 Apr 09:04
eec856f

Choose a tag to compare

Highlights

  • New method expect(locator).to_contain_class() to ergonomically assert individual class names on the element.

      expect(page.get_by_role("listitem", name="Ship v1.52")).to_contain_class("done")
  • Aria Snapshots got two new properties: /children for strict matching and /url for links.

    expect(locator).to_match_aria_snapshot("""
      - list
        - /children: equal
        - listitem: Feature A
        - listitem:
          - link "Feature B":
            - /url: "https://playwright.dev"
    """)

Miscellaneous

Breaking Changes

  • Method route.continue() does not allow to override the Cookie header anymore. If a Cookie header is provided, it will be ignored, and the cookie will be loaded from the browser's cookie store. To set custom cookies, use browserContext.add_cookies().
  • macOS 13 is now deprecated and will no longer receive WebKit updates. Please upgrade to a more recent macOS version to continue benefiting from the latest WebKit improvements.

Browser Versions

  • Chromium 136.0.7103.25
  • Mozilla Firefox 137.0
  • WebKit 18.4

This version was also tested against the following stable channels:

  • Google Chrome 135
  • Microsoft Edge 135

v1.51.0

18 Mar 09:08

Choose a tag to compare

Highlights

  • New option indexed_db for browserContext.storage_state() allows to save and restore IndexedDB contents. Useful when your application uses IndexedDB API to store authentication tokens, like Firebase Authentication.

    Here is an example following the authentication guide:

    # Save storage state into the file. Make sure to include IndexedDB.
    storage = context.storage_state(path="state.json", indexed_db=True)
    
    # Create a new context with the saved storage state.
    context = browser.new_context(storage_state="state.json")
  • New option visible for locator.filter() allows matching only visible elements.

    # Ignore invisible todo items.
    todo_items = page.get_by_test_id("todo-item").filter(visible=True)
    # Check there are exactly 3 visible ones.
    expect(todo_items).to_have_count(3)
  • New option contrast for methods page.emulate_media() and browser.new_context() allows to emulate the prefers-contrast media feature.

  • New option fail_on_status_code makes all fetch requests made through the APIRequestContext throw on response codes other than 2xx and 3xx.

Browser Versions

  • Chromium 134.0.6998.35
  • Mozilla Firefox 135.0
  • WebKit 18.4

This version was also tested against the following stable channels:

  • Google Chrome 133
  • Microsoft Edge 133

v1.50.0

03 Feb 14:36
058a335

Choose a tag to compare

Async Pytest Plugin

Miscellaneous

UI updates

  • New button in Codegen for picking elements to produce aria snapshots.
  • Additional details (such as keys pressed) are now displayed alongside action API calls in traces.
  • Display of canvas content in traces is error-prone. Display is now disabled by default, and can be enabled via the Display canvas content UI setting.
  • Call and Network panels now display additional time information.

Breaking

Browser Versions

  • Chromium 133.0.6943.16
  • Mozilla Firefox 134.0
  • WebKit 18.2

This version was also tested against the following stable channels:

  • Google Chrome 132
  • Microsoft Edge 132

v1.49.1

10 Dec 17:24

Choose a tag to compare

Highlights

#2679 - [Bug]: Warning: Validation of the RECORD file of playwright-1.49.0-py3-none-manylinux1_x86_64.whl failed

Browser Versions

  • Chromium 131.0.6778.33
  • Mozilla Firefox 132.0
  • WebKit 18.2

This version was also tested against the following stable channels:

  • Google Chrome 130
  • Microsoft Edge 130

v1.49.0

22 Nov 12:19
ebf26a6

Choose a tag to compare

Aria snapshots

New assertion expect(locator).toMatchAriaSnapshot() verifies page structure by comparing to an expected accessibility tree, represented as YAML.

page.goto("https://playwright.dev")
expect(page.locator('body')).to_match_aria_snapshot('''
  - banner:
    - heading /Playwright enables reliable/ [level=1]
    - link "Get started"
    - link "Star microsoft/playwright on GitHub"
  - main:
    - img "Browsers (Chromium, Firefox, WebKit)"
    - heading "Any browser • Any platform • One API"
''')

You can generate this assertion with Test Generator or by calling locator.ariaSnapshot().

Learn more in the aria snapshots guide.

Tracing groups

New method tracing.group() allows you to visually group actions in the trace viewer.

# All actions between group and group_end
# will be shown in the trace viewer as a group.
page.context.tracing.group("Open Playwright.dev > API")
page.goto("https://playwright.dev/")
page.get_by_role("link", name="API").click()
page.context.tracing.group_end()

Breaking: chrome and msedge channels switch to new headless mode

This change affects you if you're using one of the following channels in your playwright.config.ts:

  • chrome, chrome-dev, chrome-beta, or chrome-canary
  • msedge, msedge-dev, msedge-beta, or msedge-canary

After updating to Playwright v1.49, run your test suite. If it still passes, you're good to go. If not, you will probably need to update your snapshots, and adapt some of your test code around PDF viewers and extensions. See issue #33566 for more details.

Try new Chromium headless

You can opt into the new headless mode by using 'chromium' channel. As official Chrome documentation puts it:

New Headless on the other hand is the real Chrome browser, and is thus more authentic, reliable, and offers more features. This makes it more suitable for high-accuracy end-to-end web app testing or browser extension testing.

See issue #33566 for the list of possible breakages you could encounter and more details on Chromium headless. Please file an issue if you see any problems after opting in.

pytest test_login.py --browser-channel chromium

Miscellaneous

  • There will be no more updates for WebKit on Ubuntu 20.04 and Debian 11. We recommend updating your OS to a later version.
  • <canvas> elements inside a snapshot now draw a preview.
  • Python 3.8 is not supported anymore.

Browser Versions

  • Chromium 131.0.6778.33
  • Mozilla Firefox 132.0
  • WebKit 18.2

This version was also tested against the following stable channels:

  • Google Chrome 130
  • Microsoft Edge 130