Skip to content

Commit f081667

Browse files
authored
chore: roll to 1.60.0-alpha-2026-05-05 (#1916)
1 parent 5b33729 commit f081667

45 files changed

Lines changed: 1409 additions & 331 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/skills/playwright-roll/SKILL.md

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,45 @@ Help the user roll to a new version of Playwright.
77
ROLLING.md contains general instructions and scripts.
88

99
Start with running ./scripts/roll_driver.sh to update the version and generate the API to see the state of things.
10-
Afterwards, work through the list of changes that need to be backported.
11-
You can find a list of pull requests that might need to be taking into account in the issue titled "Backport changes".
12-
Work through them one-by-one and check off the items that you have handled.
13-
Not all of them will be relevant, some might have partially been reverted, etc. - so feel free to check with the upstream release branch.
10+
Afterwards, walk through the upstream changes that affect the Java client and port the relevant ones.
11+
12+
## Determining what to port
13+
14+
List the upstream commits that touched a client-relevant path since the last release. The paths cover everything that can change the public Java surface or the wire protocol:
15+
16+
- `docs/src/api/` — the source of truth for `api.json`. Method/option additions, removals, and `langs:` filter changes flow from here.
17+
- `packages/playwright-core/src/client/` — the JS client implementation that the Java client mirrors.
18+
- `packages/isomorphic/` — selector engines, locator generation/parsing, and aria-snapshot logic shared between client and server. Changes here can affect client-side helpers like `getByRoleSelector`.
19+
- `packages/playwright/src/matchers/matchers.ts` — assertion-method definitions. Changes here usually correspond to new options on `LocatorAssertions` / `PageAssertions`.
20+
- `packages/protocol/src/protocol.yml` — the wire protocol schema. Method/event additions, parameter renames, and result-shape changes affect what the Java `*Impl` classes need to send/receive.
21+
22+
```bash
23+
cd ~/playwright
24+
PREV_TAG=$(git tag | grep -E '^v1\.[0-9]+\.[0-9]+$' | sort -V | tail -1) # e.g. v1.59.1
25+
git log "$PREV_TAG"..HEAD --oneline -- \
26+
'docs/src/api/' \
27+
'packages/playwright-core/src/client/' \
28+
'packages/isomorphic/' \
29+
'packages/playwright/src/matchers/matchers.ts' \
30+
'packages/protocol/src/protocol.yml'
31+
```
32+
33+
Walk that list top-to-bottom (oldest-first is easier — newest is at top, so reverse). For each commit:
34+
1. Read the commit (`git show <sha>`) to see what client/protocol/docs changed.
35+
2. If it's JS-internal (bundling, dispatcher conventions, electron, mcp, dashboard, trace-viewer, test-runner) — skip.
36+
3. If it touches `docs/src/api/` or types, check `langs:` annotations — features marked `langs: js`/`langs: js, python` don't apply to Java.
37+
4. If it adds/changes a public API method or option that applies to Java, port it. The api.json regenerated by `roll_driver.sh` already contains the new types/options, so the generated Java interfaces usually pick them up automatically — what's typically missing is the `*Impl` wiring.
38+
5. Watch for follow-up reverts — a "feat: X" commit might be undone by a later "Revert X". Check whether the change still exists in HEAD before porting.
39+
6. Maintain a running notes file (e.g. `/tmp/roll-notes.md`) listing each upstream PR as ported / skipped / verified-already-supported, with a one-line reason. This file becomes the body of the eventual PR.
40+
41+
## What to include in the rolling PR
42+
43+
- Driver version bump
44+
- Generated interface diffs from `roll_driver.sh`
45+
- `*Impl` wiring for each ported feature
46+
- Generator updates (import lists, special-cases) if new types appeared
47+
- A small test per new public API surface — listener for new events, basic call for new methods, regression for changed return types
48+
- PR description: list each upstream PR ported, each skipped (with reason), and each verified-already-supported
1449

1550
Rolling includes:
1651
- updating client implementation to match changes in the upstream JS implementation (see ../playwright/packages/playwright-core/src/client)
@@ -164,5 +199,4 @@ Branch naming for issue fixes: `fix-<issue-number>`
164199

165200
## Tips & Tricks
166201
- Project checkouts are in the parent directory (`../`).
167-
- When updating checkboxes, store the issue content into /tmp and edit it there, then update the issue based on the file
168202
- use the "gh" cli to interact with GitHub

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ Playwright is a Java library to automate [Chromium](https://www.chromium.org/Hom
1010

1111
| | Linux | macOS | Windows |
1212
| :--- | :---: | :---: | :---: |
13-
| Chromium <!-- GEN:chromium-version -->147.0.7727.15<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
13+
| Chromium <!-- GEN:chromium-version -->148.0.7778.96<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
1414
| WebKit <!-- GEN:webkit-version -->26.4<!-- GEN:stop --> ||||
15-
| Firefox <!-- GEN:firefox-version -->148.0.2<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
15+
| Firefox <!-- GEN:firefox-version -->150.0.1<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
1616

1717
## Documentation
1818

examples/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<name>Playwright Client Examples</name>
1111
<properties>
1212
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
13-
<playwright.version>1.59.0</playwright.version>
13+
<playwright.version>1.60.0</playwright.version>
1414
</properties>
1515
<dependencies>
1616
<dependency>

playwright/src/main/java/com/microsoft/playwright/APIRequestContext.java

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,23 @@
2323
* This API is used for the Web API testing. You can use it to trigger API endpoints, configure micro-services, prepare
2424
* environment or the service to your e2e test.
2525
*
26-
* <p> Each Playwright browser context has associated with it {@code APIRequestContext} instance which shares cookie storage
27-
* with the browser context and can be accessed via {@link com.microsoft.playwright.BrowserContext#request
28-
* BrowserContext.request()} or {@link com.microsoft.playwright.Page#request Page.request()}. It is also possible to create
29-
* a new APIRequestContext instance manually by calling {@link com.microsoft.playwright.APIRequest#newContext
30-
* APIRequest.newContext()}.
26+
* <p> Each Playwright browser context has an associated {@code APIRequestContext}, accessible via {@link
27+
* com.microsoft.playwright.BrowserContext#request BrowserContext.request()} or {@link
28+
* com.microsoft.playwright.Page#request Page.request()} (these return the
29+
*
30+
* <p> **same instance** — {@code page.request} is a shortcut for {@code page.context().request}). You can also create a
31+
* standalone, isolated instance with {@link com.microsoft.playwright.APIRequest#newContext APIRequest.newContext()}.
3132
*
3233
* <p> <strong>Cookie management</strong>
3334
*
34-
* <p> {@code APIRequestContext} returned by {@link com.microsoft.playwright.BrowserContext#request BrowserContext.request()}
35-
* and {@link com.microsoft.playwright.Page#request Page.request()} shares cookie storage with the corresponding {@code
36-
* BrowserContext}. Each API request will have {@code Cookie} header populated with the values from the browser context. If
37-
* the API response contains {@code Set-Cookie} header it will automatically update {@code BrowserContext} cookies and
38-
* requests made from the page will pick them up. This means that if you log in using this API, your e2e test will be
39-
* logged in and vice versa.
35+
* <p> The {@code APIRequestContext} returned by {@link com.microsoft.playwright.BrowserContext#request
36+
* BrowserContext.request()} and
37+
*
38+
* <p> {@link com.microsoft.playwright.Page#request Page.request()} uses the same cookie jar as its {@code BrowserContext}:
4039
*
41-
* <p> If you want API requests to not interfere with the browser cookies you should create a new {@code APIRequestContext} by
42-
* calling {@link com.microsoft.playwright.APIRequest#newContext APIRequest.newContext()}. Such {@code APIRequestContext}
43-
* object will have its own isolated cookie storage.
40+
* <p> If you want API requests that do **not** share cookies with the browser, create an isolated context via {@link
41+
* com.microsoft.playwright.APIRequest#newContext APIRequest.newContext()}. Such {@code APIRequestContext} object will have
42+
* its own isolated cookie storage.
4443
*/
4544
public interface APIRequestContext {
4645
class DisposeOptions {
@@ -484,5 +483,11 @@ default String storageState() {
484483
* @since v1.16
485484
*/
486485
String storageState(StorageStateOptions options);
486+
/**
487+
*
488+
*
489+
* @since v1.60
490+
*/
491+
Tracing tracing();
487492
}
488493

playwright/src/main/java/com/microsoft/playwright/Browser.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,15 @@
4343
*/
4444
public interface Browser extends AutoCloseable {
4545

46+
/**
47+
* Emitted when a new browser context is created.
48+
*/
49+
void onContext(Consumer<BrowserContext> handler);
50+
/**
51+
* Removes handler that was previously added with {@link #onContext onContext(handler)}.
52+
*/
53+
void offContext(Consumer<BrowserContext> handler);
54+
4655
/**
4756
* Emitted when Browser gets disconnected from the browser application. This might happen because of one of the following:
4857
* <ul>

playwright/src/main/java/com/microsoft/playwright/BrowserContext.java

Lines changed: 64 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,48 @@ public interface BrowserContext extends AutoCloseable {
114114
*/
115115
void offDialog(Consumer<Dialog> handler);
116116

117+
/**
118+
* Emitted when attachment download started in any page belonging to this context. User can access basic file operations on
119+
* downloaded content via the passed {@code Download} instance. See also {@link com.microsoft.playwright.Page#onDownload
120+
* Page.onDownload()} to receive events about a specific page.
121+
*/
122+
void onDownload(Consumer<Download> handler);
123+
/**
124+
* Removes handler that was previously added with {@link #onDownload onDownload(handler)}.
125+
*/
126+
void offDownload(Consumer<Download> handler);
127+
128+
/**
129+
* Emitted when a frame is attached in any page belonging to this context. See also {@link
130+
* com.microsoft.playwright.Page#onFrameAttached Page.onFrameAttached()} to receive events about a specific page.
131+
*/
132+
void onFrameAttached(Consumer<Frame> handler);
133+
/**
134+
* Removes handler that was previously added with {@link #onFrameAttached onFrameAttached(handler)}.
135+
*/
136+
void offFrameAttached(Consumer<Frame> handler);
137+
138+
/**
139+
* Emitted when a frame is detached in any page belonging to this context. See also {@link
140+
* com.microsoft.playwright.Page#onFrameDetached Page.onFrameDetached()} to receive events about a specific page.
141+
*/
142+
void onFrameDetached(Consumer<Frame> handler);
143+
/**
144+
* Removes handler that was previously added with {@link #onFrameDetached onFrameDetached(handler)}.
145+
*/
146+
void offFrameDetached(Consumer<Frame> handler);
147+
148+
/**
149+
* Emitted when a frame is navigated to a new url in any page belonging to this context. See also {@link
150+
* com.microsoft.playwright.Page#onFrameNavigated Page.onFrameNavigated()} to receive events about navigations in a
151+
* specific page.
152+
*/
153+
void onFrameNavigated(Consumer<Frame> handler);
154+
/**
155+
* Removes handler that was previously added with {@link #onFrameNavigated onFrameNavigated(handler)}.
156+
*/
157+
void offFrameNavigated(Consumer<Frame> handler);
158+
117159
/**
118160
* The event is emitted when a new Page is created in the BrowserContext. The page may still be loading. The event will
119161
* also fire for popup pages. See also {@link com.microsoft.playwright.Page#onPopup Page.onPopup()} to receive events about
@@ -141,6 +183,27 @@ public interface BrowserContext extends AutoCloseable {
141183
*/
142184
void offPage(Consumer<Page> handler);
143185

186+
/**
187+
* Emitted when a page in this context is closed. See also {@link com.microsoft.playwright.Page#onClose Page.onClose()} to
188+
* receive events about a specific page.
189+
*/
190+
void onPageClose(Consumer<Page> handler);
191+
/**
192+
* Removes handler that was previously added with {@link #onPageClose onPageClose(handler)}.
193+
*/
194+
void offPageClose(Consumer<Page> handler);
195+
196+
/**
197+
* Emitted when the JavaScript <a href="https://developer.mozilla.org/en-US/docs/Web/Events/load">{@code load}</a> event is
198+
* dispatched in any page belonging to this context. See also {@link com.microsoft.playwright.Page#onLoad Page.onLoad()} to
199+
* receive events about a specific page.
200+
*/
201+
void onPageLoad(Consumer<Page> handler);
202+
/**
203+
* Removes handler that was previously added with {@link #onPageLoad onPageLoad(handler)}.
204+
*/
205+
void offPageLoad(Consumer<Page> handler);
206+
144207
/**
145208
* Emitted when exception is unhandled in any of the pages in this context. To listen for errors from a particular page,
146209
* use {@link com.microsoft.playwright.Page#onPageError Page.onPageError()} instead.
@@ -271,20 +334,6 @@ public CloseOptions setReason(String reason) {
271334
return this;
272335
}
273336
}
274-
class ExposeBindingOptions {
275-
/**
276-
* @deprecated This option will be removed in the future.
277-
*/
278-
public Boolean handle;
279-
280-
/**
281-
* @deprecated This option will be removed in the future.
282-
*/
283-
public ExposeBindingOptions setHandle(boolean handle) {
284-
this.handle = handle;
285-
return this;
286-
}
287-
}
288337
class GrantPermissionsOptions {
289338
/**
290339
* The [origin] to grant permissions to, e.g. "https://example.com".
@@ -736,54 +785,7 @@ default List<Cookie> cookies() {
736785
* @param callback Callback function that will be called in the Playwright's context.
737786
* @since v1.8
738787
*/
739-
default AutoCloseable exposeBinding(String name, BindingCallback callback) {
740-
return exposeBinding(name, callback, null);
741-
}
742-
/**
743-
* The method adds a function called {@code name} on the {@code window} object of every frame in every page in the context.
744-
* When called, the function executes {@code callback} and returns a <a
745-
* href='https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise'>Promise</a> which
746-
* resolves to the return value of {@code callback}. If the {@code callback} returns a <a
747-
* href='https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise'>Promise</a>, it will be
748-
* awaited.
749-
*
750-
* <p> The first argument of the {@code callback} function contains information about the caller: {@code { browserContext:
751-
* BrowserContext, page: Page, frame: Frame }}.
752-
*
753-
* <p> See {@link com.microsoft.playwright.Page#exposeBinding Page.exposeBinding()} for page-only version.
754-
*
755-
* <p> <strong>Usage</strong>
756-
*
757-
* <p> An example of exposing page URL to all frames in all pages in the context:
758-
* <pre>{@code
759-
* import com.microsoft.playwright.*;
760-
*
761-
* public class Example {
762-
* public static void main(String[] args) {
763-
* try (Playwright playwright = Playwright.create()) {
764-
* BrowserType webkit = playwright.webkit();
765-
* Browser browser = webkit.launch(new BrowserType.LaunchOptions().setHeadless(false));
766-
* BrowserContext context = browser.newContext();
767-
* context.exposeBinding("pageURL", (source, args) -> source.page().url());
768-
* Page page = context.newPage();
769-
* page.setContent("<script>\n" +
770-
* " async function onClick() {\n" +
771-
* " document.querySelector('div').textContent = await window.pageURL();\n" +
772-
* " }\n" +
773-
* "</script>\n" +
774-
* "<button onclick=\"onClick()\">Click me</button>\n" +
775-
* "<div></div>");
776-
* page.getByRole(AriaRole.BUTTON).click();
777-
* }
778-
* }
779-
* }
780-
* }</pre>
781-
*
782-
* @param name Name of the function on the window object.
783-
* @param callback Callback function that will be called in the Playwright's context.
784-
* @since v1.8
785-
*/
786-
AutoCloseable exposeBinding(String name, BindingCallback callback, ExposeBindingOptions options);
788+
AutoCloseable exposeBinding(String name, BindingCallback callback);
787789
/**
788790
* The method adds a function called {@code name} on the {@code window} object of every frame in every page in the context.
789791
* When called, the function executes {@code callback} and returns a <a

playwright/src/main/java/com/microsoft/playwright/BrowserType.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,15 @@ class ConnectOverCDPOptions {
133133
* the file system being the same between Playwright and the Browser.
134134
*/
135135
public Boolean isLocal;
136+
/**
137+
* When true, Playwright will not apply its default overrides to the existing default browser context. Specifically, {@code
138+
* acceptDownloads} is left at the browser's setting, focus emulation is not enabled, and media emulation options (such as
139+
* {@code colorScheme}, {@code reducedMotion}, {@code forcedColors}, and {@code contrast}) are not applied. Useful when
140+
* attaching to a user's daily-driver browser where these overrides would interfere with existing browser state. New
141+
* contexts created via {@link com.microsoft.playwright.Browser#newContext Browser.newContext()} are not affected. Defaults
142+
* to {@code false}.
143+
*/
144+
public Boolean noDefaults;
136145
/**
137146
* Slows down Playwright operations by the specified amount of milliseconds. Useful so that you can see what is going on.
138147
* Defaults to 0.
@@ -159,6 +168,18 @@ public ConnectOverCDPOptions setIsLocal(boolean isLocal) {
159168
this.isLocal = isLocal;
160169
return this;
161170
}
171+
/**
172+
* When true, Playwright will not apply its default overrides to the existing default browser context. Specifically, {@code
173+
* acceptDownloads} is left at the browser's setting, focus emulation is not enabled, and media emulation options (such as
174+
* {@code colorScheme}, {@code reducedMotion}, {@code forcedColors}, and {@code contrast}) are not applied. Useful when
175+
* attaching to a user's daily-driver browser where these overrides would interfere with existing browser state. New
176+
* contexts created via {@link com.microsoft.playwright.Browser#newContext Browser.newContext()} are not affected. Defaults
177+
* to {@code false}.
178+
*/
179+
public ConnectOverCDPOptions setNoDefaults(boolean noDefaults) {
180+
this.noDefaults = noDefaults;
181+
return this;
182+
}
162183
/**
163184
* Slows down Playwright operations by the specified amount of milliseconds. Useful so that you can see what is going on.
164185
* Defaults to 0.

0 commit comments

Comments
 (0)