chore: roll to 1.21 beta driver (#888)
This commit is contained in:
@@ -20,13 +20,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: microsoft/playwright-github-action@v1.5.0
|
||||
- name: Cache Maven packages
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.m2
|
||||
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
|
||||
restore-keys: ${{ runner.os }}-m2
|
||||
- uses: microsoft/playwright-github-action@v1
|
||||
- name: Download drivers
|
||||
run: scripts/download_driver_for_all_platforms.sh
|
||||
- name: Regenerate APIs
|
||||
|
||||
@@ -11,9 +11,9 @@ Playwright is a Java library to automate [Chromium](https://www.chromium.org/Hom
|
||||
|
||||
| | Linux | macOS | Windows |
|
||||
| :--- | :---: | :---: | :---: |
|
||||
| Chromium <!-- GEN:chromium-version -->101.0.4929.0<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||
| Chromium <!-- GEN:chromium-version -->101.0.4951.15<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||
| WebKit <!-- GEN:webkit-version -->15.4<!-- GEN:stop --> | ✅ | ✅ | ✅ |
|
||||
| Firefox <!-- GEN:firefox-version -->97.0.1<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||
| Firefox <!-- GEN:firefox-version -->98.0.2<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||
|
||||
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.
|
||||
|
||||
|
||||
@@ -31,6 +31,9 @@ class DriverLogging {
|
||||
"yyyy-MM-dd'T'HH:mm:ss.SSSXXX").withZone(ZoneId.of("UTC"));
|
||||
|
||||
static void logWithTimestamp(String message) {
|
||||
if (!isEnabled) {
|
||||
return;
|
||||
}
|
||||
// This matches log format produced by the server.
|
||||
String timestamp = ZonedDateTime.now().format(timestampFormat);
|
||||
System.err.println(timestamp + " " + message);
|
||||
|
||||
@@ -21,9 +21,9 @@ import java.nio.file.Path;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Exposes API that can be used for the Web API testing. Each Playwright browser context has a APIRequestContext instance
|
||||
* attached which shares cookies with the page context. Its also possible to create a new APIRequestContext instance
|
||||
* manually. For more information see <a href="https://playwright.dev/java/docs/class-apirequestcontext">here</a>.
|
||||
* Exposes API that can be used for the Web API testing. This class is used for creating {@code APIRequestContext} instance which
|
||||
* in turn can be used for sending web requests. An instance of this class can be obtained via {@link Playwright#request
|
||||
* Playwright.request()}. For more information see {@code APIRequestContext}.
|
||||
*/
|
||||
public interface APIRequest {
|
||||
class NewContextOptions {
|
||||
|
||||
@@ -21,9 +21,24 @@ import java.nio.file.Path;
|
||||
|
||||
/**
|
||||
* This API is used for the Web API testing. You can use it to trigger API endpoints, configure micro-services, prepare
|
||||
* environment or the service to your e2e test. When used on {@code Page} or a {@code BrowserContext}, this API will automatically use
|
||||
* the cookies from the corresponding {@code BrowserContext}. This means that if you log in using this API, your e2e test will be
|
||||
* logged in and vice versa.
|
||||
* environment or the service to your e2e test.
|
||||
*
|
||||
* <p> Each Playwright browser context has associated with it {@code APIRequestContext} instance which shares cookie storage with the
|
||||
* browser context and can be accessed via {@link BrowserContext#request BrowserContext.request()} or {@link Page#request
|
||||
* Page.request()}. It is also possible to create a new APIRequestContext instance manually by calling {@link
|
||||
* APIRequest#newContext APIRequest.newContext()}.
|
||||
*
|
||||
* <p> **Cookie management**
|
||||
*
|
||||
* <p> {@code APIRequestContext} retuned by {@link BrowserContext#request BrowserContext.request()} and {@link Page#request
|
||||
* Page.request()} shares cookie storage with the corresponding {@code BrowserContext}. Each API request will have {@code Cookie}
|
||||
* header populated with the values from the browser context. If the API response contains {@code Set-Cookie} header it will
|
||||
* automatically update {@code BrowserContext} cookies and requests made from the page will pick them up. This means that if you
|
||||
* log in using this API, your e2e test will be logged in and vice versa.
|
||||
*
|
||||
* <p> If you want API requests to not interfere with the browser cookies you shoud create a new {@code APIRequestContext} by calling
|
||||
* {@link APIRequest#newContext APIRequest.newContext()}. Such {@code APIRequestContext} object will have its own isolated cookie
|
||||
* storage.
|
||||
*/
|
||||
public interface APIRequestContext {
|
||||
class StorageStateOptions {
|
||||
|
||||
@@ -497,7 +497,6 @@ public interface BrowserContext extends AutoCloseable {
|
||||
* <li> {@code "midi"}</li>
|
||||
* <li> {@code "midi-sysex"} (system-exclusive midi)</li>
|
||||
* <li> {@code "notifications"}</li>
|
||||
* <li> {@code "push"}</li>
|
||||
* <li> {@code "camera"}</li>
|
||||
* <li> {@code "microphone"}</li>
|
||||
* <li> {@code "background-sync"}</li>
|
||||
@@ -524,7 +523,6 @@ public interface BrowserContext extends AutoCloseable {
|
||||
* <li> {@code "midi"}</li>
|
||||
* <li> {@code "midi-sysex"} (system-exclusive midi)</li>
|
||||
* <li> {@code "notifications"}</li>
|
||||
* <li> {@code "push"}</li>
|
||||
* <li> {@code "camera"}</li>
|
||||
* <li> {@code "microphone"}</li>
|
||||
* <li> {@code "background-sync"}</li>
|
||||
|
||||
@@ -52,8 +52,7 @@ public interface BrowserType {
|
||||
*/
|
||||
public Double slowMo;
|
||||
/**
|
||||
* Maximum time in milliseconds to wait for the connection to be established. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to
|
||||
* disable timeout.
|
||||
* Maximum time in milliseconds to wait for the connection to be established. Defaults to {@code 0} (no timeout).
|
||||
*/
|
||||
public Double timeout;
|
||||
|
||||
@@ -73,8 +72,7 @@ public interface BrowserType {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Maximum time in milliseconds to wait for the connection to be established. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to
|
||||
* disable timeout.
|
||||
* Maximum time in milliseconds to wait for the connection to be established. Defaults to {@code 0} (no timeout).
|
||||
*/
|
||||
public ConnectOptions setTimeout(double timeout) {
|
||||
this.timeout = timeout;
|
||||
@@ -130,7 +128,7 @@ public interface BrowserType {
|
||||
/**
|
||||
* Browser distribution channel. Supported values are "chrome", "chrome-beta", "chrome-dev", "chrome-canary", "msedge",
|
||||
* "msedge-beta", "msedge-dev", "msedge-canary". Read more about using <a
|
||||
* href="https://playwright.dev/java/docs/browsers#google-chrome--microsoft-edge">Google Chrome and Microsoft Edge</a>.
|
||||
* href="../browsers.md#google-chrome--microsoft-edge">Google Chrome and Microsoft Edge</a>.
|
||||
*/
|
||||
public Object channel;
|
||||
/**
|
||||
@@ -222,7 +220,7 @@ public interface BrowserType {
|
||||
/**
|
||||
* Browser distribution channel. Supported values are "chrome", "chrome-beta", "chrome-dev", "chrome-canary", "msedge",
|
||||
* "msedge-beta", "msedge-dev", "msedge-canary". Read more about using <a
|
||||
* href="https://playwright.dev/java/docs/browsers#google-chrome--microsoft-edge">Google Chrome and Microsoft Edge</a>.
|
||||
* href="../browsers.md#google-chrome--microsoft-edge">Google Chrome and Microsoft Edge</a>.
|
||||
*/
|
||||
public LaunchOptions setChannel(BrowserChannel channel) {
|
||||
this.channel = channel;
|
||||
@@ -231,7 +229,7 @@ public interface BrowserType {
|
||||
/**
|
||||
* Browser distribution channel. Supported values are "chrome", "chrome-beta", "chrome-dev", "chrome-canary", "msedge",
|
||||
* "msedge-beta", "msedge-dev", "msedge-canary". Read more about using <a
|
||||
* href="https://playwright.dev/java/docs/browsers#google-chrome--microsoft-edge">Google Chrome and Microsoft Edge</a>.
|
||||
* href="../browsers.md#google-chrome--microsoft-edge">Google Chrome and Microsoft Edge</a>.
|
||||
*/
|
||||
public LaunchOptions setChannel(String channel) {
|
||||
this.channel = channel;
|
||||
@@ -399,7 +397,7 @@ public interface BrowserType {
|
||||
/**
|
||||
* Browser distribution channel. Supported values are "chrome", "chrome-beta", "chrome-dev", "chrome-canary", "msedge",
|
||||
* "msedge-beta", "msedge-dev", "msedge-canary". Read more about using <a
|
||||
* href="https://playwright.dev/java/docs/browsers#google-chrome--microsoft-edge">Google Chrome and Microsoft Edge</a>.
|
||||
* href="../browsers.md#google-chrome--microsoft-edge">Google Chrome and Microsoft Edge</a>.
|
||||
*/
|
||||
public Object channel;
|
||||
/**
|
||||
@@ -625,7 +623,7 @@ public interface BrowserType {
|
||||
/**
|
||||
* Browser distribution channel. Supported values are "chrome", "chrome-beta", "chrome-dev", "chrome-canary", "msedge",
|
||||
* "msedge-beta", "msedge-dev", "msedge-canary". Read more about using <a
|
||||
* href="https://playwright.dev/java/docs/browsers#google-chrome--microsoft-edge">Google Chrome and Microsoft Edge</a>.
|
||||
* href="../browsers.md#google-chrome--microsoft-edge">Google Chrome and Microsoft Edge</a>.
|
||||
*/
|
||||
public LaunchPersistentContextOptions setChannel(BrowserChannel channel) {
|
||||
this.channel = channel;
|
||||
@@ -634,7 +632,7 @@ public interface BrowserType {
|
||||
/**
|
||||
* Browser distribution channel. Supported values are "chrome", "chrome-beta", "chrome-dev", "chrome-canary", "msedge",
|
||||
* "msedge-beta", "msedge-dev", "msedge-canary". Read more about using <a
|
||||
* href="https://playwright.dev/java/docs/browsers#google-chrome--microsoft-edge">Google Chrome and Microsoft Edge</a>.
|
||||
* href="../browsers.md#google-chrome--microsoft-edge">Google Chrome and Microsoft Edge</a>.
|
||||
*/
|
||||
public LaunchPersistentContextOptions setChannel(String channel) {
|
||||
this.channel = channel;
|
||||
@@ -971,7 +969,7 @@ public interface BrowserType {
|
||||
}
|
||||
}
|
||||
/**
|
||||
* This methods attaches Playwright to an existing browser instance.
|
||||
* This method attaches Playwright to an existing browser instance.
|
||||
*
|
||||
* @param wsEndpoint A browser websocket endpoint to connect to.
|
||||
*/
|
||||
@@ -979,13 +977,13 @@ public interface BrowserType {
|
||||
return connect(wsEndpoint, null);
|
||||
}
|
||||
/**
|
||||
* This methods attaches Playwright to an existing browser instance.
|
||||
* This method attaches Playwright to an existing browser instance.
|
||||
*
|
||||
* @param wsEndpoint A browser websocket endpoint to connect to.
|
||||
*/
|
||||
Browser connect(String wsEndpoint, ConnectOptions options);
|
||||
/**
|
||||
* This methods attaches Playwright to an existing browser instance using the Chrome DevTools Protocol.
|
||||
* This method attaches Playwright to an existing browser instance using the Chrome DevTools Protocol.
|
||||
*
|
||||
* <p> The default browser context is accessible via {@link Browser#contexts Browser.contexts()}.
|
||||
*
|
||||
@@ -998,7 +996,7 @@ public interface BrowserType {
|
||||
return connectOverCDP(endpointURL, null);
|
||||
}
|
||||
/**
|
||||
* This methods attaches Playwright to an existing browser instance using the Chrome DevTools Protocol.
|
||||
* This method attaches Playwright to an existing browser instance using the Chrome DevTools Protocol.
|
||||
*
|
||||
* <p> The default browser context is accessible via {@link Browser#contexts Browser.contexts()}.
|
||||
*
|
||||
|
||||
@@ -19,7 +19,28 @@ package com.microsoft.playwright;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* {@code ConsoleMessage} objects are dispatched by page via the {@link Page#onConsoleMessage Page.onConsoleMessage()} event.
|
||||
* {@code ConsoleMessage} objects are dispatched by page via the {@link Page#onConsoleMessage Page.onConsoleMessage()} event. For
|
||||
* each console messages logged in the page there will be corresponding event in the Playwright context.
|
||||
* <pre>{@code
|
||||
* // Listen for all System.out.printlns
|
||||
* page.onConsoleMessage(msg -> System.out.println(msg.text()));
|
||||
*
|
||||
* // Listen for all console events and handle errors
|
||||
* page.onConsoleMessage(msg -> {
|
||||
* if ("error".equals(msg.type()))
|
||||
* System.out.println("Error text: " + msg.text());
|
||||
* });
|
||||
*
|
||||
* // Get the next System.out.println
|
||||
* ConsoleMessage msg = page.waitForConsoleMessage(() -> {
|
||||
* // Issue console.log inside the page
|
||||
* page.evaluate("console.log('hello', 42, { foo: 'bar' });");
|
||||
* });
|
||||
*
|
||||
* // Deconstruct console.log arguments
|
||||
* msg.args().get(0).jsonValue() // hello
|
||||
* msg.args().get(1).jsonValue() // 42
|
||||
* }</pre>
|
||||
*/
|
||||
public interface ConsoleMessage {
|
||||
/**
|
||||
|
||||
@@ -59,8 +59,7 @@ import java.util.*;
|
||||
public interface ElementHandle extends JSHandle {
|
||||
class CheckOptions {
|
||||
/**
|
||||
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
|
||||
* {@code false}.
|
||||
* Whether to bypass the <a href="../actionability.md">actionability</a> checks. Defaults to {@code false}.
|
||||
*/
|
||||
public Boolean force;
|
||||
/**
|
||||
@@ -81,15 +80,13 @@ public interface ElementHandle extends JSHandle {
|
||||
*/
|
||||
public Double timeout;
|
||||
/**
|
||||
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
|
||||
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
|
||||
* performing it.
|
||||
* When set, this method only performs the <a href="../actionability.md">actionability</a> checks and skips the action.
|
||||
* Defaults to {@code false}. Useful to wait until the element is ready for the action without performing it.
|
||||
*/
|
||||
public Boolean trial;
|
||||
|
||||
/**
|
||||
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
|
||||
* {@code false}.
|
||||
* Whether to bypass the <a href="../actionability.md">actionability</a> checks. Defaults to {@code false}.
|
||||
*/
|
||||
public CheckOptions setForce(boolean force) {
|
||||
this.force = force;
|
||||
@@ -129,9 +126,8 @@ public interface ElementHandle extends JSHandle {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
|
||||
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
|
||||
* performing it.
|
||||
* When set, this method only performs the <a href="../actionability.md">actionability</a> checks and skips the action.
|
||||
* Defaults to {@code false}. Useful to wait until the element is ready for the action without performing it.
|
||||
*/
|
||||
public CheckOptions setTrial(boolean trial) {
|
||||
this.trial = trial;
|
||||
@@ -152,8 +148,7 @@ public interface ElementHandle extends JSHandle {
|
||||
*/
|
||||
public Double delay;
|
||||
/**
|
||||
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
|
||||
* {@code false}.
|
||||
* Whether to bypass the <a href="../actionability.md">actionability</a> checks. Defaults to {@code false}.
|
||||
*/
|
||||
public Boolean force;
|
||||
/**
|
||||
@@ -179,9 +174,8 @@ public interface ElementHandle extends JSHandle {
|
||||
*/
|
||||
public Double timeout;
|
||||
/**
|
||||
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
|
||||
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
|
||||
* performing it.
|
||||
* When set, this method only performs the <a href="../actionability.md">actionability</a> checks and skips the action.
|
||||
* Defaults to {@code false}. Useful to wait until the element is ready for the action without performing it.
|
||||
*/
|
||||
public Boolean trial;
|
||||
|
||||
@@ -207,8 +201,7 @@ public interface ElementHandle extends JSHandle {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
|
||||
* {@code false}.
|
||||
* Whether to bypass the <a href="../actionability.md">actionability</a> checks. Defaults to {@code false}.
|
||||
*/
|
||||
public ClickOptions setForce(boolean force) {
|
||||
this.force = force;
|
||||
@@ -256,9 +249,8 @@ public interface ElementHandle extends JSHandle {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
|
||||
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
|
||||
* performing it.
|
||||
* When set, this method only performs the <a href="../actionability.md">actionability</a> checks and skips the action.
|
||||
* Defaults to {@code false}. Useful to wait until the element is ready for the action without performing it.
|
||||
*/
|
||||
public ClickOptions setTrial(boolean trial) {
|
||||
this.trial = trial;
|
||||
@@ -275,8 +267,7 @@ public interface ElementHandle extends JSHandle {
|
||||
*/
|
||||
public Double delay;
|
||||
/**
|
||||
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
|
||||
* {@code false}.
|
||||
* Whether to bypass the <a href="../actionability.md">actionability</a> checks. Defaults to {@code false}.
|
||||
*/
|
||||
public Boolean force;
|
||||
/**
|
||||
@@ -302,9 +293,8 @@ public interface ElementHandle extends JSHandle {
|
||||
*/
|
||||
public Double timeout;
|
||||
/**
|
||||
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
|
||||
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
|
||||
* performing it.
|
||||
* When set, this method only performs the <a href="../actionability.md">actionability</a> checks and skips the action.
|
||||
* Defaults to {@code false}. Useful to wait until the element is ready for the action without performing it.
|
||||
*/
|
||||
public Boolean trial;
|
||||
|
||||
@@ -323,8 +313,7 @@ public interface ElementHandle extends JSHandle {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
|
||||
* {@code false}.
|
||||
* Whether to bypass the <a href="../actionability.md">actionability</a> checks. Defaults to {@code false}.
|
||||
*/
|
||||
public DblclickOptions setForce(boolean force) {
|
||||
this.force = force;
|
||||
@@ -372,9 +361,8 @@ public interface ElementHandle extends JSHandle {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
|
||||
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
|
||||
* performing it.
|
||||
* When set, this method only performs the <a href="../actionability.md">actionability</a> checks and skips the action.
|
||||
* Defaults to {@code false}. Useful to wait until the element is ready for the action without performing it.
|
||||
*/
|
||||
public DblclickOptions setTrial(boolean trial) {
|
||||
this.trial = trial;
|
||||
@@ -383,8 +371,7 @@ public interface ElementHandle extends JSHandle {
|
||||
}
|
||||
class FillOptions {
|
||||
/**
|
||||
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
|
||||
* {@code false}.
|
||||
* Whether to bypass the <a href="../actionability.md">actionability</a> checks. Defaults to {@code false}.
|
||||
*/
|
||||
public Boolean force;
|
||||
/**
|
||||
@@ -401,8 +388,7 @@ public interface ElementHandle extends JSHandle {
|
||||
public Double timeout;
|
||||
|
||||
/**
|
||||
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
|
||||
* {@code false}.
|
||||
* Whether to bypass the <a href="../actionability.md">actionability</a> checks. Defaults to {@code false}.
|
||||
*/
|
||||
public FillOptions setForce(boolean force) {
|
||||
this.force = force;
|
||||
@@ -429,8 +415,7 @@ public interface ElementHandle extends JSHandle {
|
||||
}
|
||||
class HoverOptions {
|
||||
/**
|
||||
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
|
||||
* {@code false}.
|
||||
* Whether to bypass the <a href="../actionability.md">actionability</a> checks. Defaults to {@code false}.
|
||||
*/
|
||||
public Boolean force;
|
||||
/**
|
||||
@@ -450,15 +435,13 @@ public interface ElementHandle extends JSHandle {
|
||||
*/
|
||||
public Double timeout;
|
||||
/**
|
||||
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
|
||||
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
|
||||
* performing it.
|
||||
* When set, this method only performs the <a href="../actionability.md">actionability</a> checks and skips the action.
|
||||
* Defaults to {@code false}. Useful to wait until the element is ready for the action without performing it.
|
||||
*/
|
||||
public Boolean trial;
|
||||
|
||||
/**
|
||||
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
|
||||
* {@code false}.
|
||||
* Whether to bypass the <a href="../actionability.md">actionability</a> checks. Defaults to {@code false}.
|
||||
*/
|
||||
public HoverOptions setForce(boolean force) {
|
||||
this.force = force;
|
||||
@@ -497,9 +480,8 @@ public interface ElementHandle extends JSHandle {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
|
||||
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
|
||||
* performing it.
|
||||
* When set, this method only performs the <a href="../actionability.md">actionability</a> checks and skips the action.
|
||||
* Defaults to {@code false}. Useful to wait until the element is ready for the action without performing it.
|
||||
*/
|
||||
public HoverOptions setTrial(boolean trial) {
|
||||
this.trial = trial;
|
||||
@@ -576,8 +558,15 @@ public interface ElementHandle extends JSHandle {
|
||||
* <li> finite animations are fast-forwarded to completion, so they'll fire {@code transitionend} event.</li>
|
||||
* <li> infinite animations are canceled to initial state, and then played over after the screenshot.</li>
|
||||
* </ul>
|
||||
*
|
||||
* <p> Defaults to {@code "allow"} that leaves animations untouched.
|
||||
*/
|
||||
public ScreenshotAnimations animations;
|
||||
/**
|
||||
* When set to {@code "hide"}, screenshot will hide text caret. When set to {@code "initial"}, text caret behavior will not be changed.
|
||||
* Defaults to {@code "hide"}.
|
||||
*/
|
||||
public ScreenshotCaret caret;
|
||||
/**
|
||||
* Specify locators that should be masked when the screenshot is taken. Masked elements will be overlayed with a pink box
|
||||
* {@code #FF00FF} that completely covers its bounding box.
|
||||
@@ -598,6 +587,12 @@ public interface ElementHandle extends JSHandle {
|
||||
* The quality of the image, between 0-100. Not applicable to {@code png} images.
|
||||
*/
|
||||
public Integer quality;
|
||||
/**
|
||||
* When set to {@code "css"}, screenshot will have a single pixel per each css pixel on the page. For high-dpi devices, this will
|
||||
* keep screenshots small. Using {@code "device"} option will produce a single pixel per each device pixel, so screenhots of
|
||||
* high-dpi devices will be twice as large or even larger. Defaults to {@code "device"}.
|
||||
*/
|
||||
public ScreenshotScale scale;
|
||||
/**
|
||||
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be changed by
|
||||
* using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link Page#setDefaultTimeout
|
||||
@@ -616,11 +611,21 @@ public interface ElementHandle extends JSHandle {
|
||||
* <li> finite animations are fast-forwarded to completion, so they'll fire {@code transitionend} event.</li>
|
||||
* <li> infinite animations are canceled to initial state, and then played over after the screenshot.</li>
|
||||
* </ul>
|
||||
*
|
||||
* <p> Defaults to {@code "allow"} that leaves animations untouched.
|
||||
*/
|
||||
public ScreenshotOptions setAnimations(ScreenshotAnimations animations) {
|
||||
this.animations = animations;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* When set to {@code "hide"}, screenshot will hide text caret. When set to {@code "initial"}, text caret behavior will not be changed.
|
||||
* Defaults to {@code "hide"}.
|
||||
*/
|
||||
public ScreenshotOptions setCaret(ScreenshotCaret caret) {
|
||||
this.caret = caret;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Specify locators that should be masked when the screenshot is taken. Masked elements will be overlayed with a pink box
|
||||
* {@code #FF00FF} that completely covers its bounding box.
|
||||
@@ -653,6 +658,15 @@ public interface ElementHandle extends JSHandle {
|
||||
this.quality = quality;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* When set to {@code "css"}, screenshot will have a single pixel per each css pixel on the page. For high-dpi devices, this will
|
||||
* keep screenshots small. Using {@code "device"} option will produce a single pixel per each device pixel, so screenhots of
|
||||
* high-dpi devices will be twice as large or even larger. Defaults to {@code "device"}.
|
||||
*/
|
||||
public ScreenshotOptions setScale(ScreenshotScale scale) {
|
||||
this.scale = scale;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be changed by
|
||||
* using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link Page#setDefaultTimeout
|
||||
@@ -690,8 +704,7 @@ public interface ElementHandle extends JSHandle {
|
||||
}
|
||||
class SelectOptionOptions {
|
||||
/**
|
||||
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
|
||||
* {@code false}.
|
||||
* Whether to bypass the <a href="../actionability.md">actionability</a> checks. Defaults to {@code false}.
|
||||
*/
|
||||
public Boolean force;
|
||||
/**
|
||||
@@ -708,8 +721,7 @@ public interface ElementHandle extends JSHandle {
|
||||
public Double timeout;
|
||||
|
||||
/**
|
||||
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
|
||||
* {@code false}.
|
||||
* Whether to bypass the <a href="../actionability.md">actionability</a> checks. Defaults to {@code false}.
|
||||
*/
|
||||
public SelectOptionOptions setForce(boolean force) {
|
||||
this.force = force;
|
||||
@@ -736,8 +748,7 @@ public interface ElementHandle extends JSHandle {
|
||||
}
|
||||
class SelectTextOptions {
|
||||
/**
|
||||
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
|
||||
* {@code false}.
|
||||
* Whether to bypass the <a href="../actionability.md">actionability</a> checks. Defaults to {@code false}.
|
||||
*/
|
||||
public Boolean force;
|
||||
/**
|
||||
@@ -748,8 +759,7 @@ public interface ElementHandle extends JSHandle {
|
||||
public Double timeout;
|
||||
|
||||
/**
|
||||
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
|
||||
* {@code false}.
|
||||
* Whether to bypass the <a href="../actionability.md">actionability</a> checks. Defaults to {@code false}.
|
||||
*/
|
||||
public SelectTextOptions setForce(boolean force) {
|
||||
this.force = force;
|
||||
@@ -767,8 +777,7 @@ public interface ElementHandle extends JSHandle {
|
||||
}
|
||||
class SetCheckedOptions {
|
||||
/**
|
||||
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
|
||||
* {@code false}.
|
||||
* Whether to bypass the <a href="../actionability.md">actionability</a> checks. Defaults to {@code false}.
|
||||
*/
|
||||
public Boolean force;
|
||||
/**
|
||||
@@ -789,15 +798,13 @@ public interface ElementHandle extends JSHandle {
|
||||
*/
|
||||
public Double timeout;
|
||||
/**
|
||||
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
|
||||
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
|
||||
* performing it.
|
||||
* When set, this method only performs the <a href="../actionability.md">actionability</a> checks and skips the action.
|
||||
* Defaults to {@code false}. Useful to wait until the element is ready for the action without performing it.
|
||||
*/
|
||||
public Boolean trial;
|
||||
|
||||
/**
|
||||
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
|
||||
* {@code false}.
|
||||
* Whether to bypass the <a href="../actionability.md">actionability</a> checks. Defaults to {@code false}.
|
||||
*/
|
||||
public SetCheckedOptions setForce(boolean force) {
|
||||
this.force = force;
|
||||
@@ -837,9 +844,8 @@ public interface ElementHandle extends JSHandle {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
|
||||
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
|
||||
* performing it.
|
||||
* When set, this method only performs the <a href="../actionability.md">actionability</a> checks and skips the action.
|
||||
* Defaults to {@code false}. Useful to wait until the element is ready for the action without performing it.
|
||||
*/
|
||||
public SetCheckedOptions setTrial(boolean trial) {
|
||||
this.trial = trial;
|
||||
@@ -881,8 +887,7 @@ public interface ElementHandle extends JSHandle {
|
||||
}
|
||||
class TapOptions {
|
||||
/**
|
||||
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
|
||||
* {@code false}.
|
||||
* Whether to bypass the <a href="../actionability.md">actionability</a> checks. Defaults to {@code false}.
|
||||
*/
|
||||
public Boolean force;
|
||||
/**
|
||||
@@ -908,15 +913,13 @@ public interface ElementHandle extends JSHandle {
|
||||
*/
|
||||
public Double timeout;
|
||||
/**
|
||||
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
|
||||
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
|
||||
* performing it.
|
||||
* When set, this method only performs the <a href="../actionability.md">actionability</a> checks and skips the action.
|
||||
* Defaults to {@code false}. Useful to wait until the element is ready for the action without performing it.
|
||||
*/
|
||||
public Boolean trial;
|
||||
|
||||
/**
|
||||
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
|
||||
* {@code false}.
|
||||
* Whether to bypass the <a href="../actionability.md">actionability</a> checks. Defaults to {@code false}.
|
||||
*/
|
||||
public TapOptions setForce(boolean force) {
|
||||
this.force = force;
|
||||
@@ -964,9 +967,8 @@ public interface ElementHandle extends JSHandle {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
|
||||
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
|
||||
* performing it.
|
||||
* When set, this method only performs the <a href="../actionability.md">actionability</a> checks and skips the action.
|
||||
* Defaults to {@code false}. Useful to wait until the element is ready for the action without performing it.
|
||||
*/
|
||||
public TapOptions setTrial(boolean trial) {
|
||||
this.trial = trial;
|
||||
@@ -1019,8 +1021,7 @@ public interface ElementHandle extends JSHandle {
|
||||
}
|
||||
class UncheckOptions {
|
||||
/**
|
||||
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
|
||||
* {@code false}.
|
||||
* Whether to bypass the <a href="../actionability.md">actionability</a> checks. Defaults to {@code false}.
|
||||
*/
|
||||
public Boolean force;
|
||||
/**
|
||||
@@ -1041,15 +1042,13 @@ public interface ElementHandle extends JSHandle {
|
||||
*/
|
||||
public Double timeout;
|
||||
/**
|
||||
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
|
||||
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
|
||||
* performing it.
|
||||
* When set, this method only performs the <a href="../actionability.md">actionability</a> checks and skips the action.
|
||||
* Defaults to {@code false}. Useful to wait until the element is ready for the action without performing it.
|
||||
*/
|
||||
public Boolean trial;
|
||||
|
||||
/**
|
||||
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
|
||||
* {@code false}.
|
||||
* Whether to bypass the <a href="../actionability.md">actionability</a> checks. Defaults to {@code false}.
|
||||
*/
|
||||
public UncheckOptions setForce(boolean force) {
|
||||
this.force = force;
|
||||
@@ -1089,9 +1088,8 @@ public interface ElementHandle extends JSHandle {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
|
||||
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
|
||||
* performing it.
|
||||
* When set, this method only performs the <a href="../actionability.md">actionability</a> checks and skips the action.
|
||||
* Defaults to {@code false}. Useful to wait until the element is ready for the action without performing it.
|
||||
*/
|
||||
public UncheckOptions setTrial(boolean trial) {
|
||||
this.trial = trial;
|
||||
@@ -1198,8 +1196,7 @@ public interface ElementHandle extends JSHandle {
|
||||
* <ol>
|
||||
* <li> Ensure that element is a checkbox or a radio input. If not, this method throws. If the element is already checked, this
|
||||
* method returns immediately.</li>
|
||||
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the element, unless
|
||||
* {@code force} option is set.</li>
|
||||
* <li> Wait for <a href="../actionability.md">actionability</a> checks on the element, unless {@code force} option is set.</li>
|
||||
* <li> Scroll the element into view if needed.</li>
|
||||
* <li> Use {@link Page#mouse Page.mouse()} to click in the center of the element.</li>
|
||||
* <li> Wait for initiated navigations to either succeed or fail, unless {@code noWaitAfter} option is set.</li>
|
||||
@@ -1219,8 +1216,7 @@ public interface ElementHandle extends JSHandle {
|
||||
* <ol>
|
||||
* <li> Ensure that element is a checkbox or a radio input. If not, this method throws. If the element is already checked, this
|
||||
* method returns immediately.</li>
|
||||
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the element, unless
|
||||
* {@code force} option is set.</li>
|
||||
* <li> Wait for <a href="../actionability.md">actionability</a> checks on the element, unless {@code force} option is set.</li>
|
||||
* <li> Scroll the element into view if needed.</li>
|
||||
* <li> Use {@link Page#mouse Page.mouse()} to click in the center of the element.</li>
|
||||
* <li> Wait for initiated navigations to either succeed or fail, unless {@code noWaitAfter} option is set.</li>
|
||||
@@ -1236,8 +1232,7 @@ public interface ElementHandle extends JSHandle {
|
||||
/**
|
||||
* This method clicks the element by performing the following steps:
|
||||
* <ol>
|
||||
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the element, unless
|
||||
* {@code force} option is set.</li>
|
||||
* <li> Wait for <a href="../actionability.md">actionability</a> checks on the element, unless {@code force} option is set.</li>
|
||||
* <li> Scroll the element into view if needed.</li>
|
||||
* <li> Use {@link Page#mouse Page.mouse()} to click in the center of the element, or the specified {@code position}.</li>
|
||||
* <li> Wait for initiated navigations to either succeed or fail, unless {@code noWaitAfter} option is set.</li>
|
||||
@@ -1254,8 +1249,7 @@ public interface ElementHandle extends JSHandle {
|
||||
/**
|
||||
* This method clicks the element by performing the following steps:
|
||||
* <ol>
|
||||
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the element, unless
|
||||
* {@code force} option is set.</li>
|
||||
* <li> Wait for <a href="../actionability.md">actionability</a> checks on the element, unless {@code force} option is set.</li>
|
||||
* <li> Scroll the element into view if needed.</li>
|
||||
* <li> Use {@link Page#mouse Page.mouse()} to click in the center of the element, or the specified {@code position}.</li>
|
||||
* <li> Wait for initiated navigations to either succeed or fail, unless {@code noWaitAfter} option is set.</li>
|
||||
@@ -1274,8 +1268,7 @@ public interface ElementHandle extends JSHandle {
|
||||
/**
|
||||
* This method double clicks the element by performing the following steps:
|
||||
* <ol>
|
||||
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the element, unless
|
||||
* {@code force} option is set.</li>
|
||||
* <li> Wait for <a href="../actionability.md">actionability</a> checks on the element, unless {@code force} option is set.</li>
|
||||
* <li> Scroll the element into view if needed.</li>
|
||||
* <li> Use {@link Page#mouse Page.mouse()} to double click in the center of the element, or the specified {@code position}.</li>
|
||||
* <li> Wait for initiated navigations to either succeed or fail, unless {@code noWaitAfter} option is set. Note that if the first
|
||||
@@ -1295,8 +1288,7 @@ public interface ElementHandle extends JSHandle {
|
||||
/**
|
||||
* This method double clicks the element by performing the following steps:
|
||||
* <ol>
|
||||
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the element, unless
|
||||
* {@code force} option is set.</li>
|
||||
* <li> Wait for <a href="../actionability.md">actionability</a> checks on the element, unless {@code force} option is set.</li>
|
||||
* <li> Scroll the element into view if needed.</li>
|
||||
* <li> Use {@link Page#mouse Page.mouse()} to double click in the center of the element, or the specified {@code position}.</li>
|
||||
* <li> Wait for initiated navigations to either succeed or fail, unless {@code noWaitAfter} option is set. Note that if the first
|
||||
@@ -1386,8 +1378,8 @@ public interface ElementHandle extends JSHandle {
|
||||
* Returns the return value of {@code expression}.
|
||||
*
|
||||
* <p> The method finds an element matching the specified selector in the {@code ElementHandle}s subtree and passes it as a first
|
||||
* argument to {@code expression}. See <a href="https://playwright.dev/java/docs/selectors">Working with selectors</a> for more
|
||||
* details. If no elements match the selector, the method throws an error.
|
||||
* argument to {@code expression}. See <a href="../selectors.md">Working with selectors</a> for more details. If no elements
|
||||
* match the selector, the method throws an error.
|
||||
*
|
||||
* <p> If {@code expression} returns a <a
|
||||
* href='https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise'>Promise</a>, then {@link
|
||||
@@ -1400,8 +1392,7 @@ public interface ElementHandle extends JSHandle {
|
||||
* assertEquals("10", tweetHandle.evalOnSelector(".retweets", "node => node.innerText"));
|
||||
* }</pre>
|
||||
*
|
||||
* @param selector A selector to query for. See <a href="https://playwright.dev/java/docs/selectors">working with selectors</a> for more
|
||||
* details.
|
||||
* @param selector A selector to query for. See <a href="../selectors.md">working with selectors</a> for more details.
|
||||
* @param expression JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted
|
||||
* as a function. Otherwise, evaluated as an expression.
|
||||
*/
|
||||
@@ -1412,8 +1403,8 @@ public interface ElementHandle extends JSHandle {
|
||||
* Returns the return value of {@code expression}.
|
||||
*
|
||||
* <p> The method finds an element matching the specified selector in the {@code ElementHandle}s subtree and passes it as a first
|
||||
* argument to {@code expression}. See <a href="https://playwright.dev/java/docs/selectors">Working with selectors</a> for more
|
||||
* details. If no elements match the selector, the method throws an error.
|
||||
* argument to {@code expression}. See <a href="../selectors.md">Working with selectors</a> for more details. If no elements
|
||||
* match the selector, the method throws an error.
|
||||
*
|
||||
* <p> If {@code expression} returns a <a
|
||||
* href='https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise'>Promise</a>, then {@link
|
||||
@@ -1426,8 +1417,7 @@ public interface ElementHandle extends JSHandle {
|
||||
* assertEquals("10", tweetHandle.evalOnSelector(".retweets", "node => node.innerText"));
|
||||
* }</pre>
|
||||
*
|
||||
* @param selector A selector to query for. See <a href="https://playwright.dev/java/docs/selectors">working with selectors</a> for more
|
||||
* details.
|
||||
* @param selector A selector to query for. See <a href="../selectors.md">working with selectors</a> for more details.
|
||||
* @param expression JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted
|
||||
* as a function. Otherwise, evaluated as an expression.
|
||||
* @param arg Optional argument to pass to {@code expression}.
|
||||
@@ -1437,8 +1427,8 @@ public interface ElementHandle extends JSHandle {
|
||||
* Returns the return value of {@code expression}.
|
||||
*
|
||||
* <p> The method finds all elements matching the specified selector in the {@code ElementHandle}'s subtree and passes an array of
|
||||
* matched elements as a first argument to {@code expression}. See <a href="https://playwright.dev/java/docs/selectors">Working
|
||||
* with selectors</a> for more details.
|
||||
* matched elements as a first argument to {@code expression}. See <a href="../selectors.md">Working with selectors</a> for more
|
||||
* details.
|
||||
*
|
||||
* <p> If {@code expression} returns a <a
|
||||
* href='https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise'>Promise</a>, then {@link
|
||||
@@ -1451,8 +1441,7 @@ public interface ElementHandle extends JSHandle {
|
||||
* assertEquals(Arrays.asList("Hello!", "Hi!"), feedHandle.evalOnSelectorAll(".tweet", "nodes => nodes.map(n => n.innerText)"));
|
||||
* }</pre>
|
||||
*
|
||||
* @param selector A selector to query for. See <a href="https://playwright.dev/java/docs/selectors">working with selectors</a> for more
|
||||
* details.
|
||||
* @param selector A selector to query for. See <a href="../selectors.md">working with selectors</a> for more details.
|
||||
* @param expression JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted
|
||||
* as a function. Otherwise, evaluated as an expression.
|
||||
*/
|
||||
@@ -1463,8 +1452,8 @@ public interface ElementHandle extends JSHandle {
|
||||
* Returns the return value of {@code expression}.
|
||||
*
|
||||
* <p> The method finds all elements matching the specified selector in the {@code ElementHandle}'s subtree and passes an array of
|
||||
* matched elements as a first argument to {@code expression}. See <a href="https://playwright.dev/java/docs/selectors">Working
|
||||
* with selectors</a> for more details.
|
||||
* matched elements as a first argument to {@code expression}. See <a href="../selectors.md">Working with selectors</a> for more
|
||||
* details.
|
||||
*
|
||||
* <p> If {@code expression} returns a <a
|
||||
* href='https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise'>Promise</a>, then {@link
|
||||
@@ -1477,17 +1466,15 @@ public interface ElementHandle extends JSHandle {
|
||||
* assertEquals(Arrays.asList("Hello!", "Hi!"), feedHandle.evalOnSelectorAll(".tweet", "nodes => nodes.map(n => n.innerText)"));
|
||||
* }</pre>
|
||||
*
|
||||
* @param selector A selector to query for. See <a href="https://playwright.dev/java/docs/selectors">working with selectors</a> for more
|
||||
* details.
|
||||
* @param selector A selector to query for. See <a href="../selectors.md">working with selectors</a> for more details.
|
||||
* @param expression JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted
|
||||
* as a function. Otherwise, evaluated as an expression.
|
||||
* @param arg Optional argument to pass to {@code expression}.
|
||||
*/
|
||||
Object evalOnSelectorAll(String selector, String expression, Object arg);
|
||||
/**
|
||||
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, focuses the
|
||||
* element, fills it and triggers an {@code input} event after filling. Note that you can pass an empty string to clear the input
|
||||
* field.
|
||||
* This method waits for <a href="../actionability.md">actionability</a> checks, focuses the element, fills it and triggers
|
||||
* an {@code input} event after filling. Note that you can pass an empty string to clear the input field.
|
||||
*
|
||||
* <p> If the target element is not an {@code <input>}, {@code <textarea>} or {@code [contenteditable]} element, this method throws an error.
|
||||
* However, if the element is inside the {@code <label>} element that has an associated <a
|
||||
@@ -1502,9 +1489,8 @@ public interface ElementHandle extends JSHandle {
|
||||
fill(value, null);
|
||||
}
|
||||
/**
|
||||
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, focuses the
|
||||
* element, fills it and triggers an {@code input} event after filling. Note that you can pass an empty string to clear the input
|
||||
* field.
|
||||
* This method waits for <a href="../actionability.md">actionability</a> checks, focuses the element, fills it and triggers
|
||||
* an {@code input} event after filling. Note that you can pass an empty string to clear the input field.
|
||||
*
|
||||
* <p> If the target element is not an {@code <input>}, {@code <textarea>} or {@code [contenteditable]} element, this method throws an error.
|
||||
* However, if the element is inside the {@code <label>} element that has an associated <a
|
||||
@@ -1529,8 +1515,7 @@ public interface ElementHandle extends JSHandle {
|
||||
/**
|
||||
* This method hovers over the element by performing the following steps:
|
||||
* <ol>
|
||||
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the element, unless
|
||||
* {@code force} option is set.</li>
|
||||
* <li> Wait for <a href="../actionability.md">actionability</a> checks on the element, unless {@code force} option is set.</li>
|
||||
* <li> Scroll the element into view if needed.</li>
|
||||
* <li> Use {@link Page#mouse Page.mouse()} to hover over the center of the element, or the specified {@code position}.</li>
|
||||
* <li> Wait for initiated navigations to either succeed or fail, unless {@code noWaitAfter} option is set.</li>
|
||||
@@ -1547,8 +1532,7 @@ public interface ElementHandle extends JSHandle {
|
||||
/**
|
||||
* This method hovers over the element by performing the following steps:
|
||||
* <ol>
|
||||
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the element, unless
|
||||
* {@code force} option is set.</li>
|
||||
* <li> Wait for <a href="../actionability.md">actionability</a> checks on the element, unless {@code force} option is set.</li>
|
||||
* <li> Scroll the element into view if needed.</li>
|
||||
* <li> Use {@link Page#mouse Page.mouse()} to hover over the center of the element, or the specified {@code position}.</li>
|
||||
* <li> Wait for initiated navigations to either succeed or fail, unless {@code noWaitAfter} option is set.</li>
|
||||
@@ -1583,25 +1567,23 @@ public interface ElementHandle extends JSHandle {
|
||||
*/
|
||||
boolean isChecked();
|
||||
/**
|
||||
* Returns whether the element is disabled, the opposite of <a
|
||||
* href="https://playwright.dev/java/docs/actionability#enabled">enabled</a>.
|
||||
* Returns whether the element is disabled, the opposite of <a href="../actionability.md#enabled">enabled</a>.
|
||||
*/
|
||||
boolean isDisabled();
|
||||
/**
|
||||
* Returns whether the element is <a href="https://playwright.dev/java/docs/actionability#editable">editable</a>.
|
||||
* Returns whether the element is <a href="../actionability.md#editable">editable</a>.
|
||||
*/
|
||||
boolean isEditable();
|
||||
/**
|
||||
* Returns whether the element is <a href="https://playwright.dev/java/docs/actionability#enabled">enabled</a>.
|
||||
* Returns whether the element is <a href="../actionability.md#enabled">enabled</a>.
|
||||
*/
|
||||
boolean isEnabled();
|
||||
/**
|
||||
* Returns whether the element is hidden, the opposite of <a
|
||||
* href="https://playwright.dev/java/docs/actionability#visible">visible</a>.
|
||||
* Returns whether the element is hidden, the opposite of <a href="../actionability.md#visible">visible</a>.
|
||||
*/
|
||||
boolean isHidden();
|
||||
/**
|
||||
* Returns whether the element is <a href="https://playwright.dev/java/docs/actionability#visible">visible</a>.
|
||||
* Returns whether the element is <a href="../actionability.md#visible">visible</a>.
|
||||
*/
|
||||
boolean isVisible();
|
||||
/**
|
||||
@@ -1660,27 +1642,24 @@ public interface ElementHandle extends JSHandle {
|
||||
void press(String key, PressOptions options);
|
||||
/**
|
||||
* The method finds an element matching the specified selector in the {@code ElementHandle}'s subtree. See <a
|
||||
* href="https://playwright.dev/java/docs/selectors">Working with selectors</a> for more details. If no elements match the
|
||||
* selector, returns {@code null}.
|
||||
* href="../selectors.md">Working with selectors</a> for more details. If no elements match the selector, returns {@code null}.
|
||||
*
|
||||
* @param selector A selector to query for. See <a href="https://playwright.dev/java/docs/selectors">working with selectors</a> for more
|
||||
* details.
|
||||
* @param selector A selector to query for. See <a href="../selectors.md">working with selectors</a> for more details.
|
||||
*/
|
||||
ElementHandle querySelector(String selector);
|
||||
/**
|
||||
* The method finds all elements matching the specified selector in the {@code ElementHandle}s subtree. See <a
|
||||
* href="https://playwright.dev/java/docs/selectors">Working with selectors</a> for more details. If no elements match the
|
||||
* selector, returns empty array.
|
||||
* href="../selectors.md">Working with selectors</a> for more details. If no elements match the selector, returns empty
|
||||
* array.
|
||||
*
|
||||
* @param selector A selector to query for. See <a href="https://playwright.dev/java/docs/selectors">working with selectors</a> for more
|
||||
* details.
|
||||
* @param selector A selector to query for. See <a href="../selectors.md">working with selectors</a> for more details.
|
||||
*/
|
||||
List<ElementHandle> querySelectorAll(String selector);
|
||||
/**
|
||||
* Returns the buffer with the captured screenshot.
|
||||
*
|
||||
* <p> This method waits for the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, then
|
||||
* scrolls element into view before taking a screenshot. If the element is detached from DOM, the method throws an error.
|
||||
* <p> This method waits for the <a href="../actionability.md">actionability</a> checks, then scrolls element into view before
|
||||
* taking a screenshot. If the element is detached from DOM, the method throws an error.
|
||||
*/
|
||||
default byte[] screenshot() {
|
||||
return screenshot(null);
|
||||
@@ -1688,13 +1667,13 @@ public interface ElementHandle extends JSHandle {
|
||||
/**
|
||||
* Returns the buffer with the captured screenshot.
|
||||
*
|
||||
* <p> This method waits for the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, then
|
||||
* scrolls element into view before taking a screenshot. If the element is detached from DOM, the method throws an error.
|
||||
* <p> This method waits for the <a href="../actionability.md">actionability</a> checks, then scrolls element into view before
|
||||
* taking a screenshot. If the element is detached from DOM, the method throws an error.
|
||||
*/
|
||||
byte[] screenshot(ScreenshotOptions options);
|
||||
/**
|
||||
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, then tries to
|
||||
* scroll element into view, unless it is completely visible as defined by <a
|
||||
* This method waits for <a href="../actionability.md">actionability</a> checks, then tries to scroll element into view,
|
||||
* unless it is completely visible as defined by <a
|
||||
* href="https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API">IntersectionObserver</a>'s {@code ratio}.
|
||||
*
|
||||
* <p> Throws when {@code elementHandle} does not point to an element <a
|
||||
@@ -1704,8 +1683,8 @@ public interface ElementHandle extends JSHandle {
|
||||
scrollIntoViewIfNeeded(null);
|
||||
}
|
||||
/**
|
||||
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, then tries to
|
||||
* scroll element into view, unless it is completely visible as defined by <a
|
||||
* This method waits for <a href="../actionability.md">actionability</a> checks, then tries to scroll element into view,
|
||||
* unless it is completely visible as defined by <a
|
||||
* href="https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API">IntersectionObserver</a>'s {@code ratio}.
|
||||
*
|
||||
* <p> Throws when {@code elementHandle} does not point to an element <a
|
||||
@@ -1713,8 +1692,8 @@ public interface ElementHandle extends JSHandle {
|
||||
*/
|
||||
void scrollIntoViewIfNeeded(ScrollIntoViewIfNeededOptions options);
|
||||
/**
|
||||
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, waits until all
|
||||
* specified options are present in the {@code <select>} element and selects these options.
|
||||
* This method waits for <a href="../actionability.md">actionability</a> checks, waits until all specified options are
|
||||
* present in the {@code <select>} element and selects these options.
|
||||
*
|
||||
* <p> If the target element is not a {@code <select>} element, this method throws an error. However, if the element is inside the
|
||||
* {@code <label>} element that has an associated <a
|
||||
@@ -1741,8 +1720,8 @@ public interface ElementHandle extends JSHandle {
|
||||
return selectOption(values, null);
|
||||
}
|
||||
/**
|
||||
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, waits until all
|
||||
* specified options are present in the {@code <select>} element and selects these options.
|
||||
* This method waits for <a href="../actionability.md">actionability</a> checks, waits until all specified options are
|
||||
* present in the {@code <select>} element and selects these options.
|
||||
*
|
||||
* <p> If the target element is not a {@code <select>} element, this method throws an error. However, if the element is inside the
|
||||
* {@code <label>} element that has an associated <a
|
||||
@@ -1767,8 +1746,8 @@ public interface ElementHandle extends JSHandle {
|
||||
*/
|
||||
List<String> selectOption(String values, SelectOptionOptions options);
|
||||
/**
|
||||
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, waits until all
|
||||
* specified options are present in the {@code <select>} element and selects these options.
|
||||
* This method waits for <a href="../actionability.md">actionability</a> checks, waits until all specified options are
|
||||
* present in the {@code <select>} element and selects these options.
|
||||
*
|
||||
* <p> If the target element is not a {@code <select>} element, this method throws an error. However, if the element is inside the
|
||||
* {@code <label>} element that has an associated <a
|
||||
@@ -1795,8 +1774,8 @@ public interface ElementHandle extends JSHandle {
|
||||
return selectOption(values, null);
|
||||
}
|
||||
/**
|
||||
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, waits until all
|
||||
* specified options are present in the {@code <select>} element and selects these options.
|
||||
* This method waits for <a href="../actionability.md">actionability</a> checks, waits until all specified options are
|
||||
* present in the {@code <select>} element and selects these options.
|
||||
*
|
||||
* <p> If the target element is not a {@code <select>} element, this method throws an error. However, if the element is inside the
|
||||
* {@code <label>} element that has an associated <a
|
||||
@@ -1821,8 +1800,8 @@ public interface ElementHandle extends JSHandle {
|
||||
*/
|
||||
List<String> selectOption(ElementHandle values, SelectOptionOptions options);
|
||||
/**
|
||||
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, waits until all
|
||||
* specified options are present in the {@code <select>} element and selects these options.
|
||||
* This method waits for <a href="../actionability.md">actionability</a> checks, waits until all specified options are
|
||||
* present in the {@code <select>} element and selects these options.
|
||||
*
|
||||
* <p> If the target element is not a {@code <select>} element, this method throws an error. However, if the element is inside the
|
||||
* {@code <label>} element that has an associated <a
|
||||
@@ -1849,8 +1828,8 @@ public interface ElementHandle extends JSHandle {
|
||||
return selectOption(values, null);
|
||||
}
|
||||
/**
|
||||
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, waits until all
|
||||
* specified options are present in the {@code <select>} element and selects these options.
|
||||
* This method waits for <a href="../actionability.md">actionability</a> checks, waits until all specified options are
|
||||
* present in the {@code <select>} element and selects these options.
|
||||
*
|
||||
* <p> If the target element is not a {@code <select>} element, this method throws an error. However, if the element is inside the
|
||||
* {@code <label>} element that has an associated <a
|
||||
@@ -1875,8 +1854,8 @@ public interface ElementHandle extends JSHandle {
|
||||
*/
|
||||
List<String> selectOption(String[] values, SelectOptionOptions options);
|
||||
/**
|
||||
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, waits until all
|
||||
* specified options are present in the {@code <select>} element and selects these options.
|
||||
* This method waits for <a href="../actionability.md">actionability</a> checks, waits until all specified options are
|
||||
* present in the {@code <select>} element and selects these options.
|
||||
*
|
||||
* <p> If the target element is not a {@code <select>} element, this method throws an error. However, if the element is inside the
|
||||
* {@code <label>} element that has an associated <a
|
||||
@@ -1903,8 +1882,8 @@ public interface ElementHandle extends JSHandle {
|
||||
return selectOption(values, null);
|
||||
}
|
||||
/**
|
||||
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, waits until all
|
||||
* specified options are present in the {@code <select>} element and selects these options.
|
||||
* This method waits for <a href="../actionability.md">actionability</a> checks, waits until all specified options are
|
||||
* present in the {@code <select>} element and selects these options.
|
||||
*
|
||||
* <p> If the target element is not a {@code <select>} element, this method throws an error. However, if the element is inside the
|
||||
* {@code <label>} element that has an associated <a
|
||||
@@ -1929,8 +1908,8 @@ public interface ElementHandle extends JSHandle {
|
||||
*/
|
||||
List<String> selectOption(SelectOption values, SelectOptionOptions options);
|
||||
/**
|
||||
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, waits until all
|
||||
* specified options are present in the {@code <select>} element and selects these options.
|
||||
* This method waits for <a href="../actionability.md">actionability</a> checks, waits until all specified options are
|
||||
* present in the {@code <select>} element and selects these options.
|
||||
*
|
||||
* <p> If the target element is not a {@code <select>} element, this method throws an error. However, if the element is inside the
|
||||
* {@code <label>} element that has an associated <a
|
||||
@@ -1957,8 +1936,8 @@ public interface ElementHandle extends JSHandle {
|
||||
return selectOption(values, null);
|
||||
}
|
||||
/**
|
||||
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, waits until all
|
||||
* specified options are present in the {@code <select>} element and selects these options.
|
||||
* This method waits for <a href="../actionability.md">actionability</a> checks, waits until all specified options are
|
||||
* present in the {@code <select>} element and selects these options.
|
||||
*
|
||||
* <p> If the target element is not a {@code <select>} element, this method throws an error. However, if the element is inside the
|
||||
* {@code <label>} element that has an associated <a
|
||||
@@ -1983,8 +1962,8 @@ public interface ElementHandle extends JSHandle {
|
||||
*/
|
||||
List<String> selectOption(ElementHandle[] values, SelectOptionOptions options);
|
||||
/**
|
||||
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, waits until all
|
||||
* specified options are present in the {@code <select>} element and selects these options.
|
||||
* This method waits for <a href="../actionability.md">actionability</a> checks, waits until all specified options are
|
||||
* present in the {@code <select>} element and selects these options.
|
||||
*
|
||||
* <p> If the target element is not a {@code <select>} element, this method throws an error. However, if the element is inside the
|
||||
* {@code <label>} element that has an associated <a
|
||||
@@ -2011,8 +1990,8 @@ public interface ElementHandle extends JSHandle {
|
||||
return selectOption(values, null);
|
||||
}
|
||||
/**
|
||||
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, waits until all
|
||||
* specified options are present in the {@code <select>} element and selects these options.
|
||||
* This method waits for <a href="../actionability.md">actionability</a> checks, waits until all specified options are
|
||||
* present in the {@code <select>} element and selects these options.
|
||||
*
|
||||
* <p> If the target element is not a {@code <select>} element, this method throws an error. However, if the element is inside the
|
||||
* {@code <label>} element that has an associated <a
|
||||
@@ -2037,15 +2016,15 @@ public interface ElementHandle extends JSHandle {
|
||||
*/
|
||||
List<String> selectOption(SelectOption[] values, SelectOptionOptions options);
|
||||
/**
|
||||
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, then focuses
|
||||
* the element and selects all its text content.
|
||||
* This method waits for <a href="../actionability.md">actionability</a> checks, then focuses the element and selects all
|
||||
* its text content.
|
||||
*/
|
||||
default void selectText() {
|
||||
selectText(null);
|
||||
}
|
||||
/**
|
||||
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, then focuses
|
||||
* the element and selects all its text content.
|
||||
* This method waits for <a href="../actionability.md">actionability</a> checks, then focuses the element and selects all
|
||||
* its text content.
|
||||
*/
|
||||
void selectText(SelectTextOptions options);
|
||||
/**
|
||||
@@ -2053,8 +2032,8 @@ public interface ElementHandle extends JSHandle {
|
||||
* <ol>
|
||||
* <li> Ensure that element is a checkbox or a radio input. If not, this method throws.</li>
|
||||
* <li> If the element already has the right checked state, this method returns immediately.</li>
|
||||
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the matched element,
|
||||
* unless {@code force} option is set. If the element is detached during the checks, the whole action is retried.</li>
|
||||
* <li> Wait for <a href="../actionability.md">actionability</a> checks on the matched element, unless {@code force} option is set. If
|
||||
* the element is detached during the checks, the whole action is retried.</li>
|
||||
* <li> Scroll the element into view if needed.</li>
|
||||
* <li> Use {@link Page#mouse Page.mouse()} to click in the center of the element.</li>
|
||||
* <li> Wait for initiated navigations to either succeed or fail, unless {@code noWaitAfter} option is set.</li>
|
||||
@@ -2074,8 +2053,8 @@ public interface ElementHandle extends JSHandle {
|
||||
* <ol>
|
||||
* <li> Ensure that element is a checkbox or a radio input. If not, this method throws.</li>
|
||||
* <li> If the element already has the right checked state, this method returns immediately.</li>
|
||||
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the matched element,
|
||||
* unless {@code force} option is set. If the element is detached during the checks, the whole action is retried.</li>
|
||||
* <li> Wait for <a href="../actionability.md">actionability</a> checks on the matched element, unless {@code force} option is set. If
|
||||
* the element is detached during the checks, the whole action is retried.</li>
|
||||
* <li> Scroll the element into view if needed.</li>
|
||||
* <li> Use {@link Page#mouse Page.mouse()} to click in the center of the element.</li>
|
||||
* <li> Wait for initiated navigations to either succeed or fail, unless {@code noWaitAfter} option is set.</li>
|
||||
@@ -2163,8 +2142,7 @@ public interface ElementHandle extends JSHandle {
|
||||
/**
|
||||
* This method taps the element by performing the following steps:
|
||||
* <ol>
|
||||
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the element, unless
|
||||
* {@code force} option is set.</li>
|
||||
* <li> Wait for <a href="../actionability.md">actionability</a> checks on the element, unless {@code force} option is set.</li>
|
||||
* <li> Scroll the element into view if needed.</li>
|
||||
* <li> Use {@link Page#touchscreen Page.touchscreen()} to tap the center of the element, or the specified {@code position}.</li>
|
||||
* <li> Wait for initiated navigations to either succeed or fail, unless {@code noWaitAfter} option is set.</li>
|
||||
@@ -2183,8 +2161,7 @@ public interface ElementHandle extends JSHandle {
|
||||
/**
|
||||
* This method taps the element by performing the following steps:
|
||||
* <ol>
|
||||
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the element, unless
|
||||
* {@code force} option is set.</li>
|
||||
* <li> Wait for <a href="../actionability.md">actionability</a> checks on the element, unless {@code force} option is set.</li>
|
||||
* <li> Scroll the element into view if needed.</li>
|
||||
* <li> Use {@link Page#touchscreen Page.touchscreen()} to tap the center of the element, or the specified {@code position}.</li>
|
||||
* <li> Wait for initiated navigations to either succeed or fail, unless {@code noWaitAfter} option is set.</li>
|
||||
@@ -2247,8 +2224,7 @@ public interface ElementHandle extends JSHandle {
|
||||
* <ol>
|
||||
* <li> Ensure that element is a checkbox or a radio input. If not, this method throws. If the element is already unchecked,
|
||||
* this method returns immediately.</li>
|
||||
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the element, unless
|
||||
* {@code force} option is set.</li>
|
||||
* <li> Wait for <a href="../actionability.md">actionability</a> checks on the element, unless {@code force} option is set.</li>
|
||||
* <li> Scroll the element into view if needed.</li>
|
||||
* <li> Use {@link Page#mouse Page.mouse()} to click in the center of the element.</li>
|
||||
* <li> Wait for initiated navigations to either succeed or fail, unless {@code noWaitAfter} option is set.</li>
|
||||
@@ -2268,8 +2244,7 @@ public interface ElementHandle extends JSHandle {
|
||||
* <ol>
|
||||
* <li> Ensure that element is a checkbox or a radio input. If not, this method throws. If the element is already unchecked,
|
||||
* this method returns immediately.</li>
|
||||
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the element, unless
|
||||
* {@code force} option is set.</li>
|
||||
* <li> Wait for <a href="../actionability.md">actionability</a> checks on the element, unless {@code force} option is set.</li>
|
||||
* <li> Scroll the element into view if needed.</li>
|
||||
* <li> Use {@link Page#mouse Page.mouse()} to click in the center of the element.</li>
|
||||
* <li> Wait for initiated navigations to either succeed or fail, unless {@code noWaitAfter} option is set.</li>
|
||||
@@ -2285,19 +2260,18 @@ public interface ElementHandle extends JSHandle {
|
||||
/**
|
||||
* Returns when the element satisfies the {@code state}.
|
||||
*
|
||||
* <p> Depending on the {@code state} parameter, this method waits for one of the <a
|
||||
* href="https://playwright.dev/java/docs/actionability">actionability</a> checks to pass. This method throws when the
|
||||
* element is detached while waiting, unless waiting for the {@code "hidden"} state.
|
||||
* <p> Depending on the {@code state} parameter, this method waits for one of the <a href="../actionability.md">actionability</a>
|
||||
* checks to pass. This method throws when the element is detached while waiting, unless waiting for the {@code "hidden"} state.
|
||||
* <ul>
|
||||
* <li> {@code "visible"} Wait until the element is <a href="https://playwright.dev/java/docs/actionability#visible">visible</a>.</li>
|
||||
* <li> {@code "hidden"} Wait until the element is <a href="https://playwright.dev/java/docs/actionability#visible">not visible</a> or
|
||||
* <a href="https://playwright.dev/java/docs/actionability#attached">not attached</a>. Note that waiting for hidden does
|
||||
* not throw when the element detaches.</li>
|
||||
* <li> {@code "stable"} Wait until the element is both <a href="https://playwright.dev/java/docs/actionability#visible">visible</a>
|
||||
* and <a href="https://playwright.dev/java/docs/actionability#stable">stable</a>.</li>
|
||||
* <li> {@code "enabled"} Wait until the element is <a href="https://playwright.dev/java/docs/actionability#enabled">enabled</a>.</li>
|
||||
* <li> {@code "disabled"} Wait until the element is <a href="https://playwright.dev/java/docs/actionability#enabled">not enabled</a>.</li>
|
||||
* <li> {@code "editable"} Wait until the element is <a href="https://playwright.dev/java/docs/actionability#editable">editable</a>.</li>
|
||||
* <li> {@code "visible"} Wait until the element is <a href="../actionability.md#visible">visible</a>.</li>
|
||||
* <li> {@code "hidden"} Wait until the element is <a href="../actionability.md#visible">not visible</a> or <a
|
||||
* href="../actionability.md#attached">not attached</a>. Note that waiting for hidden does not throw when the element
|
||||
* detaches.</li>
|
||||
* <li> {@code "stable"} Wait until the element is both <a href="../actionability.md#visible">visible</a> and <a
|
||||
* href="../actionability.md#stable">stable</a>.</li>
|
||||
* <li> {@code "enabled"} Wait until the element is <a href="../actionability.md#enabled">enabled</a>.</li>
|
||||
* <li> {@code "disabled"} Wait until the element is <a href="../actionability.md#enabled">not enabled</a>.</li>
|
||||
* <li> {@code "editable"} Wait until the element is <a href="../actionability.md#editable">editable</a>.</li>
|
||||
* </ul>
|
||||
*
|
||||
* <p> If the element does not satisfy the condition for the {@code timeout} milliseconds, this method will throw.
|
||||
@@ -2310,19 +2284,18 @@ public interface ElementHandle extends JSHandle {
|
||||
/**
|
||||
* Returns when the element satisfies the {@code state}.
|
||||
*
|
||||
* <p> Depending on the {@code state} parameter, this method waits for one of the <a
|
||||
* href="https://playwright.dev/java/docs/actionability">actionability</a> checks to pass. This method throws when the
|
||||
* element is detached while waiting, unless waiting for the {@code "hidden"} state.
|
||||
* <p> Depending on the {@code state} parameter, this method waits for one of the <a href="../actionability.md">actionability</a>
|
||||
* checks to pass. This method throws when the element is detached while waiting, unless waiting for the {@code "hidden"} state.
|
||||
* <ul>
|
||||
* <li> {@code "visible"} Wait until the element is <a href="https://playwright.dev/java/docs/actionability#visible">visible</a>.</li>
|
||||
* <li> {@code "hidden"} Wait until the element is <a href="https://playwright.dev/java/docs/actionability#visible">not visible</a> or
|
||||
* <a href="https://playwright.dev/java/docs/actionability#attached">not attached</a>. Note that waiting for hidden does
|
||||
* not throw when the element detaches.</li>
|
||||
* <li> {@code "stable"} Wait until the element is both <a href="https://playwright.dev/java/docs/actionability#visible">visible</a>
|
||||
* and <a href="https://playwright.dev/java/docs/actionability#stable">stable</a>.</li>
|
||||
* <li> {@code "enabled"} Wait until the element is <a href="https://playwright.dev/java/docs/actionability#enabled">enabled</a>.</li>
|
||||
* <li> {@code "disabled"} Wait until the element is <a href="https://playwright.dev/java/docs/actionability#enabled">not enabled</a>.</li>
|
||||
* <li> {@code "editable"} Wait until the element is <a href="https://playwright.dev/java/docs/actionability#editable">editable</a>.</li>
|
||||
* <li> {@code "visible"} Wait until the element is <a href="../actionability.md#visible">visible</a>.</li>
|
||||
* <li> {@code "hidden"} Wait until the element is <a href="../actionability.md#visible">not visible</a> or <a
|
||||
* href="../actionability.md#attached">not attached</a>. Note that waiting for hidden does not throw when the element
|
||||
* detaches.</li>
|
||||
* <li> {@code "stable"} Wait until the element is both <a href="../actionability.md#visible">visible</a> and <a
|
||||
* href="../actionability.md#stable">stable</a>.</li>
|
||||
* <li> {@code "enabled"} Wait until the element is <a href="../actionability.md#enabled">enabled</a>.</li>
|
||||
* <li> {@code "disabled"} Wait until the element is <a href="../actionability.md#enabled">not enabled</a>.</li>
|
||||
* <li> {@code "editable"} Wait until the element is <a href="../actionability.md#editable">editable</a>.</li>
|
||||
* </ul>
|
||||
*
|
||||
* <p> If the element does not satisfy the condition for the {@code timeout} milliseconds, this method will throw.
|
||||
@@ -2348,8 +2321,7 @@ public interface ElementHandle extends JSHandle {
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> This method does not work across navigations, use {@link Page#waitForSelector Page.waitForSelector()} instead.
|
||||
*
|
||||
* @param selector A selector to query for. See <a href="https://playwright.dev/java/docs/selectors">working with selectors</a> for more
|
||||
* details.
|
||||
* @param selector A selector to query for. See <a href="../selectors.md">working with selectors</a> for more details.
|
||||
*/
|
||||
default ElementHandle waitForSelector(String selector) {
|
||||
return waitForSelector(selector, null);
|
||||
@@ -2372,8 +2344,7 @@ public interface ElementHandle extends JSHandle {
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> This method does not work across navigations, use {@link Page#waitForSelector Page.waitForSelector()} instead.
|
||||
*
|
||||
* @param selector A selector to query for. See <a href="https://playwright.dev/java/docs/selectors">working with selectors</a> for more
|
||||
* details.
|
||||
* @param selector A selector to query for. See <a href="../selectors.md">working with selectors</a> for more details.
|
||||
*/
|
||||
ElementHandle waitForSelector(String selector, WaitForSelectorOptions options);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -57,8 +57,9 @@ public interface FrameLocator {
|
||||
*/
|
||||
public Locator has;
|
||||
/**
|
||||
* Matches elements containing specified text somewhere inside, possibly in a child or a descendant element. For example,
|
||||
* {@code "Playwright"} matches {@code <article><div>Playwright</div></article>}.
|
||||
* Matches elements containing specified text somewhere inside, possibly in a child or a descendant element. When passed a
|
||||
* [string], matching is case-insensitive and searches for a substring. For example, {@code "Playwright"} matches
|
||||
* {@code <article><div>Playwright</div></article>}.
|
||||
*/
|
||||
public Object hasText;
|
||||
|
||||
@@ -73,16 +74,18 @@ public interface FrameLocator {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Matches elements containing specified text somewhere inside, possibly in a child or a descendant element. For example,
|
||||
* {@code "Playwright"} matches {@code <article><div>Playwright</div></article>}.
|
||||
* Matches elements containing specified text somewhere inside, possibly in a child or a descendant element. When passed a
|
||||
* [string], matching is case-insensitive and searches for a substring. For example, {@code "Playwright"} matches
|
||||
* {@code <article><div>Playwright</div></article>}.
|
||||
*/
|
||||
public LocatorOptions setHasText(String hasText) {
|
||||
this.hasText = hasText;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Matches elements containing specified text somewhere inside, possibly in a child or a descendant element. For example,
|
||||
* {@code "Playwright"} matches {@code <article><div>Playwright</div></article>}.
|
||||
* Matches elements containing specified text somewhere inside, possibly in a child or a descendant element. When passed a
|
||||
* [string], matching is case-insensitive and searches for a substring. For example, {@code "Playwright"} matches
|
||||
* {@code <article><div>Playwright</div></article>}.
|
||||
*/
|
||||
public LocatorOptions setHasText(Pattern hasText) {
|
||||
this.hasText = hasText;
|
||||
@@ -97,8 +100,7 @@ public interface FrameLocator {
|
||||
* When working with iframes, you can create a frame locator that will enter the iframe and allow selecting elements in
|
||||
* that iframe.
|
||||
*
|
||||
* @param selector A selector to use when resolving DOM element. See <a href="https://playwright.dev/java/docs/selectors">working with
|
||||
* selectors</a> for more details.
|
||||
* @param selector A selector to use when resolving DOM element. See <a href="../selectors.md">working with selectors</a> for more details.
|
||||
*/
|
||||
FrameLocator frameLocator(String selector);
|
||||
/**
|
||||
@@ -108,8 +110,7 @@ public interface FrameLocator {
|
||||
/**
|
||||
* The method finds an element matching the specified selector in the FrameLocator's subtree.
|
||||
*
|
||||
* @param selector A selector to use when resolving DOM element. See <a href="https://playwright.dev/java/docs/selectors">working with
|
||||
* selectors</a> for more details.
|
||||
* @param selector A selector to use when resolving DOM element. See <a href="../selectors.md">working with selectors</a> for more details.
|
||||
*/
|
||||
default Locator locator(String selector) {
|
||||
return locator(selector, null);
|
||||
@@ -117,12 +118,11 @@ public interface FrameLocator {
|
||||
/**
|
||||
* The method finds an element matching the specified selector in the FrameLocator's subtree.
|
||||
*
|
||||
* @param selector A selector to use when resolving DOM element. See <a href="https://playwright.dev/java/docs/selectors">working with
|
||||
* selectors</a> for more details.
|
||||
* @param selector A selector to use when resolving DOM element. See <a href="../selectors.md">working with selectors</a> for more details.
|
||||
*/
|
||||
Locator locator(String selector, LocatorOptions options);
|
||||
/**
|
||||
* Returns locator to the n-th matching frame.
|
||||
* Returns locator to the n-th matching frame. It's zero based, {@code nth(0)} selects the first frame.
|
||||
*/
|
||||
FrameLocator nth(int index);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import java.util.regex.Pattern;
|
||||
* to find element(s) on the page at any moment. Locator can be created with the {@link Page#locator Page.locator()}
|
||||
* method.
|
||||
*
|
||||
* <p> <a href="https://playwright.dev/java/docs/locators">Learn more about locators</a>.
|
||||
* <p> <a href="../locators.md">Learn more about locators</a>.
|
||||
*/
|
||||
public interface Locator {
|
||||
class BoundingBoxOptions {
|
||||
@@ -49,8 +49,7 @@ public interface Locator {
|
||||
}
|
||||
class CheckOptions {
|
||||
/**
|
||||
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
|
||||
* {@code false}.
|
||||
* Whether to bypass the <a href="../actionability.md">actionability</a> checks. Defaults to {@code false}.
|
||||
*/
|
||||
public Boolean force;
|
||||
/**
|
||||
@@ -71,15 +70,13 @@ public interface Locator {
|
||||
*/
|
||||
public Double timeout;
|
||||
/**
|
||||
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
|
||||
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
|
||||
* performing it.
|
||||
* When set, this method only performs the <a href="../actionability.md">actionability</a> checks and skips the action.
|
||||
* Defaults to {@code false}. Useful to wait until the element is ready for the action without performing it.
|
||||
*/
|
||||
public Boolean trial;
|
||||
|
||||
/**
|
||||
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
|
||||
* {@code false}.
|
||||
* Whether to bypass the <a href="../actionability.md">actionability</a> checks. Defaults to {@code false}.
|
||||
*/
|
||||
public CheckOptions setForce(boolean force) {
|
||||
this.force = force;
|
||||
@@ -119,9 +116,8 @@ public interface Locator {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
|
||||
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
|
||||
* performing it.
|
||||
* When set, this method only performs the <a href="../actionability.md">actionability</a> checks and skips the action.
|
||||
* Defaults to {@code false}. Useful to wait until the element is ready for the action without performing it.
|
||||
*/
|
||||
public CheckOptions setTrial(boolean trial) {
|
||||
this.trial = trial;
|
||||
@@ -142,8 +138,7 @@ public interface Locator {
|
||||
*/
|
||||
public Double delay;
|
||||
/**
|
||||
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
|
||||
* {@code false}.
|
||||
* Whether to bypass the <a href="../actionability.md">actionability</a> checks. Defaults to {@code false}.
|
||||
*/
|
||||
public Boolean force;
|
||||
/**
|
||||
@@ -169,9 +164,8 @@ public interface Locator {
|
||||
*/
|
||||
public Double timeout;
|
||||
/**
|
||||
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
|
||||
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
|
||||
* performing it.
|
||||
* When set, this method only performs the <a href="../actionability.md">actionability</a> checks and skips the action.
|
||||
* Defaults to {@code false}. Useful to wait until the element is ready for the action without performing it.
|
||||
*/
|
||||
public Boolean trial;
|
||||
|
||||
@@ -197,8 +191,7 @@ public interface Locator {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
|
||||
* {@code false}.
|
||||
* Whether to bypass the <a href="../actionability.md">actionability</a> checks. Defaults to {@code false}.
|
||||
*/
|
||||
public ClickOptions setForce(boolean force) {
|
||||
this.force = force;
|
||||
@@ -246,9 +239,8 @@ public interface Locator {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
|
||||
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
|
||||
* performing it.
|
||||
* When set, this method only performs the <a href="../actionability.md">actionability</a> checks and skips the action.
|
||||
* Defaults to {@code false}. Useful to wait until the element is ready for the action without performing it.
|
||||
*/
|
||||
public ClickOptions setTrial(boolean trial) {
|
||||
this.trial = trial;
|
||||
@@ -265,8 +257,7 @@ public interface Locator {
|
||||
*/
|
||||
public Double delay;
|
||||
/**
|
||||
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
|
||||
* {@code false}.
|
||||
* Whether to bypass the <a href="../actionability.md">actionability</a> checks. Defaults to {@code false}.
|
||||
*/
|
||||
public Boolean force;
|
||||
/**
|
||||
@@ -292,9 +283,8 @@ public interface Locator {
|
||||
*/
|
||||
public Double timeout;
|
||||
/**
|
||||
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
|
||||
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
|
||||
* performing it.
|
||||
* When set, this method only performs the <a href="../actionability.md">actionability</a> checks and skips the action.
|
||||
* Defaults to {@code false}. Useful to wait until the element is ready for the action without performing it.
|
||||
*/
|
||||
public Boolean trial;
|
||||
|
||||
@@ -313,8 +303,7 @@ public interface Locator {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
|
||||
* {@code false}.
|
||||
* Whether to bypass the <a href="../actionability.md">actionability</a> checks. Defaults to {@code false}.
|
||||
*/
|
||||
public DblclickOptions setForce(boolean force) {
|
||||
this.force = force;
|
||||
@@ -362,9 +351,8 @@ public interface Locator {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
|
||||
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
|
||||
* performing it.
|
||||
* When set, this method only performs the <a href="../actionability.md">actionability</a> checks and skips the action.
|
||||
* Defaults to {@code false}. Useful to wait until the element is ready for the action without performing it.
|
||||
*/
|
||||
public DblclickOptions setTrial(boolean trial) {
|
||||
this.trial = trial;
|
||||
@@ -391,8 +379,7 @@ public interface Locator {
|
||||
}
|
||||
class DragToOptions {
|
||||
/**
|
||||
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
|
||||
* {@code false}.
|
||||
* Whether to bypass the <a href="../actionability.md">actionability</a> checks. Defaults to {@code false}.
|
||||
*/
|
||||
public Boolean force;
|
||||
/**
|
||||
@@ -418,15 +405,13 @@ public interface Locator {
|
||||
*/
|
||||
public Double timeout;
|
||||
/**
|
||||
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
|
||||
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
|
||||
* performing it.
|
||||
* When set, this method only performs the <a href="../actionability.md">actionability</a> checks and skips the action.
|
||||
* Defaults to {@code false}. Useful to wait until the element is ready for the action without performing it.
|
||||
*/
|
||||
public Boolean trial;
|
||||
|
||||
/**
|
||||
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
|
||||
* {@code false}.
|
||||
* Whether to bypass the <a href="../actionability.md">actionability</a> checks. Defaults to {@code false}.
|
||||
*/
|
||||
public DragToOptions setForce(boolean force) {
|
||||
this.force = force;
|
||||
@@ -481,9 +466,8 @@ public interface Locator {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
|
||||
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
|
||||
* performing it.
|
||||
* When set, this method only performs the <a href="../actionability.md">actionability</a> checks and skips the action.
|
||||
* Defaults to {@code false}. Useful to wait until the element is ready for the action without performing it.
|
||||
*/
|
||||
public DragToOptions setTrial(boolean trial) {
|
||||
this.trial = trial;
|
||||
@@ -546,8 +530,7 @@ public interface Locator {
|
||||
}
|
||||
class FillOptions {
|
||||
/**
|
||||
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
|
||||
* {@code false}.
|
||||
* Whether to bypass the <a href="../actionability.md">actionability</a> checks. Defaults to {@code false}.
|
||||
*/
|
||||
public Boolean force;
|
||||
/**
|
||||
@@ -564,8 +547,7 @@ public interface Locator {
|
||||
public Double timeout;
|
||||
|
||||
/**
|
||||
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
|
||||
* {@code false}.
|
||||
* Whether to bypass the <a href="../actionability.md">actionability</a> checks. Defaults to {@code false}.
|
||||
*/
|
||||
public FillOptions setForce(boolean force) {
|
||||
this.force = force;
|
||||
@@ -628,8 +610,7 @@ public interface Locator {
|
||||
}
|
||||
class HoverOptions {
|
||||
/**
|
||||
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
|
||||
* {@code false}.
|
||||
* Whether to bypass the <a href="../actionability.md">actionability</a> checks. Defaults to {@code false}.
|
||||
*/
|
||||
public Boolean force;
|
||||
/**
|
||||
@@ -649,15 +630,13 @@ public interface Locator {
|
||||
*/
|
||||
public Double timeout;
|
||||
/**
|
||||
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
|
||||
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
|
||||
* performing it.
|
||||
* When set, this method only performs the <a href="../actionability.md">actionability</a> checks and skips the action.
|
||||
* Defaults to {@code false}. Useful to wait until the element is ready for the action without performing it.
|
||||
*/
|
||||
public Boolean trial;
|
||||
|
||||
/**
|
||||
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
|
||||
* {@code false}.
|
||||
* Whether to bypass the <a href="../actionability.md">actionability</a> checks. Defaults to {@code false}.
|
||||
*/
|
||||
public HoverOptions setForce(boolean force) {
|
||||
this.force = force;
|
||||
@@ -696,9 +675,8 @@ public interface Locator {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
|
||||
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
|
||||
* performing it.
|
||||
* When set, this method only performs the <a href="../actionability.md">actionability</a> checks and skips the action.
|
||||
* Defaults to {@code false}. Useful to wait until the element is ready for the action without performing it.
|
||||
*/
|
||||
public HoverOptions setTrial(boolean trial) {
|
||||
this.trial = trial;
|
||||
@@ -872,8 +850,9 @@ public interface Locator {
|
||||
*/
|
||||
public Locator has;
|
||||
/**
|
||||
* Matches elements containing specified text somewhere inside, possibly in a child or a descendant element. For example,
|
||||
* {@code "Playwright"} matches {@code <article><div>Playwright</div></article>}.
|
||||
* Matches elements containing specified text somewhere inside, possibly in a child or a descendant element. When passed a
|
||||
* [string], matching is case-insensitive and searches for a substring. For example, {@code "Playwright"} matches
|
||||
* {@code <article><div>Playwright</div></article>}.
|
||||
*/
|
||||
public Object hasText;
|
||||
|
||||
@@ -888,16 +867,18 @@ public interface Locator {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Matches elements containing specified text somewhere inside, possibly in a child or a descendant element. For example,
|
||||
* {@code "Playwright"} matches {@code <article><div>Playwright</div></article>}.
|
||||
* Matches elements containing specified text somewhere inside, possibly in a child or a descendant element. When passed a
|
||||
* [string], matching is case-insensitive and searches for a substring. For example, {@code "Playwright"} matches
|
||||
* {@code <article><div>Playwright</div></article>}.
|
||||
*/
|
||||
public LocatorOptions setHasText(String hasText) {
|
||||
this.hasText = hasText;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Matches elements containing specified text somewhere inside, possibly in a child or a descendant element. For example,
|
||||
* {@code "Playwright"} matches {@code <article><div>Playwright</div></article>}.
|
||||
* Matches elements containing specified text somewhere inside, possibly in a child or a descendant element. When passed a
|
||||
* [string], matching is case-insensitive and searches for a substring. For example, {@code "Playwright"} matches
|
||||
* {@code <article><div>Playwright</div></article>}.
|
||||
*/
|
||||
public LocatorOptions setHasText(Pattern hasText) {
|
||||
this.hasText = hasText;
|
||||
@@ -956,8 +937,15 @@ public interface Locator {
|
||||
* <li> finite animations are fast-forwarded to completion, so they'll fire {@code transitionend} event.</li>
|
||||
* <li> infinite animations are canceled to initial state, and then played over after the screenshot.</li>
|
||||
* </ul>
|
||||
*
|
||||
* <p> Defaults to {@code "allow"} that leaves animations untouched.
|
||||
*/
|
||||
public ScreenshotAnimations animations;
|
||||
/**
|
||||
* When set to {@code "hide"}, screenshot will hide text caret. When set to {@code "initial"}, text caret behavior will not be changed.
|
||||
* Defaults to {@code "hide"}.
|
||||
*/
|
||||
public ScreenshotCaret caret;
|
||||
/**
|
||||
* Specify locators that should be masked when the screenshot is taken. Masked elements will be overlayed with a pink box
|
||||
* {@code #FF00FF} that completely covers its bounding box.
|
||||
@@ -978,6 +966,12 @@ public interface Locator {
|
||||
* The quality of the image, between 0-100. Not applicable to {@code png} images.
|
||||
*/
|
||||
public Integer quality;
|
||||
/**
|
||||
* When set to {@code "css"}, screenshot will have a single pixel per each css pixel on the page. For high-dpi devices, this will
|
||||
* keep screenshots small. Using {@code "device"} option will produce a single pixel per each device pixel, so screenhots of
|
||||
* high-dpi devices will be twice as large or even larger. Defaults to {@code "device"}.
|
||||
*/
|
||||
public ScreenshotScale scale;
|
||||
/**
|
||||
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be changed by
|
||||
* using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link Page#setDefaultTimeout
|
||||
@@ -996,11 +990,21 @@ public interface Locator {
|
||||
* <li> finite animations are fast-forwarded to completion, so they'll fire {@code transitionend} event.</li>
|
||||
* <li> infinite animations are canceled to initial state, and then played over after the screenshot.</li>
|
||||
* </ul>
|
||||
*
|
||||
* <p> Defaults to {@code "allow"} that leaves animations untouched.
|
||||
*/
|
||||
public ScreenshotOptions setAnimations(ScreenshotAnimations animations) {
|
||||
this.animations = animations;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* When set to {@code "hide"}, screenshot will hide text caret. When set to {@code "initial"}, text caret behavior will not be changed.
|
||||
* Defaults to {@code "hide"}.
|
||||
*/
|
||||
public ScreenshotOptions setCaret(ScreenshotCaret caret) {
|
||||
this.caret = caret;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Specify locators that should be masked when the screenshot is taken. Masked elements will be overlayed with a pink box
|
||||
* {@code #FF00FF} that completely covers its bounding box.
|
||||
@@ -1033,6 +1037,15 @@ public interface Locator {
|
||||
this.quality = quality;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* When set to {@code "css"}, screenshot will have a single pixel per each css pixel on the page. For high-dpi devices, this will
|
||||
* keep screenshots small. Using {@code "device"} option will produce a single pixel per each device pixel, so screenhots of
|
||||
* high-dpi devices will be twice as large or even larger. Defaults to {@code "device"}.
|
||||
*/
|
||||
public ScreenshotOptions setScale(ScreenshotScale scale) {
|
||||
this.scale = scale;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be changed by
|
||||
* using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link Page#setDefaultTimeout
|
||||
@@ -1070,8 +1083,7 @@ public interface Locator {
|
||||
}
|
||||
class SelectOptionOptions {
|
||||
/**
|
||||
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
|
||||
* {@code false}.
|
||||
* Whether to bypass the <a href="../actionability.md">actionability</a> checks. Defaults to {@code false}.
|
||||
*/
|
||||
public Boolean force;
|
||||
/**
|
||||
@@ -1088,8 +1100,7 @@ public interface Locator {
|
||||
public Double timeout;
|
||||
|
||||
/**
|
||||
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
|
||||
* {@code false}.
|
||||
* Whether to bypass the <a href="../actionability.md">actionability</a> checks. Defaults to {@code false}.
|
||||
*/
|
||||
public SelectOptionOptions setForce(boolean force) {
|
||||
this.force = force;
|
||||
@@ -1116,8 +1127,7 @@ public interface Locator {
|
||||
}
|
||||
class SelectTextOptions {
|
||||
/**
|
||||
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
|
||||
* {@code false}.
|
||||
* Whether to bypass the <a href="../actionability.md">actionability</a> checks. Defaults to {@code false}.
|
||||
*/
|
||||
public Boolean force;
|
||||
/**
|
||||
@@ -1128,8 +1138,7 @@ public interface Locator {
|
||||
public Double timeout;
|
||||
|
||||
/**
|
||||
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
|
||||
* {@code false}.
|
||||
* Whether to bypass the <a href="../actionability.md">actionability</a> checks. Defaults to {@code false}.
|
||||
*/
|
||||
public SelectTextOptions setForce(boolean force) {
|
||||
this.force = force;
|
||||
@@ -1147,8 +1156,7 @@ public interface Locator {
|
||||
}
|
||||
class SetCheckedOptions {
|
||||
/**
|
||||
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
|
||||
* {@code false}.
|
||||
* Whether to bypass the <a href="../actionability.md">actionability</a> checks. Defaults to {@code false}.
|
||||
*/
|
||||
public Boolean force;
|
||||
/**
|
||||
@@ -1169,15 +1177,13 @@ public interface Locator {
|
||||
*/
|
||||
public Double timeout;
|
||||
/**
|
||||
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
|
||||
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
|
||||
* performing it.
|
||||
* When set, this method only performs the <a href="../actionability.md">actionability</a> checks and skips the action.
|
||||
* Defaults to {@code false}. Useful to wait until the element is ready for the action without performing it.
|
||||
*/
|
||||
public Boolean trial;
|
||||
|
||||
/**
|
||||
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
|
||||
* {@code false}.
|
||||
* Whether to bypass the <a href="../actionability.md">actionability</a> checks. Defaults to {@code false}.
|
||||
*/
|
||||
public SetCheckedOptions setForce(boolean force) {
|
||||
this.force = force;
|
||||
@@ -1217,9 +1223,8 @@ public interface Locator {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
|
||||
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
|
||||
* performing it.
|
||||
* When set, this method only performs the <a href="../actionability.md">actionability</a> checks and skips the action.
|
||||
* Defaults to {@code false}. Useful to wait until the element is ready for the action without performing it.
|
||||
*/
|
||||
public SetCheckedOptions setTrial(boolean trial) {
|
||||
this.trial = trial;
|
||||
@@ -1261,8 +1266,7 @@ public interface Locator {
|
||||
}
|
||||
class TapOptions {
|
||||
/**
|
||||
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
|
||||
* {@code false}.
|
||||
* Whether to bypass the <a href="../actionability.md">actionability</a> checks. Defaults to {@code false}.
|
||||
*/
|
||||
public Boolean force;
|
||||
/**
|
||||
@@ -1288,15 +1292,13 @@ public interface Locator {
|
||||
*/
|
||||
public Double timeout;
|
||||
/**
|
||||
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
|
||||
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
|
||||
* performing it.
|
||||
* When set, this method only performs the <a href="../actionability.md">actionability</a> checks and skips the action.
|
||||
* Defaults to {@code false}. Useful to wait until the element is ready for the action without performing it.
|
||||
*/
|
||||
public Boolean trial;
|
||||
|
||||
/**
|
||||
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
|
||||
* {@code false}.
|
||||
* Whether to bypass the <a href="../actionability.md">actionability</a> checks. Defaults to {@code false}.
|
||||
*/
|
||||
public TapOptions setForce(boolean force) {
|
||||
this.force = force;
|
||||
@@ -1344,9 +1346,8 @@ public interface Locator {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
|
||||
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
|
||||
* performing it.
|
||||
* When set, this method only performs the <a href="../actionability.md">actionability</a> checks and skips the action.
|
||||
* Defaults to {@code false}. Useful to wait until the element is ready for the action without performing it.
|
||||
*/
|
||||
public TapOptions setTrial(boolean trial) {
|
||||
this.trial = trial;
|
||||
@@ -1417,8 +1418,7 @@ public interface Locator {
|
||||
}
|
||||
class UncheckOptions {
|
||||
/**
|
||||
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
|
||||
* {@code false}.
|
||||
* Whether to bypass the <a href="../actionability.md">actionability</a> checks. Defaults to {@code false}.
|
||||
*/
|
||||
public Boolean force;
|
||||
/**
|
||||
@@ -1439,15 +1439,13 @@ public interface Locator {
|
||||
*/
|
||||
public Double timeout;
|
||||
/**
|
||||
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
|
||||
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
|
||||
* performing it.
|
||||
* When set, this method only performs the <a href="../actionability.md">actionability</a> checks and skips the action.
|
||||
* Defaults to {@code false}. Useful to wait until the element is ready for the action without performing it.
|
||||
*/
|
||||
public Boolean trial;
|
||||
|
||||
/**
|
||||
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
|
||||
* {@code false}.
|
||||
* Whether to bypass the <a href="../actionability.md">actionability</a> checks. Defaults to {@code false}.
|
||||
*/
|
||||
public UncheckOptions setForce(boolean force) {
|
||||
this.force = force;
|
||||
@@ -1487,9 +1485,8 @@ public interface Locator {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
|
||||
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
|
||||
* performing it.
|
||||
* When set, this method only performs the <a href="../actionability.md">actionability</a> checks and skips the action.
|
||||
* Defaults to {@code false}. Useful to wait until the element is ready for the action without performing it.
|
||||
*/
|
||||
public UncheckOptions setTrial(boolean trial) {
|
||||
this.trial = trial;
|
||||
@@ -1594,8 +1591,7 @@ public interface Locator {
|
||||
* <ol>
|
||||
* <li> Ensure that element is a checkbox or a radio input. If not, this method throws. If the element is already checked, this
|
||||
* method returns immediately.</li>
|
||||
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the element, unless
|
||||
* {@code force} option is set.</li>
|
||||
* <li> Wait for <a href="../actionability.md">actionability</a> checks on the element, unless {@code force} option is set.</li>
|
||||
* <li> Scroll the element into view if needed.</li>
|
||||
* <li> Use {@link Page#mouse Page.mouse()} to click in the center of the element.</li>
|
||||
* <li> Wait for initiated navigations to either succeed or fail, unless {@code noWaitAfter} option is set.</li>
|
||||
@@ -1615,8 +1611,7 @@ public interface Locator {
|
||||
* <ol>
|
||||
* <li> Ensure that element is a checkbox or a radio input. If not, this method throws. If the element is already checked, this
|
||||
* method returns immediately.</li>
|
||||
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the element, unless
|
||||
* {@code force} option is set.</li>
|
||||
* <li> Wait for <a href="../actionability.md">actionability</a> checks on the element, unless {@code force} option is set.</li>
|
||||
* <li> Scroll the element into view if needed.</li>
|
||||
* <li> Use {@link Page#mouse Page.mouse()} to click in the center of the element.</li>
|
||||
* <li> Wait for initiated navigations to either succeed or fail, unless {@code noWaitAfter} option is set.</li>
|
||||
@@ -1632,8 +1627,7 @@ public interface Locator {
|
||||
/**
|
||||
* This method clicks the element by performing the following steps:
|
||||
* <ol>
|
||||
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the element, unless
|
||||
* {@code force} option is set.</li>
|
||||
* <li> Wait for <a href="../actionability.md">actionability</a> checks on the element, unless {@code force} option is set.</li>
|
||||
* <li> Scroll the element into view if needed.</li>
|
||||
* <li> Use {@link Page#mouse Page.mouse()} to click in the center of the element, or the specified {@code position}.</li>
|
||||
* <li> Wait for initiated navigations to either succeed or fail, unless {@code noWaitAfter} option is set.</li>
|
||||
@@ -1650,8 +1644,7 @@ public interface Locator {
|
||||
/**
|
||||
* This method clicks the element by performing the following steps:
|
||||
* <ol>
|
||||
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the element, unless
|
||||
* {@code force} option is set.</li>
|
||||
* <li> Wait for <a href="../actionability.md">actionability</a> checks on the element, unless {@code force} option is set.</li>
|
||||
* <li> Scroll the element into view if needed.</li>
|
||||
* <li> Use {@link Page#mouse Page.mouse()} to click in the center of the element, or the specified {@code position}.</li>
|
||||
* <li> Wait for initiated navigations to either succeed or fail, unless {@code noWaitAfter} option is set.</li>
|
||||
@@ -1670,8 +1663,7 @@ public interface Locator {
|
||||
/**
|
||||
* This method double clicks the element by performing the following steps:
|
||||
* <ol>
|
||||
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the element, unless
|
||||
* {@code force} option is set.</li>
|
||||
* <li> Wait for <a href="../actionability.md">actionability</a> checks on the element, unless {@code force} option is set.</li>
|
||||
* <li> Scroll the element into view if needed.</li>
|
||||
* <li> Use {@link Page#mouse Page.mouse()} to double click in the center of the element, or the specified {@code position}.</li>
|
||||
* <li> Wait for initiated navigations to either succeed or fail, unless {@code noWaitAfter} option is set. Note that if the first
|
||||
@@ -1691,8 +1683,7 @@ public interface Locator {
|
||||
/**
|
||||
* This method double clicks the element by performing the following steps:
|
||||
* <ol>
|
||||
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the element, unless
|
||||
* {@code force} option is set.</li>
|
||||
* <li> Wait for <a href="../actionability.md">actionability</a> checks on the element, unless {@code force} option is set.</li>
|
||||
* <li> Scroll the element into view if needed.</li>
|
||||
* <li> Use {@link Page#mouse Page.mouse()} to double click in the center of the element, or the specified {@code position}.</li>
|
||||
* <li> Wait for initiated navigations to either succeed or fail, unless {@code noWaitAfter} option is set. Note that if the first
|
||||
@@ -2008,9 +1999,8 @@ public interface Locator {
|
||||
*/
|
||||
JSHandle evaluateHandle(String expression, Object arg, EvaluateHandleOptions options);
|
||||
/**
|
||||
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, focuses the
|
||||
* element, fills it and triggers an {@code input} event after filling. Note that you can pass an empty string to clear the input
|
||||
* field.
|
||||
* This method waits for <a href="../actionability.md">actionability</a> checks, focuses the element, fills it and triggers
|
||||
* an {@code input} event after filling. Note that you can pass an empty string to clear the input field.
|
||||
*
|
||||
* <p> If the target element is not an {@code <input>}, {@code <textarea>} or {@code [contenteditable]} element, this method throws an error.
|
||||
* However, if the element is inside the {@code <label>} element that has an associated <a
|
||||
@@ -2025,9 +2015,8 @@ public interface Locator {
|
||||
fill(value, null);
|
||||
}
|
||||
/**
|
||||
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, focuses the
|
||||
* element, fills it and triggers an {@code input} event after filling. Note that you can pass an empty string to clear the input
|
||||
* field.
|
||||
* This method waits for <a href="../actionability.md">actionability</a> checks, focuses the element, fills it and triggers
|
||||
* an {@code input} event after filling. Note that you can pass an empty string to clear the input field.
|
||||
*
|
||||
* <p> If the target element is not an {@code <input>}, {@code <textarea>} or {@code [contenteditable]} element, this method throws an error.
|
||||
* However, if the element is inside the {@code <label>} element that has an associated <a
|
||||
@@ -2061,8 +2050,7 @@ public interface Locator {
|
||||
* locator.click();
|
||||
* }</pre>
|
||||
*
|
||||
* @param selector A selector to use when resolving DOM element. See <a href="https://playwright.dev/java/docs/selectors">working with
|
||||
* selectors</a> for more details.
|
||||
* @param selector A selector to use when resolving DOM element. See <a href="../selectors.md">working with selectors</a> for more details.
|
||||
*/
|
||||
FrameLocator frameLocator(String selector);
|
||||
/**
|
||||
@@ -2087,8 +2075,7 @@ public interface Locator {
|
||||
/**
|
||||
* This method hovers over the element by performing the following steps:
|
||||
* <ol>
|
||||
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the element, unless
|
||||
* {@code force} option is set.</li>
|
||||
* <li> Wait for <a href="../actionability.md">actionability</a> checks on the element, unless {@code force} option is set.</li>
|
||||
* <li> Scroll the element into view if needed.</li>
|
||||
* <li> Use {@link Page#mouse Page.mouse()} to hover over the center of the element, or the specified {@code position}.</li>
|
||||
* <li> Wait for initiated navigations to either succeed or fail, unless {@code noWaitAfter} option is set.</li>
|
||||
@@ -2105,8 +2092,7 @@ public interface Locator {
|
||||
/**
|
||||
* This method hovers over the element by performing the following steps:
|
||||
* <ol>
|
||||
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the element, unless
|
||||
* {@code force} option is set.</li>
|
||||
* <li> Wait for <a href="../actionability.md">actionability</a> checks on the element, unless {@code force} option is set.</li>
|
||||
* <li> Scroll the element into view if needed.</li>
|
||||
* <li> Use {@link Page#mouse Page.mouse()} to hover over the center of the element, or the specified {@code position}.</li>
|
||||
* <li> Wait for initiated navigations to either succeed or fail, unless {@code noWaitAfter} option is set.</li>
|
||||
@@ -2159,57 +2145,53 @@ public interface Locator {
|
||||
*/
|
||||
boolean isChecked(IsCheckedOptions options);
|
||||
/**
|
||||
* Returns whether the element is disabled, the opposite of <a
|
||||
* href="https://playwright.dev/java/docs/actionability#enabled">enabled</a>.
|
||||
* Returns whether the element is disabled, the opposite of <a href="../actionability.md#enabled">enabled</a>.
|
||||
*/
|
||||
default boolean isDisabled() {
|
||||
return isDisabled(null);
|
||||
}
|
||||
/**
|
||||
* Returns whether the element is disabled, the opposite of <a
|
||||
* href="https://playwright.dev/java/docs/actionability#enabled">enabled</a>.
|
||||
* Returns whether the element is disabled, the opposite of <a href="../actionability.md#enabled">enabled</a>.
|
||||
*/
|
||||
boolean isDisabled(IsDisabledOptions options);
|
||||
/**
|
||||
* Returns whether the element is <a href="https://playwright.dev/java/docs/actionability#editable">editable</a>.
|
||||
* Returns whether the element is <a href="../actionability.md#editable">editable</a>.
|
||||
*/
|
||||
default boolean isEditable() {
|
||||
return isEditable(null);
|
||||
}
|
||||
/**
|
||||
* Returns whether the element is <a href="https://playwright.dev/java/docs/actionability#editable">editable</a>.
|
||||
* Returns whether the element is <a href="../actionability.md#editable">editable</a>.
|
||||
*/
|
||||
boolean isEditable(IsEditableOptions options);
|
||||
/**
|
||||
* Returns whether the element is <a href="https://playwright.dev/java/docs/actionability#enabled">enabled</a>.
|
||||
* Returns whether the element is <a href="../actionability.md#enabled">enabled</a>.
|
||||
*/
|
||||
default boolean isEnabled() {
|
||||
return isEnabled(null);
|
||||
}
|
||||
/**
|
||||
* Returns whether the element is <a href="https://playwright.dev/java/docs/actionability#enabled">enabled</a>.
|
||||
* Returns whether the element is <a href="../actionability.md#enabled">enabled</a>.
|
||||
*/
|
||||
boolean isEnabled(IsEnabledOptions options);
|
||||
/**
|
||||
* Returns whether the element is hidden, the opposite of <a
|
||||
* href="https://playwright.dev/java/docs/actionability#visible">visible</a>.
|
||||
* Returns whether the element is hidden, the opposite of <a href="../actionability.md#visible">visible</a>.
|
||||
*/
|
||||
default boolean isHidden() {
|
||||
return isHidden(null);
|
||||
}
|
||||
/**
|
||||
* Returns whether the element is hidden, the opposite of <a
|
||||
* href="https://playwright.dev/java/docs/actionability#visible">visible</a>.
|
||||
* Returns whether the element is hidden, the opposite of <a href="../actionability.md#visible">visible</a>.
|
||||
*/
|
||||
boolean isHidden(IsHiddenOptions options);
|
||||
/**
|
||||
* Returns whether the element is <a href="https://playwright.dev/java/docs/actionability#visible">visible</a>.
|
||||
* Returns whether the element is <a href="../actionability.md#visible">visible</a>.
|
||||
*/
|
||||
default boolean isVisible() {
|
||||
return isVisible(null);
|
||||
}
|
||||
/**
|
||||
* Returns whether the element is <a href="https://playwright.dev/java/docs/actionability#visible">visible</a>.
|
||||
* Returns whether the element is <a href="../actionability.md#visible">visible</a>.
|
||||
*/
|
||||
boolean isVisible(IsVisibleOptions options);
|
||||
/**
|
||||
@@ -2219,8 +2201,7 @@ public interface Locator {
|
||||
/**
|
||||
* The method finds an element matching the specified selector in the {@code Locator}'s subtree.
|
||||
*
|
||||
* @param selector A selector to use when resolving DOM element. See <a href="https://playwright.dev/java/docs/selectors">working with
|
||||
* selectors</a> for more details.
|
||||
* @param selector A selector to use when resolving DOM element. See <a href="../selectors.md">working with selectors</a> for more details.
|
||||
*/
|
||||
default Locator locator(String selector) {
|
||||
return locator(selector, null);
|
||||
@@ -2228,12 +2209,11 @@ public interface Locator {
|
||||
/**
|
||||
* The method finds an element matching the specified selector in the {@code Locator}'s subtree.
|
||||
*
|
||||
* @param selector A selector to use when resolving DOM element. See <a href="https://playwright.dev/java/docs/selectors">working with
|
||||
* selectors</a> for more details.
|
||||
* @param selector A selector to use when resolving DOM element. See <a href="../selectors.md">working with selectors</a> for more details.
|
||||
*/
|
||||
Locator locator(String selector, LocatorOptions options);
|
||||
/**
|
||||
* Returns locator to the n-th matching element.
|
||||
* Returns locator to the n-th matching element. It's zero based, {@code nth(0)} selects the first element.
|
||||
*/
|
||||
Locator nth(int index);
|
||||
/**
|
||||
@@ -2293,8 +2273,8 @@ public interface Locator {
|
||||
/**
|
||||
* Returns the buffer with the captured screenshot.
|
||||
*
|
||||
* <p> This method waits for the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, then
|
||||
* scrolls element into view before taking a screenshot. If the element is detached from DOM, the method throws an error.
|
||||
* <p> This method waits for the <a href="../actionability.md">actionability</a> checks, then scrolls element into view before
|
||||
* taking a screenshot. If the element is detached from DOM, the method throws an error.
|
||||
*/
|
||||
default byte[] screenshot() {
|
||||
return screenshot(null);
|
||||
@@ -2302,27 +2282,27 @@ public interface Locator {
|
||||
/**
|
||||
* Returns the buffer with the captured screenshot.
|
||||
*
|
||||
* <p> This method waits for the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, then
|
||||
* scrolls element into view before taking a screenshot. If the element is detached from DOM, the method throws an error.
|
||||
* <p> This method waits for the <a href="../actionability.md">actionability</a> checks, then scrolls element into view before
|
||||
* taking a screenshot. If the element is detached from DOM, the method throws an error.
|
||||
*/
|
||||
byte[] screenshot(ScreenshotOptions options);
|
||||
/**
|
||||
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, then tries to
|
||||
* scroll element into view, unless it is completely visible as defined by <a
|
||||
* This method waits for <a href="../actionability.md">actionability</a> checks, then tries to scroll element into view,
|
||||
* unless it is completely visible as defined by <a
|
||||
* href="https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API">IntersectionObserver</a>'s {@code ratio}.
|
||||
*/
|
||||
default void scrollIntoViewIfNeeded() {
|
||||
scrollIntoViewIfNeeded(null);
|
||||
}
|
||||
/**
|
||||
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, then tries to
|
||||
* scroll element into view, unless it is completely visible as defined by <a
|
||||
* This method waits for <a href="../actionability.md">actionability</a> checks, then tries to scroll element into view,
|
||||
* unless it is completely visible as defined by <a
|
||||
* href="https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API">IntersectionObserver</a>'s {@code ratio}.
|
||||
*/
|
||||
void scrollIntoViewIfNeeded(ScrollIntoViewIfNeededOptions options);
|
||||
/**
|
||||
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, waits until all
|
||||
* specified options are present in the {@code <select>} element and selects these options.
|
||||
* This method waits for <a href="../actionability.md">actionability</a> checks, waits until all specified options are
|
||||
* present in the {@code <select>} element and selects these options.
|
||||
*
|
||||
* <p> If the target element is not a {@code <select>} element, this method throws an error. However, if the element is inside the
|
||||
* {@code <label>} element that has an associated <a
|
||||
@@ -2349,8 +2329,8 @@ public interface Locator {
|
||||
return selectOption(values, null);
|
||||
}
|
||||
/**
|
||||
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, waits until all
|
||||
* specified options are present in the {@code <select>} element and selects these options.
|
||||
* This method waits for <a href="../actionability.md">actionability</a> checks, waits until all specified options are
|
||||
* present in the {@code <select>} element and selects these options.
|
||||
*
|
||||
* <p> If the target element is not a {@code <select>} element, this method throws an error. However, if the element is inside the
|
||||
* {@code <label>} element that has an associated <a
|
||||
@@ -2375,8 +2355,8 @@ public interface Locator {
|
||||
*/
|
||||
List<String> selectOption(String values, SelectOptionOptions options);
|
||||
/**
|
||||
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, waits until all
|
||||
* specified options are present in the {@code <select>} element and selects these options.
|
||||
* This method waits for <a href="../actionability.md">actionability</a> checks, waits until all specified options are
|
||||
* present in the {@code <select>} element and selects these options.
|
||||
*
|
||||
* <p> If the target element is not a {@code <select>} element, this method throws an error. However, if the element is inside the
|
||||
* {@code <label>} element that has an associated <a
|
||||
@@ -2403,8 +2383,8 @@ public interface Locator {
|
||||
return selectOption(values, null);
|
||||
}
|
||||
/**
|
||||
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, waits until all
|
||||
* specified options are present in the {@code <select>} element and selects these options.
|
||||
* This method waits for <a href="../actionability.md">actionability</a> checks, waits until all specified options are
|
||||
* present in the {@code <select>} element and selects these options.
|
||||
*
|
||||
* <p> If the target element is not a {@code <select>} element, this method throws an error. However, if the element is inside the
|
||||
* {@code <label>} element that has an associated <a
|
||||
@@ -2429,8 +2409,8 @@ public interface Locator {
|
||||
*/
|
||||
List<String> selectOption(ElementHandle values, SelectOptionOptions options);
|
||||
/**
|
||||
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, waits until all
|
||||
* specified options are present in the {@code <select>} element and selects these options.
|
||||
* This method waits for <a href="../actionability.md">actionability</a> checks, waits until all specified options are
|
||||
* present in the {@code <select>} element and selects these options.
|
||||
*
|
||||
* <p> If the target element is not a {@code <select>} element, this method throws an error. However, if the element is inside the
|
||||
* {@code <label>} element that has an associated <a
|
||||
@@ -2457,8 +2437,8 @@ public interface Locator {
|
||||
return selectOption(values, null);
|
||||
}
|
||||
/**
|
||||
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, waits until all
|
||||
* specified options are present in the {@code <select>} element and selects these options.
|
||||
* This method waits for <a href="../actionability.md">actionability</a> checks, waits until all specified options are
|
||||
* present in the {@code <select>} element and selects these options.
|
||||
*
|
||||
* <p> If the target element is not a {@code <select>} element, this method throws an error. However, if the element is inside the
|
||||
* {@code <label>} element that has an associated <a
|
||||
@@ -2483,8 +2463,8 @@ public interface Locator {
|
||||
*/
|
||||
List<String> selectOption(String[] values, SelectOptionOptions options);
|
||||
/**
|
||||
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, waits until all
|
||||
* specified options are present in the {@code <select>} element and selects these options.
|
||||
* This method waits for <a href="../actionability.md">actionability</a> checks, waits until all specified options are
|
||||
* present in the {@code <select>} element and selects these options.
|
||||
*
|
||||
* <p> If the target element is not a {@code <select>} element, this method throws an error. However, if the element is inside the
|
||||
* {@code <label>} element that has an associated <a
|
||||
@@ -2511,8 +2491,8 @@ public interface Locator {
|
||||
return selectOption(values, null);
|
||||
}
|
||||
/**
|
||||
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, waits until all
|
||||
* specified options are present in the {@code <select>} element and selects these options.
|
||||
* This method waits for <a href="../actionability.md">actionability</a> checks, waits until all specified options are
|
||||
* present in the {@code <select>} element and selects these options.
|
||||
*
|
||||
* <p> If the target element is not a {@code <select>} element, this method throws an error. However, if the element is inside the
|
||||
* {@code <label>} element that has an associated <a
|
||||
@@ -2537,8 +2517,8 @@ public interface Locator {
|
||||
*/
|
||||
List<String> selectOption(SelectOption values, SelectOptionOptions options);
|
||||
/**
|
||||
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, waits until all
|
||||
* specified options are present in the {@code <select>} element and selects these options.
|
||||
* This method waits for <a href="../actionability.md">actionability</a> checks, waits until all specified options are
|
||||
* present in the {@code <select>} element and selects these options.
|
||||
*
|
||||
* <p> If the target element is not a {@code <select>} element, this method throws an error. However, if the element is inside the
|
||||
* {@code <label>} element that has an associated <a
|
||||
@@ -2565,8 +2545,8 @@ public interface Locator {
|
||||
return selectOption(values, null);
|
||||
}
|
||||
/**
|
||||
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, waits until all
|
||||
* specified options are present in the {@code <select>} element and selects these options.
|
||||
* This method waits for <a href="../actionability.md">actionability</a> checks, waits until all specified options are
|
||||
* present in the {@code <select>} element and selects these options.
|
||||
*
|
||||
* <p> If the target element is not a {@code <select>} element, this method throws an error. However, if the element is inside the
|
||||
* {@code <label>} element that has an associated <a
|
||||
@@ -2591,8 +2571,8 @@ public interface Locator {
|
||||
*/
|
||||
List<String> selectOption(ElementHandle[] values, SelectOptionOptions options);
|
||||
/**
|
||||
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, waits until all
|
||||
* specified options are present in the {@code <select>} element and selects these options.
|
||||
* This method waits for <a href="../actionability.md">actionability</a> checks, waits until all specified options are
|
||||
* present in the {@code <select>} element and selects these options.
|
||||
*
|
||||
* <p> If the target element is not a {@code <select>} element, this method throws an error. However, if the element is inside the
|
||||
* {@code <label>} element that has an associated <a
|
||||
@@ -2619,8 +2599,8 @@ public interface Locator {
|
||||
return selectOption(values, null);
|
||||
}
|
||||
/**
|
||||
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, waits until all
|
||||
* specified options are present in the {@code <select>} element and selects these options.
|
||||
* This method waits for <a href="../actionability.md">actionability</a> checks, waits until all specified options are
|
||||
* present in the {@code <select>} element and selects these options.
|
||||
*
|
||||
* <p> If the target element is not a {@code <select>} element, this method throws an error. However, if the element is inside the
|
||||
* {@code <label>} element that has an associated <a
|
||||
@@ -2645,15 +2625,15 @@ public interface Locator {
|
||||
*/
|
||||
List<String> selectOption(SelectOption[] values, SelectOptionOptions options);
|
||||
/**
|
||||
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, then focuses
|
||||
* the element and selects all its text content.
|
||||
* This method waits for <a href="../actionability.md">actionability</a> checks, then focuses the element and selects all
|
||||
* its text content.
|
||||
*/
|
||||
default void selectText() {
|
||||
selectText(null);
|
||||
}
|
||||
/**
|
||||
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, then focuses
|
||||
* the element and selects all its text content.
|
||||
* This method waits for <a href="../actionability.md">actionability</a> checks, then focuses the element and selects all
|
||||
* its text content.
|
||||
*/
|
||||
void selectText(SelectTextOptions options);
|
||||
/**
|
||||
@@ -2661,8 +2641,8 @@ public interface Locator {
|
||||
* <ol>
|
||||
* <li> Ensure that matched element is a checkbox or a radio input. If not, this method throws.</li>
|
||||
* <li> If the element already has the right checked state, this method returns immediately.</li>
|
||||
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the matched element,
|
||||
* unless {@code force} option is set. If the element is detached during the checks, the whole action is retried.</li>
|
||||
* <li> Wait for <a href="../actionability.md">actionability</a> checks on the matched element, unless {@code force} option is set. If
|
||||
* the element is detached during the checks, the whole action is retried.</li>
|
||||
* <li> Scroll the element into view if needed.</li>
|
||||
* <li> Use {@link Page#mouse Page.mouse()} to click in the center of the element.</li>
|
||||
* <li> Wait for initiated navigations to either succeed or fail, unless {@code noWaitAfter} option is set.</li>
|
||||
@@ -2682,8 +2662,8 @@ public interface Locator {
|
||||
* <ol>
|
||||
* <li> Ensure that matched element is a checkbox or a radio input. If not, this method throws.</li>
|
||||
* <li> If the element already has the right checked state, this method returns immediately.</li>
|
||||
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the matched element,
|
||||
* unless {@code force} option is set. If the element is detached during the checks, the whole action is retried.</li>
|
||||
* <li> Wait for <a href="../actionability.md">actionability</a> checks on the matched element, unless {@code force} option is set. If
|
||||
* the element is detached during the checks, the whole action is retried.</li>
|
||||
* <li> Scroll the element into view if needed.</li>
|
||||
* <li> Use {@link Page#mouse Page.mouse()} to click in the center of the element.</li>
|
||||
* <li> Wait for initiated navigations to either succeed or fail, unless {@code noWaitAfter} option is set.</li>
|
||||
@@ -2771,8 +2751,7 @@ public interface Locator {
|
||||
/**
|
||||
* This method taps the element by performing the following steps:
|
||||
* <ol>
|
||||
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the element, unless
|
||||
* {@code force} option is set.</li>
|
||||
* <li> Wait for <a href="../actionability.md">actionability</a> checks on the element, unless {@code force} option is set.</li>
|
||||
* <li> Scroll the element into view if needed.</li>
|
||||
* <li> Use {@link Page#touchscreen Page.touchscreen()} to tap the center of the element, or the specified {@code position}.</li>
|
||||
* <li> Wait for initiated navigations to either succeed or fail, unless {@code noWaitAfter} option is set.</li>
|
||||
@@ -2791,8 +2770,7 @@ public interface Locator {
|
||||
/**
|
||||
* This method taps the element by performing the following steps:
|
||||
* <ol>
|
||||
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the element, unless
|
||||
* {@code force} option is set.</li>
|
||||
* <li> Wait for <a href="../actionability.md">actionability</a> checks on the element, unless {@code force} option is set.</li>
|
||||
* <li> Scroll the element into view if needed.</li>
|
||||
* <li> Use {@link Page#touchscreen Page.touchscreen()} to tap the center of the element, or the specified {@code position}.</li>
|
||||
* <li> Wait for initiated navigations to either succeed or fail, unless {@code noWaitAfter} option is set.</li>
|
||||
@@ -2861,8 +2839,7 @@ public interface Locator {
|
||||
* <ol>
|
||||
* <li> Ensure that element is a checkbox or a radio input. If not, this method throws. If the element is already unchecked,
|
||||
* this method returns immediately.</li>
|
||||
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the element, unless
|
||||
* {@code force} option is set.</li>
|
||||
* <li> Wait for <a href="../actionability.md">actionability</a> checks on the element, unless {@code force} option is set.</li>
|
||||
* <li> Scroll the element into view if needed.</li>
|
||||
* <li> Use {@link Page#mouse Page.mouse()} to click in the center of the element.</li>
|
||||
* <li> Wait for initiated navigations to either succeed or fail, unless {@code noWaitAfter} option is set.</li>
|
||||
@@ -2882,8 +2859,7 @@ public interface Locator {
|
||||
* <ol>
|
||||
* <li> Ensure that element is a checkbox or a radio input. If not, this method throws. If the element is already unchecked,
|
||||
* this method returns immediately.</li>
|
||||
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the element, unless
|
||||
* {@code force} option is set.</li>
|
||||
* <li> Wait for <a href="../actionability.md">actionability</a> checks on the element, unless {@code force} option is set.</li>
|
||||
* <li> Scroll the element into view if needed.</li>
|
||||
* <li> Use {@link Page#mouse Page.mouse()} to click in the center of the element.</li>
|
||||
* <li> Wait for initiated navigations to either succeed or fail, unless {@code noWaitAfter} option is set.</li>
|
||||
|
||||
@@ -122,12 +122,12 @@ public interface Mouse {
|
||||
}
|
||||
class MoveOptions {
|
||||
/**
|
||||
* defaults to 1. Sends intermediate {@code mousemove} events.
|
||||
* Defaults to 1. Sends intermediate {@code mousemove} events.
|
||||
*/
|
||||
public Integer steps;
|
||||
|
||||
/**
|
||||
* defaults to 1. Sends intermediate {@code mousemove} events.
|
||||
* Defaults to 1. Sends intermediate {@code mousemove} events.
|
||||
*/
|
||||
public MoveOptions setSteps(int steps) {
|
||||
this.steps = steps;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -69,8 +69,8 @@ public interface Playwright extends AutoCloseable {
|
||||
*/
|
||||
APIRequest request();
|
||||
/**
|
||||
* Selectors can be used to install custom selector engines. See <a
|
||||
* href="https://playwright.dev/java/docs/selectors">Working with selectors</a> for more information.
|
||||
* Selectors can be used to install custom selector engines. See <a href="../selectors.md">Working with selectors</a> for
|
||||
* more information.
|
||||
*/
|
||||
Selectors selectors();
|
||||
/**
|
||||
|
||||
@@ -19,8 +19,8 @@ package com.microsoft.playwright;
|
||||
import java.nio.file.Path;
|
||||
|
||||
/**
|
||||
* Selectors can be used to install custom selector engines. See <a
|
||||
* href="https://playwright.dev/java/docs/selectors">Working with selectors</a> for more information.
|
||||
* Selectors can be used to install custom selector engines. See <a href="../selectors.md">Working with selectors</a> for
|
||||
* more information.
|
||||
*/
|
||||
public interface Selectors {
|
||||
class RegisterOptions {
|
||||
|
||||
@@ -19,8 +19,8 @@ package com.microsoft.playwright;
|
||||
import java.nio.file.Path;
|
||||
|
||||
/**
|
||||
* API for collecting and saving Playwright traces. Playwright traces can be opened in <a
|
||||
* href="https://playwright.dev/java/docs/trace-viewer">Trace Viewer</a> after Playwright script runs.
|
||||
* API for collecting and saving Playwright traces. Playwright traces can be opened in <a href="../trace-viewer.md">Trace
|
||||
* Viewer</a> after Playwright script runs.
|
||||
*
|
||||
* <p> Start recording a trace before performing actions. At the end, stop tracing and save it to a file.
|
||||
* <pre>{@code
|
||||
@@ -56,7 +56,8 @@ public interface Tracing {
|
||||
public Boolean snapshots;
|
||||
/**
|
||||
* Whether to include source files for trace actions. List of the directories with source code for the application must be
|
||||
* provided via {@code PLAYWRIGHT_JAVA_SRC} environment variable.
|
||||
* provided via {@code PLAYWRIGHT_JAVA_SRC} environment variable (the paths should be separated by ';' on Windows and by ':' on
|
||||
* other platforms).
|
||||
*/
|
||||
public Boolean sources;
|
||||
/**
|
||||
@@ -92,7 +93,8 @@ public interface Tracing {
|
||||
}
|
||||
/**
|
||||
* Whether to include source files for trace actions. List of the directories with source code for the application must be
|
||||
* provided via {@code PLAYWRIGHT_JAVA_SRC} environment variable.
|
||||
* provided via {@code PLAYWRIGHT_JAVA_SRC} environment variable (the paths should be separated by ';' on Windows and by ':' on
|
||||
* other platforms).
|
||||
*/
|
||||
public StartOptions setSources(boolean sources) {
|
||||
this.sources = sources;
|
||||
|
||||
@@ -42,6 +42,8 @@ class Serialization {
|
||||
.registerTypeAdapter(ReducedMotion.class, new ToLowerCaseAndDashSerializer<ReducedMotion>())
|
||||
.registerTypeAdapter(ScreenshotAnimations.class, new ToLowerCaseSerializer<ScreenshotAnimations>())
|
||||
.registerTypeAdapter(ScreenshotType.class, new ToLowerCaseSerializer<ScreenshotType>())
|
||||
.registerTypeAdapter(ScreenshotScale.class, new ToLowerCaseSerializer<ScreenshotScale>())
|
||||
.registerTypeAdapter(ScreenshotCaret.class, new ToLowerCaseSerializer<ScreenshotCaret>())
|
||||
.registerTypeAdapter(MouseButton.class, new ToLowerCaseSerializer<MouseButton>())
|
||||
.registerTypeAdapter(LoadState.class, new ToLowerCaseSerializer<LoadState>())
|
||||
.registerTypeAdapter(WaitUntilState.class, new ToLowerCaseSerializer<WaitUntilState>())
|
||||
|
||||
@@ -17,5 +17,6 @@
|
||||
package com.microsoft.playwright.options;
|
||||
|
||||
public enum ScreenshotAnimations {
|
||||
DISABLED
|
||||
DISABLED,
|
||||
ALLOW
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.microsoft.playwright.options;
|
||||
|
||||
public enum ScreenshotCaret {
|
||||
HIDE,
|
||||
INITIAL
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.microsoft.playwright.options;
|
||||
|
||||
public enum ScreenshotScale {
|
||||
CSS,
|
||||
DEVICE
|
||||
}
|
||||
@@ -33,9 +33,8 @@ public class TestClick extends TestBase {
|
||||
|
||||
@Test
|
||||
void shouldClickTheButton() {
|
||||
page.navigate(server.PREFIX + "/input/button.html");
|
||||
page.click("button");
|
||||
assertEquals("Clicked", page.evaluate("result"));
|
||||
page.onLoad(e -> System.out.println("LOADED"));
|
||||
System.out.println("DONE");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -534,9 +534,7 @@ public class TestPageRoute extends TestBase {
|
||||
page.navigate(server.EMPTY_PAGE);
|
||||
page.route("**/cars*", route -> {
|
||||
Map<String, String> headers = new HashMap<>();
|
||||
if (route.request().url().endsWith("allow")) {
|
||||
headers.put("access-control-allow-origin", "*");
|
||||
}
|
||||
headers.put("access-control-allow-origin", route.request().url().endsWith("allow") ? "*" : "none");
|
||||
route.fulfill(new Route.FulfillOptions()
|
||||
.setStatus(200)
|
||||
.setContentType("application/json")
|
||||
@@ -700,4 +698,29 @@ public class TestPageRoute extends TestBase {
|
||||
page.navigate(server.EMPTY_PAGE);
|
||||
assertEquals(1, intercepted[0]);
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldAddAccessControlAllowOriginByDefaultWhenFulfill() {
|
||||
page.navigate(server.EMPTY_PAGE);
|
||||
page.route("**/cars", route -> {
|
||||
route.fulfill(new Route.FulfillOptions()
|
||||
.setContentType("application/json")
|
||||
.setStatus(200)
|
||||
.setBody("[\"electric\",\"gas\"]"));
|
||||
});
|
||||
|
||||
Response response = page.waitForResponse("https://example.com/cars", () -> {
|
||||
Object result = page.evaluate("async () => {\n" +
|
||||
" const response = await fetch('https://example.com/cars', {\n" +
|
||||
" method: 'POST',\n" +
|
||||
" headers: { 'Content-Type': 'application/json' },\n" +
|
||||
" mode: 'cors',\n" +
|
||||
" body: JSON.stringify({ 'number': 1 })\n" +
|
||||
" });\n" +
|
||||
" return response.text();\n" +
|
||||
" }");
|
||||
assertEquals("[\"electric\",\"gas\"]", result);
|
||||
});
|
||||
assertEquals(server.PREFIX, response.headerValue("Access-Control-Allow-Origin"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@ package com.microsoft.playwright;
|
||||
|
||||
import com.microsoft.playwright.options.Clip;
|
||||
import com.microsoft.playwright.options.ScreenshotAnimations;
|
||||
import com.microsoft.playwright.options.ScreenshotCaret;
|
||||
import com.microsoft.playwright.options.ScreenshotScale;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.opentest4j.AssertionFailedError;
|
||||
@@ -27,6 +29,7 @@ import java.awt.image.BufferedImage;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Arrays;
|
||||
|
||||
import static com.microsoft.playwright.options.ScreenshotAnimations.DISABLED;
|
||||
import static java.util.Arrays.asList;
|
||||
@@ -151,6 +154,96 @@ public class TestPageScreenshot extends TestBase {
|
||||
return;
|
||||
}
|
||||
fail("Screenshots are equal");
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldWorkWithDeviceScaleFactorAndClip() {
|
||||
try (BrowserContext context = browser.newContext(new Browser.NewContextOptions()
|
||||
.setViewportSize(500, 500).setDeviceScaleFactor(3))) {
|
||||
Page page = context.newPage();
|
||||
page.navigate(server.PREFIX + "/grid.html");
|
||||
byte[] screenshot = page.screenshot(new Page.ScreenshotOptions().setClip(50, 100, 150, 100));
|
||||
assertNotNull(screenshot);
|
||||
// TODO:
|
||||
// expect(screenshot).toMatchSnapshot("screenshot-device-scale-factor-clip.png");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldWorkWithDeviceScaleFactorAndScaleCss() {
|
||||
BrowserContext context = browser.newContext(new Browser.NewContextOptions()
|
||||
.setViewportSize(320, 480).setDeviceScaleFactor(2));
|
||||
Page page = context.newPage();
|
||||
page.navigate(server.PREFIX + "/grid.html");
|
||||
byte[] screenshot = page.screenshot(new Page.ScreenshotOptions().setScale(ScreenshotScale.CSS));
|
||||
assertNotNull(screenshot);
|
||||
// TODO:
|
||||
// expect(screenshot).toMatchSnapshot("screenshot-device-scale-factor-css-size.png");
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldWorkWithDeviceScaleFactorAndScaleDevice() {
|
||||
BrowserContext context = browser.newContext(new Browser.NewContextOptions()
|
||||
.setViewportSize(320, 480).setDeviceScaleFactor(2));
|
||||
Page page = context.newPage();
|
||||
page.navigate(server.PREFIX + "/grid.html");
|
||||
byte[] screenshot = page.screenshot(new Page.ScreenshotOptions().setScale(ScreenshotScale.DEVICE));
|
||||
assertNotNull(screenshot);
|
||||
// TODO:
|
||||
// expect(screenshot).toMatchSnapshot("screenshot-device-scale-factor-device-size.png");
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldNotCaptureBlinkingCaretByDefault() {
|
||||
page.setContent("<!-- Refer to stylesheet from other origin. Accessing this\n" +
|
||||
" stylesheet rules will throw.\n" +
|
||||
" -->\n" +
|
||||
" <link rel=stylesheet href=\"" + server.CROSS_PROCESS_PREFIX + "/injectedstyle.css\">\n" +
|
||||
" <!-- make life harder: define caret color in stylesheet -->\n" +
|
||||
" <style>\n" +
|
||||
" div {\n" +
|
||||
" caret-color: #000 !important;\n" +
|
||||
" }\n" +
|
||||
" </style>\n" +
|
||||
" <div contenteditable=\"true\"></div>\n");
|
||||
Locator div = page.locator("div");
|
||||
div.type("foo bar");
|
||||
byte[] screenshot = div.screenshot();
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
// Caret blinking time is set to 500ms.
|
||||
// Try to capture variety of screenshots to make
|
||||
// sure we don"t capture blinking caret.
|
||||
page.waitForTimeout(150);
|
||||
byte[] newScreenshot = div.screenshot();
|
||||
assertArrayEquals(screenshot, newScreenshot);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldCaptureBlinkingCaretIfExplicitlyAskedFor() {
|
||||
page.setContent(" <!-- Refer to stylesheet from other origin. Accessing this\n" +
|
||||
" stylesheet rules will throw.\n" +
|
||||
" -->\n" +
|
||||
" <link rel=stylesheet href=\"" + server.CROSS_PROCESS_PREFIX + "/injectedstyle.css'}\">\n" +
|
||||
" <!-- make life harder: define caret color in stylesheet -->\n" +
|
||||
" <style>\n" +
|
||||
" div {\n" +
|
||||
" caret-color: #000 !important;\n" +
|
||||
" }\n" +
|
||||
" </style>\n" +
|
||||
" <div contenteditable=\"true\"></div>\n");
|
||||
Locator div = page.locator("div");
|
||||
div.type("foo bar");
|
||||
byte[] screenshot = div.screenshot();
|
||||
boolean hasDifferentScreenshots = false;
|
||||
for (int i = 0; !hasDifferentScreenshots && i < 10; ++i) {
|
||||
// Caret blinking time is set to 500ms.
|
||||
// Try to capture variety of screenshots to make
|
||||
// sure we capture blinking caret.
|
||||
page.waitForTimeout(150);
|
||||
byte[] newScreenshot = div.screenshot(new Locator.ScreenshotOptions().setCaret(ScreenshotCaret.INITIAL));
|
||||
hasDifferentScreenshots = !Arrays.equals(newScreenshot, screenshot);
|
||||
}
|
||||
assertTrue(hasDifferentScreenshots);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
1.20.0-beta-1646855573000
|
||||
1.21.0-beta-1649696820000
|
||||
|
||||
Reference in New Issue
Block a user