Skip to content

Commit ba5bd2c

Browse files
authored
chore: roll to beta driver version (#700)
1 parent 4be749f commit ba5bd2c

File tree

5 files changed

+79
-29
lines changed

5 files changed

+79
-29
lines changed

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
/**
2424
* ElementHandle represents an in-page DOM element. ElementHandles can be created with the {@link Page#querySelector
2525
* Page.querySelector()} method.
26+
*
27+
* <p> <strong>NOTE:</strong> The use of ElementHandle is discouraged, use {@code Locator} objects and web-first assertions instead.
2628
* <pre>{@code
2729
* ElementHandle hrefElement = page.querySelector("a");
2830
* hrefElement.click();
@@ -34,10 +36,6 @@
3436
* <p> ElementHandle instances can be used as an argument in {@link Page#evalOnSelector Page.evalOnSelector()} and {@link
3537
* Page#evaluate Page.evaluate()} methods.
3638
*
37-
* <p> <strong>NOTE:</strong> In most cases, you would want to use the {@code Locator} object instead. You should only use {@code ElementHandle} if you want to
38-
* retain a handle to a particular DOM Node that you intend to pass into {@link Page#evaluate Page.evaluate()} as an
39-
* argument.
40-
*
4139
* <p> The difference between the {@code Locator} and ElementHandle is that the ElementHandle points to a particular element, while
4240
* {@code Locator} captures the logic of how to retrieve an element.
4341
*

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

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2329,6 +2329,9 @@ default void dragAndDrop(String source, String target) {
23292329
/**
23302330
* Returns the return value of {@code expression}.
23312331
*
2332+
* <p> <strong>NOTE:</strong> This method does not wait for the element to pass actionability checks and therefore can lead to the flaky tests. Use
2333+
* {@link Locator#evaluate Locator.evaluate()}, other {@code Locator} helper methods or web-first assertions instead.
2334+
*
23322335
* <p> The method finds an element matching the specified selector within the frame and passes it as a first argument to
23332336
* {@code expression}. See <a href="https://playwright.dev/java/docs/selectors/">Working with selectors</a> for more details. If
23342337
* no elements match the selector, the method throws an error.
@@ -2356,6 +2359,9 @@ default Object evalOnSelector(String selector, String expression, Object arg) {
23562359
/**
23572360
* Returns the return value of {@code expression}.
23582361
*
2362+
* <p> <strong>NOTE:</strong> This method does not wait for the element to pass actionability checks and therefore can lead to the flaky tests. Use
2363+
* {@link Locator#evaluate Locator.evaluate()}, other {@code Locator} helper methods or web-first assertions instead.
2364+
*
23592365
* <p> The method finds an element matching the specified selector within the frame and passes it as a first argument to
23602366
* {@code expression}. See <a href="https://playwright.dev/java/docs/selectors/">Working with selectors</a> for more details. If
23612367
* no elements match the selector, the method throws an error.
@@ -2382,6 +2388,9 @@ default Object evalOnSelector(String selector, String expression) {
23822388
/**
23832389
* Returns the return value of {@code expression}.
23842390
*
2391+
* <p> <strong>NOTE:</strong> This method does not wait for the element to pass actionability checks and therefore can lead to the flaky tests. Use
2392+
* {@link Locator#evaluate Locator.evaluate()}, other {@code Locator} helper methods or web-first assertions instead.
2393+
*
23852394
* <p> The method finds an element matching the specified selector within the frame and passes it as a first argument to
23862395
* {@code expression}. See <a href="https://playwright.dev/java/docs/selectors/">Working with selectors</a> for more details. If
23872396
* no elements match the selector, the method throws an error.
@@ -2407,6 +2416,9 @@ default Object evalOnSelector(String selector, String expression) {
24072416
/**
24082417
* Returns the return value of {@code expression}.
24092418
*
2419+
* <p> <strong>NOTE:</strong> In most cases, {@link Locator#evaluateAll Locator.evaluateAll()}, other {@code Locator} helper methods and web-first
2420+
* assertions do a better job.
2421+
*
24102422
* <p> The method finds all elements matching the specified selector within the frame and passes an array of matched elements
24112423
* as a first argument to {@code expression}. See <a href="https://playwright.dev/java/docs/selectors/">Working with
24122424
* selectors</a> for more details.
@@ -2431,6 +2443,9 @@ default Object evalOnSelectorAll(String selector, String expression) {
24312443
/**
24322444
* Returns the return value of {@code expression}.
24332445
*
2446+
* <p> <strong>NOTE:</strong> In most cases, {@link Locator#evaluateAll Locator.evaluateAll()}, other {@code Locator} helper methods and web-first
2447+
* assertions do a better job.
2448+
*
24342449
* <p> The method finds all elements matching the specified selector within the frame and passes an array of matched elements
24352450
* as a first argument to {@code expression}. See <a href="https://playwright.dev/java/docs/selectors/">Working with
24362451
* selectors</a> for more details.
@@ -2475,7 +2490,7 @@ default Object evalOnSelectorAll(String selector, String expression) {
24752490
*
24762491
* <p> {@code ElementHandle} instances can be passed as an argument to the {@link Frame#evaluate Frame.evaluate()}:
24772492
* <pre>{@code
2478-
* ElementHandle bodyHandle = frame.querySelector("body");
2493+
* ElementHandle bodyHandle = frame.evaluate("document.body");
24792494
* String html = (String) frame.evaluate("([body, suffix]) => body.innerHTML + suffix", Arrays.asList(bodyHandle, "hello"));
24802495
* bodyHandle.dispose();
24812496
* }</pre>
@@ -2510,7 +2525,7 @@ default Object evaluate(String expression) {
25102525
*
25112526
* <p> {@code ElementHandle} instances can be passed as an argument to the {@link Frame#evaluate Frame.evaluate()}:
25122527
* <pre>{@code
2513-
* ElementHandle bodyHandle = frame.querySelector("body");
2528+
* ElementHandle bodyHandle = frame.evaluate("document.body");
25142529
* String html = (String) frame.evaluate("([body, suffix]) => body.innerHTML + suffix", Arrays.asList(bodyHandle, "hello"));
25152530
* bodyHandle.dispose();
25162531
* }</pre>
@@ -3010,6 +3025,8 @@ default void press(String selector, String key) {
30103025
/**
30113026
* Returns the ElementHandle pointing to the frame element.
30123027
*
3028+
* <p> <strong>NOTE:</strong> The use of {@code ElementHandle} is discouraged, use {@code Locator} objects and web-first assertions instead.
3029+
*
30133030
* <p> The method finds an element matching the specified selector within the frame. See <a
30143031
* href="https://playwright.dev/java/docs/selectors/">Working with selectors</a> for more details. If no elements match the
30153032
* selector, returns {@code null}.
@@ -3023,6 +3040,8 @@ default ElementHandle querySelector(String selector) {
30233040
/**
30243041
* Returns the ElementHandle pointing to the frame element.
30253042
*
3043+
* <p> <strong>NOTE:</strong> The use of {@code ElementHandle} is discouraged, use {@code Locator} objects and web-first assertions instead.
3044+
*
30263045
* <p> The method finds an element matching the specified selector within the frame. See <a
30273046
* href="https://playwright.dev/java/docs/selectors/">Working with selectors</a> for more details. If no elements match the
30283047
* selector, returns {@code null}.
@@ -3034,6 +3053,8 @@ default ElementHandle querySelector(String selector) {
30343053
/**
30353054
* Returns the ElementHandles pointing to the frame elements.
30363055
*
3056+
* <p> <strong>NOTE:</strong> The use of {@code ElementHandle} is discouraged, use {@code Locator} objects instead.
3057+
*
30373058
* <p> The method finds all elements matching the specified selector within the frame. See <a
30383059
* href="https://playwright.dev/java/docs/selectors/">Working with selectors</a> for more details. If no elements match the
30393060
* selector, returns empty array.
@@ -3904,6 +3925,9 @@ default Response waitForNavigation(Runnable callback) {
39043925
* Returns when element specified by selector satisfies {@code state} option. Returns {@code null} if waiting for {@code hidden} or
39053926
* {@code detached}.
39063927
*
3928+
* <p> <strong>NOTE:</strong> Playwright automatically waits for element to be ready before performing an action. Using {@code Locator} objects and
3929+
* web-first assertions make the code wait-for-selector-free.
3930+
*
39073931
* <p> Wait for the {@code selector} to satisfy {@code state} option (either appear/disappear from dom, or become visible/hidden). If at
39083932
* the moment of calling the method {@code selector} already satisfies the condition, the method will return immediately. If the
39093933
* selector doesn't satisfy the condition for the {@code timeout} milliseconds, the function will throw.
@@ -3939,6 +3963,9 @@ default ElementHandle waitForSelector(String selector) {
39393963
* Returns when element specified by selector satisfies {@code state} option. Returns {@code null} if waiting for {@code hidden} or
39403964
* {@code detached}.
39413965
*
3966+
* <p> <strong>NOTE:</strong> Playwright automatically waits for element to be ready before performing an action. Using {@code Locator} objects and
3967+
* web-first assertions make the code wait-for-selector-free.
3968+
*
39423969
* <p> Wait for the {@code selector} to satisfy {@code state} option (either appear/disappear from dom, or become visible/hidden). If at
39433970
* the moment of calling the method {@code selector} already satisfies the condition, the method will return immediately. If the
39443971
* selector doesn't satisfy the condition for the {@code timeout} milliseconds, the function will throw.

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

Lines changed: 39 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3467,7 +3467,10 @@ default void emulateMedia() {
34673467
*/
34683468
void emulateMedia(EmulateMediaOptions options);
34693469
/**
3470-
* The method finds an element matching the specified selector within the page and passes it as a first argument to
3470+
* <strong>NOTE:</strong> This method does not wait for the element to pass actionability checks and therefore can lead to the flaky tests. Use
3471+
* {@link Locator#evaluate Locator.evaluate()}, other {@code Locator} helper methods or web-first assertions instead.
3472+
*
3473+
* <p> The method finds an element matching the specified selector within the page and passes it as a first argument to
34713474
* {@code expression}. If no elements match the selector, the method throws an error. Returns the value of {@code expression}.
34723475
*
34733476
* <p> If {@code expression} returns a <a
@@ -3493,7 +3496,10 @@ default Object evalOnSelector(String selector, String expression, Object arg) {
34933496
return evalOnSelector(selector, expression, arg, null);
34943497
}
34953498
/**
3496-
* The method finds an element matching the specified selector within the page and passes it as a first argument to
3499+
* <strong>NOTE:</strong> This method does not wait for the element to pass actionability checks and therefore can lead to the flaky tests. Use
3500+
* {@link Locator#evaluate Locator.evaluate()}, other {@code Locator} helper methods or web-first assertions instead.
3501+
*
3502+
* <p> The method finds an element matching the specified selector within the page and passes it as a first argument to
34973503
* {@code expression}. If no elements match the selector, the method throws an error. Returns the value of {@code expression}.
34983504
*
34993505
* <p> If {@code expression} returns a <a
@@ -3518,7 +3524,10 @@ default Object evalOnSelector(String selector, String expression) {
35183524
return evalOnSelector(selector, expression, null);
35193525
}
35203526
/**
3521-
* The method finds an element matching the specified selector within the page and passes it as a first argument to
3527+
* <strong>NOTE:</strong> This method does not wait for the element to pass actionability checks and therefore can lead to the flaky tests. Use
3528+
* {@link Locator#evaluate Locator.evaluate()}, other {@code Locator} helper methods or web-first assertions instead.
3529+
*
3530+
* <p> The method finds an element matching the specified selector within the page and passes it as a first argument to
35223531
* {@code expression}. If no elements match the selector, the method throws an error. Returns the value of {@code expression}.
35233532
*
35243533
* <p> If {@code expression} returns a <a
@@ -3542,7 +3551,10 @@ default Object evalOnSelector(String selector, String expression) {
35423551
*/
35433552
Object evalOnSelector(String selector, String expression, Object arg, EvalOnSelectorOptions options);
35443553
/**
3545-
* The method finds all elements matching the specified selector within the page and passes an array of matched elements as
3554+
* <strong>NOTE:</strong> In most cases, {@link Locator#evaluateAll Locator.evaluateAll()}, other {@code Locator} helper methods and web-first
3555+
* assertions do a better job.
3556+
*
3557+
* <p> The method finds all elements matching the specified selector within the page and passes an array of matched elements as
35463558
* a first argument to {@code expression}. Returns the result of {@code expression} invocation.
35473559
*
35483560
* <p> If {@code expression} returns a <a
@@ -3563,7 +3575,10 @@ default Object evalOnSelectorAll(String selector, String expression) {
35633575
return evalOnSelectorAll(selector, expression, null);
35643576
}
35653577
/**
3566-
* The method finds all elements matching the specified selector within the page and passes an array of matched elements as
3578+
* <strong>NOTE:</strong> In most cases, {@link Locator#evaluateAll Locator.evaluateAll()}, other {@code Locator} helper methods and web-first
3579+
* assertions do a better job.
3580+
*
3581+
* <p> The method finds all elements matching the specified selector within the page and passes an array of matched elements as
35673582
* a first argument to {@code expression}. Returns the result of {@code expression} invocation.
35683583
*
35693584
* <p> If {@code expression} returns a <a
@@ -3608,7 +3623,7 @@ default Object evalOnSelectorAll(String selector, String expression) {
36083623
*
36093624
* <p> {@code ElementHandle} instances can be passed as an argument to the {@link Page#evaluate Page.evaluate()}:
36103625
* <pre>{@code
3611-
* ElementHandle bodyHandle = page.querySelector("body");
3626+
* ElementHandle bodyHandle = page.evaluate("document.body");
36123627
* String html = (String) page.evaluate("([body, suffix]) => body.innerHTML + suffix", Arrays.asList(bodyHandle, "hello"));
36133628
* bodyHandle.dispose();
36143629
* }</pre>
@@ -3647,7 +3662,7 @@ default Object evaluate(String expression) {
36473662
*
36483663
* <p> {@code ElementHandle} instances can be passed as an argument to the {@link Page#evaluate Page.evaluate()}:
36493664
* <pre>{@code
3650-
* ElementHandle bodyHandle = page.querySelector("body");
3665+
* ElementHandle bodyHandle = page.evaluate("document.body");
36513666
* String html = (String) page.evaluate("([body, suffix]) => body.innerHTML + suffix", Arrays.asList(bodyHandle, "hello"));
36523667
* bodyHandle.dispose();
36533668
* }</pre>
@@ -4535,9 +4550,10 @@ default void press(String selector, String key) {
45354550
*/
45364551
void press(String selector, String key, PressOptions options);
45374552
/**
4538-
* The method finds an element matching the specified selector within the page. If no elements match the selector, the
4539-
* return value resolves to {@code null}. To wait for an element on the page, use {@link Page#waitForSelector
4540-
* Page.waitForSelector()}.
4553+
* <strong>NOTE:</strong> The use of {@code ElementHandle} is discouraged, use {@code Locator} objects and web-first assertions instead.
4554+
*
4555+
* <p> The method finds an element matching the specified selector within the page. If no elements match the selector, the
4556+
* return value resolves to {@code null}. To wait for an element on the page, use {@link Locator#waitFor Locator.waitFor()}.
45414557
*
45424558
* <p> Shortcut for main frame's {@link Frame#querySelector Frame.querySelector()}.
45434559
*
@@ -4548,9 +4564,10 @@ default ElementHandle querySelector(String selector) {
45484564
return querySelector(selector, null);
45494565
}
45504566
/**
4551-
* The method finds an element matching the specified selector within the page. If no elements match the selector, the
4552-
* return value resolves to {@code null}. To wait for an element on the page, use {@link Page#waitForSelector
4553-
* Page.waitForSelector()}.
4567+
* <strong>NOTE:</strong> The use of {@code ElementHandle} is discouraged, use {@code Locator} objects and web-first assertions instead.
4568+
*
4569+
* <p> The method finds an element matching the specified selector within the page. If no elements match the selector, the
4570+
* return value resolves to {@code null}. To wait for an element on the page, use {@link Locator#waitFor Locator.waitFor()}.
45544571
*
45554572
* <p> Shortcut for main frame's {@link Frame#querySelector Frame.querySelector()}.
45564573
*
@@ -4559,7 +4576,9 @@ default ElementHandle querySelector(String selector) {
45594576
*/
45604577
ElementHandle querySelector(String selector, QuerySelectorOptions options);
45614578
/**
4562-
* The method finds all elements matching the specified selector within the page. If no elements match the selector, the
4579+
* <strong>NOTE:</strong> The use of {@code ElementHandle} is discouraged, use {@code Locator} objects and web-first assertions instead.
4580+
*
4581+
* <p> The method finds all elements matching the specified selector within the page. If no elements match the selector, the
45634582
* return value resolves to {@code []}.
45644583
*
45654584
* <p> Shortcut for main frame's {@link Frame#querySelectorAll Frame.querySelectorAll()}.
@@ -6343,6 +6362,9 @@ default Response waitForResponse(Predicate<Response> urlOrPredicate, Runnable ca
63436362
* Returns when element specified by selector satisfies {@code state} option. Returns {@code null} if waiting for {@code hidden} or
63446363
* {@code detached}.
63456364
*
6365+
* <p> <strong>NOTE:</strong> Playwright automatically waits for element to be ready before performing an action. Using {@code Locator} objects and
6366+
* web-first assertions make the code wait-for-selector-free.
6367+
*
63466368
* <p> Wait for the {@code selector} to satisfy {@code state} option (either appear/disappear from dom, or become visible/hidden). If at
63476369
* the moment of calling the method {@code selector} already satisfies the condition, the method will return immediately. If the
63486370
* selector doesn't satisfy the condition for the {@code timeout} milliseconds, the function will throw.
@@ -6378,6 +6400,9 @@ default ElementHandle waitForSelector(String selector) {
63786400
* Returns when element specified by selector satisfies {@code state} option. Returns {@code null} if waiting for {@code hidden} or
63796401
* {@code detached}.
63806402
*
6403+
* <p> <strong>NOTE:</strong> Playwright automatically waits for element to be ready before performing an action. Using {@code Locator} objects and
6404+
* web-first assertions make the code wait-for-selector-free.
6405+
*
63816406
* <p> Wait for the {@code selector} to satisfy {@code state} option (either appear/disappear from dom, or become visible/hidden). If at
63826407
* the moment of calling the method {@code selector} already satisfies the condition, the method will return immediately. If the
63836408
* selector doesn't satisfy the condition for the {@code timeout} milliseconds, the function will throw.

0 commit comments

Comments
 (0)