Skip to content

Commit f7b7d79

Browse files
committed
chore: roll 1.52.0 driver, implement new features except glob
indexeddb
1 parent 478417b commit f7b7d79

File tree

16 files changed

+331
-89
lines changed

16 files changed

+331
-89
lines changed

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

+15
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ class NewContextOptions {
7272
* Whether to ignore HTTPS errors when sending network requests. Defaults to {@code false}.
7373
*/
7474
public Boolean ignoreHTTPSErrors;
75+
/**
76+
* Maximum number of request redirects that will be followed automatically. An error will be thrown if the number is
77+
* exceeded. Defaults to {@code 20}. Pass {@code 0} to not follow redirects. This can be overwritten for each request
78+
* individually.
79+
*/
80+
public Integer maxRedirects;
7581
/**
7682
* Network proxy settings.
7783
*/
@@ -171,6 +177,15 @@ public NewContextOptions setIgnoreHTTPSErrors(boolean ignoreHTTPSErrors) {
171177
this.ignoreHTTPSErrors = ignoreHTTPSErrors;
172178
return this;
173179
}
180+
/**
181+
* Maximum number of request redirects that will be followed automatically. An error will be thrown if the number is
182+
* exceeded. Defaults to {@code 20}. Pass {@code 0} to not follow redirects. This can be overwritten for each request
183+
* individually.
184+
*/
185+
public NewContextOptions setMaxRedirects(int maxRedirects) {
186+
this.maxRedirects = maxRedirects;
187+
return this;
188+
}
174189
/**
175190
* Network proxy settings.
176191
*/

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

+12-16
Original file line numberDiff line numberDiff line change
@@ -411,8 +411,6 @@ class StorageStateOptions {
411411
* Set to {@code true} to include <a href="https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API">IndexedDB</a> in
412412
* the storage state snapshot. If your application uses IndexedDB to store authentication tokens, like Firebase
413413
* Authentication, enable this.
414-
*
415-
* <p> <strong>NOTE:</strong> IndexedDBs with typed arrays are currently not supported.
416414
*/
417415
public Boolean indexedDB;
418416
/**
@@ -425,8 +423,6 @@ class StorageStateOptions {
425423
* Set to {@code true} to include <a href="https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API">IndexedDB</a> in
426424
* the storage state snapshot. If your application uses IndexedDB to store authentication tokens, like Firebase
427425
* Authentication, enable this.
428-
*
429-
* <p> <strong>NOTE:</strong> IndexedDBs with typed arrays are currently not supported.
430426
*/
431427
public StorageStateOptions setIndexedDB(boolean indexedDB) {
432428
this.indexedDB = indexedDB;
@@ -996,8 +992,8 @@ default void grantPermissions(List<String> permissions) {
996992
*
997993
* <p> <strong>NOTE:</strong> Enabling routing disables http cache.
998994
*
999-
* @param url A glob pattern, regex pattern or predicate receiving [URL] to match while routing. When a {@code baseURL} via the
1000-
* context options was provided and the passed URL is a path, it gets merged via the <a
995+
* @param url A glob pattern, regex pattern, or predicate that receives a [URL] to match during routing. If {@code baseURL} is set in
996+
* the context options and the provided URL is a string that does not start with {@code *}, it is resolved using the <a
1001997
* href="https://developer.mozilla.org/en-US/docs/Web/API/URL/URL">{@code new URL()}</a> constructor.
1002998
* @param handler handler function to route the request.
1003999
* @since v1.8
@@ -1052,8 +1048,8 @@ default void route(String url, Consumer<Route> handler) {
10521048
*
10531049
* <p> <strong>NOTE:</strong> Enabling routing disables http cache.
10541050
*
1055-
* @param url A glob pattern, regex pattern or predicate receiving [URL] to match while routing. When a {@code baseURL} via the
1056-
* context options was provided and the passed URL is a path, it gets merged via the <a
1051+
* @param url A glob pattern, regex pattern, or predicate that receives a [URL] to match during routing. If {@code baseURL} is set in
1052+
* the context options and the provided URL is a string that does not start with {@code *}, it is resolved using the <a
10571053
* href="https://developer.mozilla.org/en-US/docs/Web/API/URL/URL">{@code new URL()}</a> constructor.
10581054
* @param handler handler function to route the request.
10591055
* @since v1.8
@@ -1106,8 +1102,8 @@ default void route(String url, Consumer<Route> handler) {
11061102
*
11071103
* <p> <strong>NOTE:</strong> Enabling routing disables http cache.
11081104
*
1109-
* @param url A glob pattern, regex pattern or predicate receiving [URL] to match while routing. When a {@code baseURL} via the
1110-
* context options was provided and the passed URL is a path, it gets merged via the <a
1105+
* @param url A glob pattern, regex pattern, or predicate that receives a [URL] to match during routing. If {@code baseURL} is set in
1106+
* the context options and the provided URL is a string that does not start with {@code *}, it is resolved using the <a
11111107
* href="https://developer.mozilla.org/en-US/docs/Web/API/URL/URL">{@code new URL()}</a> constructor.
11121108
* @param handler handler function to route the request.
11131109
* @since v1.8
@@ -1162,8 +1158,8 @@ default void route(Pattern url, Consumer<Route> handler) {
11621158
*
11631159
* <p> <strong>NOTE:</strong> Enabling routing disables http cache.
11641160
*
1165-
* @param url A glob pattern, regex pattern or predicate receiving [URL] to match while routing. When a {@code baseURL} via the
1166-
* context options was provided and the passed URL is a path, it gets merged via the <a
1161+
* @param url A glob pattern, regex pattern, or predicate that receives a [URL] to match during routing. If {@code baseURL} is set in
1162+
* the context options and the provided URL is a string that does not start with {@code *}, it is resolved using the <a
11671163
* href="https://developer.mozilla.org/en-US/docs/Web/API/URL/URL">{@code new URL()}</a> constructor.
11681164
* @param handler handler function to route the request.
11691165
* @since v1.8
@@ -1216,8 +1212,8 @@ default void route(Pattern url, Consumer<Route> handler) {
12161212
*
12171213
* <p> <strong>NOTE:</strong> Enabling routing disables http cache.
12181214
*
1219-
* @param url A glob pattern, regex pattern or predicate receiving [URL] to match while routing. When a {@code baseURL} via the
1220-
* context options was provided and the passed URL is a path, it gets merged via the <a
1215+
* @param url A glob pattern, regex pattern, or predicate that receives a [URL] to match during routing. If {@code baseURL} is set in
1216+
* the context options and the provided URL is a string that does not start with {@code *}, it is resolved using the <a
12211217
* href="https://developer.mozilla.org/en-US/docs/Web/API/URL/URL">{@code new URL()}</a> constructor.
12221218
* @param handler handler function to route the request.
12231219
* @since v1.8
@@ -1272,8 +1268,8 @@ default void route(Predicate<String> url, Consumer<Route> handler) {
12721268
*
12731269
* <p> <strong>NOTE:</strong> Enabling routing disables http cache.
12741270
*
1275-
* @param url A glob pattern, regex pattern or predicate receiving [URL] to match while routing. When a {@code baseURL} via the
1276-
* context options was provided and the passed URL is a path, it gets merged via the <a
1271+
* @param url A glob pattern, regex pattern, or predicate that receives a [URL] to match during routing. If {@code baseURL} is set in
1272+
* the context options and the provided URL is a string that does not start with {@code *}, it is resolved using the <a
12771273
* href="https://developer.mozilla.org/en-US/docs/Web/API/URL/URL">{@code new URL()}</a> constructor.
12781274
* @param handler handler function to route the request.
12791275
* @since v1.8

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

+24-16
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,8 @@ class LaunchOptions {
226226
/**
227227
* Whether to run browser in headless mode. More details for <a
228228
* href="https://developers.google.com/web/updates/2017/04/headless-chrome">Chromium</a> and <a
229-
* href="https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Headless_mode">Firefox</a>. Defaults to {@code true}
230-
* unless the {@code devtools} option is {@code true}.
229+
* href="https://hacks.mozilla.org/2017/12/using-headless-mode-in-firefox/">Firefox</a>. Defaults to {@code true} unless
230+
* the {@code devtools} option is {@code true}.
231231
*/
232232
public Boolean headless;
233233
/**
@@ -368,8 +368,8 @@ public LaunchOptions setHandleSIGTERM(boolean handleSIGTERM) {
368368
/**
369369
* Whether to run browser in headless mode. More details for <a
370370
* href="https://developers.google.com/web/updates/2017/04/headless-chrome">Chromium</a> and <a
371-
* href="https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Headless_mode">Firefox</a>. Defaults to {@code true}
372-
* unless the {@code devtools} option is {@code true}.
371+
* href="https://hacks.mozilla.org/2017/12/using-headless-mode-in-firefox/">Firefox</a>. Defaults to {@code true} unless
372+
* the {@code devtools} option is {@code true}.
373373
*/
374374
public LaunchOptions setHeadless(boolean headless) {
375375
this.headless = headless;
@@ -564,8 +564,8 @@ class LaunchPersistentContextOptions {
564564
/**
565565
* Whether to run browser in headless mode. More details for <a
566566
* href="https://developers.google.com/web/updates/2017/04/headless-chrome">Chromium</a> and <a
567-
* href="https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Headless_mode">Firefox</a>. Defaults to {@code true}
568-
* unless the {@code devtools} option is {@code true}.
567+
* href="https://hacks.mozilla.org/2017/12/using-headless-mode-in-firefox/">Firefox</a>. Defaults to {@code true} unless
568+
* the {@code devtools} option is {@code true}.
569569
*/
570570
public Boolean headless;
571571
/**
@@ -934,8 +934,8 @@ public LaunchPersistentContextOptions setHasTouch(boolean hasTouch) {
934934
/**
935935
* Whether to run browser in headless mode. More details for <a
936936
* href="https://developers.google.com/web/updates/2017/04/headless-chrome">Chromium</a> and <a
937-
* href="https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Headless_mode">Firefox</a>. Defaults to {@code true}
938-
* unless the {@code devtools} option is {@code true}.
937+
* href="https://hacks.mozilla.org/2017/12/using-headless-mode-in-firefox/">Firefox</a>. Defaults to {@code true} unless
938+
* the {@code devtools} option is {@code true}.
939939
*/
940940
public LaunchPersistentContextOptions setHeadless(boolean headless) {
941941
this.headless = headless;
@@ -1365,11 +1365,15 @@ default Browser launch() {
13651365
* <p> Launches browser that uses persistent storage located at {@code userDataDir} and returns the only context. Closing this
13661366
* context will automatically close the browser.
13671367
*
1368-
* @param userDataDir Path to a User Data Directory, which stores browser session data like cookies and local storage. More details for <a
1368+
* @param userDataDir Path to a User Data Directory, which stores browser session data like cookies and local storage. Pass an empty string to
1369+
* create a temporary directory.
1370+
*
1371+
* <p> More details for <a
13691372
* href="https://chromium.googlesource.com/chromium/src/+/master/docs/user_data_dir.md#introduction">Chromium</a> and <a
1370-
* href="https://developer.mozilla.org/en-US/docs/Mozilla/Command_Line_Options#User_Profile">Firefox</a>. Note that
1371-
* Chromium's user data directory is the **parent** directory of the "Profile Path" seen at {@code chrome://version}. Pass
1372-
* an empty string to use a temporary directory instead.
1373+
* href="https://wiki.mozilla.org/Firefox/CommandLineOptions#User_profile">Firefox</a>. Chromium's user data directory is
1374+
* the **parent** directory of the "Profile Path" seen at {@code chrome://version}.
1375+
*
1376+
* <p> Note that browsers do not allow launching multiple instances with the same User Data Directory.
13731377
* @since v1.8
13741378
*/
13751379
default BrowserContext launchPersistentContext(Path userDataDir) {
@@ -1381,11 +1385,15 @@ default BrowserContext launchPersistentContext(Path userDataDir) {
13811385
* <p> Launches browser that uses persistent storage located at {@code userDataDir} and returns the only context. Closing this
13821386
* context will automatically close the browser.
13831387
*
1384-
* @param userDataDir Path to a User Data Directory, which stores browser session data like cookies and local storage. More details for <a
1388+
* @param userDataDir Path to a User Data Directory, which stores browser session data like cookies and local storage. Pass an empty string to
1389+
* create a temporary directory.
1390+
*
1391+
* <p> More details for <a
13851392
* href="https://chromium.googlesource.com/chromium/src/+/master/docs/user_data_dir.md#introduction">Chromium</a> and <a
1386-
* href="https://developer.mozilla.org/en-US/docs/Mozilla/Command_Line_Options#User_Profile">Firefox</a>. Note that
1387-
* Chromium's user data directory is the **parent** directory of the "Profile Path" seen at {@code chrome://version}. Pass
1388-
* an empty string to use a temporary directory instead.
1393+
* href="https://wiki.mozilla.org/Firefox/CommandLineOptions#User_profile">Firefox</a>. Chromium's user data directory is
1394+
* the **parent** directory of the "Profile Path" seen at {@code chrome://version}.
1395+
*
1396+
* <p> Note that browsers do not allow launching multiple instances with the same User Data Directory.
13891397
* @since v1.8
13901398
*/
13911399
BrowserContext launchPersistentContext(Path userDataDir, LaunchPersistentContextOptions options);

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

+21-16
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@
3030
*/
3131
public interface Locator {
3232
class AriaSnapshotOptions {
33+
/**
34+
* Generate symbolic reference for each element. One can use {@code aria-ref=<ref>} locator immediately after capturing the
35+
* snapshot to perform actions on the element.
36+
*/
37+
public Boolean ref;
3338
/**
3439
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
3540
* value can be changed by using the {@link com.microsoft.playwright.BrowserContext#setDefaultTimeout
@@ -38,6 +43,14 @@ class AriaSnapshotOptions {
3843
*/
3944
public Double timeout;
4045

46+
/**
47+
* Generate symbolic reference for each element. One can use {@code aria-ref=<ref>} locator immediately after capturing the
48+
* snapshot to perform actions on the element.
49+
*/
50+
public AriaSnapshotOptions setRef(boolean ref) {
51+
this.ref = ref;
52+
return this;
53+
}
4154
/**
4255
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
4356
* value can be changed by using the {@link com.microsoft.playwright.BrowserContext#setDefaultTimeout
@@ -600,18 +613,14 @@ public ElementHandleOptions setTimeout(double timeout) {
600613
}
601614
class EvaluateOptions {
602615
/**
603-
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
604-
* value can be changed by using the {@link com.microsoft.playwright.BrowserContext#setDefaultTimeout
605-
* BrowserContext.setDefaultTimeout()} or {@link com.microsoft.playwright.Page#setDefaultTimeout Page.setDefaultTimeout()}
606-
* methods.
616+
* Maximum time in milliseconds to wait for the locator before evaluating. Note that after locator is resolved, evaluation
617+
* itself is not limited by the timeout. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout.
607618
*/
608619
public Double timeout;
609620

610621
/**
611-
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
612-
* value can be changed by using the {@link com.microsoft.playwright.BrowserContext#setDefaultTimeout
613-
* BrowserContext.setDefaultTimeout()} or {@link com.microsoft.playwright.Page#setDefaultTimeout Page.setDefaultTimeout()}
614-
* methods.
622+
* Maximum time in milliseconds to wait for the locator before evaluating. Note that after locator is resolved, evaluation
623+
* itself is not limited by the timeout. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout.
615624
*/
616625
public EvaluateOptions setTimeout(double timeout) {
617626
this.timeout = timeout;
@@ -620,18 +629,14 @@ public EvaluateOptions setTimeout(double timeout) {
620629
}
621630
class EvaluateHandleOptions {
622631
/**
623-
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
624-
* value can be changed by using the {@link com.microsoft.playwright.BrowserContext#setDefaultTimeout
625-
* BrowserContext.setDefaultTimeout()} or {@link com.microsoft.playwright.Page#setDefaultTimeout Page.setDefaultTimeout()}
626-
* methods.
632+
* Maximum time in milliseconds to wait for the locator before evaluating. Note that after locator is resolved, evaluation
633+
* itself is not limited by the timeout. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout.
627634
*/
628635
public Double timeout;
629636

630637
/**
631-
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
632-
* value can be changed by using the {@link com.microsoft.playwright.BrowserContext#setDefaultTimeout
633-
* BrowserContext.setDefaultTimeout()} or {@link com.microsoft.playwright.Page#setDefaultTimeout Page.setDefaultTimeout()}
634-
* methods.
638+
* Maximum time in milliseconds to wait for the locator before evaluating. Note that after locator is resolved, evaluation
639+
* itself is not limited by the timeout. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout.
635640
*/
636641
public EvaluateHandleOptions setTimeout(double timeout) {
637642
this.timeout = timeout;

0 commit comments

Comments
 (0)