Releases: microsoft/playwright-python
v1.59.0
🎬 Screencast
New page.screencast API provides a unified interface for capturing page content with:
- Screencast recordings
- Action annotations
- Visual overlays
- Real-time frame capture
- Agentic video receipts
Screencast recording — record video with precise start/stop control, as an alternative to the recordVideoDir option:
page.screencast.start(path="video.webm")
# ... perform actions ...
page.screencast.stop()Action annotations — enable built-in visual annotations that highlight interacted elements and display action titles during recording:
page.screencast.show_actions(position="top-right")screencast.show_actions() accepts position ('top-left', 'top', 'top-right', 'bottom-left', 'bottom', 'bottom-right'), duration (ms per annotation), and font_size (px). Returns a disposable to stop showing actions.
Visual overlays — add chapter titles and custom HTML overlays on top of the page for richer narration:
page.screencast.show_chapter("Adding TODOs",
description="Type and press enter for each TODO",
duration=1000,
)
page.screencast.show_overlay('<div style="color: red">Recording</div>')Real-time frame capture — stream JPEG-encoded frames for custom processing like thumbnails, live previews, AI vision, and more:
page.screencast.start(
on_frame=lambda frame: send_to_vision_model(frame["data"]),
)Agentic video receipts — coding agents can produce video evidence of their work. After completing a task, an agent can record a walkthrough video with rich annotations for human review:
page.screencast.start(path="receipt.webm")
page.screencast.show_actions(position="top-right")
page.screencast.show_chapter("Verifying checkout flow",
description="Added coupon code support per ticket #1234",
)
# Agent performs the verification steps...
page.locator("#coupon").fill("SAVE20")
page.locator("#apply-coupon").click()
expect(page.locator(".discount")).to_contain_text("20%")
page.screencast.show_chapter("Done",
description="Coupon applied, discount reflected in total",
)
page.screencast.stop()The resulting video serves as a receipt: chapter titles provide context, action annotations highlight each interaction, and the visual walkthrough is faster to review than text logs.
🔍 Snapshots and Locators
- Method page.aria_snapshot() to capture the aria snapshot of the page — equivalent to
page.locator('body').aria_snapshot(). - Options
depthandmodein locator.aria_snapshot(). - Method locator.normalize() converts a locator to follow best practices like test ids and aria roles.
- Method page.pick_locator() enters an interactive mode where hovering over elements highlights them and shows the corresponding locator. Click an element to get its Locator back. Use page.cancel_pick_locator() to cancel.
New APIs
Screencast
- page.screencast provides video recording, real-time frame streaming, and overlay management.
- Methods screencast.start() and screencast.stop() for recording and frame capture.
- Methods screencast.show_actions() and screencast.hide_actions() for action annotations.
- Methods screencast.show_chapter() and screencast.show_overlay() for visual overlays.
- Methods screencast.show_overlays() and screencast.hide_overlays() for overlay visibility control.
Storage, Console and Errors
- Method browser_context.set_storage_state() clears existing cookies, local storage, and IndexedDB for all origins and sets a new storage state — no need to create a new context.
- Methods page.clear_console_messages() and page.clear_page_errors() to clear stored messages and errors.
- Option
filterin page.console_messages() and page.page_errors() controls which messages are returned. - Method console_message.timestamp().
Miscellaneous
- browser_context.debugger provides programmatic control over the Playwright debugger.
- Method browser_context.is_closed().
- Method request.existing_response() returns the response without waiting.
- Method response.http_version() returns the HTTP version used by the response.
- Option
livein tracing.start() for real-time trace updates. - Option
artifacts_dirin browser_type.launch() to configure the artifacts directory.
🔗 Interoperability
New browser.bind() API makes a launched browser available for playwright-cli, @playwright/mcp, and other clients to connect to.
Bind a browser — start a browser and bind it so others can connect:
server_info = await browser.bind("my-session",
workspace_dir="/my/project",
)Connect from playwright-cli — connect to the running browser from your favorite coding agent.
playwright-cli attach my-session
playwright-cli -s my-session snapshotConnect from @playwright/mcp — or point your MCP server to the running browser.
@playwright/mcp --endpoint=my-sessionConnect from a Playwright client — use API to connect to the browser. Multiple clients at a time are supported!
browser = await chromium.connect(server_info["endpoint"])Pass host and port options to bind over WebSocket instead of a named pipe:
server_info = await browser.bind("my-session",
host="localhost",
port=0,
)
# server_info["endpoint"] is a ws:// URLCall browser.unbind() to stop accepting new connections.
📊 Observability
Run playwright-cli show to open the Dashboard that lists all the bound browsers, their statuses, and allows interacting with them:
- See what your agent is doing on the background browsers
- Click into the sessions for manual interventions
- Open DevTools to inspect pages from the background browsers.
Breaking Changes ⚠️
- Removed macOS 14 support for WebKit. We recommend upgrading your macOS version, or keeping an older Playwright version.
Browser Versions
- Chromium 147.0.7727.15
- Mozilla Firefox 148.0.2
- WebKit 26.4
This version was also tested against the following stable channels:
- Google Chrome 146
- Microsoft Edge 146
v1.58.0
Trace Viewer Improvements
- New 'system' theme option follows your OS dark/light mode preference
- Search functionality (Cmd/Ctrl+F) is now available in code editors
- Network details panel has been reorganized for better usability
- JSON responses are now automatically formatted for readability
Thanks to @cpAdm for contributing these improvements!
Miscellaneous
browser_type.connect_over_cdp() now accepts an is_local option. When set to True, it tells Playwright that it runs on the same host as the CDP server, enabling file system optimizations.
Breaking Changes ⚠️
- Removed
_reactand_vueselectors. See locators guide for alternatives. - Removed
:lightselector engine suffix. Use standard CSS selectors instead. - Option
devtoolsfrom browser_type.launch() has been removed. Useargs=['--auto-open-devtools-for-tabs']instead. - Removed macOS 13 support for WebKit. We recommend to upgrade your macOS version, or keep using an older Playwright version.
Browser Versions
- Chromium 145.0.7632.6
- Mozilla Firefox 146.0.1
- WebKit 26.0
This version was also tested against the following stable channels:
- Google Chrome 144
- Microsoft Edge 144
v1.57.0
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.
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
stepsin locator.click() and locator.drag_to() that configures the number ofmousemoveevents 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_NETWORKenvironment variable. - Console messages from Service Workers are dispatched through worker.on("console"). You can opt out of this using the
PLAYWRIGHT_DISABLE_SERVICE_WORKER_CONSOLEenvironment variable.
Browser Versions
- Chromium 143.0.7499.4
- Mozilla Firefox 144.0.2
- WebKit 26.0
v1.56.0
New APIs
- New methods page. console_messages() and page.page_errors() for retrieving the most recent console messages from the page
- New method page.requests() for retrieving the most recent network requests from the page
Breaking Changes
- Event browserContext.on("backgroundpage") has been deprecated and will not be emitted. Method browserContext. background_pages() will return an empty list
Miscellaneous
- Aria snapshots render and compare
inputplaceholder
Browser Versions
- Chromium 141.0.7390.37
- Mozilla Firefox 142.0.1
- WebKit 26.0
v1.55.0
Codegen
- Automatic
to_be_visible()assertions: Codegen can now generate automaticto_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
Highlights
-
New cookie property
partition_keyin 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-dirin 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 opendoes not open the test recorder anymore. Useplaywright codegeninstead.
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
Miscellaneous
-
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 --listwill 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
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:
/childrenfor strict matching and/urlfor links.expect(locator).to_match_aria_snapshot(""" - list - /children: equal - listitem: Feature A - listitem: - link "Feature B": - /url: "https://playwright.dev" """)
Miscellaneous
- New option
max_redirectsin apiRequest.new_context() to control the maximum number of redirects. - New option
refin locator.aria_snapshot() to generate reference for each element in the snapshot which can later be used to locate the element.
Breaking Changes
- Method route.continue() does not allow to override the
Cookieheader anymore. If aCookieheader 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
Highlights
-
New option
indexed_dbfor 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
visiblefor 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
contrastfor methods page.emulate_media() and browser.new_context() allows to emulate theprefers-contrastmedia feature. -
New option
fail_on_status_codemakes 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
Async Pytest Plugin
- Playwright's Pytest plugin now has support for Async Fixtures.
Miscellaneous
- Added method expect(locator).to_have_accessible_error_message() to assert the Locator points to an element with a given aria errormessage.
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
canvascontent in traces is error-prone. Display is now disabled by default, and can be enabled via theDisplay canvas contentUI setting. CallandNetworkpanels now display additional time information.
Breaking
- expect(locator).to_be_editable() and locator.is_editable() now throw if the target element is not
<input>,<select>, or a number of other editable elements.
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


