Skip to content

Commit 015939b

Browse files
authored
feat: roll driver to 1.50 alpha (#1729)
1 parent eb8cf62 commit 015939b

File tree

18 files changed

+459
-115
lines changed

18 files changed

+459
-115
lines changed

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 -->131.0.6778.33<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
13+
| Chromium <!-- GEN:chromium-version -->132.0.6834.57<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
1414
| WebKit <!-- GEN:webkit-version -->18.2<!-- GEN:stop --> ||||
15-
| Firefox <!-- GEN:firefox-version -->132.0<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
15+
| Firefox <!-- GEN:firefox-version -->134.0<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
1616

1717
Headless execution is supported for all the browsers on all platforms. Check out [system requirements](https://playwright.dev/java/docs/intro#system-requirements) for details.
1818

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,10 +1225,10 @@ public StartTracingOptions setScreenshots(boolean screenshots) {
12251225
* <p> In case this browser is connected to, clears all created contexts belonging to this browser and disconnects from the
12261226
* browser server.
12271227
*
1228-
* <p> <strong>NOTE:</strong> This is similar to force quitting the browser. Therefore, you should call {@link
1229-
* com.microsoft.playwright.BrowserContext#close BrowserContext.close()} on any {@code BrowserContext}'s you explicitly
1230-
* created earlier with {@link com.microsoft.playwright.Browser#newContext Browser.newContext()} **before** calling {@link
1231-
* com.microsoft.playwright.Browser#close Browser.close()}.
1228+
* <p> <strong>NOTE:</strong> This is similar to force-quitting the browser. To close pages gracefully and ensure you receive page close events, call
1229+
* {@link com.microsoft.playwright.BrowserContext#close BrowserContext.close()} on any {@code BrowserContext} instances you
1230+
* explicitly created earlier using {@link com.microsoft.playwright.Browser#newContext Browser.newContext()} **before**
1231+
* calling {@link com.microsoft.playwright.Browser#close Browser.close()}.
12321232
*
12331233
* <p> The {@code Browser} object itself is considered to be disposed and cannot be used anymore.
12341234
*
@@ -1244,10 +1244,10 @@ default void close() {
12441244
* <p> In case this browser is connected to, clears all created contexts belonging to this browser and disconnects from the
12451245
* browser server.
12461246
*
1247-
* <p> <strong>NOTE:</strong> This is similar to force quitting the browser. Therefore, you should call {@link
1248-
* com.microsoft.playwright.BrowserContext#close BrowserContext.close()} on any {@code BrowserContext}'s you explicitly
1249-
* created earlier with {@link com.microsoft.playwright.Browser#newContext Browser.newContext()} **before** calling {@link
1250-
* com.microsoft.playwright.Browser#close Browser.close()}.
1247+
* <p> <strong>NOTE:</strong> This is similar to force-quitting the browser. To close pages gracefully and ensure you receive page close events, call
1248+
* {@link com.microsoft.playwright.BrowserContext#close BrowserContext.close()} on any {@code BrowserContext} instances you
1249+
* explicitly created earlier using {@link com.microsoft.playwright.Browser#newContext Browser.newContext()} **before**
1250+
* calling {@link com.microsoft.playwright.Browser#close Browser.close()}.
12511251
*
12521252
* <p> The {@code Browser} object itself is considered to be disposed and cannot be used anymore.
12531253
*

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

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -834,10 +834,14 @@ default void exposeBinding(String name, BindingCallback callback) {
834834
* Grants specified permissions to the browser context. Only grants corresponding permissions to the given origin if
835835
* specified.
836836
*
837-
* @param permissions A permission or an array of permissions to grant. Permissions can be one of the following values:
837+
* @param permissions A list of permissions to grant.
838+
*
839+
* <p> <strong>NOTE:</strong> Supported permissions differ between browsers, and even between different versions of the same browser. Any permission
840+
* may stop working after an update.
841+
*
842+
* <p> Here are some permissions that may be supported by some browsers:
838843
* <ul>
839844
* <li> {@code "accelerometer"}</li>
840-
* <li> {@code "accessibility-events"}</li>
841845
* <li> {@code "ambient-light-sensor"}</li>
842846
* <li> {@code "background-sync"}</li>
843847
* <li> {@code "camera"}</li>
@@ -862,10 +866,14 @@ default void grantPermissions(List<String> permissions) {
862866
* Grants specified permissions to the browser context. Only grants corresponding permissions to the given origin if
863867
* specified.
864868
*
865-
* @param permissions A permission or an array of permissions to grant. Permissions can be one of the following values:
869+
* @param permissions A list of permissions to grant.
870+
*
871+
* <p> <strong>NOTE:</strong> Supported permissions differ between browsers, and even between different versions of the same browser. Any permission
872+
* may stop working after an update.
873+
*
874+
* <p> Here are some permissions that may be supported by some browsers:
866875
* <ul>
867876
* <li> {@code "accelerometer"}</li>
868-
* <li> {@code "accessibility-events"}</li>
869877
* <li> {@code "ambient-light-sensor"}</li>
870878
* <li> {@code "background-sync"}</li>
871879
* <li> {@code "camera"}</li>
@@ -1388,7 +1396,7 @@ default void routeFromHAR(Path har) {
13881396
* com.microsoft.playwright.BrowserContext#setDefaultNavigationTimeout BrowserContext.setDefaultNavigationTimeout()} take
13891397
* priority over {@link com.microsoft.playwright.BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()}.
13901398
*
1391-
* @param timeout Maximum time in milliseconds
1399+
* @param timeout Maximum time in milliseconds. Pass {@code 0} to disable timeout.
13921400
* @since v1.8
13931401
*/
13941402
void setDefaultTimeout(double timeout);

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

Lines changed: 48 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,14 @@ class LaunchOptions {
172172
*/
173173
public List<String> args;
174174
/**
175-
* Browser distribution channel. Supported values are "chrome", "chrome-beta", "chrome-dev", "chrome-canary", "msedge",
176-
* "msedge-beta", "msedge-dev", "msedge-canary". Read more about using <a
177-
* href="https://playwright.dev/java/docs/browsers#google-chrome--microsoft-edge">Google Chrome and Microsoft Edge</a>.
175+
* Browser distribution channel.
176+
*
177+
* <p> Use "chromium" to <a href="https://playwright.dev/java/docs/browsers#chromium-new-headless-mode">opt in to new headless
178+
* mode</a>.
179+
*
180+
* <p> Use "chrome", "chrome-beta", "chrome-dev", "chrome-canary", "msedge", "msedge-beta", "msedge-dev", or "msedge-canary" to
181+
* use branded <a href="https://playwright.dev/java/docs/browsers#google-chrome--microsoft-edge">Google Chrome and
182+
* Microsoft Edge</a>.
178183
*/
179184
public Object channel;
180185
/**
@@ -265,18 +270,28 @@ public LaunchOptions setArgs(List<String> args) {
265270
}
266271
@Deprecated
267272
/**
268-
* Browser distribution channel. Supported values are "chrome", "chrome-beta", "chrome-dev", "chrome-canary", "msedge",
269-
* "msedge-beta", "msedge-dev", "msedge-canary". Read more about using <a
270-
* href="https://playwright.dev/java/docs/browsers#google-chrome--microsoft-edge">Google Chrome and Microsoft Edge</a>.
273+
* Browser distribution channel.
274+
*
275+
* <p> Use "chromium" to <a href="https://playwright.dev/java/docs/browsers#chromium-new-headless-mode">opt in to new headless
276+
* mode</a>.
277+
*
278+
* <p> Use "chrome", "chrome-beta", "chrome-dev", "chrome-canary", "msedge", "msedge-beta", "msedge-dev", or "msedge-canary" to
279+
* use branded <a href="https://playwright.dev/java/docs/browsers#google-chrome--microsoft-edge">Google Chrome and
280+
* Microsoft Edge</a>.
271281
*/
272282
public LaunchOptions setChannel(BrowserChannel channel) {
273283
this.channel = channel;
274284
return this;
275285
}
276286
/**
277-
* Browser distribution channel. Supported values are "chrome", "chrome-beta", "chrome-dev", "chrome-canary", "msedge",
278-
* "msedge-beta", "msedge-dev", "msedge-canary". Read more about using <a
279-
* href="https://playwright.dev/java/docs/browsers#google-chrome--microsoft-edge">Google Chrome and Microsoft Edge</a>.
287+
* Browser distribution channel.
288+
*
289+
* <p> Use "chromium" to <a href="https://playwright.dev/java/docs/browsers#chromium-new-headless-mode">opt in to new headless
290+
* mode</a>.
291+
*
292+
* <p> Use "chrome", "chrome-beta", "chrome-dev", "chrome-canary", "msedge", "msedge-beta", "msedge-dev", or "msedge-canary" to
293+
* use branded <a href="https://playwright.dev/java/docs/browsers#google-chrome--microsoft-edge">Google Chrome and
294+
* Microsoft Edge</a>.
280295
*/
281296
public LaunchOptions setChannel(String channel) {
282297
this.channel = channel;
@@ -446,9 +461,14 @@ class LaunchPersistentContextOptions {
446461
*/
447462
public Boolean bypassCSP;
448463
/**
449-
* Browser distribution channel. Supported values are "chrome", "chrome-beta", "chrome-dev", "chrome-canary", "msedge",
450-
* "msedge-beta", "msedge-dev", "msedge-canary". Read more about using <a
451-
* href="https://playwright.dev/java/docs/browsers#google-chrome--microsoft-edge">Google Chrome and Microsoft Edge</a>.
464+
* Browser distribution channel.
465+
*
466+
* <p> Use "chromium" to <a href="https://playwright.dev/java/docs/browsers#chromium-new-headless-mode">opt in to new headless
467+
* mode</a>.
468+
*
469+
* <p> Use "chrome", "chrome-beta", "chrome-dev", "chrome-canary", "msedge", "msedge-beta", "msedge-dev", or "msedge-canary" to
470+
* use branded <a href="https://playwright.dev/java/docs/browsers#google-chrome--microsoft-edge">Google Chrome and
471+
* Microsoft Edge</a>.
452472
*/
453473
public Object channel;
454474
/**
@@ -734,18 +754,28 @@ public LaunchPersistentContextOptions setBypassCSP(boolean bypassCSP) {
734754
}
735755
@Deprecated
736756
/**
737-
* Browser distribution channel. Supported values are "chrome", "chrome-beta", "chrome-dev", "chrome-canary", "msedge",
738-
* "msedge-beta", "msedge-dev", "msedge-canary". Read more about using <a
739-
* href="https://playwright.dev/java/docs/browsers#google-chrome--microsoft-edge">Google Chrome and Microsoft Edge</a>.
757+
* Browser distribution channel.
758+
*
759+
* <p> Use "chromium" to <a href="https://playwright.dev/java/docs/browsers#chromium-new-headless-mode">opt in to new headless
760+
* mode</a>.
761+
*
762+
* <p> Use "chrome", "chrome-beta", "chrome-dev", "chrome-canary", "msedge", "msedge-beta", "msedge-dev", or "msedge-canary" to
763+
* use branded <a href="https://playwright.dev/java/docs/browsers#google-chrome--microsoft-edge">Google Chrome and
764+
* Microsoft Edge</a>.
740765
*/
741766
public LaunchPersistentContextOptions setChannel(BrowserChannel channel) {
742767
this.channel = channel;
743768
return this;
744769
}
745770
/**
746-
* Browser distribution channel. Supported values are "chrome", "chrome-beta", "chrome-dev", "chrome-canary", "msedge",
747-
* "msedge-beta", "msedge-dev", "msedge-canary". Read more about using <a
748-
* href="https://playwright.dev/java/docs/browsers#google-chrome--microsoft-edge">Google Chrome and Microsoft Edge</a>.
771+
* Browser distribution channel.
772+
*
773+
* <p> Use "chromium" to <a href="https://playwright.dev/java/docs/browsers#chromium-new-headless-mode">opt in to new headless
774+
* mode</a>.
775+
*
776+
* <p> Use "chrome", "chrome-beta", "chrome-dev", "chrome-canary", "msedge", "msedge-beta", "msedge-dev", or "msedge-canary" to
777+
* use branded <a href="https://playwright.dev/java/docs/browsers#google-chrome--microsoft-edge">Google Chrome and
778+
* Microsoft Edge</a>.
749779
*/
750780
public LaunchPersistentContextOptions setChannel(String channel) {
751781
this.channel = channel;

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

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,19 @@ default void install() {
174174
* page.clock().pauseAt("2020-02-02");
175175
* }</pre>
176176
*
177+
* <p> For best results, install the clock before navigating the page and set it to a time slightly before the intended test
178+
* time. This ensures that all timers run normally during page loading, preventing the page from getting stuck. Once the
179+
* page has fully loaded, you can safely use {@link com.microsoft.playwright.Clock#pauseAt Clock.pauseAt()} to pause the
180+
* clock.
181+
* <pre>{@code
182+
* // Initialize clock with some time before the test time and let the page load
183+
* // naturally. `Date.now` will progress as the timers fire.
184+
* SimpleDateFormat format = new SimpleDateFormat("yyy-MM-dd'T'HH:mm:ss");
185+
* page.clock().install(new Clock.InstallOptions().setTime(format.parse("2024-12-10T08:00:00")));
186+
* page.navigate("http://localhost:3333");
187+
* page.clock().pauseAt(format.parse("2024-12-10T10:00:00"));
188+
* }</pre>
189+
*
177190
* @param time Time to pause at.
178191
* @since v1.45
179192
*/
@@ -194,6 +207,19 @@ default void install() {
194207
* page.clock().pauseAt("2020-02-02");
195208
* }</pre>
196209
*
210+
* <p> For best results, install the clock before navigating the page and set it to a time slightly before the intended test
211+
* time. This ensures that all timers run normally during page loading, preventing the page from getting stuck. Once the
212+
* page has fully loaded, you can safely use {@link com.microsoft.playwright.Clock#pauseAt Clock.pauseAt()} to pause the
213+
* clock.
214+
* <pre>{@code
215+
* // Initialize clock with some time before the test time and let the page load
216+
* // naturally. `Date.now` will progress as the timers fire.
217+
* SimpleDateFormat format = new SimpleDateFormat("yyy-MM-dd'T'HH:mm:ss");
218+
* page.clock().install(new Clock.InstallOptions().setTime(format.parse("2024-12-10T08:00:00")));
219+
* page.navigate("http://localhost:3333");
220+
* page.clock().pauseAt(format.parse("2024-12-10T10:00:00"));
221+
* }</pre>
222+
*
197223
* @param time Time to pause at.
198224
* @since v1.45
199225
*/
@@ -214,6 +240,19 @@ default void install() {
214240
* page.clock().pauseAt("2020-02-02");
215241
* }</pre>
216242
*
243+
* <p> For best results, install the clock before navigating the page and set it to a time slightly before the intended test
244+
* time. This ensures that all timers run normally during page loading, preventing the page from getting stuck. Once the
245+
* page has fully loaded, you can safely use {@link com.microsoft.playwright.Clock#pauseAt Clock.pauseAt()} to pause the
246+
* clock.
247+
* <pre>{@code
248+
* // Initialize clock with some time before the test time and let the page load
249+
* // naturally. `Date.now` will progress as the timers fire.
250+
* SimpleDateFormat format = new SimpleDateFormat("yyy-MM-dd'T'HH:mm:ss");
251+
* page.clock().install(new Clock.InstallOptions().setTime(format.parse("2024-12-10T08:00:00")));
252+
* page.navigate("http://localhost:3333");
253+
* page.clock().pauseAt(format.parse("2024-12-10T10:00:00"));
254+
* }</pre>
255+
*
217256
* @param time Time to pause at.
218257
* @since v1.45
219258
*/

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

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2630,7 +2630,6 @@ default void dblclick() {
26302630
*
26312631
* <p> You can also specify {@code JSHandle} as the property value if you want live objects to be passed into the event:
26322632
* <pre>{@code
2633-
* // Note you can only create DataTransfer in Chromium and Firefox
26342633
* JSHandle dataTransfer = page.evaluateHandle("() => new DataTransfer()");
26352634
* Map<String, Object> arg = new HashMap<>();
26362635
* arg.put("dataTransfer", dataTransfer);
@@ -2679,7 +2678,6 @@ default void dispatchEvent(String type, Object eventInit) {
26792678
*
26802679
* <p> You can also specify {@code JSHandle} as the property value if you want live objects to be passed into the event:
26812680
* <pre>{@code
2682-
* // Note you can only create DataTransfer in Chromium and Firefox
26832681
* JSHandle dataTransfer = page.evaluateHandle("() => new DataTransfer()");
26842682
* Map<String, Object> arg = new HashMap<>();
26852683
* arg.put("dataTransfer", dataTransfer);
@@ -2727,7 +2725,6 @@ default void dispatchEvent(String type) {
27272725
*
27282726
* <p> You can also specify {@code JSHandle} as the property value if you want live objects to be passed into the event:
27292727
* <pre>{@code
2730-
* // Note you can only create DataTransfer in Chromium and Firefox
27312728
* JSHandle dataTransfer = page.evaluateHandle("() => new DataTransfer()");
27322729
* Map<String, Object> arg = new HashMap<>();
27332730
* arg.put("dataTransfer", dataTransfer);
@@ -3968,7 +3965,9 @@ default boolean isDisabled() {
39683965
*/
39693966
boolean isDisabled(IsDisabledOptions options);
39703967
/**
3971-
* Returns whether the element is <a href="https://playwright.dev/java/docs/actionability#editable">editable</a>.
3968+
* Returns whether the element is <a href="https://playwright.dev/java/docs/actionability#editable">editable</a>. If the
3969+
* target element is not an {@code <input>}, {@code <textarea>}, {@code <select>}, {@code [contenteditable]} and does not
3970+
* have a role allowing {@code [aria-readonly]}, this method throws an error.
39723971
*
39733972
* <p> <strong>NOTE:</strong> If you need to assert that an element is editable, prefer {@link
39743973
* com.microsoft.playwright.assertions.LocatorAssertions#isEditable LocatorAssertions.isEditable()} to avoid flakiness. See
@@ -3985,7 +3984,9 @@ default boolean isEditable() {
39853984
return isEditable(null);
39863985
}
39873986
/**
3988-
* Returns whether the element is <a href="https://playwright.dev/java/docs/actionability#editable">editable</a>.
3987+
* Returns whether the element is <a href="https://playwright.dev/java/docs/actionability#editable">editable</a>. If the
3988+
* target element is not an {@code <input>}, {@code <textarea>}, {@code <select>}, {@code [contenteditable]} and does not
3989+
* have a role allowing {@code [aria-readonly]}, this method throws an error.
39893990
*
39903991
* <p> <strong>NOTE:</strong> If you need to assert that an element is editable, prefer {@link
39913992
* com.microsoft.playwright.assertions.LocatorAssertions#isEditable LocatorAssertions.isEditable()} to avoid flakiness. See
@@ -4166,17 +4167,21 @@ default Locator locator(Locator selectorOrLocator) {
41664167
/**
41674168
* Creates a locator matching all elements that match one or both of the two locators.
41684169
*
4169-
* <p> Note that when both locators match something, the resulting locator will have multiple matches and violate <a
4170-
* href="https://playwright.dev/java/docs/locators#strictness">locator strictness</a> guidelines.
4170+
* <p> Note that when both locators match something, the resulting locator will have multiple matches, potentially causing a <a
4171+
* href="https://playwright.dev/java/docs/locators#strictness">locator strictness</a> violation.
41714172
*
41724173
* <p> <strong>Usage</strong>
41734174
*
41744175
* <p> Consider a scenario where you'd like to click on a "New email" button, but sometimes a security settings dialog shows up
41754176
* instead. In this case, you can wait for either a "New email" button, or a dialog and act accordingly.
4177+
*
4178+
* <p> <strong>NOTE:</strong> If both "New email" button and security dialog appear on screen, the "or" locator will match both of them, possibly
4179+
* throwing the <a href="https://playwright.dev/java/docs/locators#strictness">"strict mode violation" error</a>. In this
4180+
* case, you can use {@link com.microsoft.playwright.Locator#first Locator.first()} to only match one of them.
41764181
* <pre>{@code
41774182
* Locator newEmail = page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("New"));
41784183
* Locator dialog = page.getByText("Confirm security settings");
4179-
* assertThat(newEmail.or(dialog)).isVisible();
4184+
* assertThat(newEmail.or(dialog).first()).isVisible();
41804185
* if (dialog.isVisible())
41814186
* page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("Dismiss")).click();
41824187
* newEmail.click();

0 commit comments

Comments
 (0)