Skip to main content

Release notes

Version 1.59

🎬 Screencast

New Page.screencast() API provides a unified interface for capturing page content with:

Demo

Screencast recording — record video with precise start/stop control, as an alternative to the setRecordVideoDir option:

page.screencast().start(new Screencast.StartOptions().setPath(Paths.get("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().showActions(new Screencast.ShowActionsOptions().setPosition("top-right"));

Screencast.showActions() accepts position ("top-left", "top", "top-right", "bottom-left", "bottom", "bottom-right"), duration (ms per annotation), and fontSize (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().showChapter("Adding TODOs",
new Screencast.ShowChapterOptions()
.setDescription("Type and press enter for each TODO")
.setDuration(1000));

page.screencast().showOverlay("<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(new Screencast.StartOptions()
.setOnFrame(frame -> sendToVisionModel(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(new Screencast.StartOptions()
.setPath(Paths.get("receipt.webm")));
page.screencast().showActions(new Screencast.ShowActionsOptions().setPosition("top-right"));

page.screencast().showChapter("Verifying checkout flow",
new Screencast.ShowChapterOptions()
.setDescription("Added coupon code support per ticket #1234"));

// Agent performs the verification steps...
page.locator("#coupon").fill("SAVE20");
page.locator("#apply-coupon").click();
assertThat(page.locator(".discount")).containsText("20%");

page.screencast().showChapter("Done",
new Screencast.ShowChapterOptions()
.setDescription("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

New APIs

Screencast

Storage, Console and Errors

Miscellaneous

🔗 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:

Browser.BindResult serverInfo = browser.bind("my-session",
new Browser.BindOptions().setWorkspaceDir("/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 snapshot

Connect from @playwright/mcp — or point your MCP server to the running browser.

@playwright/mcp --endpoint=my-session

Connect from a Playwright client — use API to connect to the browser. Multiple clients at a time are supported!

Browser browser = chromium.connect(serverInfo.endpoint);

Pass host and port options to bind over WebSocket instead of a named pipe:

Browser.BindResult serverInfo = browser.bind("my-session",
new Browser.BindOptions().setHost("localhost").setPort(0));
// serverInfo.endpoint is a ws:// URL

Call 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:

Demo

Breaking Changes ⚠️

Browser Versions

This version was also tested against the following stable channels:

Version 1.58

UI Mode and Trace Viewer Improvements

Thanks to @cpAdm for contributing these improvements!

Miscellaneous

BrowserType.connectOverCDP() now accepts an isLocal 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 ⚠️

Browser Versions

This version was also tested against the following stable channels:

Version 1.57

Chrome for Testing

Playwright now runs on Chrome for Testing builds rather than Chromium. Headed mode uses chrome; headless mode uses chrome-headless-shell. Existing tests should continue to pass after upgrading to v1.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

Browser Versions

Version 1.56

New APIs

Breaking Changes

Miscellaneous

Browser Versions

Version 1.55

Codegen

Breaking Changes

Miscellaneous

Browser Versions

This version was also tested against the following stable channels:

Version 1.54

Highlights

Browser Versions

This version was also tested against the following stable channels:

Version 1.53

Trace Viewer and HTML Reporter Updates

Browser Versions

This version was also tested against the following stable channels:

Version 1.52

Highlights

Miscellaneous

Breaking Changes

Browser Versions

This version was also tested against the following stable channels:

Version 1.51

Highlights

Browser Versions

This version was also tested against the following stable channels:

Version 1.50

Miscellaneous

UI updates

Breaking

Browser Versions

This version was also tested against the following stable channels:

Version 1.49

Aria snapshots

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

page.navigate("https://playwright.dev");
assertThat(page.locator("body")).matchesAriaSnapshot("""
- 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 groupEnd
// will be shown in the trace viewer as a group.
page.context().tracing().group("Open Playwright.dev > API");
page.navigate("https://playwright.dev/");
page.getByRole(AriaRole.LINK, new Page.GetByRoleOptions().setName("API")).click();
page.context().tracing().groupEnd();

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:

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.

Browser browser = playwright.chromium().launch(new BrowserType.LaunchOptions().setChannel("chromium"));

Miscellaneous

Browser Versions

This version was also tested against the following stable channels:

Version 1.48

WebSocket routing

New methods Page.routeWebSocket() and BrowserContext.routeWebSocket() allow to intercept, modify and mock WebSocket connections initiated in the page. Below is a simple example that mocks WebSocket communication by responding to a "request" with a "response".

page.routeWebSocket("/ws", ws -> {
ws.onMessage(frame -> {
if ("request".equals(frame.text()))
ws.send("response");
});
});

See WebSocketRoute for more details.

UI updates

Miscellaneous

Browser Versions

This version was also tested against the following stable channels:

Version 1.47

Network Tab improvements

The Network tab in the trace viewer has several nice improvements:

Network tab now has filters

Miscellaneous

Browser Versions

This version was also tested against the following stable channels:

Version 1.46

TLS Client Certificates

Playwright now allows to supply client-side certificates, so that server can verify them, as specified by TLS Client Authentication.

You can provide client certificates as a parameter of Browser.newContext() and APIRequest.newContext(). The following snippet sets up a client certificate for https://example.com:

BrowserContext context = browser.newContext(new Browser.NewContextOptions()
.setClientCertificates(asList(new ClientCertificate("https://example.com")
.setCertPath(Paths.get("client-certificates/cert.pem"))
.setKeyPath(Paths.get("client-certificates/key.pem")))));

Trace Viewer Updates

Miscellaneous

Browser Versions

This version was also tested against the following stable channels:

Version 1.45

Clock

Utilizing the new Clock API allows to manipulate and control time within tests to verify time-related behavior. This API covers many common scenarios, including:

// Initialize clock with some time before the test time and let the page load
// naturally. `Date.now` will progress as the timers fire.
page.clock().install(new Clock.InstallOptions().setTime("2024-02-02T08:00:00"));
page.navigate("http://localhost:3333");
Locator locator = page.getByTestId("current-time");

// Pretend that the user closed the laptop lid and opened it again at 10am.
// Pause the time once reached that point.
page.clock().pauseAt("2024-02-02T10:00:00");

// Assert the page state.
assertThat(locator).hasText("2/2/2024, 10:00:00 AM");

// Close the laptop lid again and open it at 10:30am.
page.clock().fastForward("30:00");
assertThat(locator).hasText("2/2/2024, 10:30:00 AM");

See the clock guide for more details.

Miscellaneous

Browser Versions

This version was also tested against the following stable channels:

Version 1.44

New APIs

Accessibility assertions

Locator handler

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

Browser Versions

This version was also tested against the following stable channels:

Version 1.43

New APIs

Browser Versions

This version was also tested against the following stable channels:

Version 1.42

Experimental JUnit integration

Add new @UsePlaywright annotation to your test classes to start using Playwright fixtures for Page, BrowserContext, Browser, APIRequestContext and Playwright in the test methods.

package org.example;

import com.microsoft.playwright.Page;
import com.microsoft.playwright.junit.UsePlaywright;
import org.junit.jupiter.api.Test;

import static com.microsoft.playwright.assertions.PlaywrightAssertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals;

@UsePlaywright
public class TestExample {
void shouldNavigateToInstallationGuide(Page page) {
page.navigate("https://playwright.dev/java/");
page.getByRole(AriaRole.LINK, new Page.GetByRoleOptions().setName("Docs")).click();
assertThat(page.getByRole(AriaRole.HEADING, new Page.GetByRoleOptions().setName("Installation"))).isVisible();
}

@Test
void shouldCheckTheBox(Page page) {
page.setContent("<input id='checkbox' type='checkbox'></input>");
page.locator("input").check();
assertEquals(true, page.evaluate("window['checkbox'].checked"));
}

@Test
void shouldSearchWiki(Page page) {
page.navigate("https://www.wikipedia.org/");
page.locator("input[name=\"search\"]").click();
page.locator("input[name=\"search\"]").fill("playwright");
page.locator("input[name=\"search\"]").press("Enter");
assertThat(page).hasURL("https://en.wikipedia.org/wiki/Playwright");
}
}

In the example above, all three test methods use the same Browser. Each test uses its own BrowserContext and Page.

Custom options

Implement your own OptionsFactory to initialize the fixtures with custom configuration.

import com.microsoft.playwright.junit.Options;
import com.microsoft.playwright.junit.OptionsFactory;
import com.microsoft.playwright.junit.UsePlaywright;

@UsePlaywright(MyTest.CustomOptions.class)
public class MyTest {

public static class CustomOptions implements OptionsFactory {
@Override
public Options getOptions() {
return new Options()
.setHeadless(false)
.setContextOption(new Browser.NewContextOptions()
.setBaseURL("https://github.com"))
.setApiRequestOptions(new APIRequest.NewContextOptions()
.setBaseURL("https://playwright.dev"));
}
}

@Test
public void testWithCustomOptions(Page page, APIRequestContext request) {
page.navigate("/");
assertThat(page).hasURL(Pattern.compile("github"));

APIResponse response = request.get("/");
assertTrue(response.text().contains("Playwright"));
}
}

Learn more about the fixtures in our JUnit guide.

New Locator Handler

New method Page.addLocatorHandler() registers a callback that will be invoked when specified element becomes visible and may block Playwright actions. The callback can get rid of the overlay. Here is an example that closes a cookie dialog when it appears.

// Setup the handler.
page.addLocatorHandler(
page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("Hej! You are in control of your cookies.")),
() -> {
page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("Accept all")).click();
});
// Write the test as usual.
page.navigate("https://www.ikea.com/");
page.getByRole(AriaRole.LINK, new Page.GetByRoleOptions().setName("Collection of blue and white")).click();
assertThat(page.getByRole(AriaRole.HEADING, new Page.GetByRoleOptions().setName("Light and easy"))).isVisible();

New APIs

Announcements

Browser Versions

This version was also tested against the following stable channels:

Version 1.41

New APIs

Browser Versions

This version was also tested against the following stable channels:

Version 1.40

Test Generator Update

Playwright Test Generator

New tools to generate assertions:

Here is an example of a generated test with assertions:

page.navigate("https://playwright.dev/");
page.getByRole(AriaRole.LINK, new Page.GetByRoleOptions().setName("Get started")).click();
assertThat(page.getByLabel("Breadcrumbs").getByRole(AriaRole.LIST)).containsText("Installation");
assertThat(page.getByLabel("Search")).isVisible();
page.getByLabel("Search").click();
page.getByPlaceholder("Search docs").fill("locator");
assertThat(page.getByPlaceholder("Search docs")).hasValue("locator");

New APIs

Other Changes

Browser Versions

This version was also tested against the following stable channels:

Version 1.39

Evergreen browsers update.

Browser Versions

This version was also tested against the following stable channels:

Version 1.38

Trace Viewer Updates

Playwright Trace Viewer
  1. Zoom into time range.
  2. Network panel redesign.

New APIs

Deprecations

Browser Versions

This version was also tested against the following stable channels:

Version 1.37

New APIs

📚 Debian 12 Bookworm Support

Playwright now supports Debian 12 Bookworm on both x86_64 and arm64 for Chromium, Firefox and WebKit. Let us know if you encounter any issues!

Linux support looks like this:

Ubuntu 20.04Ubuntu 22.04Debian 11Debian 12Chromium✅✅✅✅WebKit✅✅✅✅Firefox✅✅✅✅

Browser Versions

This version was also tested against the following stable channels:

Version 1.36

🏝️ Summer maintenance release.

Browser Versions

This version was also tested against the following stable channels:

Version 1.35

Highlights

Browser Versions

This version was also tested against the following stable channels:

Version 1.34

Highlights

Browser Versions

This version was also tested against the following stable channels:

Version 1.33

Locators Update

New APIs

Other highlights

⚠️ Breaking change

Browser Versions

This version was also tested against the following stable channels:

Version 1.32

New APIs

Browser Versions

This version was also tested against the following stable channels:

Version 1.31

New APIs

Miscellaneous

Browser Versions

This version was also tested against the following stable channels:

Version 1.30

Browser Versions

This version was also tested against the following stable channels:

Version 1.29

New APIs

Browser Versions

This version was also tested against the following stable channels:

Version 1.28

Playwright Tools

Locator Explorer

New APIs

Browser Versions

This version was also tested against the following stable channels:

Version 1.27

Locators

With these new APIs writing locators is a joy:

page.getByLabel("User Name").fill("John");

page.getByLabel("Password").fill("secret-password");

page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("Sign in")).click();

assertThat(page.getByText("Welcome, John!")).isVisible();

All the same methods are also available on Locator, FrameLocator and Frame classes.

Other highlights

Behavior Changes

Browser Versions

This version was also tested against the following stable channels:

Version 1.26

Assertions

Other highlights

Behavior Change

A bunch of Playwright APIs already support the setWaitUntil(WaitUntilState.DOMCONTENTLOADED) option. For example:

page.navigate("https://playwright.dev", new Page.NavigateOptions().setWaitUntil(WaitUntilState.DOMCONTENTLOADED));

Prior to 1.26, this would wait for all iframes to fire the DOMContentLoaded event.

To align with web specification, the WaitUntilState.DOMCONTENTLOADED value only waits for the target frame to fire the 'DOMContentLoaded' event. Use setWaitUntil(WaitUntilState.LOAD) to wait for all iframes.

Browser Versions

This version was also tested against the following stable channels:

Version 1.25

New APIs & changes

Announcements

Browser Versions

This version was also tested against the following stable channels:

Version 1.24

🐂 Debian 11 Bullseye Support

Playwright now supports Debian 11 Bullseye on x86_64 for Chromium, Firefox and WebKit. Let us know if you encounter any issues!

Linux support looks like this:

| | Ubuntu 20.04 | Ubuntu 22.04 | Debian 11 | :--- | :---: | :---: | :---: | :---: | | Chromium | ✅ | ✅ | ✅ | | WebKit | ✅ | ✅ | ✅ | | Firefox | ✅ | ✅ | ✅ |

Version 1.23

Network Replay

Now you can record network traffic into a HAR file and re-use this traffic in your tests.

To record network into HAR file:

mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="open --save-har=example.har --save-har-glob='**/api/**' https://example.com"

Alternatively, you can record HAR programmatically:

BrowserContext context = browser.newContext(new Browser.NewContextOptions()
.setRecordHarPath(Paths.get("example.har"))
.setRecordHarUrlFilter("**/api/**"));

// ... Perform actions ...

// Close context to ensure HAR is saved to disk.
context.close();

Use the new methods Page.routeFromHAR() or BrowserContext.routeFromHAR() to serve matching responses from the HAR file:

context.routeFromHAR(Paths.get("example.har"));

Read more in our documentation.

Advanced Routing

You can now use Route.fallback() to defer routing to other handlers.

Consider the following example:

// Remove a header from all requests.
page.route("**/*", route -> {
Map<String, String> headers = new HashMap<>(route.request().headers());
headers.remove("X-Secret");
route.resume(new Route.ResumeOptions().setHeaders(headers));
});

// Abort all images.
page.route("**/*", route -> {
if ("image".equals(route.request().resourceType()))
route.abort();
else
route.fallback();
});

Note that the new methods Page.routeFromHAR() and BrowserContext.routeFromHAR() also participate in routing and could be deferred to.

Web-First Assertions Update

Miscellaneous

Version 1.22

Highlights

Version 1.21

Highlights

Behavior Changes

Browser Versions

This version was also tested against the following stable channels:

Version 1.20

Highlights

Announcements

Browser Versions

This version was also tested against the following stable channels:

Version 1.19

Highlights

Browser Versions

This version was also tested against the following stable channels:

Version 1.18

API Testing

Playwright for Java 1.18 introduces new API Testing that lets you send requests to the server directly from Java! Now you can:

To do a request on behalf of Playwright's Page, use new Page.request() API:

// Do a GET request on behalf of page
APIResponse res = page.request().get("http://example.com/foo.json");

Read more about it in our API testing guide.

Web-First Assertions

Playwright for Java 1.18 introduces Web-First Assertions.

Consider the following example:

import static com.microsoft.playwright.assertions.PlaywrightAssertions.assertThat;

public class TestExample {
@Test
void statusBecomesSubmitted() {
// ...
page.locator("#submit-button").click();
assertThat(page.locator(".status")).hasText("Submitted");
}
}

Playwright will be re-testing the node with the selector .status until fetched Node has the "Submitted" text. It will be re-fetching the node and checking it over and over, until the condition is met or until the timeout is reached. You can pass this timeout as an option.

Read more in our documentation.

Locator Improvements

Tracing Improvements

Tracing now can embed Java sources to recorded traces, using new setSources option.

tracing-java-sources

New APIs & changes

Browser Versions

This version was also tested against the following stable channels:

Version 1.17

Frame Locators

Playwright 1.17 introduces frame locators - a locator to the iframe on the page. Frame locators capture the logic sufficient to retrieve the iframe and then locate elements in that iframe. Frame locators are strict by default, will wait for iframe to appear and can be used in Web-First assertions.

Graphics

Frame locators can be created with either Page.frameLocator() or Locator.frameLocator() method.

Locator locator = page.frameLocator("#my-frame").locator("text=Submit");
locator.click();

Read more at our documentation.

Trace Viewer Update

Playwright Trace Viewer is now available online at https://trace.playwright.dev! Just drag-and-drop your trace.zip file to inspect its contents.

NOTE: trace files are not uploaded anywhere; trace.playwright.dev is a progressive web application that processes traces locally.

image

HTML Report Update

image

Ubuntu ARM64 support + more

New APIs

Version 1.16

🎭 Playwright Library

Locator.waitFor

Wait for a locator to resolve to a single element with a given state. Defaults to the state: 'visible'.

Locator orderSent = page.locator("#order-sent");
orderSent.waitFor();

Read more about Locator.waitFor().

🎭 Playwright Trace Viewer

Read more about Trace Viewer.

Browser Versions

This version of Playwright was also tested against the following stable channels:

Version 1.15

🖱️ Mouse Wheel

By using Mouse.wheel() you are now able to scroll vertically or horizontally.

📜 New Headers API

Previously it was not possible to get multiple header values of a response. This is now possible and additional helper functions are available:

🌈 Forced-Colors emulation

Its now possible to emulate the forced-colors CSS media feature by passing it in the Browser.newContext() or calling Page.emulateMedia().

New APIs

Browser Versions

Version 1.14

⚡️ New "strict" mode

Selector ambiguity is a common problem in automation testing. "strict" mode ensures that your selector points to a single element and throws otherwise.

Set setStrict(true) in your action calls to opt in.

// This will throw if you have more than one button!
page.click("button", new Page.ClickOptions().setStrict(true));

📍 New Locators API

Locator represents a view to the element(s) on the page. It captures the logic sufficient to retrieve the element at any given moment.

The difference between the Locator and ElementHandle is that the latter points to a particular element, while Locator captures the logic of how to retrieve that element.

Also, locators are "strict" by default!

Locator locator = page.locator("button");
locator.click();

Learn more in the documentation.

🧩 Experimental React and Vue selector engines

React and Vue selectors allow selecting elements by its component name and/or property values. The syntax is very similar to attribute selectors and supports all attribute selector operators.

page.locator("_react=SubmitButton[enabled=true]").click();
page.locator("_vue=submit-button[enabled=true]").click();

Learn more in the react selectors documentation and the vue selectors documentation.

✨ New nth and visible selector engines

// select the first button among all buttons
button.click("button >> nth=0");
// or if you are using locators, you can use first(), nth() and last()
page.locator("button").first().click();

// click a visible button
button.click("button >> visible=true");

Browser Versions

Version 1.13

Playwright

Tools

New and Overhauled Guides

Browser Versions

New Playwright APIs

Version 1.12

🧟‍♂️ Introducing Playwright Trace Viewer

Playwright Trace Viewer is a new GUI tool that helps exploring recorded Playwright traces after the script ran. Playwright traces let you examine:

Traces are recorded using the new BrowserContext.tracing() API:

Browser browser = playwright.chromium().launch();
BrowserContext context = browser.newContext();

// Start tracing before creating / navigating a page.
context.tracing().start(new Tracing.StartOptions()
.setScreenshots(true)
.setSnapshots(true));

Page page = context.newPage();
page.navigate("https://playwright.dev");

// Stop tracing and export it into a zip archive.
context.tracing().stop(new Tracing.StopOptions()
.setPath(Paths.get("trace.zip")));

Traces are examined later with the Playwright CLI:

mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="show-trace trace.zip"

That will open the following GUI:

image

👉 Read more in trace viewer documentation.

Browser Versions

This version of Playwright was also tested against the following stable channels:

New APIs

Version 1.11

🎥 New video: Playwright: A New Test Automation Framework for the Modern Web (slides)

Browser Versions

New APIs

Version 1.10

Bundled Browser Versions

This version of Playwright was also tested against the following stable channels:

New APIs

Version 1.9

Browser Versions

New APIs

Version 1.8

New APIs

Browser Versions

Version 1.7

New APIs

Browser Versions