@@ -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