microsoft/playwright-java
 Watch   
 Star   
 Fork   
28 days ago
playwright-java

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

Demo

Screencast recording — record video with precise start/stop control, as an alternative to the recordVideoDir 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:

  • 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.

Demo

- `playwright-cli` binds all of its browsers automatically, so you can see what your agents are doing. - Pass `PLAYWRIGHT_DASHBOARD=1` env variable to see all `@playwright/test` browsers in the dashboard.

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
2026-01-29 06:58:24
playwright-java

v1.58.0

UI Mode and 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

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 ⚠️

  • Removed _react and _vue selectors. See locators guide for alternatives.
  • Removed :light selector engine suffix. Use standard CSS selectors instead.
  • Option devtools from browserType.launch() has been removed. Use setArgs(Arrays.asList("--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
2025-12-05 02:41:23
playwright-java

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.

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

  • Chromium 143.0.7499.4
  • Mozilla Firefox 144.0.2
  • WebKit 26.0
2025-10-18 03:42:01
playwright-java

v1.56.0

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
2025-08-28 01:03:03
playwright-java

v1.55.0

Codegen

  • Automatic isVisible() assertions: Codegen can now generate automatic isVisible() 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
2025-07-22 02:43:08
playwright-java

v1.54.0

Highlights

  • New cookie property partitionKey in browserContext.cookies() and browserContext.addCookies(). 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.

    mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="codegen --user-data-dir=./user-data"
  • mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args=open command does not open the test recorder anymore. Use mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args=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
2025-06-25 04:33:38
playwright-java

v1.53.0

Miscellaneous

  • New Steps in Trace Viewer: New Trace Viewer Steps

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

    Locator button = page.getByTestId("btn-sub").describe("Subscribe button");
    button.click();
  • mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="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
2025-06-25 02:47:10
playwright-java

v1.53.0

Miscellaneous

  • New Steps in Trace Viewer: New Trace Viewer Steps

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

    Locator button = page.getByTestId("btn-sub").describe("Subscribe button");
    button.click();
  • mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="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
2025-05-02 14:51:06
playwright-java

v1.52.0

Highlights

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

    assertThat(page.getByRole(AriaRole.LISTITEM, new Page.GetByRoleOptions().setName("Ship v1.52")))
      .containsClass("done");
  • Aria Snapshots got two new properties: /children for strict matching and /url for links.

    assertThat(locator).matchesAriaSnapshot("""
      - 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.addCookies().
  • 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
2025-03-18 03:13:56
playwright-java

v1.51.0

Highlights

  • New option setIndexedDB for browserContext.storageState() 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.
    context.storageState(new BrowserContext.StorageStateOptions()
        .setPath(Paths.get("state.json"))
        .setIndexedDB(true));
    
    // Create a new context with the saved storage state.
    BrowserContext context = browser.newContext(new Browser.NewContextOptions()
        .setStorageStatePath(Paths.get("state.json")));
  • New option setVisible for locator.filter() allows matching only visible elements.

    // Ignore invisible todo items.
    Locator todoItems = page.getByTestId("todo-item")
        .filter(new Locator.FilterOptions().setVisible(true));
    // Check there are exactly 3 visible ones.
    assertThat(todoItems).hasCount(3);
  • New option setContrast for methods page.emulateMedia() and browser.newContext() allows to emulate the prefers-contrast media feature.

  • New option setFailOnStatusCode 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