Skip to content

Commit d87c6b2

Browse files
authored
chore(roll): roll 1.24.0 add regex, date, url serializers (#1003)
1 parent 41355bd commit d87c6b2

25 files changed

+250
-50
lines changed

README.md

Lines changed: 3 additions & 3 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 -->104.0.5112.20<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
15-
| WebKit <!-- GEN:webkit-version -->15.4<!-- GEN:stop --> ||||
16-
| Firefox <!-- GEN:firefox-version -->100.0.2<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
14+
| Chromium <!-- GEN:chromium-version -->104.0.5112.48<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
15+
| WebKit <!-- GEN:webkit-version -->16.0<!-- GEN:stop --> ||||
16+
| Firefox <!-- GEN:firefox-version -->102.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

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,6 +1075,10 @@ public StartTracingOptions setScreenshots(boolean screenshots) {
10751075
* <p> In case this browser is connected to, clears all created contexts belonging to this browser and disconnects from the
10761076
* browser server.
10771077
*
1078+
* <p> <strong>NOTE:</strong> This is similar to force quitting the browser. Therefore, you should call {@link BrowserContext#close
1079+
* BrowserContext.close()} on any {@code BrowserContext}'s you explicitly created earlier with {@link Browser#newContext
1080+
* Browser.newContext()} **before** calling {@link Browser#close Browser.close()}.
1081+
*
10781082
* <p> The {@code Browser} object itself is considered to be disposed and cannot be used anymore.
10791083
*/
10801084
void close();
@@ -1094,27 +1098,45 @@ public StartTracingOptions setScreenshots(boolean screenshots) {
10941098
boolean isConnected();
10951099
/**
10961100
* Creates a new browser context. It won't share cookies/cache with other browser contexts.
1101+
*
1102+
* <p> <strong>NOTE:</strong> If directly using this method to create {@code BrowserContext}s, it is best practice to explicilty close the returned context
1103+
* via {@link BrowserContext#close BrowserContext.close()} when your code is done with the {@code BrowserContext}, and before
1104+
* calling {@link Browser#close Browser.close()}. This will ensure the {@code context} is closed gracefully and any
1105+
* artifacts—like HARs and videos—are fully flushed and saved.
10971106
* <pre>{@code
10981107
* Browser browser = playwright.firefox().launch(); // Or 'chromium' or 'webkit'.
10991108
* // Create a new incognito browser context.
11001109
* BrowserContext context = browser.newContext();
11011110
* // Create a new page in a pristine context.
11021111
* Page page = context.newPage();
11031112
* page.navigate('https://example.com');
1113+
*
1114+
* // Gracefull close up everything
1115+
* context.close();
1116+
* browser.close();
11041117
* }</pre>
11051118
*/
11061119
default BrowserContext newContext() {
11071120
return newContext(null);
11081121
}
11091122
/**
11101123
* Creates a new browser context. It won't share cookies/cache with other browser contexts.
1124+
*
1125+
* <p> <strong>NOTE:</strong> If directly using this method to create {@code BrowserContext}s, it is best practice to explicilty close the returned context
1126+
* via {@link BrowserContext#close BrowserContext.close()} when your code is done with the {@code BrowserContext}, and before
1127+
* calling {@link Browser#close Browser.close()}. This will ensure the {@code context} is closed gracefully and any
1128+
* artifacts—like HARs and videos—are fully flushed and saved.
11111129
* <pre>{@code
11121130
* Browser browser = playwright.firefox().launch(); // Or 'chromium' or 'webkit'.
11131131
* // Create a new incognito browser context.
11141132
* BrowserContext context = browser.newContext();
11151133
* // Create a new page in a pristine context.
11161134
* Page page = context.newPage();
11171135
* page.navigate('https://example.com');
1136+
*
1137+
* // Gracefull close up everything
1138+
* context.close();
1139+
* browser.close();
11181140
* }</pre>
11191141
*/
11201142
BrowserContext newContext(NewContextOptions options);

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public interface BrowserContext extends AutoCloseable {
6767
* done and its response has started loading in the popup.
6868
* <pre>{@code
6969
* Page newPage = context.waitForPage(() -> {
70-
* page.click("a[target=_blank]");
70+
* page.locator("a[target=_blank]").click();
7171
* });
7272
* System.out.println(newPage.evaluate("location.href"));
7373
* }</pre>
@@ -190,7 +190,7 @@ class RouteFromHAROptions {
190190
public Boolean update;
191191
/**
192192
* A glob pattern, regular expression or predicate to match the request URL. Only requests with URL matching the pattern
193-
* will be surved from the HAR file. If not specified, all requests are served from the HAR file.
193+
* will be served from the HAR file. If not specified, all requests are served from the HAR file.
194194
*/
195195
public Object url;
196196

@@ -215,15 +215,15 @@ public RouteFromHAROptions setUpdate(boolean update) {
215215
}
216216
/**
217217
* A glob pattern, regular expression or predicate to match the request URL. Only requests with URL matching the pattern
218-
* will be surved from the HAR file. If not specified, all requests are served from the HAR file.
218+
* will be served from the HAR file. If not specified, all requests are served from the HAR file.
219219
*/
220220
public RouteFromHAROptions setUrl(String url) {
221221
this.url = url;
222222
return this;
223223
}
224224
/**
225225
* A glob pattern, regular expression or predicate to match the request URL. Only requests with URL matching the pattern
226-
* will be surved from the HAR file. If not specified, all requests are served from the HAR file.
226+
* will be served from the HAR file. If not specified, all requests are served from the HAR file.
227227
*/
228228
public RouteFromHAROptions setUrl(Pattern url) {
229229
this.url = url;
@@ -404,7 +404,7 @@ default List<Cookie> cookies() {
404404
* "</script>\n" +
405405
* "<button onclick=\"onClick()\">Click me</button>\n" +
406406
* "<div></div>");
407-
* page.click("button");
407+
* page.locator("button").click();
408408
* }
409409
* }
410410
* }
@@ -463,7 +463,7 @@ default void exposeBinding(String name, BindingCallback callback) {
463463
* "</script>\n" +
464464
* "<button onclick=\"onClick()\">Click me</button>\n" +
465465
* "<div></div>");
466-
* page.click("button");
466+
* page.locator("button").click();
467467
* }
468468
* }
469469
* }
@@ -533,7 +533,7 @@ default void exposeBinding(String name, BindingCallback callback) {
533533
* "</script>\n" +
534534
* "<button onclick=\"onClick()\">Click me</button>\n" +
535535
* "<div></div>\n");
536-
* page.click("button");
536+
* page.locator("button").click();
537537
* }
538538
* }
539539
* }

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@
2727
* <p> Download event is emitted once the download starts. Download path becomes available once download completes:
2828
* <pre>{@code
2929
* // wait for download to start
30-
* Download download = page.waitForDownload(() -> page.click("a"));
30+
* Download download = page.waitForDownload(() -> page.locator("a").click());
3131
* // wait for download to complete
3232
* Path path = download.path();
3333
* }</pre>
3434
* <pre>{@code
3535
* // wait for download to start
3636
* Download download = page.waitForDownload(() -> {
37-
* page.click("a");
37+
* page.locator("a").click();
3838
* });
3939
* // wait for download to complete
4040
* Path path = download.path();

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1214,7 +1214,7 @@ public WaitForSelectorOptions setTimeout(double timeout) {
12141214
* This method returns the bounding box of the element, or {@code null} if the element is not visible. The bounding box is
12151215
* calculated relative to the main frame viewport - which is usually the same as the browser window.
12161216
*
1217-
* <p> Scrolling affects the returned bonding box, similarly to <a
1217+
* <p> Scrolling affects the returned bounding box, similarly to <a
12181218
* href="https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect">Element.getBoundingClientRect</a>.
12191219
* That means {@code x} and/or {@code y} may be negative.
12201220
*

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
/**
2323
* {@code FileChooser} objects are dispatched by the page in the {@link Page#onFileChooser Page.onFileChooser()} event.
2424
* <pre>{@code
25-
* FileChooser fileChooser = page.waitForFileChooser(() -> page.click("upload"));
25+
* FileChooser fileChooser = page.waitForFileChooser(() -> page.locator("upload").click());
2626
* fileChooser.setFiles(Paths.get("myfile.pdf"));
2727
* }</pre>
2828
*/

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2366,9 +2366,25 @@ default void dispatchEvent(String selector, String type) {
23662366
* @param eventInit Optional event-specific initialization properties.
23672367
*/
23682368
void dispatchEvent(String selector, String type, Object eventInit, DispatchEventOptions options);
2369+
/**
2370+
*
2371+
*
2372+
* @param source A selector to search for an element to drag. If there are multiple elements satisfying the selector, the first will be
2373+
* used. See <a href="https://playwright.dev/java/docs/selectors">working with selectors</a> for more details.
2374+
* @param target A selector to search for an element to drop onto. If there are multiple elements satisfying the selector, the first will
2375+
* be used. See <a href="https://playwright.dev/java/docs/selectors">working with selectors</a> for more details.
2376+
*/
23692377
default void dragAndDrop(String source, String target) {
23702378
dragAndDrop(source, target, null);
23712379
}
2380+
/**
2381+
*
2382+
*
2383+
* @param source A selector to search for an element to drag. If there are multiple elements satisfying the selector, the first will be
2384+
* used. See <a href="https://playwright.dev/java/docs/selectors">working with selectors</a> for more details.
2385+
* @param target A selector to search for an element to drop onto. If there are multiple elements satisfying the selector, the first will
2386+
* be used. See <a href="https://playwright.dev/java/docs/selectors">working with selectors</a> for more details.
2387+
*/
23722388
void dragAndDrop(String source, String target, DragAndDropOptions options);
23732389
/**
23742390
* Returns the return value of {@code expression}.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1636,7 +1636,7 @@ public WaitForOptions setTimeout(double timeout) {
16361636
* This method returns the bounding box of the element, or {@code null} if the element is not visible. The bounding box is
16371637
* calculated relative to the main frame viewport - which is usually the same as the browser window.
16381638
*
1639-
* <p> Scrolling affects the returned bonding box, similarly to <a
1639+
* <p> Scrolling affects the returned bounding box, similarly to <a
16401640
* href="https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect">Element.getBoundingClientRect</a>.
16411641
* That means {@code x} and/or {@code y} may be negative.
16421642
*
@@ -1657,7 +1657,7 @@ default BoundingBox boundingBox() {
16571657
* This method returns the bounding box of the element, or {@code null} if the element is not visible. The bounding box is
16581658
* calculated relative to the main frame viewport - which is usually the same as the browser window.
16591659
*
1660-
* <p> Scrolling affects the returned bonding box, similarly to <a
1660+
* <p> Scrolling affects the returned bounding box, similarly to <a
16611661
* href="https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect">Element.getBoundingClientRect</a>.
16621662
* That means {@code x} and/or {@code y} may be negative.
16631663
*

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

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2013,7 +2013,7 @@ class RouteFromHAROptions {
20132013
public Boolean update;
20142014
/**
20152015
* A glob pattern, regular expression or predicate to match the request URL. Only requests with URL matching the pattern
2016-
* will be surved from the HAR file. If not specified, all requests are served from the HAR file.
2016+
* will be served from the HAR file. If not specified, all requests are served from the HAR file.
20172017
*/
20182018
public Object url;
20192019

@@ -2038,15 +2038,15 @@ public RouteFromHAROptions setUpdate(boolean update) {
20382038
}
20392039
/**
20402040
* A glob pattern, regular expression or predicate to match the request URL. Only requests with URL matching the pattern
2041-
* will be surved from the HAR file. If not specified, all requests are served from the HAR file.
2041+
* will be served from the HAR file. If not specified, all requests are served from the HAR file.
20422042
*/
20432043
public RouteFromHAROptions setUrl(String url) {
20442044
this.url = url;
20452045
return this;
20462046
}
20472047
/**
20482048
* A glob pattern, regular expression or predicate to match the request URL. Only requests with URL matching the pattern
2049-
* will be surved from the HAR file. If not specified, all requests are served from the HAR file.
2049+
* will be served from the HAR file. If not specified, all requests are served from the HAR file.
20502050
*/
20512051
public RouteFromHAROptions setUrl(Pattern url) {
20522052
this.url = url;
@@ -3581,9 +3581,25 @@ default void dispatchEvent(String selector, String type) {
35813581
* @param eventInit Optional event-specific initialization properties.
35823582
*/
35833583
void dispatchEvent(String selector, String type, Object eventInit, DispatchEventOptions options);
3584+
/**
3585+
*
3586+
*
3587+
* @param source A selector to search for an element to drag. If there are multiple elements satisfying the selector, the first will be
3588+
* used. See <a href="https://playwright.dev/java/docs/selectors">working with selectors</a> for more details.
3589+
* @param target A selector to search for an element to drop onto. If there are multiple elements satisfying the selector, the first will
3590+
* be used. See <a href="https://playwright.dev/java/docs/selectors">working with selectors</a> for more details.
3591+
*/
35843592
default void dragAndDrop(String source, String target) {
35853593
dragAndDrop(source, target, null);
35863594
}
3595+
/**
3596+
*
3597+
*
3598+
* @param source A selector to search for an element to drag. If there are multiple elements satisfying the selector, the first will be
3599+
* used. See <a href="https://playwright.dev/java/docs/selectors">working with selectors</a> for more details.
3600+
* @param target A selector to search for an element to drop onto. If there are multiple elements satisfying the selector, the first will
3601+
* be used. See <a href="https://playwright.dev/java/docs/selectors">working with selectors</a> for more details.
3602+
*/
35873603
void dragAndDrop(String source, String target, DragAndDropOptions options);
35883604
/**
35893605
* This method changes the {@code CSS media type} through the {@code media} argument, and/or the {@code "prefers-colors-scheme"} media

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ default void resume() {
280280
void resume(ResumeOptions options);
281281
/**
282282
* When several routes match the given pattern, they run in the order opposite to their registration. That way the last
283-
* registered route can always override all the previos ones. In the example below, request will be handled by the
283+
* registered route can always override all the previous ones. In the example below, request will be handled by the
284284
* bottom-most handler first, then it'll fall back to the previous one and in the end will be aborted by the first
285285
* registered route.
286286
* <pre>{@code
@@ -341,7 +341,7 @@ default void fallback() {
341341
}
342342
/**
343343
* When several routes match the given pattern, they run in the order opposite to their registration. That way the last
344-
* registered route can always override all the previos ones. In the example below, request will be handled by the
344+
* registered route can always override all the previous ones. In the example below, request will be handled by the
345345
* bottom-most handler first, then it'll fall back to the previous one and in the end will be aborted by the first
346346
* registered route.
347347
* <pre>{@code

0 commit comments

Comments
 (0)