Skip to content

Commit c4b27fe

Browse files
authored
feat: roll driver 1.31.0-beta-1676591072000 (#1207)
1 parent a478acf commit c4b27fe

25 files changed

+348
-118
lines changed

README.md

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

1212
| | Linux | macOS | Windows |
1313
| :--- | :---: | :---: | :---: |
14-
| Chromium <!-- GEN:chromium-version -->110.0.5481.38<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
14+
| Chromium <!-- GEN:chromium-version -->111.0.5563.19<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
1515
| WebKit <!-- GEN:webkit-version -->16.4<!-- GEN:stop --> ||||
16-
| Firefox <!-- GEN:firefox-version -->108.0.2<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
16+
| Firefox <!-- GEN:firefox-version -->109.0<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
1717

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

examples/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<dependency>
1616
<groupId>com.microsoft.playwright</groupId>
1717
<artifactId>playwright</artifactId>
18-
<version>1.22.0</version>
18+
<version>1.30.0</version>
1919
</dependency>
2020
</dependencies>
2121
<build>

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

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,11 @@ class NewContextOptions {
227227
*/
228228
public String userAgent;
229229
/**
230-
* Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. {@code null} disables the default
231-
* viewport.
230+
* Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use {@code null} to disable the consistent
231+
* viewport emulation.
232+
*
233+
* <p> <strong>NOTE:</strong> The {@code null} value opts out from the default presets, makes viewport depend on the host window size defined by the
234+
* operating system. It makes the execution of the tests non-deterministic.
232235
*/
233236
public Optional<ViewportSize> viewportSize;
234237

@@ -536,15 +539,21 @@ public NewContextOptions setUserAgent(String userAgent) {
536539
return this;
537540
}
538541
/**
539-
* Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. {@code null} disables the default
540-
* viewport.
542+
* Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use {@code null} to disable the consistent
543+
* viewport emulation.
544+
*
545+
* <p> <strong>NOTE:</strong> The {@code null} value opts out from the default presets, makes viewport depend on the host window size defined by the
546+
* operating system. It makes the execution of the tests non-deterministic.
541547
*/
542548
public NewContextOptions setViewportSize(int width, int height) {
543549
return setViewportSize(new ViewportSize(width, height));
544550
}
545551
/**
546-
* Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. {@code null} disables the default
547-
* viewport.
552+
* Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use {@code null} to disable the consistent
553+
* viewport emulation.
554+
*
555+
* <p> <strong>NOTE:</strong> The {@code null} value opts out from the default presets, makes viewport depend on the host window size defined by the
556+
* operating system. It makes the execution of the tests non-deterministic.
548557
*/
549558
public NewContextOptions setViewportSize(ViewportSize viewportSize) {
550559
this.viewportSize = Optional.ofNullable(viewportSize);
@@ -722,8 +731,11 @@ class NewPageOptions {
722731
*/
723732
public String userAgent;
724733
/**
725-
* Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. {@code null} disables the default
726-
* viewport.
734+
* Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use {@code null} to disable the consistent
735+
* viewport emulation.
736+
*
737+
* <p> <strong>NOTE:</strong> The {@code null} value opts out from the default presets, makes viewport depend on the host window size defined by the
738+
* operating system. It makes the execution of the tests non-deterministic.
727739
*/
728740
public Optional<ViewportSize> viewportSize;
729741

@@ -1031,15 +1043,21 @@ public NewPageOptions setUserAgent(String userAgent) {
10311043
return this;
10321044
}
10331045
/**
1034-
* Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. {@code null} disables the default
1035-
* viewport.
1046+
* Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use {@code null} to disable the consistent
1047+
* viewport emulation.
1048+
*
1049+
* <p> <strong>NOTE:</strong> The {@code null} value opts out from the default presets, makes viewport depend on the host window size defined by the
1050+
* operating system. It makes the execution of the tests non-deterministic.
10361051
*/
10371052
public NewPageOptions setViewportSize(int width, int height) {
10381053
return setViewportSize(new ViewportSize(width, height));
10391054
}
10401055
/**
1041-
* Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. {@code null} disables the default
1042-
* viewport.
1056+
* Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use {@code null} to disable the consistent
1057+
* viewport emulation.
1058+
*
1059+
* <p> <strong>NOTE:</strong> The {@code null} value opts out from the default presets, makes viewport depend on the host window size defined by the
1060+
* operating system. It makes the execution of the tests non-deterministic.
10431061
*/
10441062
public NewPageOptions setViewportSize(ViewportSize viewportSize) {
10451063
this.viewportSize = Optional.ofNullable(viewportSize);

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

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -601,8 +601,11 @@ class LaunchPersistentContextOptions {
601601
*/
602602
public String userAgent;
603603
/**
604-
* Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. {@code null} disables the default
605-
* viewport.
604+
* Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use {@code null} to disable the consistent
605+
* viewport emulation.
606+
*
607+
* <p> <strong>NOTE:</strong> The {@code null} value opts out from the default presets, makes viewport depend on the host window size defined by the
608+
* operating system. It makes the execution of the tests non-deterministic.
606609
*/
607610
public Optional<ViewportSize> viewportSize;
608611

@@ -1021,15 +1024,21 @@ public LaunchPersistentContextOptions setUserAgent(String userAgent) {
10211024
return this;
10221025
}
10231026
/**
1024-
* Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. {@code null} disables the default
1025-
* viewport.
1027+
* Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use {@code null} to disable the consistent
1028+
* viewport emulation.
1029+
*
1030+
* <p> <strong>NOTE:</strong> The {@code null} value opts out from the default presets, makes viewport depend on the host window size defined by the
1031+
* operating system. It makes the execution of the tests non-deterministic.
10261032
*/
10271033
public LaunchPersistentContextOptions setViewportSize(int width, int height) {
10281034
return setViewportSize(new ViewportSize(width, height));
10291035
}
10301036
/**
1031-
* Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. {@code null} disables the default
1032-
* viewport.
1037+
* Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use {@code null} to disable the consistent
1038+
* viewport emulation.
1039+
*
1040+
* <p> <strong>NOTE:</strong> The {@code null} value opts out from the default presets, makes viewport depend on the host window size defined by the
1041+
* operating system. It makes the execution of the tests non-deterministic.
10331042
*/
10341043
public LaunchPersistentContextOptions setViewportSize(ViewportSize viewportSize) {
10351044
this.viewportSize = Optional.ofNullable(viewportSize);

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2283,7 +2283,7 @@ default void dblclick() {
22832283
*/
22842284
void dblclick(DblclickOptions options);
22852285
/**
2286-
* Programmaticaly dispatch an event on the matching element.
2286+
* Programmatically dispatch an event on the matching element.
22872287
*
22882288
* <p> **Usage**
22892289
* <pre>{@code
@@ -2328,7 +2328,7 @@ default void dispatchEvent(String type, Object eventInit) {
23282328
dispatchEvent(type, eventInit, null);
23292329
}
23302330
/**
2331-
* Programmaticaly dispatch an event on the matching element.
2331+
* Programmatically dispatch an event on the matching element.
23322332
*
23332333
* <p> **Usage**
23342334
* <pre>{@code
@@ -2372,7 +2372,7 @@ default void dispatchEvent(String type) {
23722372
dispatchEvent(type, null);
23732373
}
23742374
/**
2375-
* Programmaticaly dispatch an event on the matching element.
2375+
* Programmatically dispatch an event on the matching element.
23762376
*
23772377
* <p> **Usage**
23782378
* <pre>{@code
@@ -3717,7 +3717,7 @@ default Locator locator(String selector) {
37173717
*/
37183718
Page page();
37193719
/**
3720-
* Focuses the mathing element and presses a combintation of the keys.
3720+
* Focuses the matching element and presses a combination of the keys.
37213721
*
37223722
* <p> **Usage**
37233723
* <pre>{@code
@@ -3756,7 +3756,7 @@ default void press(String key) {
37563756
press(key, null);
37573757
}
37583758
/**
3759-
* Focuses the mathing element and presses a combintation of the keys.
3759+
* Focuses the matching element and presses a combination of the keys.
37603760
*
37613761
* <p> **Usage**
37623762
* <pre>{@code

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

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -5441,6 +5441,45 @@ default Locator locator(String selector) {
54415441
* @since v1.8
54425442
*/
54435443
Mouse mouse();
5444+
/**
5445+
* Adds one-off {@code Dialog} handler. The handler will be removed immediately after next {@code Dialog} is created.
5446+
* <pre>{@code
5447+
* page.onceDialog(dialog -> {
5448+
* dialog.accept("foo");
5449+
* });
5450+
*
5451+
* // prints 'foo'
5452+
* System.out.println(page.evaluate("prompt('Enter string:')"));
5453+
*
5454+
* // prints 'null' as the dialog will be auto-dismissed because there are no handlers.
5455+
* System.out.println(page.evaluate("prompt('Enter string:')"));
5456+
* }</pre>
5457+
*
5458+
* <p> This code above is equivalent to:
5459+
* <pre>{@code
5460+
* Consumer<Dialog> handler = new Consumer<Dialog>() {
5461+
* @Override
5462+
* public void accept(Dialog dialog) {
5463+
* dialog.accept("foo");
5464+
* page.offDialog(this);
5465+
* }
5466+
* };
5467+
* page.onDialog(handler);
5468+
*
5469+
* // prints 'foo'
5470+
* System.out.println(page.evaluate("prompt('Enter string:')"));
5471+
*
5472+
* // prints 'null' as the dialog will be auto-dismissed because there are no handlers.
5473+
* System.out.println(page.evaluate("prompt('Enter string:')"));
5474+
* }</pre>
5475+
*
5476+
* @param handler Receives the {@code Dialog} object, it **must** either {@link Dialog#accept Dialog.accept()} or {@link Dialog#dismiss
5477+
* Dialog.dismiss()} the dialog - otherwise the page will <a
5478+
* href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/EventLoop#never_blocking">freeze</a> waiting for the
5479+
* dialog, and actions like click will never finish.
5480+
* @since v1.10
5481+
*/
5482+
void onceDialog(Consumer<Dialog> handler);
54445483
/**
54455484
* Returns the opener for popup pages and {@code null} for others. If the opener has been closed already the returns {@code
54465485
* null}.
@@ -6727,7 +6766,7 @@ default void setInputFiles(String selector, FilePayload[] files) {
67276766
* <p> When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code
67286767
* TimeoutError}. Passing zero timeout disables this.
67296768
*
6730-
* <p> <strong>NOTE:</strong> {@link Page#tap Page.tap()} requires that the {@code hasTouch} option of the browser context be set to true.
6769+
* <p> <strong>NOTE:</strong> {@link Page#tap Page.tap()} the method will throw if {@code hasTouch} option of the browser context is false.
67316770
*
67326771
* @param selector A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used.
67336772
* @since v1.8
@@ -6749,7 +6788,7 @@ default void tap(String selector) {
67496788
* <p> When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code
67506789
* TimeoutError}. Passing zero timeout disables this.
67516790
*
6752-
* <p> <strong>NOTE:</strong> {@link Page#tap Page.tap()} requires that the {@code hasTouch} option of the browser context be set to true.
6791+
* <p> <strong>NOTE:</strong> {@link Page#tap Page.tap()} the method will throw if {@code hasTouch} option of the browser context is false.
67536792
*
67546793
* @param selector A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used.
67556794
* @since v1.8
@@ -7838,44 +7877,5 @@ default Worker waitForWorker(Runnable callback) {
78387877
* @since v1.8
78397878
*/
78407879
List<Worker> workers();
7841-
/**
7842-
* Adds one-off {@code Dialog} handler. The handler will be removed immediately after next {@code Dialog} is created.
7843-
* <pre>{@code
7844-
* page.onceDialog(dialog -> {
7845-
* dialog.accept("foo");
7846-
* });
7847-
*
7848-
* // prints 'foo'
7849-
* System.out.println(page.evaluate("prompt('Enter string:')"));
7850-
*
7851-
* // prints 'null' as the dialog will be auto-dismissed because there are no handlers.
7852-
* System.out.println(page.evaluate("prompt('Enter string:')"));
7853-
* }</pre>
7854-
*
7855-
* <p> This code above is equivalent to:
7856-
* <pre>{@code
7857-
* Consumer<Dialog> handler = new Consumer<Dialog>() {
7858-
* @Override
7859-
* public void accept(Dialog dialog) {
7860-
* dialog.accept("foo");
7861-
* page.offDialog(this);
7862-
* }
7863-
* };
7864-
* page.onDialog(handler);
7865-
*
7866-
* // prints 'foo'
7867-
* System.out.println(page.evaluate("prompt('Enter string:')"));
7868-
*
7869-
* // prints 'null' as the dialog will be auto-dismissed because there are no handlers.
7870-
* System.out.println(page.evaluate("prompt('Enter string:')"));
7871-
* }</pre>
7872-
*
7873-
* @param handler Receives the {@code Dialog} object, it **must** either {@link Dialog#accept Dialog.accept()} or {@link Dialog#dismiss
7874-
* Dialog.dismiss()} the dialog - otherwise the page will <a
7875-
* href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/EventLoop#never_blocking">freeze</a> waiting for the
7876-
* dialog, and actions like click will never finish.
7877-
* @since v1.10
7878-
*/
7879-
void onceDialog(Consumer<Dialog> handler);
78807880
}
78817881

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public CreateOptions setEnv(Map<String, String> env) {
9797
* Launches new Playwright driver process and connects to it. {@link Playwright#close Playwright.close()} should be called
9898
* when the instance is no longer needed.
9999
* <pre>{@code
100-
* Playwright playwright = Playwright.create()) {
100+
* Playwright playwright = Playwright.create();
101101
* Browser browser = playwright.webkit().launch();
102102
* Page page = browser.newPage();
103103
* page.navigate("https://www.w3.org/");

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

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,11 @@ class FetchOptions {
141141
* If set changes the request HTTP headers. Header values will be converted to a string.
142142
*/
143143
public Map<String, String> headers;
144+
/**
145+
* Maximum number of request redirects that will be followed automatically. An error will be thrown if the number is
146+
* exceeded. Defaults to {@code 20}. Pass {@code 0} to not follow redirects.
147+
*/
148+
public Integer maxRedirects;
144149
/**
145150
* If set changes the request method (e.g. GET or POST).
146151
*/
@@ -161,6 +166,14 @@ public FetchOptions setHeaders(Map<String, String> headers) {
161166
this.headers = headers;
162167
return this;
163168
}
169+
/**
170+
* Maximum number of request redirects that will be followed automatically. An error will be thrown if the number is
171+
* exceeded. Defaults to {@code 20}. Pass {@code 0} to not follow redirects.
172+
*/
173+
public FetchOptions setMaxRedirects(int maxRedirects) {
174+
this.maxRedirects = maxRedirects;
175+
return this;
176+
}
164177
/**
165178
* If set changes the request method (e.g. GET or POST).
166179
*/
@@ -321,6 +334,13 @@ default void abort() {
321334
* });
322335
* }</pre>
323336
*
337+
* <p> **Details**
338+
*
339+
* <p> Note that any overrides such as {@code url} or {@code headers} only apply to the request being routed. If this request
340+
* results in a redirect, overrides will not be applied to the new redirected request. If you want to propagate a header
341+
* through redirects, use the combination of {@link Route#fetch Route.fetch()} and {@link Route#fulfill Route.fulfill()}
342+
* instead.
343+
*
324344
* @since v1.8
325345
*/
326346
default void resume() {
@@ -340,6 +360,13 @@ default void resume() {
340360
* });
341361
* }</pre>
342362
*
363+
* <p> **Details**
364+
*
365+
* <p> Note that any overrides such as {@code url} or {@code headers} only apply to the request being routed. If this request
366+
* results in a redirect, overrides will not be applied to the new redirected request. If you want to propagate a header
367+
* through redirects, use the combination of {@link Route#fetch Route.fetch()} and {@link Route#fulfill Route.fulfill()}
368+
* instead.
369+
*
343370
* @since v1.8
344371
*/
345372
void resume(ResumeOptions options);
@@ -488,6 +515,12 @@ default void fallback() {
488515
* });
489516
* }</pre>
490517
*
518+
* <p> **Details**
519+
*
520+
* <p> Note that {@code headers} option will apply to the fetched request as well as any redirects initiated by it. If you want
521+
* to only apply {@code headers} to the original request, but not to redirects, look into {@link Route#resume
522+
* Route.resume()} instead.
523+
*
491524
* @since v1.29
492525
*/
493526
default APIResponse fetch() {
@@ -510,6 +543,12 @@ default APIResponse fetch() {
510543
* });
511544
* }</pre>
512545
*
546+
* <p> **Details**
547+
*
548+
* <p> Note that {@code headers} option will apply to the fetched request as well as any redirects initiated by it. If you want
549+
* to only apply {@code headers} to the original request, but not to redirects, look into {@link Route#resume
550+
* Route.resume()} instead.
551+
*
513552
* @since v1.29
514553
*/
515554
APIResponse fetch(FetchOptions options);

0 commit comments

Comments
 (0)