1
0
mirror of synced 2026-05-23 03:03:15 +00:00

Compare commits

..

1 Commits

Author SHA1 Message Date
Yury Semikhatsky af2dd24147 chore: set version 1.44.0 (#1578) 2024-05-17 09:10:14 -07:00
94 changed files with 762 additions and 2969 deletions
+1 -1
View File
@@ -47,7 +47,7 @@ extends:
GPG_PRIVATE_KEY_BASE64: $(GPG_PRIVATE_KEY_BASE64) # secret variable has to be mapped to an env variable
displayName: "Import gpg key"
- bash: ./scripts/download_driver.sh
- bash: ./scripts/download_driver_for_all_platforms.sh
displayName: 'Download driver'
- bash: mvn -B deploy -D skipTests --no-transfer-progress --activate-profiles release -D gpg.passphrase=$GPG_PASSPHRASE -DaltDeploymentRepository=snapshot-repo::default::file:$(pwd)/local-build
+6 -10
View File
@@ -27,7 +27,7 @@ jobs:
java-version: 8
- name: Download drivers
shell: bash
run: scripts/download_driver.sh
run: scripts/download_driver_for_all_platforms.sh
- name: Build & Install
run: mvn -B install -D skipTests --no-transfer-progress
- name: Run tests
@@ -75,20 +75,16 @@ jobs:
java-version: 8
- name: Download drivers
shell: bash
run: scripts/download_driver.sh
run: scripts/download_driver_for_all_platforms.sh
- name: Build & Install
run: mvn -B install -D skipTests --no-transfer-progress
- name: Install MS Edge
if: matrix.browser-channel == 'msedge' && matrix.os == 'macos-latest'
shell: bash
run: mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install msedge" -f playwright/pom.xml
- name: Run tests
run: mvn test --no-transfer-progress --fail-at-end -D org.slf4j.simpleLogger.showDateTime=true -D org.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss
env:
BROWSER: chromium
BROWSER_CHANNEL: ${{ matrix.browser-channel }}
Java_21:
Java_17:
timeout-minutes: 30
strategy:
fail-fast: false
@@ -98,14 +94,14 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: microsoft/playwright-github-action@v1
- name: Set up JDK 21
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: adopt
java-version: 21
java-version: 17
- name: Download drivers
shell: bash
run: scripts/download_driver.sh
run: scripts/download_driver_for_all_platforms.sh
- name: Build & Install
run: mvn -B install -D skipTests --no-transfer-progress
- name: Run tests
+1 -1
View File
@@ -21,7 +21,7 @@ jobs:
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Download drivers
run: scripts/download_driver.sh
run: scripts/download_driver_for_all_platforms.sh
- name: Intall Playwright
run: mvn install -D skipTests --no-transfer-progress
- name: Test CLI
+1 -1
View File
@@ -11,7 +11,7 @@ on:
paths:
- .github/workflows/test_docker.yml
- '**/Dockerfile*'
- scripts/DRIVER_VERSION
- scripts/CLI_VERSION
- '**/pom.xml'
branches:
- main
+1 -1
View File
@@ -22,7 +22,7 @@ jobs:
- uses: actions/checkout@v2
- uses: microsoft/playwright-github-action@v1
- name: Download drivers
run: scripts/download_driver.sh
run: scripts/download_driver_for_all_platforms.sh
- name: Regenerate APIs
run: scripts/generate_api.sh
- name: Update browser versions in README
+14 -6
View File
@@ -20,12 +20,14 @@ git clone https://github.com/microsoft/playwright-java
cd playwright-java
```
2. Run the following script to download Playwright driver for all platforms into `driver-bundle/src/main/resources/driver/` directory (browser binaries for Chromium, Firefox and WebKit will be automatically downloaded later on first Playwright run).
2. Run the following script to download playwright-cli binaries for all platforms into `driver-bundle/src/main/resources/driver/` directory (browser binaries for Chromium, Firefox and WebKit will be automatically downloaded later on first Playwright run).
```bash
scripts/download_driver.sh
scripts/download_driver_for_all_platforms.sh
```
Names of published driver archives can be found at https://github.com/microsoft/playwright-cli/actions
### Building and running the tests with Maven
```bash
@@ -39,19 +41,25 @@ BROWSER=chromium mvn test --projects=playwright -Dtest=TestPageNetworkSizes
### Generating API
Public Java API is generated from api.json which is produced by `print-api-json` command of playwright CLI. To regenerate Java interfaces for the current driver run the following commands:
Public Java API is generated from api.json which is produced by `playwright-cli print-api-json`. To regenerate
Java interfaces for the current driver run the following commands:
```bash
./scripts/download_driver.sh
./scripts/download_driver_for_all_platforms.sh
./scripts/generate_api.sh
```
#### Updating driver version
Versions of published driver archives can be found in [publish canary](https://github.com/microsoft/playwright/actions/workflows/publish_canary.yml) and [publish release](https://github.com/microsoft/playwright/actions/workflows/publish_release_driver.yml) actions logs. To update the driver to a particular version run the following command:
Driver version is read from [scripts/CLI_VERSION](https://github.com/microsoft/playwright-java/blob/main/scripts/CLI_VERSION) and can be found in the upstream [GHA build](https://github.com/microsoft/playwright/actions/workflows/publish_canary.yml) logs. To update the driver to a particular version run the following commands:
```bash
scripts/roll_driver.sh [version]
cat > scripts/CLI_VERSION
<paste new version>
^D
./scripts/download_driver_for_all_platforms.sh -f
./scripts/generate_api.sh
./scripts/update_readme.sh
```
### Code Style
+5 -5
View File
@@ -3,7 +3,7 @@
[![javadoc](https://javadoc.io/badge2/com.microsoft.playwright/playwright/javadoc.svg)](https://javadoc.io/doc/com.microsoft.playwright/playwright)
[![maven version](https://img.shields.io/maven-central/v/com.microsoft.playwright/playwright)](https://search.maven.org/search?q=com.microsoft.playwright)
[![Sonatype Nexus (Snapshots)](https://img.shields.io/nexus/s/https/oss.sonatype.org/com.microsoft.playwright/playwright.svg)](https://oss.sonatype.org/content/repositories/snapshots/com/microsoft/playwright/playwright/)
[![Join Discord](https://img.shields.io/badge/join-discord-infomational)](https://aka.ms/playwright/discord)
[![Join Slack](https://img.shields.io/badge/join-slack-infomational)](https://aka.ms/playwright-slack)
#### [Website](https://playwright.dev/java/) | [API reference](https://www.javadoc.io/doc/com.microsoft.playwright/playwright/latest/index.html)
@@ -11,9 +11,9 @@ Playwright is a Java library to automate [Chromium](https://www.chromium.org/Hom
| | Linux | macOS | Windows |
| :--- | :---: | :---: | :---: |
| Chromium <!-- GEN:chromium-version -->128.0.6613.18<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| WebKit <!-- GEN:webkit-version -->18.0<!-- GEN:stop --> | ✅ | ✅ | ✅ |
| Firefox <!-- GEN:firefox-version -->128.0<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| Chromium <!-- GEN:chromium-version -->125.0.6422.26<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| WebKit <!-- GEN:webkit-version -->17.4<!-- GEN:stop --> | ✅ | ✅ | ✅ |
| Firefox <!-- GEN:firefox-version -->125.0.1<!-- 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/intro#system-requirements) for details.
@@ -122,7 +122,7 @@ public class MobileAndGeolocation {
.setPermissions(asList("geolocation")));
Page page = context.newPage();
page.navigate("https://www.openstreetmap.org/");
page.click("a[data-bs-original-title=\"Show My Location\"]");
page.click("a[data-original-title=\"Show My Location\"]");
page.screenshot(new Page.ScreenshotOptions().setPath(Paths.get("colosseum-pixel2.png")));
}
}
+2 -2
View File
@@ -2,8 +2,8 @@
* make sure to have at least Java 8 and Maven 3.6.3
* clone playwright for java: http://github.com/microsoft/playwright-java
* set new driver version in `scripts/DRIVER_VERSION`
* regenerate API: `./scripts/download_driver.sh -f && ./scripts/generate_api.sh && ./scripts/update_readme.sh`
* set new driver version in `scripts/CLI_VERSION`
* regenerate API: `./scripts/download_driver_for_all_platforms.sh -f && ./scripts/generate_api.sh && ./scripts/update_readme.sh`
* commit & send PR with the roll
### Finding driver version
+1 -1
View File
@@ -6,7 +6,7 @@
<parent>
<groupId>com.microsoft.playwright</groupId>
<artifactId>parent-pom</artifactId>
<version>1.46.0</version>
<version>1.44.0</version>
</parent>
<artifactId>driver-bundle</artifactId>
@@ -74,7 +74,7 @@ public class DriverJar extends Driver {
skip = System.getenv(PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD);
}
if (skip != null && !"0".equals(skip) && !"false".equals(skip)) {
logMessage("Skipping browsers download because `PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD` env variable is set");
System.out.println("Skipping browsers download because `PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD` env variable is set");
return;
}
if (env.get(SELENIUM_REMOTE_URL) != null || System.getenv(SELENIUM_REMOTE_URL) != null) {
+1 -1
View File
@@ -6,7 +6,7 @@
<parent>
<groupId>com.microsoft.playwright</groupId>
<artifactId>parent-pom</artifactId>
<version>1.46.0</version>
<version>1.44.0</version>
</parent>
<artifactId>driver</artifactId>
+1 -1
View File
@@ -6,7 +6,7 @@
<groupId>org.example</groupId>
<artifactId>examples</artifactId>
<version>1.46.0</version>
<version>1.44.0</version>
<name>Playwright Client Examples</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+1 -1
View File
@@ -7,7 +7,7 @@
<parent>
<groupId>com.microsoft.playwright</groupId>
<artifactId>parent-pom</artifactId>
<version>1.46.0</version>
<version>1.44.0</version>
</parent>
<artifactId>playwright</artifactId>
@@ -41,22 +41,6 @@ public interface APIRequest {
* </ul>
*/
public String baseURL;
/**
* TLS Client Authentication allows the server to request a client certificate and verify it.
*
* <p> <strong>Details</strong>
*
* <p> An array of client certificates to be used. Each certificate object must have both {@code certPath} and {@code keyPath}
* or a single {@code pfxPath} to load the client certificate. Optionally, {@code passphrase} property should be provided
* if the certficiate is encrypted. The {@code origin} property should be provided with an exact match to the request
* origin that the certificate is valid for.
*
* <p> <strong>NOTE:</strong> Using Client Certificates in combination with Proxy Servers is not supported.
*
* <p> <strong>NOTE:</strong> When using WebKit on macOS, accessing {@code localhost} will not pick up client certificates. You can make it work by
* replacing {@code localhost} with {@code local.playwright}.
*/
public List<ClientCertificate> clientCertificates;
/**
* An object containing additional HTTP headers to be sent with every request. Defaults to none.
*/
@@ -116,25 +100,6 @@ public interface APIRequest {
this.baseURL = baseURL;
return this;
}
/**
* TLS Client Authentication allows the server to request a client certificate and verify it.
*
* <p> <strong>Details</strong>
*
* <p> An array of client certificates to be used. Each certificate object must have both {@code certPath} and {@code keyPath}
* or a single {@code pfxPath} to load the client certificate. Optionally, {@code passphrase} property should be provided
* if the certficiate is encrypted. The {@code origin} property should be provided with an exact match to the request
* origin that the certificate is valid for.
*
* <p> <strong>NOTE:</strong> Using Client Certificates in combination with Proxy Servers is not supported.
*
* <p> <strong>NOTE:</strong> When using WebKit on macOS, accessing {@code localhost} will not pick up client certificates. You can make it work by
* replacing {@code localhost} with {@code local.playwright}.
*/
public NewContextOptions setClientCertificates(List<ClientCertificate> clientCertificates) {
this.clientCertificates = clientCertificates;
return this;
}
/**
* An object containing additional HTTP headers to be sent with every request. Defaults to none.
*/
@@ -43,20 +43,6 @@ import java.nio.file.Path;
* object will have its own isolated cookie storage.
*/
public interface APIRequestContext {
class DisposeOptions {
/**
* The reason to be reported to the operations interrupted by the context disposal.
*/
public String reason;
/**
* The reason to be reported to the operations interrupted by the context disposal.
*/
public DisposeOptions setReason(String reason) {
this.reason = reason;
return this;
}
}
class StorageStateOptions {
/**
* The file path to save the storage state to. If {@code path} is a relative path, then it is resolved relative to current
@@ -102,18 +88,7 @@ public interface APIRequestContext {
*
* @since v1.16
*/
default void dispose() {
dispose(null);
}
/**
* All responses returned by {@link com.microsoft.playwright.APIRequestContext#get APIRequestContext.get()} and similar
* methods are stored in the memory, so that you can later call {@link com.microsoft.playwright.APIResponse#body
* APIResponse.body()}.This method discards all its resources, calling any method on disposed {@code APIRequestContext}
* will throw an exception.
*
* @since v1.16
*/
void dispose(DisposeOptions options);
void dispose();
/**
* Sends HTTP(S) request and returns its response. The method will populate request cookies from the context and update
* context cookies from the response. The method will automatically follow redirects.
@@ -96,22 +96,6 @@ public interface Browser extends AutoCloseable {
* Toggles bypassing page's Content-Security-Policy. Defaults to {@code false}.
*/
public Boolean bypassCSP;
/**
* TLS Client Authentication allows the server to request a client certificate and verify it.
*
* <p> <strong>Details</strong>
*
* <p> An array of client certificates to be used. Each certificate object must have both {@code certPath} and {@code keyPath}
* or a single {@code pfxPath} to load the client certificate. Optionally, {@code passphrase} property should be provided
* if the certficiate is encrypted. The {@code origin} property should be provided with an exact match to the request
* origin that the certificate is valid for.
*
* <p> <strong>NOTE:</strong> Using Client Certificates in combination with Proxy Servers is not supported.
*
* <p> <strong>NOTE:</strong> When using WebKit on macOS, accessing {@code localhost} will not pick up client certificates. You can make it work by
* replacing {@code localhost} with {@code local.playwright}.
*/
public List<ClientCertificate> clientCertificates;
/**
* Emulates {@code "prefers-colors-scheme"} media feature, supported values are {@code "light"}, {@code "dark"}, {@code
* "no-preference"}. See {@link com.microsoft.playwright.Page#emulateMedia Page.emulateMedia()} for more details. Passing
@@ -311,25 +295,6 @@ public interface Browser extends AutoCloseable {
this.bypassCSP = bypassCSP;
return this;
}
/**
* TLS Client Authentication allows the server to request a client certificate and verify it.
*
* <p> <strong>Details</strong>
*
* <p> An array of client certificates to be used. Each certificate object must have both {@code certPath} and {@code keyPath}
* or a single {@code pfxPath} to load the client certificate. Optionally, {@code passphrase} property should be provided
* if the certficiate is encrypted. The {@code origin} property should be provided with an exact match to the request
* origin that the certificate is valid for.
*
* <p> <strong>NOTE:</strong> Using Client Certificates in combination with Proxy Servers is not supported.
*
* <p> <strong>NOTE:</strong> When using WebKit on macOS, accessing {@code localhost} will not pick up client certificates. You can make it work by
* replacing {@code localhost} with {@code local.playwright}.
*/
public NewContextOptions setClientCertificates(List<ClientCertificate> clientCertificates) {
this.clientCertificates = clientCertificates;
return this;
}
/**
* Emulates {@code "prefers-colors-scheme"} media feature, supported values are {@code "light"}, {@code "dark"}, {@code
* "no-preference"}. See {@link com.microsoft.playwright.Page#emulateMedia Page.emulateMedia()} for more details. Passing
@@ -661,22 +626,6 @@ public interface Browser extends AutoCloseable {
* Toggles bypassing page's Content-Security-Policy. Defaults to {@code false}.
*/
public Boolean bypassCSP;
/**
* TLS Client Authentication allows the server to request a client certificate and verify it.
*
* <p> <strong>Details</strong>
*
* <p> An array of client certificates to be used. Each certificate object must have both {@code certPath} and {@code keyPath}
* or a single {@code pfxPath} to load the client certificate. Optionally, {@code passphrase} property should be provided
* if the certficiate is encrypted. The {@code origin} property should be provided with an exact match to the request
* origin that the certificate is valid for.
*
* <p> <strong>NOTE:</strong> Using Client Certificates in combination with Proxy Servers is not supported.
*
* <p> <strong>NOTE:</strong> When using WebKit on macOS, accessing {@code localhost} will not pick up client certificates. You can make it work by
* replacing {@code localhost} with {@code local.playwright}.
*/
public List<ClientCertificate> clientCertificates;
/**
* Emulates {@code "prefers-colors-scheme"} media feature, supported values are {@code "light"}, {@code "dark"}, {@code
* "no-preference"}. See {@link com.microsoft.playwright.Page#emulateMedia Page.emulateMedia()} for more details. Passing
@@ -876,25 +825,6 @@ public interface Browser extends AutoCloseable {
this.bypassCSP = bypassCSP;
return this;
}
/**
* TLS Client Authentication allows the server to request a client certificate and verify it.
*
* <p> <strong>Details</strong>
*
* <p> An array of client certificates to be used. Each certificate object must have both {@code certPath} and {@code keyPath}
* or a single {@code pfxPath} to load the client certificate. Optionally, {@code passphrase} property should be provided
* if the certficiate is encrypted. The {@code origin} property should be provided with an exact match to the request
* origin that the certificate is valid for.
*
* <p> <strong>NOTE:</strong> Using Client Certificates in combination with Proxy Servers is not supported.
*
* <p> <strong>NOTE:</strong> When using WebKit on macOS, accessing {@code localhost} will not pick up client certificates. You can make it work by
* replacing {@code localhost} with {@code local.playwright}.
*/
public NewPageOptions setClientCertificates(List<ClientCertificate> clientCertificates) {
this.clientCertificates = clientCertificates;
return this;
}
/**
* Emulates {@code "prefers-colors-scheme"} media feature, supported values are {@code "light"}, {@code "dark"}, {@code
* "no-preference"}. See {@link com.microsoft.playwright.Page#emulateMedia Page.emulateMedia()} for more details. Passing
@@ -279,12 +279,14 @@ public interface BrowserContext extends AutoCloseable {
}
class ExposeBindingOptions {
/**
* @deprecated This option will be removed in the future.
* Whether to pass the argument as a handle, instead of passing by value. When passing a handle, only one argument is
* supported. When passing by value, multiple arguments are supported.
*/
public Boolean handle;
/**
* @deprecated This option will be removed in the future.
* Whether to pass the argument as a handle, instead of passing by value. When passing a handle, only one argument is
* supported. When passing by value, multiple arguments are supported.
*/
public ExposeBindingOptions setHandle(boolean handle) {
this.handle = handle;
@@ -499,12 +501,6 @@ public interface BrowserContext extends AutoCloseable {
return this;
}
}
/**
* Playwright has ability to mock clock and passage of time.
*
* @since v1.45
*/
Clock clock();
/**
* Adds cookies into this browser context. All pages within this context will have these cookies installed. Cookies can be
* obtained via {@link com.microsoft.playwright.BrowserContext#cookies BrowserContext.cookies()}.
@@ -514,6 +510,9 @@ public interface BrowserContext extends AutoCloseable {
* browserContext.addCookies(Arrays.asList(cookieObject1, cookieObject2));
* }</pre>
*
* @param cookies Adds cookies to the browser context.
*
* <p> For the cookie to apply to all subdomains as well, prefix domain with a dot, like this: ".example.com".
* @since v1.8
*/
void addCookies(List<Cookie> cookies);
@@ -718,6 +717,21 @@ public interface BrowserContext extends AutoCloseable {
* }
* }</pre>
*
* <p> An example of passing an element handle:
* <pre>{@code
* context.exposeBinding("clicked", (source, args) -> {
* ElementHandle element = (ElementHandle) args[0];
* System.out.println(element.textContent());
* return null;
* }, new BrowserContext.ExposeBindingOptions().setHandle(true));
* page.setContent("" +
* "<script>\n" +
* " document.addEventListener('click', event => window.clicked(event.target));\n" +
* "</script>\n" +
* "<div>Click me</div>\n" +
* "<div>Or click me</div>\n");
* }</pre>
*
* @param name Name of the function on the window object.
* @param callback Callback function that will be called in the Playwright's context.
* @since v1.8
@@ -765,6 +779,21 @@ public interface BrowserContext extends AutoCloseable {
* }
* }</pre>
*
* <p> An example of passing an element handle:
* <pre>{@code
* context.exposeBinding("clicked", (source, args) -> {
* ElementHandle element = (ElementHandle) args[0];
* System.out.println(element.textContent());
* return null;
* }, new BrowserContext.ExposeBindingOptions().setHandle(true));
* page.setContent("" +
* "<script>\n" +
* " document.addEventListener('click', event => window.clicked(event.target));\n" +
* "</script>\n" +
* "<div>Click me</div>\n" +
* "<div>Or click me</div>\n");
* }</pre>
*
* @param name Name of the function on the window object.
* @param callback Callback function that will be called in the Playwright's context.
* @since v1.8
@@ -834,22 +863,21 @@ public interface BrowserContext extends AutoCloseable {
*
* @param permissions A permission or an array of permissions to grant. Permissions can be one of the following values:
* <ul>
* <li> {@code "accelerometer"}</li>
* <li> {@code "accessibility-events"}</li>
* <li> {@code "ambient-light-sensor"}</li>
* <li> {@code "background-sync"}</li>
* <li> {@code "camera"}</li>
* <li> {@code "clipboard-read"}</li>
* <li> {@code "clipboard-write"}</li>
* <li> {@code "geolocation"}</li>
* <li> {@code "midi"}</li>
* <li> {@code "midi-sysex"} (system-exclusive midi)</li>
* <li> {@code "notifications"}</li>
* <li> {@code "camera"}</li>
* <li> {@code "microphone"}</li>
* <li> {@code "background-sync"}</li>
* <li> {@code "ambient-light-sensor"}</li>
* <li> {@code "accelerometer"}</li>
* <li> {@code "gyroscope"}</li>
* <li> {@code "magnetometer"}</li>
* <li> {@code "microphone"}</li>
* <li> {@code "midi-sysex"} (system-exclusive midi)</li>
* <li> {@code "midi"}</li>
* <li> {@code "notifications"}</li>
* <li> {@code "accessibility-events"}</li>
* <li> {@code "clipboard-read"}</li>
* <li> {@code "clipboard-write"}</li>
* <li> {@code "payment-handler"}</li>
* <li> {@code "storage-access"}</li>
* </ul>
* @since v1.8
*/
@@ -862,22 +890,21 @@ public interface BrowserContext extends AutoCloseable {
*
* @param permissions A permission or an array of permissions to grant. Permissions can be one of the following values:
* <ul>
* <li> {@code "accelerometer"}</li>
* <li> {@code "accessibility-events"}</li>
* <li> {@code "ambient-light-sensor"}</li>
* <li> {@code "background-sync"}</li>
* <li> {@code "camera"}</li>
* <li> {@code "clipboard-read"}</li>
* <li> {@code "clipboard-write"}</li>
* <li> {@code "geolocation"}</li>
* <li> {@code "midi"}</li>
* <li> {@code "midi-sysex"} (system-exclusive midi)</li>
* <li> {@code "notifications"}</li>
* <li> {@code "camera"}</li>
* <li> {@code "microphone"}</li>
* <li> {@code "background-sync"}</li>
* <li> {@code "ambient-light-sensor"}</li>
* <li> {@code "accelerometer"}</li>
* <li> {@code "gyroscope"}</li>
* <li> {@code "magnetometer"}</li>
* <li> {@code "microphone"}</li>
* <li> {@code "midi-sysex"} (system-exclusive midi)</li>
* <li> {@code "midi"}</li>
* <li> {@code "notifications"}</li>
* <li> {@code "accessibility-events"}</li>
* <li> {@code "clipboard-read"}</li>
* <li> {@code "clipboard-write"}</li>
* <li> {@code "payment-handler"}</li>
* <li> {@code "storage-access"}</li>
* </ul>
* @since v1.8
*/
@@ -455,22 +455,6 @@ public interface BrowserType {
* Enable Chromium sandboxing. Defaults to {@code false}.
*/
public Boolean chromiumSandbox;
/**
* TLS Client Authentication allows the server to request a client certificate and verify it.
*
* <p> <strong>Details</strong>
*
* <p> An array of client certificates to be used. Each certificate object must have both {@code certPath} and {@code keyPath}
* or a single {@code pfxPath} to load the client certificate. Optionally, {@code passphrase} property should be provided
* if the certficiate is encrypted. The {@code origin} property should be provided with an exact match to the request
* origin that the certificate is valid for.
*
* <p> <strong>NOTE:</strong> Using Client Certificates in combination with Proxy Servers is not supported.
*
* <p> <strong>NOTE:</strong> When using WebKit on macOS, accessing {@code localhost} will not pick up client certificates. You can make it work by
* replacing {@code localhost} with {@code local.playwright}.
*/
public List<ClientCertificate> clientCertificates;
/**
* Emulates {@code "prefers-colors-scheme"} media feature, supported values are {@code "light"}, {@code "dark"}, {@code
* "no-preference"}. See {@link com.microsoft.playwright.Page#emulateMedia Page.emulateMedia()} for more details. Passing
@@ -758,25 +742,6 @@ public interface BrowserType {
this.chromiumSandbox = chromiumSandbox;
return this;
}
/**
* TLS Client Authentication allows the server to request a client certificate and verify it.
*
* <p> <strong>Details</strong>
*
* <p> An array of client certificates to be used. Each certificate object must have both {@code certPath} and {@code keyPath}
* or a single {@code pfxPath} to load the client certificate. Optionally, {@code passphrase} property should be provided
* if the certficiate is encrypted. The {@code origin} property should be provided with an exact match to the request
* origin that the certificate is valid for.
*
* <p> <strong>NOTE:</strong> Using Client Certificates in combination with Proxy Servers is not supported.
*
* <p> <strong>NOTE:</strong> When using WebKit on macOS, accessing {@code localhost} will not pick up client certificates. You can make it work by
* replacing {@code localhost} with {@code local.playwright}.
*/
public LaunchPersistentContextOptions setClientCertificates(List<ClientCertificate> clientCertificates) {
this.clientCertificates = clientCertificates;
return this;
}
/**
* Emulates {@code "prefers-colors-scheme"} media feature, supported values are {@code "light"}, {@code "dark"}, {@code
* "no-preference"}. See {@link com.microsoft.playwright.Page#emulateMedia Page.emulateMedia()} for more details. Passing
@@ -1,312 +0,0 @@
/*
* 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;
import java.util.Date;
/**
* Accurately simulating time-dependent behavior is essential for verifying the correctness of applications. Learn more
* about <a href="https://playwright.dev/java/docs/clock">clock emulation</a>.
*
* <p> Note that clock is installed for the entire {@code BrowserContext}, so the time in all the pages and iframes is
* controlled by the same clock.
*/
public interface Clock {
class InstallOptions {
/**
* Time to initialize with, current system time by default.
*/
public Object time;
/**
* Time to initialize with, current system time by default.
*/
public InstallOptions setTime(long time) {
this.time = time;
return this;
}
/**
* Time to initialize with, current system time by default.
*/
public InstallOptions setTime(String time) {
this.time = time;
return this;
}
/**
* Time to initialize with, current system time by default.
*/
public InstallOptions setTime(Date time) {
this.time = time;
return this;
}
}
/**
* Advance the clock by jumping forward in time. Only fires due timers at most once. This is equivalent to user closing the
* laptop lid for a while and reopening it later, after given time.
*
* <p> <strong>Usage</strong>
* <pre>{@code
* page.clock().fastForward(1000);
* page.clock().fastForward("30:00");
* }</pre>
*
* @param ticks Time may be the number of milliseconds to advance the clock by or a human-readable string. Valid string formats are "08"
* for eight seconds, "01:00" for one minute and "02:34:10" for two hours, 34 minutes and ten seconds.
* @since v1.45
*/
void fastForward(long ticks);
/**
* Advance the clock by jumping forward in time. Only fires due timers at most once. This is equivalent to user closing the
* laptop lid for a while and reopening it later, after given time.
*
* <p> <strong>Usage</strong>
* <pre>{@code
* page.clock().fastForward(1000);
* page.clock().fastForward("30:00");
* }</pre>
*
* @param ticks Time may be the number of milliseconds to advance the clock by or a human-readable string. Valid string formats are "08"
* for eight seconds, "01:00" for one minute and "02:34:10" for two hours, 34 minutes and ten seconds.
* @since v1.45
*/
void fastForward(String ticks);
/**
* Install fake implementations for the following time-related functions:
* <ul>
* <li> {@code Date}</li>
* <li> {@code setTimeout}</li>
* <li> {@code clearTimeout}</li>
* <li> {@code setInterval}</li>
* <li> {@code clearInterval}</li>
* <li> {@code requestAnimationFrame}</li>
* <li> {@code cancelAnimationFrame}</li>
* <li> {@code requestIdleCallback}</li>
* <li> {@code cancelIdleCallback}</li>
* <li> {@code performance}</li>
* </ul>
*
* <p> Fake timers are used to manually control the flow of time in tests. They allow you to advance time, fire timers, and
* control the behavior of time-dependent functions. See {@link com.microsoft.playwright.Clock#runFor Clock.runFor()} and
* {@link com.microsoft.playwright.Clock#fastForward Clock.fastForward()} for more information.
*
* @since v1.45
*/
default void install() {
install(null);
}
/**
* Install fake implementations for the following time-related functions:
* <ul>
* <li> {@code Date}</li>
* <li> {@code setTimeout}</li>
* <li> {@code clearTimeout}</li>
* <li> {@code setInterval}</li>
* <li> {@code clearInterval}</li>
* <li> {@code requestAnimationFrame}</li>
* <li> {@code cancelAnimationFrame}</li>
* <li> {@code requestIdleCallback}</li>
* <li> {@code cancelIdleCallback}</li>
* <li> {@code performance}</li>
* </ul>
*
* <p> Fake timers are used to manually control the flow of time in tests. They allow you to advance time, fire timers, and
* control the behavior of time-dependent functions. See {@link com.microsoft.playwright.Clock#runFor Clock.runFor()} and
* {@link com.microsoft.playwright.Clock#fastForward Clock.fastForward()} for more information.
*
* @since v1.45
*/
void install(InstallOptions options);
/**
* Advance the clock, firing all the time-related callbacks.
*
* <p> <strong>Usage</strong>
* <pre>{@code
* page.clock().runFor(1000);
* page.clock().runFor("30:00");
* }</pre>
*
* @param ticks Time may be the number of milliseconds to advance the clock by or a human-readable string. Valid string formats are "08"
* for eight seconds, "01:00" for one minute and "02:34:10" for two hours, 34 minutes and ten seconds.
* @since v1.45
*/
void runFor(long ticks);
/**
* Advance the clock, firing all the time-related callbacks.
*
* <p> <strong>Usage</strong>
* <pre>{@code
* page.clock().runFor(1000);
* page.clock().runFor("30:00");
* }</pre>
*
* @param ticks Time may be the number of milliseconds to advance the clock by or a human-readable string. Valid string formats are "08"
* for eight seconds, "01:00" for one minute and "02:34:10" for two hours, 34 minutes and ten seconds.
* @since v1.45
*/
void runFor(String ticks);
/**
* Advance the clock by jumping forward in time and pause the time. Once this method is called, no timers are fired unless
* {@link com.microsoft.playwright.Clock#runFor Clock.runFor()}, {@link com.microsoft.playwright.Clock#fastForward
* Clock.fastForward()}, {@link com.microsoft.playwright.Clock#pauseAt Clock.pauseAt()} or {@link
* com.microsoft.playwright.Clock#resume Clock.resume()} is called.
*
* <p> Only fires due timers at most once. This is equivalent to user closing the laptop lid for a while and reopening it at
* the specified time and pausing.
*
* <p> <strong>Usage</strong>
* <pre>{@code
* SimpleDateFormat format = new SimpleDateFormat("yyy-MM-dd");
* page.clock().pauseAt(format.parse("2020-02-02"));
* page.clock().pauseAt("2020-02-02");
* }</pre>
*
* @param time Time to pause at.
* @since v1.45
*/
void pauseAt(long time);
/**
* Advance the clock by jumping forward in time and pause the time. Once this method is called, no timers are fired unless
* {@link com.microsoft.playwright.Clock#runFor Clock.runFor()}, {@link com.microsoft.playwright.Clock#fastForward
* Clock.fastForward()}, {@link com.microsoft.playwright.Clock#pauseAt Clock.pauseAt()} or {@link
* com.microsoft.playwright.Clock#resume Clock.resume()} is called.
*
* <p> Only fires due timers at most once. This is equivalent to user closing the laptop lid for a while and reopening it at
* the specified time and pausing.
*
* <p> <strong>Usage</strong>
* <pre>{@code
* SimpleDateFormat format = new SimpleDateFormat("yyy-MM-dd");
* page.clock().pauseAt(format.parse("2020-02-02"));
* page.clock().pauseAt("2020-02-02");
* }</pre>
*
* @param time Time to pause at.
* @since v1.45
*/
void pauseAt(String time);
/**
* Advance the clock by jumping forward in time and pause the time. Once this method is called, no timers are fired unless
* {@link com.microsoft.playwright.Clock#runFor Clock.runFor()}, {@link com.microsoft.playwright.Clock#fastForward
* Clock.fastForward()}, {@link com.microsoft.playwright.Clock#pauseAt Clock.pauseAt()} or {@link
* com.microsoft.playwright.Clock#resume Clock.resume()} is called.
*
* <p> Only fires due timers at most once. This is equivalent to user closing the laptop lid for a while and reopening it at
* the specified time and pausing.
*
* <p> <strong>Usage</strong>
* <pre>{@code
* SimpleDateFormat format = new SimpleDateFormat("yyy-MM-dd");
* page.clock().pauseAt(format.parse("2020-02-02"));
* page.clock().pauseAt("2020-02-02");
* }</pre>
*
* @param time Time to pause at.
* @since v1.45
*/
void pauseAt(Date time);
/**
* Resumes timers. Once this method is called, time resumes flowing, timers are fired as usual.
*
* @since v1.45
*/
void resume();
/**
* Makes {@code Date.now} and {@code new Date()} return fixed fake time at all times, keeps all the timers running.
*
* <p> <strong>Usage</strong>
* <pre>{@code
* page.clock().setFixedTime(new Date());
* page.clock().setFixedTime(new SimpleDateFormat("yyy-MM-dd").parse("2020-02-02"));
* page.clock().setFixedTime("2020-02-02");
* }</pre>
*
* @param time Time to be set in milliseconds.
* @since v1.45
*/
void setFixedTime(long time);
/**
* Makes {@code Date.now} and {@code new Date()} return fixed fake time at all times, keeps all the timers running.
*
* <p> <strong>Usage</strong>
* <pre>{@code
* page.clock().setFixedTime(new Date());
* page.clock().setFixedTime(new SimpleDateFormat("yyy-MM-dd").parse("2020-02-02"));
* page.clock().setFixedTime("2020-02-02");
* }</pre>
*
* @param time Time to be set in milliseconds.
* @since v1.45
*/
void setFixedTime(String time);
/**
* Makes {@code Date.now} and {@code new Date()} return fixed fake time at all times, keeps all the timers running.
*
* <p> <strong>Usage</strong>
* <pre>{@code
* page.clock().setFixedTime(new Date());
* page.clock().setFixedTime(new SimpleDateFormat("yyy-MM-dd").parse("2020-02-02"));
* page.clock().setFixedTime("2020-02-02");
* }</pre>
*
* @param time Time to be set in milliseconds.
* @since v1.45
*/
void setFixedTime(Date time);
/**
* Sets current system time but does not trigger any timers.
*
* <p> <strong>Usage</strong>
* <pre>{@code
* page.clock().setSystemTime(new Date());
* page.clock().setSystemTime(new SimpleDateFormat("yyy-MM-dd").parse("2020-02-02"));
* page.clock().setSystemTime("2020-02-02");
* }</pre>
*
* @param time Time to be set in milliseconds.
* @since v1.45
*/
void setSystemTime(long time);
/**
* Sets current system time but does not trigger any timers.
*
* <p> <strong>Usage</strong>
* <pre>{@code
* page.clock().setSystemTime(new Date());
* page.clock().setSystemTime(new SimpleDateFormat("yyy-MM-dd").parse("2020-02-02"));
* page.clock().setSystemTime("2020-02-02");
* }</pre>
*
* @param time Time to be set in milliseconds.
* @since v1.45
*/
void setSystemTime(String time);
/**
* Sets current system time but does not trigger any timers.
*
* <p> <strong>Usage</strong>
* <pre>{@code
* page.clock().setSystemTime(new Date());
* page.clock().setSystemTime(new SimpleDateFormat("yyy-MM-dd").parse("2020-02-02"));
* page.clock().setSystemTime("2020-02-02");
* }</pre>
*
* @param time Time to be set in milliseconds.
* @since v1.45
*/
void setSystemTime(Date time);
}
@@ -20,7 +20,7 @@ import java.util.*;
/**
* {@code ConsoleMessage} objects are dispatched by page via the {@link com.microsoft.playwright.Page#onConsoleMessage
* Page.onConsoleMessage()} event. For each console message logged in the page there will be corresponding event in the
* 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 console messages and print them to the standard output.
@@ -65,7 +65,9 @@ public interface ElementHandle extends JSHandle {
*/
public Boolean force;
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -96,7 +98,9 @@ public interface ElementHandle extends JSHandle {
return this;
}
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public CheckOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -162,7 +166,9 @@ public interface ElementHandle extends JSHandle {
*/
public List<KeyboardModifier> modifiers;
/**
* @deprecated This option will default to {@code true} in the future.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -223,7 +229,9 @@ public interface ElementHandle extends JSHandle {
return this;
}
/**
* @deprecated This option will default to {@code true} in the future.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public ClickOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -285,7 +293,9 @@ public interface ElementHandle extends JSHandle {
*/
public List<KeyboardModifier> modifiers;
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -339,7 +349,9 @@ public interface ElementHandle extends JSHandle {
return this;
}
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public DblclickOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -387,7 +399,9 @@ public interface ElementHandle extends JSHandle {
*/
public Boolean force;
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -407,7 +421,9 @@ public interface ElementHandle extends JSHandle {
return this;
}
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public FillOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -437,7 +453,9 @@ public interface ElementHandle extends JSHandle {
*/
public List<KeyboardModifier> modifiers;
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -477,7 +495,9 @@ public interface ElementHandle extends JSHandle {
return this;
}
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public HoverOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -544,7 +564,9 @@ public interface ElementHandle extends JSHandle {
*/
public Double delay;
/**
* @deprecated This option will default to {@code true} in the future.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -563,7 +585,9 @@ public interface ElementHandle extends JSHandle {
return this;
}
/**
* @deprecated This option will default to {@code true} in the future.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public PressOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -777,7 +801,9 @@ public interface ElementHandle extends JSHandle {
*/
public Boolean force;
/**
* @deprecated This option will default to {@code true} in the future.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -797,7 +823,9 @@ public interface ElementHandle extends JSHandle {
return this;
}
/**
* @deprecated This option will default to {@code true} in the future.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public SelectOptionOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -854,7 +882,9 @@ public interface ElementHandle extends JSHandle {
*/
public Boolean force;
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -885,7 +915,9 @@ public interface ElementHandle extends JSHandle {
return this;
}
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public SetCheckedOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -928,7 +960,9 @@ public interface ElementHandle extends JSHandle {
}
class SetInputFilesOptions {
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -940,7 +974,9 @@ public interface ElementHandle extends JSHandle {
public Double timeout;
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public SetInputFilesOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -970,7 +1006,9 @@ public interface ElementHandle extends JSHandle {
*/
public List<KeyboardModifier> modifiers;
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -1010,7 +1048,9 @@ public interface ElementHandle extends JSHandle {
return this;
}
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public TapOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -1057,7 +1097,9 @@ public interface ElementHandle extends JSHandle {
*/
public Double delay;
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -1076,7 +1118,9 @@ public interface ElementHandle extends JSHandle {
return this;
}
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public TypeOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -1100,7 +1144,9 @@ public interface ElementHandle extends JSHandle {
*/
public Boolean force;
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -1131,7 +1177,9 @@ public interface ElementHandle extends JSHandle {
return this;
}
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public UncheckOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -1284,6 +1332,7 @@ public interface ElementHandle extends JSHandle {
* force} option is set.</li>
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link com.microsoft.playwright.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>
* <li> Ensure that the element is now checked. If not, this method throws.</li>
* </ol>
*
@@ -1306,6 +1355,7 @@ public interface ElementHandle extends JSHandle {
* force} option is set.</li>
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link com.microsoft.playwright.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>
* <li> Ensure that the element is now checked. If not, this method throws.</li>
* </ol>
*
@@ -1371,6 +1421,8 @@ public interface ElementHandle extends JSHandle {
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link com.microsoft.playwright.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 click of the {@code dblclick()} triggers a navigation event, this method will throw.</li>
* </ol>
*
* <p> If the element is detached from the DOM at any moment during the action, this method throws.
@@ -1393,6 +1445,8 @@ public interface ElementHandle extends JSHandle {
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link com.microsoft.playwright.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 click of the {@code dblclick()} triggers a navigation event, this method will throw.</li>
* </ol>
*
* <p> If the element is detached from the DOM at any moment during the action, this method throws.
@@ -1649,6 +1703,7 @@ public interface ElementHandle extends JSHandle {
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link com.microsoft.playwright.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>
* </ol>
*
* <p> If the element is detached from the DOM at any moment during the action, this method throws.
@@ -1669,6 +1724,7 @@ public interface ElementHandle extends JSHandle {
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link com.microsoft.playwright.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>
* </ol>
*
* <p> If the element is detached from the DOM at any moment during the action, this method throws.
@@ -1870,8 +1926,6 @@ public interface ElementHandle extends JSHandle {
* <p> Throws when {@code elementHandle} does not point to an element <a
* href="https://developer.mozilla.org/en-US/docs/Web/API/Node/isConnected">connected</a> to a Document or a ShadowRoot.
*
* <p> See <a href="https://playwright.dev/java/docs/input#scrolling">scrolling</a> for alternative ways to scroll.
*
* @since v1.8
*/
default void scrollIntoViewIfNeeded() {
@@ -1886,8 +1940,6 @@ public interface ElementHandle extends JSHandle {
* <p> Throws when {@code elementHandle} does not point to an element <a
* href="https://developer.mozilla.org/en-US/docs/Web/API/Node/isConnected">connected</a> to a Document or a ShadowRoot.
*
* <p> See <a href="https://playwright.dev/java/docs/input#scrolling">scrolling</a> for alternative ways to scroll.
*
* @since v1.8
*/
void scrollIntoViewIfNeeded(ScrollIntoViewIfNeededOptions options);
@@ -2284,6 +2336,7 @@ public interface ElementHandle extends JSHandle {
* 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 com.microsoft.playwright.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>
* <li> Ensure that the element is now checked or unchecked. If not, this method throws.</li>
* </ol>
*
@@ -2305,6 +2358,7 @@ public interface ElementHandle extends JSHandle {
* 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 com.microsoft.playwright.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>
* <li> Ensure that the element is now checked or unchecked. If not, this method throws.</li>
* </ol>
*
@@ -2317,8 +2371,7 @@ public interface ElementHandle extends JSHandle {
void setChecked(boolean checked, SetCheckedOptions options);
/**
* Sets the value of the file input to these file paths or files. If some of the {@code filePaths} are relative paths, then
* they are resolved relative to the current working directory. For empty array, clears the selected files. For inputs with
* a {@code [webkitdirectory]} attribute, only a single directory path is supported.
* they are resolved relative to the current working directory. For empty array, clears the selected files.
*
* <p> This method expects {@code ElementHandle} to point to an <a
* href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input">input element</a>. However, if the element is
@@ -2333,8 +2386,7 @@ public interface ElementHandle extends JSHandle {
}
/**
* Sets the value of the file input to these file paths or files. If some of the {@code filePaths} are relative paths, then
* they are resolved relative to the current working directory. For empty array, clears the selected files. For inputs with
* a {@code [webkitdirectory]} attribute, only a single directory path is supported.
* they are resolved relative to the current working directory. For empty array, clears the selected files.
*
* <p> This method expects {@code ElementHandle} to point to an <a
* href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input">input element</a>. However, if the element is
@@ -2347,8 +2399,7 @@ public interface ElementHandle extends JSHandle {
void setInputFiles(Path files, SetInputFilesOptions options);
/**
* Sets the value of the file input to these file paths or files. If some of the {@code filePaths} are relative paths, then
* they are resolved relative to the current working directory. For empty array, clears the selected files. For inputs with
* a {@code [webkitdirectory]} attribute, only a single directory path is supported.
* they are resolved relative to the current working directory. For empty array, clears the selected files.
*
* <p> This method expects {@code ElementHandle} to point to an <a
* href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input">input element</a>. However, if the element is
@@ -2363,8 +2414,7 @@ public interface ElementHandle extends JSHandle {
}
/**
* Sets the value of the file input to these file paths or files. If some of the {@code filePaths} are relative paths, then
* they are resolved relative to the current working directory. For empty array, clears the selected files. For inputs with
* a {@code [webkitdirectory]} attribute, only a single directory path is supported.
* they are resolved relative to the current working directory. For empty array, clears the selected files.
*
* <p> This method expects {@code ElementHandle} to point to an <a
* href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input">input element</a>. However, if the element is
@@ -2377,8 +2427,7 @@ public interface ElementHandle extends JSHandle {
void setInputFiles(Path[] files, SetInputFilesOptions options);
/**
* Sets the value of the file input to these file paths or files. If some of the {@code filePaths} are relative paths, then
* they are resolved relative to the current working directory. For empty array, clears the selected files. For inputs with
* a {@code [webkitdirectory]} attribute, only a single directory path is supported.
* they are resolved relative to the current working directory. For empty array, clears the selected files.
*
* <p> This method expects {@code ElementHandle} to point to an <a
* href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input">input element</a>. However, if the element is
@@ -2393,8 +2442,7 @@ public interface ElementHandle extends JSHandle {
}
/**
* Sets the value of the file input to these file paths or files. If some of the {@code filePaths} are relative paths, then
* they are resolved relative to the current working directory. For empty array, clears the selected files. For inputs with
* a {@code [webkitdirectory]} attribute, only a single directory path is supported.
* they are resolved relative to the current working directory. For empty array, clears the selected files.
*
* <p> This method expects {@code ElementHandle} to point to an <a
* href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input">input element</a>. However, if the element is
@@ -2407,8 +2455,7 @@ public interface ElementHandle extends JSHandle {
void setInputFiles(FilePayload files, SetInputFilesOptions options);
/**
* Sets the value of the file input to these file paths or files. If some of the {@code filePaths} are relative paths, then
* they are resolved relative to the current working directory. For empty array, clears the selected files. For inputs with
* a {@code [webkitdirectory]} attribute, only a single directory path is supported.
* they are resolved relative to the current working directory. For empty array, clears the selected files.
*
* <p> This method expects {@code ElementHandle} to point to an <a
* href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input">input element</a>. However, if the element is
@@ -2423,8 +2470,7 @@ public interface ElementHandle extends JSHandle {
}
/**
* Sets the value of the file input to these file paths or files. If some of the {@code filePaths} are relative paths, then
* they are resolved relative to the current working directory. For empty array, clears the selected files. For inputs with
* a {@code [webkitdirectory]} attribute, only a single directory path is supported.
* they are resolved relative to the current working directory. For empty array, clears the selected files.
*
* <p> This method expects {@code ElementHandle} to point to an <a
* href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input">input element</a>. However, if the element is
@@ -2443,6 +2489,7 @@ public interface ElementHandle extends JSHandle {
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link com.microsoft.playwright.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>
* </ol>
*
* <p> If the element is detached from the DOM at any moment during the action, this method throws.
@@ -2465,6 +2512,7 @@ public interface ElementHandle extends JSHandle {
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link com.microsoft.playwright.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>
* </ol>
*
* <p> If the element is detached from the DOM at any moment during the action, this method throws.
@@ -2512,6 +2560,7 @@ public interface ElementHandle extends JSHandle {
* force} option is set.</li>
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link com.microsoft.playwright.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>
* <li> Ensure that the element is now unchecked. If not, this method throws.</li>
* </ol>
*
@@ -2534,6 +2583,7 @@ public interface ElementHandle extends JSHandle {
* force} option is set.</li>
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link com.microsoft.playwright.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>
* <li> Ensure that the element is now unchecked. If not, this method throws.</li>
* </ol>
*
@@ -30,7 +30,9 @@ import java.nio.file.Path;
public interface FileChooser {
class SetFilesOptions {
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -42,7 +44,9 @@ public interface FileChooser {
public Double timeout;
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public SetFilesOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -72,7 +72,7 @@ public interface Frame {
*/
public Path path;
/**
* Script type. Use 'module' in order to load a JavaScript ES6 module. See <a
* Script type. Use 'module' in order to load a Javascript ES6 module. See <a
* href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script">script</a> for more details.
*/
public String type;
@@ -97,7 +97,7 @@ public interface Frame {
return this;
}
/**
* Script type. Use 'module' in order to load a JavaScript ES6 module. See <a
* Script type. Use 'module' in order to load a Javascript ES6 module. See <a
* href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script">script</a> for more details.
*/
public AddScriptTagOptions setType(String type) {
@@ -157,7 +157,9 @@ public interface Frame {
*/
public Boolean force;
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -193,7 +195,9 @@ public interface Frame {
return this;
}
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public CheckOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -267,7 +271,9 @@ public interface Frame {
*/
public List<KeyboardModifier> modifiers;
/**
* @deprecated This option will default to {@code true} in the future.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -333,7 +339,9 @@ public interface Frame {
return this;
}
/**
* @deprecated This option will default to {@code true} in the future.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public ClickOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -403,7 +411,9 @@ public interface Frame {
*/
public List<KeyboardModifier> modifiers;
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -462,7 +472,9 @@ public interface Frame {
return this;
}
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public DblclickOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -551,7 +563,9 @@ public interface Frame {
*/
public Boolean force;
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -592,7 +606,9 @@ public interface Frame {
return this;
}
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public DragAndDropOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -679,7 +695,9 @@ public interface Frame {
*/
public Boolean force;
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -704,7 +722,9 @@ public interface Frame {
return this;
}
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public FillOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -1104,7 +1124,9 @@ public interface Frame {
*/
public List<KeyboardModifier> modifiers;
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -1149,7 +1171,9 @@ public interface Frame {
return this;
}
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public HoverOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -1589,7 +1613,9 @@ public interface Frame {
*/
public Double delay;
/**
* @deprecated This option will default to {@code true} in the future.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -1613,7 +1639,9 @@ public interface Frame {
return this;
}
/**
* @deprecated This option will default to {@code true} in the future.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public PressOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -1661,7 +1689,9 @@ public interface Frame {
*/
public Boolean force;
/**
* @deprecated This option will default to {@code true} in the future.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -1686,7 +1716,9 @@ public interface Frame {
return this;
}
/**
* @deprecated This option will default to {@code true} in the future.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public SelectOptionOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -1718,7 +1750,9 @@ public interface Frame {
*/
public Boolean force;
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -1754,7 +1788,9 @@ public interface Frame {
return this;
}
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public SetCheckedOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -1854,7 +1890,9 @@ public interface Frame {
}
class SetInputFilesOptions {
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -1871,7 +1909,9 @@ public interface Frame {
public Double timeout;
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public SetInputFilesOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -1909,7 +1949,9 @@ public interface Frame {
*/
public List<KeyboardModifier> modifiers;
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -1954,7 +1996,9 @@ public interface Frame {
return this;
}
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public TapOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -2042,7 +2086,9 @@ public interface Frame {
*/
public Double delay;
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -2066,7 +2112,9 @@ public interface Frame {
return this;
}
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public TypeOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -2098,7 +2146,9 @@ public interface Frame {
*/
public Boolean force;
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -2134,7 +2184,9 @@ public interface Frame {
return this;
}
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public UncheckOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -2479,6 +2531,7 @@ public interface Frame {
* 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 com.microsoft.playwright.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>
* <li> Ensure that the element is now checked. If not, this method throws.</li>
* </ol>
*
@@ -2501,6 +2554,7 @@ public interface Frame {
* 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 com.microsoft.playwright.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>
* <li> Ensure that the element is now checked. If not, this method throws.</li>
* </ol>
*
@@ -2571,8 +2625,9 @@ public interface Frame {
* 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 com.microsoft.playwright.Page#mouse Page.mouse()} to double click in the center of the element, or the
* specified {@code position}. if the first click of the {@code dblclick()} triggers a navigation event, this method will
* throw.</li>
* 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 click of the {@code dblclick()} triggers a navigation event, this method will throw.</li>
* </ol>
*
* <p> When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code
@@ -2594,8 +2649,9 @@ public interface Frame {
* 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 com.microsoft.playwright.Page#mouse Page.mouse()} to double click in the center of the element, or the
* specified {@code position}. if the first click of the {@code dblclick()} triggers a navigation event, this method will
* throw.</li>
* 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 click of the {@code dblclick()} triggers a navigation event, this method will throw.</li>
* </ol>
*
* <p> When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code
@@ -3775,6 +3831,7 @@ public interface Frame {
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link com.microsoft.playwright.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>
* </ol>
*
* <p> When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code
@@ -3795,6 +3852,7 @@ public interface Frame {
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link com.microsoft.playwright.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>
* </ol>
*
* <p> When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code
@@ -4510,6 +4568,7 @@ public interface Frame {
* 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 com.microsoft.playwright.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>
* <li> Ensure that the element is now checked or unchecked. If not, this method throws.</li>
* </ol>
*
@@ -4533,6 +4592,7 @@ public interface Frame {
* 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 com.microsoft.playwright.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>
* <li> Ensure that the element is now checked or unchecked. If not, this method throws.</li>
* </ol>
*
@@ -4693,6 +4753,7 @@ public interface Frame {
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link com.microsoft.playwright.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>
* </ol>
*
* <p> When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code
@@ -4715,6 +4776,7 @@ public interface Frame {
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link com.microsoft.playwright.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>
* </ol>
*
* <p> When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code
@@ -4780,6 +4842,7 @@ public interface Frame {
* 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 com.microsoft.playwright.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>
* <li> Ensure that the element is now unchecked. If not, this method throws.</li>
* </ol>
*
@@ -4802,6 +4865,7 @@ public interface Frame {
* 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 com.microsoft.playwright.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>
* <li> Ensure that the element is now unchecked. If not, this method throws.</li>
* </ol>
*
@@ -76,7 +76,9 @@ public interface Locator {
*/
public Boolean force;
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -107,7 +109,9 @@ public interface Locator {
return this;
}
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public CheckOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -155,7 +159,9 @@ public interface Locator {
*/
public Boolean force;
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -175,7 +181,9 @@ public interface Locator {
return this;
}
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public ClearOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -217,7 +225,9 @@ public interface Locator {
*/
public List<KeyboardModifier> modifiers;
/**
* @deprecated This option will default to {@code true} in the future.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -278,7 +288,9 @@ public interface Locator {
return this;
}
/**
* @deprecated This option will default to {@code true} in the future.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public ClickOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -340,7 +352,9 @@ public interface Locator {
*/
public List<KeyboardModifier> modifiers;
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -394,7 +408,9 @@ public interface Locator {
return this;
}
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public DblclickOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -462,7 +478,9 @@ public interface Locator {
*/
public Boolean force;
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -498,7 +516,9 @@ public interface Locator {
return this;
}
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public DragToOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -621,7 +641,9 @@ public interface Locator {
*/
public Boolean force;
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -641,7 +663,9 @@ public interface Locator {
return this;
}
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public FillOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -1041,7 +1065,9 @@ public interface Locator {
*/
public List<KeyboardModifier> modifiers;
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -1081,7 +1107,9 @@ public interface Locator {
return this;
}
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public HoverOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -1396,7 +1424,9 @@ public interface Locator {
*/
public Double delay;
/**
* @deprecated This option will default to {@code true} in the future.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -1415,7 +1445,9 @@ public interface Locator {
return this;
}
/**
* @deprecated This option will default to {@code true} in the future.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public PressOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -1438,7 +1470,9 @@ public interface Locator {
*/
public Double delay;
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -1457,7 +1491,9 @@ public interface Locator {
return this;
}
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public PressSequentiallyOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -1671,7 +1707,9 @@ public interface Locator {
*/
public Boolean force;
/**
* @deprecated This option will default to {@code true} in the future.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -1691,7 +1729,9 @@ public interface Locator {
return this;
}
/**
* @deprecated This option will default to {@code true} in the future.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public SelectOptionOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -1748,7 +1788,9 @@ public interface Locator {
*/
public Boolean force;
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -1779,7 +1821,9 @@ public interface Locator {
return this;
}
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public SetCheckedOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -1822,7 +1866,9 @@ public interface Locator {
}
class SetInputFilesOptions {
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -1834,7 +1880,9 @@ public interface Locator {
public Double timeout;
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public SetInputFilesOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -1864,7 +1912,9 @@ public interface Locator {
*/
public List<KeyboardModifier> modifiers;
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -1904,7 +1954,9 @@ public interface Locator {
return this;
}
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public TapOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -1971,7 +2023,9 @@ public interface Locator {
*/
public Double delay;
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -1990,7 +2044,9 @@ public interface Locator {
return this;
}
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public TypeOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -2014,7 +2070,9 @@ public interface Locator {
*/
public Boolean force;
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -2045,7 +2103,9 @@ public interface Locator {
return this;
}
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public UncheckOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -2274,6 +2334,7 @@ public interface Locator {
* force} option is set.</li>
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link com.microsoft.playwright.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>
* <li> Ensure that the element is now checked. If not, this method throws.</li>
* </ol>
*
@@ -2305,6 +2366,7 @@ public interface Locator {
* force} option is set.</li>
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link com.microsoft.playwright.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>
* <li> Ensure that the element is now checked. If not, this method throws.</li>
* </ol>
*
@@ -2470,6 +2532,8 @@ public interface Locator {
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link com.microsoft.playwright.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 click of the {@code dblclick()} triggers a navigation event, this method will throw.</li>
* </ol>
*
* <p> If the element is detached from the DOM at any moment during the action, this method throws.
@@ -2496,6 +2560,8 @@ public interface Locator {
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link com.microsoft.playwright.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 click of the {@code dblclick()} triggers a navigation event, this method will throw.</li>
* </ol>
*
* <p> If the element is detached from the DOM at any moment during the action, this method throws.
@@ -3691,6 +3757,7 @@ public interface Locator {
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link com.microsoft.playwright.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>
* </ol>
*
* <p> If the element is detached from the DOM at any moment during the action, this method throws.
@@ -3720,6 +3787,7 @@ public interface Locator {
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link com.microsoft.playwright.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>
* </ol>
*
* <p> If the element is detached from the DOM at any moment during the action, this method throws.
@@ -4304,8 +4372,6 @@ public interface Locator {
* href="https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API">IntersectionObserver</a>'s {@code
* ratio}.
*
* <p> See <a href="https://playwright.dev/java/docs/input#scrolling">scrolling</a> for alternative ways to scroll.
*
* @since v1.14
*/
default void scrollIntoViewIfNeeded() {
@@ -4317,8 +4383,6 @@ public interface Locator {
* href="https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API">IntersectionObserver</a>'s {@code
* ratio}.
*
* <p> See <a href="https://playwright.dev/java/docs/input#scrolling">scrolling</a> for alternative ways to scroll.
*
* @since v1.14
*/
void scrollIntoViewIfNeeded(ScrollIntoViewIfNeededOptions options);
@@ -4772,6 +4836,7 @@ public interface Locator {
* 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 com.microsoft.playwright.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>
* <li> Ensure that the element is now checked or unchecked. If not, this method throws.</li>
* </ol>
*
@@ -4802,6 +4867,7 @@ public interface Locator {
* 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 com.microsoft.playwright.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>
* <li> Ensure that the element is now checked or unchecked. If not, this method throws.</li>
* </ol>
*
@@ -4813,8 +4879,7 @@ public interface Locator {
*/
void setChecked(boolean checked, SetCheckedOptions options);
/**
* Upload file or multiple files into {@code <input type=file>}. For inputs with a {@code [webkitdirectory]} attribute,
* only a single directory path is supported.
* Upload file or multiple files into {@code <input type=file>}.
*
* <p> <strong>Usage</strong>
* <pre>{@code
@@ -4824,9 +4889,6 @@ public interface Locator {
* // Select multiple files
* page.getByLabel("Upload files").setInputFiles(new Path[] {Paths.get("file1.txt"), Paths.get("file2.txt")});
*
* // Select a directory
* page.getByLabel("Upload directory").setInputFiles(Paths.get("mydir"));
*
* // Remove all the selected files
* page.getByLabel("Upload file").setInputFiles(new Path[0]);
*
@@ -4852,8 +4914,7 @@ public interface Locator {
setInputFiles(files, null);
}
/**
* Upload file or multiple files into {@code <input type=file>}. For inputs with a {@code [webkitdirectory]} attribute,
* only a single directory path is supported.
* Upload file or multiple files into {@code <input type=file>}.
*
* <p> <strong>Usage</strong>
* <pre>{@code
@@ -4863,9 +4924,6 @@ public interface Locator {
* // Select multiple files
* page.getByLabel("Upload files").setInputFiles(new Path[] {Paths.get("file1.txt"), Paths.get("file2.txt")});
*
* // Select a directory
* page.getByLabel("Upload directory").setInputFiles(Paths.get("mydir"));
*
* // Remove all the selected files
* page.getByLabel("Upload file").setInputFiles(new Path[0]);
*
@@ -4889,8 +4947,7 @@ public interface Locator {
*/
void setInputFiles(Path files, SetInputFilesOptions options);
/**
* Upload file or multiple files into {@code <input type=file>}. For inputs with a {@code [webkitdirectory]} attribute,
* only a single directory path is supported.
* Upload file or multiple files into {@code <input type=file>}.
*
* <p> <strong>Usage</strong>
* <pre>{@code
@@ -4900,9 +4957,6 @@ public interface Locator {
* // Select multiple files
* page.getByLabel("Upload files").setInputFiles(new Path[] {Paths.get("file1.txt"), Paths.get("file2.txt")});
*
* // Select a directory
* page.getByLabel("Upload directory").setInputFiles(Paths.get("mydir"));
*
* // Remove all the selected files
* page.getByLabel("Upload file").setInputFiles(new Path[0]);
*
@@ -4928,8 +4982,7 @@ public interface Locator {
setInputFiles(files, null);
}
/**
* Upload file or multiple files into {@code <input type=file>}. For inputs with a {@code [webkitdirectory]} attribute,
* only a single directory path is supported.
* Upload file or multiple files into {@code <input type=file>}.
*
* <p> <strong>Usage</strong>
* <pre>{@code
@@ -4939,9 +4992,6 @@ public interface Locator {
* // Select multiple files
* page.getByLabel("Upload files").setInputFiles(new Path[] {Paths.get("file1.txt"), Paths.get("file2.txt")});
*
* // Select a directory
* page.getByLabel("Upload directory").setInputFiles(Paths.get("mydir"));
*
* // Remove all the selected files
* page.getByLabel("Upload file").setInputFiles(new Path[0]);
*
@@ -4965,8 +5015,7 @@ public interface Locator {
*/
void setInputFiles(Path[] files, SetInputFilesOptions options);
/**
* Upload file or multiple files into {@code <input type=file>}. For inputs with a {@code [webkitdirectory]} attribute,
* only a single directory path is supported.
* Upload file or multiple files into {@code <input type=file>}.
*
* <p> <strong>Usage</strong>
* <pre>{@code
@@ -4976,9 +5025,6 @@ public interface Locator {
* // Select multiple files
* page.getByLabel("Upload files").setInputFiles(new Path[] {Paths.get("file1.txt"), Paths.get("file2.txt")});
*
* // Select a directory
* page.getByLabel("Upload directory").setInputFiles(Paths.get("mydir"));
*
* // Remove all the selected files
* page.getByLabel("Upload file").setInputFiles(new Path[0]);
*
@@ -5004,8 +5050,7 @@ public interface Locator {
setInputFiles(files, null);
}
/**
* Upload file or multiple files into {@code <input type=file>}. For inputs with a {@code [webkitdirectory]} attribute,
* only a single directory path is supported.
* Upload file or multiple files into {@code <input type=file>}.
*
* <p> <strong>Usage</strong>
* <pre>{@code
@@ -5015,9 +5060,6 @@ public interface Locator {
* // Select multiple files
* page.getByLabel("Upload files").setInputFiles(new Path[] {Paths.get("file1.txt"), Paths.get("file2.txt")});
*
* // Select a directory
* page.getByLabel("Upload directory").setInputFiles(Paths.get("mydir"));
*
* // Remove all the selected files
* page.getByLabel("Upload file").setInputFiles(new Path[0]);
*
@@ -5041,8 +5083,7 @@ public interface Locator {
*/
void setInputFiles(FilePayload files, SetInputFilesOptions options);
/**
* Upload file or multiple files into {@code <input type=file>}. For inputs with a {@code [webkitdirectory]} attribute,
* only a single directory path is supported.
* Upload file or multiple files into {@code <input type=file>}.
*
* <p> <strong>Usage</strong>
* <pre>{@code
@@ -5052,9 +5093,6 @@ public interface Locator {
* // Select multiple files
* page.getByLabel("Upload files").setInputFiles(new Path[] {Paths.get("file1.txt"), Paths.get("file2.txt")});
*
* // Select a directory
* page.getByLabel("Upload directory").setInputFiles(Paths.get("mydir"));
*
* // Remove all the selected files
* page.getByLabel("Upload file").setInputFiles(new Path[0]);
*
@@ -5080,8 +5118,7 @@ public interface Locator {
setInputFiles(files, null);
}
/**
* Upload file or multiple files into {@code <input type=file>}. For inputs with a {@code [webkitdirectory]} attribute,
* only a single directory path is supported.
* Upload file or multiple files into {@code <input type=file>}.
*
* <p> <strong>Usage</strong>
* <pre>{@code
@@ -5091,9 +5128,6 @@ public interface Locator {
* // Select multiple files
* page.getByLabel("Upload files").setInputFiles(new Path[] {Paths.get("file1.txt"), Paths.get("file2.txt")});
*
* // Select a directory
* page.getByLabel("Upload directory").setInputFiles(Paths.get("mydir"));
*
* // Remove all the selected files
* page.getByLabel("Upload file").setInputFiles(new Path[0]);
*
@@ -5128,6 +5162,7 @@ public interface Locator {
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link com.microsoft.playwright.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>
* </ol>
*
* <p> If the element is detached from the DOM at any moment during the action, this method throws.
@@ -5154,6 +5189,7 @@ public interface Locator {
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link com.microsoft.playwright.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>
* </ol>
*
* <p> If the element is detached from the DOM at any moment during the action, this method throws.
@@ -5226,6 +5262,7 @@ public interface Locator {
* force} option is set.</li>
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link com.microsoft.playwright.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>
* <li> Ensure that the element is now unchecked. If not, this method throws.</li>
* </ol>
*
@@ -5257,6 +5294,7 @@ public interface Locator {
* force} option is set.</li>
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link com.microsoft.playwright.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>
* <li> Ensure that the element is now unchecked. If not, this method throws.</li>
* </ol>
*
@@ -163,8 +163,6 @@ public interface Mouse {
* Shortcut for {@link com.microsoft.playwright.Mouse#move Mouse.move()}, {@link com.microsoft.playwright.Mouse#down
* Mouse.down()}, {@link com.microsoft.playwright.Mouse#up Mouse.up()}.
*
* @param x X coordinate relative to the main frame's viewport in CSS pixels.
* @param y Y coordinate relative to the main frame's viewport in CSS pixels.
* @since v1.8
*/
default void click(double x, double y) {
@@ -174,8 +172,6 @@ public interface Mouse {
* Shortcut for {@link com.microsoft.playwright.Mouse#move Mouse.move()}, {@link com.microsoft.playwright.Mouse#down
* Mouse.down()}, {@link com.microsoft.playwright.Mouse#up Mouse.up()}.
*
* @param x X coordinate relative to the main frame's viewport in CSS pixels.
* @param y Y coordinate relative to the main frame's viewport in CSS pixels.
* @since v1.8
*/
void click(double x, double y, ClickOptions options);
@@ -184,8 +180,6 @@ public interface Mouse {
* Mouse.down()}, {@link com.microsoft.playwright.Mouse#up Mouse.up()}, {@link com.microsoft.playwright.Mouse#down
* Mouse.down()} and {@link com.microsoft.playwright.Mouse#up Mouse.up()}.
*
* @param x X coordinate relative to the main frame's viewport in CSS pixels.
* @param y Y coordinate relative to the main frame's viewport in CSS pixels.
* @since v1.8
*/
default void dblclick(double x, double y) {
@@ -196,8 +190,6 @@ public interface Mouse {
* Mouse.down()}, {@link com.microsoft.playwright.Mouse#up Mouse.up()}, {@link com.microsoft.playwright.Mouse#down
* Mouse.down()} and {@link com.microsoft.playwright.Mouse#up Mouse.up()}.
*
* @param x X coordinate relative to the main frame's viewport in CSS pixels.
* @param y Y coordinate relative to the main frame's viewport in CSS pixels.
* @since v1.8
*/
void dblclick(double x, double y, DblclickOptions options);
@@ -218,8 +210,6 @@ public interface Mouse {
/**
* Dispatches a {@code mousemove} event.
*
* @param x X coordinate relative to the main frame's viewport in CSS pixels.
* @param y Y coordinate relative to the main frame's viewport in CSS pixels.
* @since v1.8
*/
default void move(double x, double y) {
@@ -228,8 +218,6 @@ public interface Mouse {
/**
* Dispatches a {@code mousemove} event.
*
* @param x X coordinate relative to the main frame's viewport in CSS pixels.
* @param y Y coordinate relative to the main frame's viewport in CSS pixels.
* @since v1.8
*/
void move(double x, double y, MoveOptions options);
@@ -248,8 +236,7 @@ public interface Mouse {
*/
void up(UpOptions options);
/**
* Dispatches a {@code wheel} event. This method is usually used to manually scroll the page. See <a
* href="https://playwright.dev/java/docs/input#scrolling">scrolling</a> for alternative ways to scroll.
* Dispatches a {@code wheel} event.
*
* <p> <strong>NOTE:</strong> Wheel events may cause scrolling if they are not handled, and this method does not wait for the scrolling to finish
* before returning.
@@ -342,7 +342,7 @@ public interface Page extends AutoCloseable {
*/
public Path path;
/**
* Script type. Use 'module' in order to load a JavaScript ES6 module. See <a
* Script type. Use 'module' in order to load a Javascript ES6 module. See <a
* href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script">script</a> for more details.
*/
public String type;
@@ -367,7 +367,7 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* Script type. Use 'module' in order to load a JavaScript ES6 module. See <a
* Script type. Use 'module' in order to load a Javascript ES6 module. See <a
* href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script">script</a> for more details.
*/
public AddScriptTagOptions setType(String type) {
@@ -427,7 +427,9 @@ public interface Page extends AutoCloseable {
*/
public Boolean force;
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -463,7 +465,9 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public CheckOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -537,7 +541,9 @@ public interface Page extends AutoCloseable {
*/
public List<KeyboardModifier> modifiers;
/**
* @deprecated This option will default to {@code true} in the future.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -603,7 +609,9 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* @deprecated This option will default to {@code true} in the future.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public ClickOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -700,7 +708,9 @@ public interface Page extends AutoCloseable {
*/
public List<KeyboardModifier> modifiers;
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -759,7 +769,9 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public DblclickOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -848,7 +860,9 @@ public interface Page extends AutoCloseable {
*/
public Boolean force;
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -889,7 +903,9 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public DragAndDropOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -1026,12 +1042,14 @@ public interface Page extends AutoCloseable {
}
class ExposeBindingOptions {
/**
* @deprecated This option will be removed in the future.
* Whether to pass the argument as a handle, instead of passing by value. When passing a handle, only one argument is
* supported. When passing by value, multiple arguments are supported.
*/
public Boolean handle;
/**
* @deprecated This option will be removed in the future.
* Whether to pass the argument as a handle, instead of passing by value. When passing a handle, only one argument is
* supported. When passing by value, multiple arguments are supported.
*/
public ExposeBindingOptions setHandle(boolean handle) {
this.handle = handle;
@@ -1045,7 +1063,9 @@ public interface Page extends AutoCloseable {
*/
public Boolean force;
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -1070,7 +1090,9 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public FillOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -1568,7 +1590,9 @@ public interface Page extends AutoCloseable {
*/
public List<KeyboardModifier> modifiers;
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -1613,7 +1637,9 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public HoverOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -2241,7 +2267,9 @@ public interface Page extends AutoCloseable {
*/
public Double delay;
/**
* @deprecated This option will default to {@code true} in the future.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -2265,7 +2293,9 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* @deprecated This option will default to {@code true} in the future.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public PressOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -2691,7 +2721,9 @@ public interface Page extends AutoCloseable {
*/
public Boolean force;
/**
* @deprecated This option will default to {@code true} in the future.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -2716,7 +2748,9 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* @deprecated This option will default to {@code true} in the future.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public SelectOptionOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -2748,7 +2782,9 @@ public interface Page extends AutoCloseable {
*/
public Boolean force;
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -2784,7 +2820,9 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public SetCheckedOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -2884,7 +2922,9 @@ public interface Page extends AutoCloseable {
}
class SetInputFilesOptions {
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -2901,7 +2941,9 @@ public interface Page extends AutoCloseable {
public Double timeout;
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public SetInputFilesOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -2939,7 +2981,9 @@ public interface Page extends AutoCloseable {
*/
public List<KeyboardModifier> modifiers;
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -2984,7 +3028,9 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public TapOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -3072,7 +3118,9 @@ public interface Page extends AutoCloseable {
*/
public Double delay;
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -3096,7 +3144,9 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public TypeOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -3128,7 +3178,9 @@ public interface Page extends AutoCloseable {
*/
public Boolean force;
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public Boolean noWaitAfter;
/**
@@ -3164,7 +3216,9 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* @deprecated This option has no effect.
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
* inaccessible pages. Defaults to {@code false}.
*/
public UncheckOptions setNoWaitAfter(boolean noWaitAfter) {
this.noWaitAfter = noWaitAfter;
@@ -3738,12 +3792,6 @@ public interface Page extends AutoCloseable {
return this;
}
}
/**
* Playwright has ability to mock clock and passage of time.
*
* @since v1.45
*/
Clock clock();
/**
* Adds a script which would be evaluated in one of the following scenarios:
* <ul>
@@ -3848,6 +3896,7 @@ public interface Page extends AutoCloseable {
* 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 com.microsoft.playwright.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>
* <li> Ensure that the element is now checked. If not, this method throws.</li>
* </ol>
*
@@ -3870,6 +3919,7 @@ public interface Page extends AutoCloseable {
* 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 com.microsoft.playwright.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>
* <li> Ensure that the element is now checked. If not, this method throws.</li>
* </ol>
*
@@ -3969,6 +4019,8 @@ public interface Page extends AutoCloseable {
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link com.microsoft.playwright.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 click of the {@code dblclick()} triggers a navigation event, this method will throw.</li>
* </ol>
*
* <p> When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code
@@ -3991,6 +4043,8 @@ public interface Page extends AutoCloseable {
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link com.microsoft.playwright.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 click of the {@code dblclick()} triggers a navigation event, this method will throw.</li>
* </ol>
*
* <p> When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code
@@ -4569,6 +4623,21 @@ public interface Page extends AutoCloseable {
* }
* }</pre>
*
* <p> An example of passing an element handle:
* <pre>{@code
* page.exposeBinding("clicked", (source, args) -> {
* ElementHandle element = (ElementHandle) args[0];
* System.out.println(element.textContent());
* return null;
* }, new Page.ExposeBindingOptions().setHandle(true));
* page.setContent("" +
* "<script>\n" +
* " document.addEventListener('click', event => window.clicked(event.target));\n" +
* "</script>\n" +
* "<div>Click me</div>\n" +
* "<div>Or click me</div>\n");
* }</pre>
*
* @param name Name of the function on the window object.
* @param callback Callback function that will be called in the Playwright's context.
* @since v1.8
@@ -4619,6 +4688,21 @@ public interface Page extends AutoCloseable {
* }
* }</pre>
*
* <p> An example of passing an element handle:
* <pre>{@code
* page.exposeBinding("clicked", (source, args) -> {
* ElementHandle element = (ElementHandle) args[0];
* System.out.println(element.textContent());
* return null;
* }, new Page.ExposeBindingOptions().setHandle(true));
* page.setContent("" +
* "<script>\n" +
* " document.addEventListener('click', event => window.clicked(event.target));\n" +
* "</script>\n" +
* "<div>Click me</div>\n" +
* "<div>Or click me</div>\n");
* }</pre>
*
* @param name Name of the function on the window object.
* @param callback Callback function that will be called in the Playwright's context.
* @since v1.8
@@ -5376,7 +5460,7 @@ public interface Page extends AutoCloseable {
Locator getByTitle(Pattern text, GetByTitleOptions options);
/**
* Returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of the
* last redirect. If cannot go back, returns {@code null}.
* last redirect. If can not go back, returns {@code null}.
*
* <p> Navigate to the previous page in history.
*
@@ -5387,7 +5471,7 @@ public interface Page extends AutoCloseable {
}
/**
* Returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of the
* last redirect. If cannot go back, returns {@code null}.
* last redirect. If can not go back, returns {@code null}.
*
* <p> Navigate to the previous page in history.
*
@@ -5396,7 +5480,7 @@ public interface Page extends AutoCloseable {
Response goBack(GoBackOptions options);
/**
* Returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of the
* last redirect. If cannot go forward, returns {@code null}.
* last redirect. If can not go forward, returns {@code null}.
*
* <p> Navigate to the next page in history.
*
@@ -5407,7 +5491,7 @@ public interface Page extends AutoCloseable {
}
/**
* Returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of the
* last redirect. If cannot go forward, returns {@code null}.
* last redirect. If can not go forward, returns {@code null}.
*
* <p> Navigate to the next page in history.
*
@@ -5483,6 +5567,7 @@ public interface Page extends AutoCloseable {
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link com.microsoft.playwright.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>
* </ol>
*
* <p> When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code
@@ -5503,6 +5588,7 @@ public interface Page extends AutoCloseable {
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link com.microsoft.playwright.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>
* </ol>
*
* <p> When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code
@@ -7015,6 +7101,7 @@ public interface Page extends AutoCloseable {
* 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 com.microsoft.playwright.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>
* <li> Ensure that the element is now checked or unchecked. If not, this method throws.</li>
* </ol>
*
@@ -7038,6 +7125,7 @@ public interface Page extends AutoCloseable {
* 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 com.microsoft.playwright.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>
* <li> Ensure that the element is now checked or unchecked. If not, this method throws.</li>
* </ol>
*
@@ -7112,8 +7200,7 @@ public interface Page extends AutoCloseable {
void setExtraHTTPHeaders(Map<String, String> headers);
/**
* Sets the value of the file input to these file paths or files. If some of the {@code filePaths} are relative paths, then
* they are resolved relative to the current working directory. For empty array, clears the selected files. For inputs with
* a {@code [webkitdirectory]} attribute, only a single directory path is supported.
* they are resolved relative to the current working directory. For empty array, clears the selected files.
*
* <p> This method expects {@code selector} to point to an <a
* href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input">input element</a>. However, if the element is
@@ -7129,8 +7216,7 @@ public interface Page extends AutoCloseable {
}
/**
* Sets the value of the file input to these file paths or files. If some of the {@code filePaths} are relative paths, then
* they are resolved relative to the current working directory. For empty array, clears the selected files. For inputs with
* a {@code [webkitdirectory]} attribute, only a single directory path is supported.
* they are resolved relative to the current working directory. For empty array, clears the selected files.
*
* <p> This method expects {@code selector} to point to an <a
* href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input">input element</a>. However, if the element is
@@ -7144,8 +7230,7 @@ public interface Page extends AutoCloseable {
void setInputFiles(String selector, Path files, SetInputFilesOptions options);
/**
* Sets the value of the file input to these file paths or files. If some of the {@code filePaths} are relative paths, then
* they are resolved relative to the current working directory. For empty array, clears the selected files. For inputs with
* a {@code [webkitdirectory]} attribute, only a single directory path is supported.
* they are resolved relative to the current working directory. For empty array, clears the selected files.
*
* <p> This method expects {@code selector} to point to an <a
* href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input">input element</a>. However, if the element is
@@ -7161,8 +7246,7 @@ public interface Page extends AutoCloseable {
}
/**
* Sets the value of the file input to these file paths or files. If some of the {@code filePaths} are relative paths, then
* they are resolved relative to the current working directory. For empty array, clears the selected files. For inputs with
* a {@code [webkitdirectory]} attribute, only a single directory path is supported.
* they are resolved relative to the current working directory. For empty array, clears the selected files.
*
* <p> This method expects {@code selector} to point to an <a
* href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input">input element</a>. However, if the element is
@@ -7176,8 +7260,7 @@ public interface Page extends AutoCloseable {
void setInputFiles(String selector, Path[] files, SetInputFilesOptions options);
/**
* Sets the value of the file input to these file paths or files. If some of the {@code filePaths} are relative paths, then
* they are resolved relative to the current working directory. For empty array, clears the selected files. For inputs with
* a {@code [webkitdirectory]} attribute, only a single directory path is supported.
* they are resolved relative to the current working directory. For empty array, clears the selected files.
*
* <p> This method expects {@code selector} to point to an <a
* href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input">input element</a>. However, if the element is
@@ -7193,8 +7276,7 @@ public interface Page extends AutoCloseable {
}
/**
* Sets the value of the file input to these file paths or files. If some of the {@code filePaths} are relative paths, then
* they are resolved relative to the current working directory. For empty array, clears the selected files. For inputs with
* a {@code [webkitdirectory]} attribute, only a single directory path is supported.
* they are resolved relative to the current working directory. For empty array, clears the selected files.
*
* <p> This method expects {@code selector} to point to an <a
* href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input">input element</a>. However, if the element is
@@ -7208,8 +7290,7 @@ public interface Page extends AutoCloseable {
void setInputFiles(String selector, FilePayload files, SetInputFilesOptions options);
/**
* Sets the value of the file input to these file paths or files. If some of the {@code filePaths} are relative paths, then
* they are resolved relative to the current working directory. For empty array, clears the selected files. For inputs with
* a {@code [webkitdirectory]} attribute, only a single directory path is supported.
* they are resolved relative to the current working directory. For empty array, clears the selected files.
*
* <p> This method expects {@code selector} to point to an <a
* href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input">input element</a>. However, if the element is
@@ -7225,8 +7306,7 @@ public interface Page extends AutoCloseable {
}
/**
* Sets the value of the file input to these file paths or files. If some of the {@code filePaths} are relative paths, then
* they are resolved relative to the current working directory. For empty array, clears the selected files. For inputs with
* a {@code [webkitdirectory]} attribute, only a single directory path is supported.
* they are resolved relative to the current working directory. For empty array, clears the selected files.
*
* <p> This method expects {@code selector} to point to an <a
* href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input">input element</a>. However, if the element is
@@ -7268,6 +7348,7 @@ public interface Page extends AutoCloseable {
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link com.microsoft.playwright.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>
* </ol>
*
* <p> When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code
@@ -7291,6 +7372,7 @@ public interface Page extends AutoCloseable {
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link com.microsoft.playwright.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>
* </ol>
*
* <p> When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code
@@ -7363,6 +7445,7 @@ public interface Page extends AutoCloseable {
* 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 com.microsoft.playwright.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>
* <li> Ensure that the element is now unchecked. If not, this method throws.</li>
* </ol>
*
@@ -7385,6 +7468,7 @@ public interface Page extends AutoCloseable {
* 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 com.microsoft.playwright.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>
* <li> Ensure that the element is now unchecked. If not, this method throws.</li>
* </ol>
*
@@ -8000,7 +8084,7 @@ public interface Page extends AutoCloseable {
* });
*
* // Waits for the next response matching some conditions
* Response response = page.waitForResponse(response -> "https://example.com".equals(response.url()) && response.status() == 200 && "GET".equals(response.request().method()), () -> {
* Response response = page.waitForResponse(response -> "https://example.com".equals(response.url()) && response.status() == 200, () -> {
* // Triggers the response
* page.getByText("trigger response").click();
* });
@@ -8028,7 +8112,7 @@ public interface Page extends AutoCloseable {
* });
*
* // Waits for the next response matching some conditions
* Response response = page.waitForResponse(response -> "https://example.com".equals(response.url()) && response.status() == 200 && "GET".equals(response.request().method()), () -> {
* Response response = page.waitForResponse(response -> "https://example.com".equals(response.url()) && response.status() == 200, () -> {
* // Triggers the response
* page.getByText("trigger response").click();
* });
@@ -8054,7 +8138,7 @@ public interface Page extends AutoCloseable {
* });
*
* // Waits for the next response matching some conditions
* Response response = page.waitForResponse(response -> "https://example.com".equals(response.url()) && response.status() == 200 && "GET".equals(response.request().method()), () -> {
* Response response = page.waitForResponse(response -> "https://example.com".equals(response.url()) && response.status() == 200, () -> {
* // Triggers the response
* page.getByText("trigger response").click();
* });
@@ -8082,7 +8166,7 @@ public interface Page extends AutoCloseable {
* });
*
* // Waits for the next response matching some conditions
* Response response = page.waitForResponse(response -> "https://example.com".equals(response.url()) && response.status() == 200 && "GET".equals(response.request().method()), () -> {
* Response response = page.waitForResponse(response -> "https://example.com".equals(response.url()) && response.status() == 200, () -> {
* // Triggers the response
* page.getByText("trigger response").click();
* });
@@ -8108,7 +8192,7 @@ public interface Page extends AutoCloseable {
* });
*
* // Waits for the next response matching some conditions
* Response response = page.waitForResponse(response -> "https://example.com".equals(response.url()) && response.status() == 200 && "GET".equals(response.request().method()), () -> {
* Response response = page.waitForResponse(response -> "https://example.com".equals(response.url()) && response.status() == 200, () -> {
* // Triggers the response
* page.getByText("trigger response").click();
* });
@@ -8136,7 +8220,7 @@ public interface Page extends AutoCloseable {
* });
*
* // Waits for the next response matching some conditions
* Response response = page.waitForResponse(response -> "https://example.com".equals(response.url()) && response.status() == 200 && "GET".equals(response.request().method()), () -> {
* Response response = page.waitForResponse(response -> "https://example.com".equals(response.url()) && response.status() == 200, () -> {
* // Triggers the response
* page.getByText("trigger response").click();
* });
@@ -99,7 +99,7 @@ public interface Request {
*/
List<HttpHeader> headersArray();
/**
* Returns the value of the header matching the name. The name is case-insensitive.
* Returns the value of the header matching the name. The name is case insensitive.
*
* @param name Name of the header.
* @since v1.15
@@ -71,7 +71,7 @@ public interface Response {
*/
List<HttpHeader> headersArray();
/**
* Returns the value of the header matching the name. The name is case-insensitive. If multiple headers have the same name
* Returns the value of the header matching the name. The name is case insensitive. If multiple headers have the same name
* (except {@code set-cookie}), they are returned as a list separated by {@code , }. For {@code set-cookie}, the {@code \n}
* separator is used. If no headers are found, {@code null} is returned.
*
@@ -80,7 +80,7 @@ public interface Response {
*/
String headerValue(String name);
/**
* Returns all values of the headers matching the name, for example {@code set-cookie}. The name is case-insensitive.
* Returns all values of the headers matching the name, for example {@code set-cookie}. The name is case insensitive.
*
* @param name Name of the header.
* @since v1.15
@@ -147,12 +147,6 @@ public interface Route {
* exceeded. Defaults to {@code 20}. Pass {@code 0} to not follow redirects.
*/
public Integer maxRedirects;
/**
* Maximum number of times network errors should be retried. Currently only {@code ECONNRESET} error is retried. Does not
* retry based on HTTP response codes. An error will be thrown if the limit is exceeded. Defaults to {@code 0} - no
* retries.
*/
public Integer maxRetries;
/**
* If set changes the request method (e.g. GET or POST).
*/
@@ -185,15 +179,6 @@ public interface Route {
this.maxRedirects = maxRedirects;
return this;
}
/**
* Maximum number of times network errors should be retried. Currently only {@code ECONNRESET} error is retried. Does not
* retry based on HTTP response codes. An error will be thrown if the limit is exceeded. Defaults to {@code 0} - no
* retries.
*/
public FetchOptions setMaxRetries(int maxRetries) {
this.maxRetries = maxRetries;
return this;
}
/**
* If set changes the request method (e.g. GET or POST).
*/
@@ -28,8 +28,6 @@ public interface Touchscreen {
* <p> <strong>NOTE:</strong> {@link com.microsoft.playwright.Page#tap Page.tap()} the method will throw if {@code hasTouch} option of the browser
* context is false.
*
* @param x X coordinate relative to the main frame's viewport in CSS pixels.
* @param y Y coordinate relative to the main frame's viewport in CSS pixels.
* @since v1.8
*/
void tap(double x, double y);
@@ -752,10 +752,10 @@ public interface LocatorAssertions {
* assertThat(page.getByText("Welcome")).isVisible();
*
* // At least one item in the list is visible.
* assertThat(page.getByTestId("todo-item").first()).isVisible();
* asserThat(page.getByTestId("todo-item").first()).isVisible();
*
* // At least one of the two elements is visible, possibly both.
* assertThat(
* asserThat(
* page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("Sign in"))
* .or(page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("Sign up")))
* .first()
@@ -780,10 +780,10 @@ public interface LocatorAssertions {
* assertThat(page.getByText("Welcome")).isVisible();
*
* // At least one item in the list is visible.
* assertThat(page.getByTestId("todo-item").first()).isVisible();
* asserThat(page.getByTestId("todo-item").first()).isVisible();
*
* // At least one of the two elements is visible, possibly both.
* assertThat(
* asserThat(
* page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("Sign in"))
* .or(page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("Sign up")))
* .first()
@@ -37,7 +37,6 @@ import static com.microsoft.playwright.impl.Utils.toFilePayload;
class APIRequestContextImpl extends ChannelOwner implements APIRequestContext {
private final TracingImpl tracing;
private String disposeReason;
APIRequestContextImpl(ChannelOwner parent, String type, String guid, JsonObject initializer) {
super(parent, type, guid, initializer);
@@ -50,17 +49,8 @@ class APIRequestContextImpl extends ChannelOwner implements APIRequestContext {
}
@Override
public void dispose(DisposeOptions options) {
withLogging("APIRequestContext.dispose", () -> disposeImpl(options));
}
private void disposeImpl(DisposeOptions options) {
if (options == null) {
options = new DisposeOptions();
}
disposeReason = options.reason;
JsonObject params = gson().toJsonTree(options).getAsJsonObject();
sendMessage("dispose", params);
public void dispose() {
withLogging("APIRequestContext.dispose", () -> sendMessage("dispose"));
}
@Override
@@ -87,9 +77,6 @@ class APIRequestContextImpl extends ChannelOwner implements APIRequestContext {
}
private APIResponse fetchImpl(String url, RequestOptionsImpl options) {
if (disposeReason != null) {
throw new PlaywrightException(disposeReason);
}
if (options == null) {
options = new RequestOptionsImpl();
}
@@ -120,7 +107,7 @@ class APIRequestContextImpl extends ChannelOwner implements APIRequestContext {
}
}
if (bytes == null) {
params.addProperty("jsonData", jsonDataSerializer.toJson(options.data));
params.addProperty("jsonData", gson().toJson(options.data));
} else {
String base64 = Base64.getEncoder().encodeToString(bytes);
params.addProperty("postData", base64);
@@ -147,12 +134,6 @@ class APIRequestContextImpl extends ChannelOwner implements APIRequestContext {
}
params.addProperty("maxRedirects", options.maxRedirects);
}
if (options.maxRetries != null) {
if (options.maxRetries < 0) {
throw new PlaywrightException("'maxRetries' must be greater than or equal to '0'");
}
params.addProperty("maxRetries", options.maxRetries);
}
JsonObject json = sendMessage("fetch", params).getAsJsonObject();
return new APIResponseImpl(this, json.getAsJsonObject("response"));
}
@@ -17,21 +17,15 @@
package com.microsoft.playwright.impl;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.microsoft.playwright.APIRequest;
import com.microsoft.playwright.PlaywrightException;
import com.microsoft.playwright.options.ClientCertificate;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.util.Base64;
import java.util.List;
import static com.microsoft.playwright.impl.Serialization.gson;
import static com.microsoft.playwright.impl.Utils.addToProtocol;
import static java.nio.file.Files.readAllBytes;
class APIRequestImpl implements APIRequest {
private final PlaywrightImpl playwright;
@@ -48,8 +42,6 @@ class APIRequestImpl implements APIRequest {
private APIRequestContextImpl newContextImpl(NewContextOptions options) {
if (options == null) {
options = new NewContextOptions();
} else {
options = Utils.clone(options);
}
if (options.storageStatePath != null) {
try {
@@ -65,13 +57,11 @@ class APIRequestImpl implements APIRequest {
storageState = new Gson().fromJson(options.storageState, JsonObject.class);
options.storageState = null;
}
List<ClientCertificate> clientCertificateList = options.clientCertificates;
options.clientCertificates = null;
JsonObject params = gson().toJsonTree(options).getAsJsonObject();
if (storageState != null) {
params.add("storageState", storageState);
}
addToProtocol(params, clientCertificateList);
JsonObject result = playwright.sendMessage("newRequest", params).getAsJsonObject();
APIRequestContextImpl context = playwright.connection.getExistingObject(result.getAsJsonObject("request").get("guid").getAsString());
return context;
@@ -36,7 +36,8 @@ import java.util.regex.Pattern;
import static com.microsoft.playwright.impl.Serialization.addHarUrlFilter;
import static com.microsoft.playwright.impl.Serialization.gson;
import static com.microsoft.playwright.impl.Utils.*;
import static com.microsoft.playwright.impl.Utils.isSafeCloseError;
import static com.microsoft.playwright.impl.Utils.toJsRegexFlags;
import static java.nio.charset.StandardCharsets.UTF_8;
import static java.nio.file.Files.readAllBytes;
import static java.util.Arrays.asList;
@@ -45,7 +46,6 @@ class BrowserContextImpl extends ChannelOwner implements BrowserContext {
private final BrowserImpl browser;
private final TracingImpl tracing;
private final APIRequestContextImpl request;
private final ClockImpl clock;
final List<PageImpl> pages = new ArrayList<>();
final List<PageImpl> backgroundPages = new ArrayList<>();
@@ -104,7 +104,6 @@ class BrowserContextImpl extends ChannelOwner implements BrowserContext {
}
tracing = connection.getExistingObject(initializer.getAsJsonObject("tracing").get("guid").getAsString());
request = connection.getExistingObject(initializer.getAsJsonObject("requestContext").get("guid").getAsString());
clock = new ClockImpl(this);
closePromise = new WaitableEvent<>(listeners, EventType.CLOSE);
}
@@ -232,11 +231,6 @@ class BrowserContextImpl extends ChannelOwner implements BrowserContext {
listeners.remove(EventType.RESPONSE, handler);
}
@Override
public ClockImpl clock() {
return clock;
}
private <T> T waitForEventWithTimeout(EventType eventType, Runnable code, Predicate<T> predicate, Double timeout) {
List<Waitable<T>> waitables = new ArrayList<>();
waitables.add(new WaitableEvent<>(listeners, eventType, predicate));
@@ -290,7 +284,6 @@ class BrowserContextImpl extends ChannelOwner implements BrowserContext {
options = new CloseOptions();
}
closeReason = options.reason;
request.dispose(convertType(options, APIRequestContext.DisposeOptions.class));
for (Map.Entry<String, HarRecorder> entry : harRecorders.entrySet()) {
JsonObject params = new JsonObject();
params.addProperty("harId", entry.getKey());
@@ -208,7 +208,6 @@ class BrowserImpl extends ChannelOwner implements Browser {
params.addProperty("noDefaultViewport", true);
}
}
addToProtocol(params, options.clientCertificates);
params.remove("acceptDownloads");
if (options.acceptDownloads != null) {
params.addProperty("acceptDownloads", options.acceptDownloads ? "accept" : "deny");
@@ -30,7 +30,6 @@ import java.util.function.Consumer;
import static com.microsoft.playwright.impl.Serialization.addHarUrlFilter;
import static com.microsoft.playwright.impl.Serialization.gson;
import static com.microsoft.playwright.impl.Utils.addToProtocol;
import static com.microsoft.playwright.impl.Utils.convertType;
class BrowserTypeImpl extends ChannelOwner implements BrowserType {
@@ -222,7 +221,6 @@ class BrowserTypeImpl extends ChannelOwner implements BrowserType {
params.addProperty("noDefaultViewport", true);
}
}
addToProtocol(params, options.clientCertificates);
params.remove("acceptDownloads");
if (options.acceptDownloads != null) {
params.addProperty("acceptDownloads", options.acceptDownloads ? "accept" : "deny");
@@ -1,129 +0,0 @@
package com.microsoft.playwright.impl;
import com.google.gson.JsonObject;
import com.microsoft.playwright.Clock;
import java.util.Date;
class ClockImpl implements Clock {
private final ChannelOwner browserContext;
ClockImpl(BrowserContextImpl browserContext) {
this.browserContext = browserContext;
}
@Override
public void fastForward(long ticks) {
JsonObject params = new JsonObject();
params.addProperty("ticksNumber", ticks);
browserContext.sendMessage("clockFastForward", params);
}
@Override
public void fastForward(String ticks) {
JsonObject params = new JsonObject();
params.addProperty("ticksString", ticks);
browserContext.sendMessage("clockFastForward", params);
}
@Override
public void install(InstallOptions options) {
JsonObject params = new JsonObject();
if (options != null) {
parseTime(options.time, params);
}
browserContext.sendMessage("clockInstall", params);
}
@Override
public void runFor(long ticks) {
JsonObject params = new JsonObject();
params.addProperty("ticksNumber", ticks);
browserContext.sendMessage("clockRunFor", params);
}
@Override
public void runFor(String ticks) {
JsonObject params = new JsonObject();
params.addProperty("ticksString", ticks);
browserContext.sendMessage("clockRunFor", params);
}
@Override
public void pauseAt(long time) {
JsonObject params = new JsonObject();
params.addProperty("timeNumber", time);
browserContext.sendMessage("clockPauseAt", params);
}
@Override
public void pauseAt(String time) {
JsonObject params = new JsonObject();
params.addProperty("timeString", time);
browserContext.sendMessage("clockPauseAt", params);
}
@Override
public void pauseAt(Date time) {
JsonObject params = new JsonObject();
params.addProperty("timeNumber", time.getTime());
browserContext.sendMessage("clockPauseAt", params);
}
@Override
public void resume() {
browserContext.sendMessage("clockResume");
}
@Override
public void setFixedTime(long time) {
JsonObject params = new JsonObject();
params.addProperty("timeNumber", time);
browserContext.sendMessage("clockSetFixedTime", params);
}
@Override
public void setFixedTime(String time) {
JsonObject params = new JsonObject();
params.addProperty("timeString", time);
browserContext.sendMessage("clockSetFixedTime", params);
}
@Override
public void setFixedTime(Date time) {
JsonObject params = new JsonObject();
params.addProperty("timeNumber", time.getTime());
browserContext.sendMessage("clockSetFixedTime", params);
}
@Override
public void setSystemTime(long time) {
JsonObject params = new JsonObject();
params.addProperty("timeNumber", time);
browserContext.sendMessage("clockSetSystemTime", params);
}
@Override
public void setSystemTime(String time) {
JsonObject params = new JsonObject();
params.addProperty("timeString", time);
browserContext.sendMessage("clockSetSystemTime", params);
}
@Override
public void setSystemTime(Date time) {
JsonObject params = new JsonObject();
params.addProperty("timeNumber", time.getTime());
browserContext.sendMessage("clockSetSystemTime", params);
}
private static void parseTime(Object time, JsonObject params) {
if (time instanceof Long) {
params.addProperty("timeNumber", (Long) time);
} else if (time instanceof Date) {
params.addProperty("timeNumber", ((Date) time).getTime());
} else if (time instanceof String) {
params.addProperty("timeString", (String) time);
}
}
}
@@ -21,13 +21,11 @@ import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.microsoft.playwright.ElementHandle;
import com.microsoft.playwright.Frame;
import com.microsoft.playwright.PlaywrightException;
import com.microsoft.playwright.options.BoundingBox;
import com.microsoft.playwright.options.ElementState;
import com.microsoft.playwright.options.FilePayload;
import com.microsoft.playwright.options.SelectOption;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Base64;
@@ -431,11 +431,6 @@ public class PageImpl extends ChannelOwner implements Page {
listeners.remove(EventType.WORKER, handler);
}
@Override
public ClockImpl clock() {
return browserContext.clock();
}
@Override
public Page waitForClose(WaitForCloseOptions options, Runnable code) {
return withWaitLogging("Page.waitForClose", logger -> waitForCloseImpl(options, code));
@@ -33,12 +33,6 @@ class SerializedValue{
String d;
String u;
String bi;
public static class E {
String m;
String n;
String s;
}
E e;
public static class R {
String p;
String f;
@@ -33,7 +33,6 @@ public class RequestOptionsImpl implements RequestOptions {
Boolean ignoreHTTPSErrors;
Double timeout;
Integer maxRedirects;
Integer maxRetries;
@Override
public RequestOptions setHeader(String name, String value) {
@@ -126,10 +125,4 @@ public class RequestOptionsImpl implements RequestOptions {
this.maxRedirects = maxRedirects;
return this;
}
@Override
public RequestOptions setMaxRetries(int maxRetries) {
this.maxRetries = maxRetries;
return this;
}
}
@@ -24,7 +24,9 @@ import com.microsoft.playwright.ElementHandle;
import com.microsoft.playwright.PlaywrightException;
import com.microsoft.playwright.options.*;
import java.io.*;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.lang.reflect.Type;
import java.math.BigInteger;
import java.net.MalformedURLException;
@@ -33,7 +35,11 @@ import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.time.*;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.regex.Pattern;
@@ -49,7 +55,6 @@ class Serialization {
.registerTypeAdapter(ColorScheme.class, new ToLowerCaseAndDashSerializer<ColorScheme>())
.registerTypeAdapter(Media.class, new ToLowerCaseSerializer<Media>())
.registerTypeAdapter(ForcedColors.class, new ToLowerCaseSerializer<ForcedColors>())
.registerTypeAdapter(HttpCredentialsSend.class, new ToLowerCaseSerializer<HttpCredentialsSend>())
.registerTypeAdapter(ReducedMotion.class, new ToLowerCaseAndDashSerializer<ReducedMotion>())
.registerTypeAdapter(ScreenshotAnimations.class, new ToLowerCaseSerializer<ScreenshotAnimations>())
.registerTypeAdapter(ScreenshotType.class, new ToLowerCaseSerializer<ScreenshotType>())
@@ -71,12 +76,6 @@ class Serialization {
return gson;
}
static final Gson jsonDataSerializer = new GsonBuilder().disableHtmlEscaping()
.registerTypeAdapter(Date.class, new DateSerializer())
.registerTypeAdapter(LocalDateTime.class, new LocalDateTimeSerializer())
.registerTypeAdapter(OffsetDateTime.class, new OffsetDateTimeSerializer())
.serializeNulls().create();
static SerializedError serializeError(Throwable e) {
SerializedError result = new SerializedError();
result.error = new SerializedError.Error();
@@ -170,14 +169,6 @@ class Serialization {
result.r = new SerializedValue.R();
result.r.p = ((Pattern)value).pattern();
result.r.f = toJsRegexFlags(((Pattern)value));
} else if (value instanceof Exception) {
Exception exception = (Exception) value;
result.e = new SerializedValue.E();
result.e.m = exception.getMessage();
result.e.n = exception.getClass().getSimpleName();
StringWriter sw = new StringWriter();
exception.printStackTrace(new PrintWriter(sw));
result.e.s = sw.toString();
} else {
HashableValue mapKey = new HashableValue(value);
Integer id = valueToId.get(mapKey);
@@ -255,9 +246,6 @@ class Serialization {
return (T)(Date.from(Instant.parse(value.d)));
if (value.r != null)
return (T)(Pattern.compile(value.r.p, fromJsRegexFlags(value.r.f)));
if (value.e != null) {
return (T)new Exception(value.e.s);
}
if (value.v != null) {
switch (value.v) {
case "undefined":
@@ -315,9 +303,6 @@ class Serialization {
if (modifiers.contains(KeyboardModifier.CONTROL)) {
result.add("Control");
}
if (modifiers.contains(KeyboardModifier.CONTROLORMETA)) {
result.add("ControlOrMeta");
}
if (modifiers.contains(KeyboardModifier.META)) {
result.add("Meta");
}
@@ -529,13 +514,6 @@ class Serialization {
}
}
private static class OffsetDateTimeSerializer implements JsonSerializer<OffsetDateTime> {
@Override
public JsonElement serialize(OffsetDateTime src, Type typeOfSrc, JsonSerializationContext context) {
return new JsonPrimitive(dateFormat.format(Date.from(src.toInstant())));
}
}
private static class LocalDateTimeSerializer implements JsonSerializer<LocalDateTime> {
@Override
public JsonElement serialize(LocalDateTime src, Type typeOfSrc, JsonSerializationContext context) {
@@ -17,10 +17,8 @@
package com.microsoft.playwright.impl;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.microsoft.playwright.PlaywrightException;
import com.microsoft.playwright.options.ClientCertificate;
import com.microsoft.playwright.options.FilePayload;
import com.microsoft.playwright.options.HttpHeader;
@@ -35,10 +33,8 @@ import java.nio.file.Path;
import java.nio.file.attribute.FileTime;
import java.util.*;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import static com.microsoft.playwright.impl.Serialization.toJsonArray;
import static java.nio.file.Files.readAllBytes;
public class Utils {
static <F, T> T convertType(F f, Class<T> t) {
@@ -177,105 +173,40 @@ public class Utils {
return mimeType;
}
static void addFilePathUploadParams(Path[] items, JsonObject params, BrowserContextImpl context) {
List<Path> localPaths = new ArrayList<>();
Path localDirectory = resolvePathsAndDirectoryForInputFiles(items, localPaths);
if (items.length == 0) {
static void addFilePathUploadParams(Path[] files, JsonObject params, BrowserContextImpl context) {
if (files.length == 0) {
// FIXME: shouldBeAbleToResetSelectedFilesWithEmptyFileList tesst hangs in Chromium if we pass empty paths list.
params.add("payloads", new JsonArray());
} else if (context.connection.isRemote) {
if (localDirectory != null) {
localPaths = collectFiles(localDirectory);
}
JsonObject json = createTempFiles(context, localDirectory, localPaths);
JsonArray writableStreams = json.getAsJsonArray("writableStreams");
JsonArray jsonStreams = copyLocalToTempFiles(context, localPaths, writableStreams);
if (json.has("rootDir")) {
params.add("directoryStream", json.get("rootDir"));
} else {
params.add("streams", jsonStreams);
}
} else {
if (!localPaths.isEmpty()) {
params.add("localPaths", toJsonArray(localPaths.toArray(new Path[0])));
}
if (localDirectory != null) {
params.addProperty("localDirectory", localDirectory.toString());
}
}
}
private static Path resolvePathsAndDirectoryForInputFiles(Path[] items, List<Path> outLocalPaths) {
Path localDirectory = null;
try {
for (Path item : items) {
if (Files.isDirectory(item)) {
if (localDirectory != null) {
throw new PlaywrightException("Multiple directories are not supported");
}
localDirectory = item.toRealPath();
} else {
outLocalPaths.add(item.toRealPath());
List<WritableStream> streams = new ArrayList<>();
JsonArray jsonStreams = new JsonArray();
for (Path path : files) {
long lastModifiedMs;
try {
lastModifiedMs = Files.getLastModifiedTime(path).toMillis();
} catch (IOException e) {
throw new PlaywrightException("Cannot read file timestamp: " + path, e);
}
WritableStream temp = context.createTempFile(path.getFileName().toString(), lastModifiedMs);
streams.add(temp);
try (OutputStream out = temp.stream()) {
Files.copy(path, out);
} catch (IOException e) {
throw new PlaywrightException("Failed to copy file to remote server.", e);
}
jsonStreams.add(temp.toProtocolRef());
}
} catch (IOException e) {
throw new PlaywrightException("Cannot get absolute file path", e);
params.add("streams", jsonStreams);
} else {
Path[] absolute = Arrays.stream(files).map(f -> {
try {
return f.toRealPath();
} catch (IOException e) {
throw new PlaywrightException("Cannot get absolute file path", e);
}
}).toArray(Path[]::new);
params.add("localPaths", toJsonArray(absolute));
}
if (!outLocalPaths.isEmpty() && localDirectory != null) {
throw new PlaywrightException("File paths must be all files or a single directory");
}
return localDirectory;
}
private static List<Path> collectFiles(Path localDirectory) {
try {
return Files.walk(localDirectory).filter(e -> Files.isRegularFile(e)).collect(Collectors.toList());
} catch (IOException e) {
throw new PlaywrightException("Failed to traverse directory", e);
}
}
private static JsonArray copyLocalToTempFiles(BrowserContextImpl context, List<Path> localPaths, JsonArray writableStreams) {
JsonArray jsonStreams = new JsonArray();
for (int i = 0; i < localPaths.size(); i++) {
JsonObject jsonStream = writableStreams.get(i).getAsJsonObject();
WritableStream temp = context.connection.getExistingObject(jsonStream.get("guid").getAsString());
try (OutputStream out = temp.stream()) {
Files.copy(localPaths.get(i), out);
} catch (IOException e) {
throw new PlaywrightException("Failed to copy file to remote server.", e);
}
jsonStreams.add(temp.toProtocolRef());
}
return jsonStreams;
}
private static JsonObject createTempFiles(BrowserContextImpl context, Path localDirectory, List<Path> localPaths) {
JsonObject tempFilesParams = new JsonObject();
if (localDirectory != null) {
tempFilesParams.addProperty("rootDirName", localDirectory.getFileName().toString());
}
JsonArray items = new JsonArray();
for (Path path : localPaths) {
long lastModifiedMs;
try {
lastModifiedMs = Files.getLastModifiedTime(path).toMillis();
} catch (IOException e) {
throw new PlaywrightException("Cannot read file timestamp: " + path, e);
}
Path name;
if (localDirectory == null) {
name = path.getFileName();
} else {
name = localDirectory.relativize(path);
}
JsonObject item = new JsonObject();
item.addProperty("name", name.toString());
item.addProperty("lastModifiedMs", lastModifiedMs);
items.add(item);
}
tempFilesParams.add("items", items);
return context.sendMessage("createTempFiles", tempFilesParams).getAsJsonObject();
}
static void checkFilePayloadSize(FilePayload[] files) {
@@ -414,40 +345,4 @@ public class Utils {
static String addSourceUrlToScript(String source, Path path) {
return source + "\n//# sourceURL=" + path.toString().replace("\n", "");
}
static void addToProtocol(JsonObject params, List<ClientCertificate> clientCertificateList) {
if (clientCertificateList == null) {
return;
}
JsonArray clientCertificates = new JsonArray();
for (ClientCertificate cert: clientCertificateList) {
JsonObject jsonCert = new JsonObject();
jsonCert.addProperty("origin", cert.origin);
try {
if (cert.certPath != null) {
byte[] bytes = readAllBytes(cert.certPath);
String base64 = Base64.getEncoder().encodeToString(bytes);
jsonCert.addProperty("cert", base64);
}
if (cert.keyPath != null) {
byte[] bytes = readAllBytes(cert.keyPath);
String base64 = Base64.getEncoder().encodeToString(bytes);
jsonCert.addProperty("key", base64);
}
if (cert.pfxPath != null) {
byte[] bytes = readAllBytes(cert.pfxPath);
String base64 = Base64.getEncoder().encodeToString(bytes);
params.addProperty("pfx", base64);
}
} catch (IOException e) {
throw new PlaywrightException("Failed to read from file", e);
}
if (cert.passphrase != null) {
jsonCert.addProperty("passphrase", cert.passphrase);
}
clientCertificates.add(jsonCert);
}
params.remove("clientCertificates");
params.add("clientCertificates", clientCertificates);
}
}
@@ -1,75 +0,0 @@
/*
* 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;
import java.nio.file.Path;
public class ClientCertificate {
/**
* Exact origin that the certificate is valid for. Origin includes {@code https} protocol, a hostname and optionally a
* port.
*/
public String origin;
/**
* Path to the file with the certificate in PEM format.
*/
public Path certPath;
/**
* Path to the file with the private key in PEM format.
*/
public Path keyPath;
/**
* Path to the PFX or PKCS12 encoded private key and certificate chain.
*/
public Path pfxPath;
/**
* Passphrase for the private key (PEM or PFX).
*/
public String passphrase;
public ClientCertificate(String origin) {
this.origin = origin;
}
/**
* Path to the file with the certificate in PEM format.
*/
public ClientCertificate setCertPath(Path certPath) {
this.certPath = certPath;
return this;
}
/**
* Path to the file with the private key in PEM format.
*/
public ClientCertificate setKeyPath(Path keyPath) {
this.keyPath = keyPath;
return this;
}
/**
* Path to the PFX or PKCS12 encoded private key and certificate chain.
*/
public ClientCertificate setPfxPath(Path pfxPath) {
this.pfxPath = pfxPath;
return this;
}
/**
* Passphrase for the private key (PEM or PFX).
*/
public ClientCertificate setPassphrase(String passphrase) {
this.passphrase = passphrase;
return this;
}
}
@@ -20,16 +20,15 @@ public class Cookie {
public String name;
public String value;
/**
* Either url or domain / path are required. Optional.
* either url or domain / path are required. Optional.
*/
public String url;
/**
* For the cookie to apply to all subdomains as well, prefix domain with a dot, like this: ".example.com". Either url or
* domain / path are required. Optional.
* either url or domain / path are required Optional.
*/
public String domain;
/**
* Either url or domain / path are required Optional.
* either url or domain / path are required Optional.
*/
public String path;
/**
@@ -54,22 +53,21 @@ public class Cookie {
this.value = value;
}
/**
* Either url or domain / path are required. Optional.
* either url or domain / path are required. Optional.
*/
public Cookie setUrl(String url) {
this.url = url;
return this;
}
/**
* For the cookie to apply to all subdomains as well, prefix domain with a dot, like this: ".example.com". Either url or
* domain / path are required. Optional.
* either url or domain / path are required Optional.
*/
public Cookie setDomain(String domain) {
this.domain = domain;
return this;
}
/**
* Either url or domain / path are required Optional.
* either url or domain / path are required Optional.
*/
public Cookie setPath(String path) {
this.path = path;
@@ -23,13 +23,6 @@ public class HttpCredentials {
* Restrain sending http credentials on specific origin (scheme://host:port).
*/
public String origin;
/**
* This option only applies to the requests sent from corresponding {@code APIRequestContext} and does not affect requests
* sent from the browser. {@code "always"} - {@code Authorization} header with basic authentication credentials will be
* sent with the each API request. {@code 'unauthorized} - the credentials are only sent when 401 (Unauthorized) response
* with {@code WWW-Authenticate} header is received. Defaults to {@code "unauthorized"}.
*/
public HttpCredentialsSend send;
public HttpCredentials(String username, String password) {
this.username = username;
@@ -42,14 +35,4 @@ public class HttpCredentials {
this.origin = origin;
return this;
}
/**
* This option only applies to the requests sent from corresponding {@code APIRequestContext} and does not affect requests
* sent from the browser. {@code "always"} - {@code Authorization} header with basic authentication credentials will be
* sent with the each API request. {@code 'unauthorized} - the credentials are only sent when 401 (Unauthorized) response
* with {@code WWW-Authenticate} header is received. Defaults to {@code "unauthorized"}.
*/
public HttpCredentials setSend(HttpCredentialsSend send) {
this.send = send;
return this;
}
}
@@ -1,22 +0,0 @@
/*
* 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 HttpCredentialsSend {
UNAUTHORIZED,
ALWAYS
}
@@ -133,15 +133,6 @@ public interface RequestOptions {
* @since v1.26
*/
RequestOptions setMaxRedirects(int maxRedirects);
/**
*
*
* @param maxRetries Maximum number of times network errors should be retried. Currently only {@code ECONNRESET} error is retried. Does not
* retry based on HTTP response codes. An error will be thrown if the limit is exceeded. Defaults to {@code 0} - no
* retries.
* @since v1.46
*/
RequestOptions setMaxRetries(int maxRetries);
/**
* Changes the request method (e.g. <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PUT">PUT</a> or <a
* href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST">POST</a>).
@@ -19,15 +19,11 @@ package com.microsoft.playwright;
import com.sun.net.httpserver.HttpsConfigurator;
import com.sun.net.httpserver.HttpsParameters;
import javax.net.ssl.*;
import java.io.FileInputStream;
import java.io.InputStream;
import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLParameters;
import javax.net.ssl.TrustManagerFactory;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
class HttpsConfiguratorImpl extends HttpsConfigurator {
@@ -35,7 +31,7 @@ class HttpsConfiguratorImpl extends HttpsConfigurator {
return new HttpsConfiguratorImpl(createSSLContext());
}
HttpsConfiguratorImpl(SSLContext context) {
private HttpsConfiguratorImpl(SSLContext context) {
super(context);
}
@@ -20,6 +20,7 @@ import com.sun.net.httpserver.*;
import java.io.*;
import java.net.InetSocketAddress;
import java.nio.file.FileSystems;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Future;
@@ -72,8 +73,11 @@ public class Server implements HttpHandler {
} else {
server = HttpServer.create(new InetSocketAddress("localhost", port), 0);
}
server.createContext("/", this);
server.setExecutor(null); // creates a default executor
File cwd = FileSystems.getDefault().getPath(".").toFile();
server.start();
}
@@ -1,160 +0,0 @@
/*
* Copyright (c) Microsoft Corporation.
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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;
import com.sun.net.httpserver.*;
import javax.net.ssl.*;
import java.io.*;
import java.net.InetSocketAddress;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.cert.*;
import java.util.*;
public class ServerWithClientCertificate implements HttpHandler {
private final HttpServer server;
final String origin;
final String crossOrigin;
final String url;
KeyStore keyStore;
static ServerWithClientCertificate create(int port) throws IOException {
return new ServerWithClientCertificate(port);
}
private ServerWithClientCertificate(int port) throws IOException {
origin = "https://localhost:" + port;
crossOrigin = "https://127.0.0.1:" + port;;
url = origin + "/index.html";
HttpsServer httpsServer = HttpsServer.create(new InetSocketAddress("localhost", port), 0);
httpsServer.setHttpsConfigurator(new HttpsConfiguratorImpl(loadCertificates()));
server = httpsServer;
server.createContext("/", this);
server.setExecutor(null); // creates a default executor
server.start();
}
public void stop() {
server.stop(0);
}
private SSLContext loadCertificates() {
try {
// Create an SSL context
SSLContext sslContext = SSLContext.getInstance("TLS");
// Load the keystore from file
char[] password = "".toCharArray(); // the password you set during the PKCS12 export
keyStore = KeyStore.getInstance("PKCS12");
InputStream fis = HttpsConfiguratorImpl.class.getClassLoader().getResourceAsStream(
"resources/client-certificates/server/server_keystore.p12");
keyStore.load(fis, password);
// Set up the KeyManagerFactory to use the keystore
KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
kmf.init(keyStore, password);
TrustManager[] trustAllCerts = new TrustManager[]{
new X509TrustManager() {
public X509Certificate[] getAcceptedIssuers() {
List<X509Certificate> certs = new ArrayList<>();
try {
for (String alias : Collections.list(keyStore.aliases())) {
certs.add((X509Certificate) keyStore.getCertificate(alias));
}
} catch (KeyStoreException e) {
throw new RuntimeException(e);
}
return certs.toArray(new X509Certificate[0]);
}
public void checkClientTrusted(X509Certificate[] clientCerts, String authType) throws CertificateException {
}
public void checkServerTrusted(X509Certificate[] certs, String authType) {
}
}
};
// Initialize the SSL context
sslContext.init(kmf.getKeyManagers(), trustAllCerts, null);
return sslContext;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
private boolean validateCertChain(Certificate[] clientCerts) {
try {
// Create CertPath from the provided client certificates
CertificateFactory factory = CertificateFactory.getInstance("X.509");
CertPath certPath = factory.generateCertPath(Arrays.asList(clientCerts));
// Extract Trust Anchors from the trust store
Set<TrustAnchor> trustAnchors = new HashSet<>();
for (String alias : Collections.list(keyStore.aliases())) {
X509Certificate trustedCert = (X509Certificate) keyStore.getCertificate(alias);
if (trustedCert != null) {
trustAnchors.add(new TrustAnchor(trustedCert, null));
}
}
// Initialize PKIX parameters
PKIXParameters params = new PKIXParameters(trustAnchors);
params.setRevocationEnabled(false); // Set to true if you want to enable CRL checking
// Validate the certification path
CertPathValidator certPathValidator = CertPathValidator.getInstance(CertPathValidator.getDefaultType());
certPathValidator.validate(certPath, params);
return true;
} catch (Exception e) {
return false;
}
}
private static String div(String testId, String message) {
return "<div data-testid='" + testId + "'>" + message + "</div>";
}
@Override
public void handle(HttpExchange exchange) throws IOException {
SSLSession sslSession = ((HttpsExchange) exchange).getSSLSession();
String response = div("servername", sslSession.getPeerHost());
Certificate[] certs = sslSession.getPeerCertificates();
if (certs.length > 0 && certs[0] instanceof X509Certificate) {
X509Certificate cert = (X509Certificate) certs[0];
exchange.getResponseHeaders().add("Content-Type", "text/html");
if (validateCertChain(certs)) {
exchange.sendResponseHeaders(200, 0);
response += div("message", String.format("Hello %s, your certificate was issued by %s!",
cert.getSubjectX500Principal().getName(), cert.getIssuerX500Principal().getName()));
} else {
response += div("message", String.format("Sorry %s, certificates from %s are not welcome here.",
cert.getSubjectX500Principal().getName(), cert.getIssuerX500Principal().getName()));
exchange.sendResponseHeaders(403, 0);
}
} else {
response += div("message", "Sorry, but you need to provide a client certificate to continue.");
exchange.sendResponseHeaders(401, 0);
}
try (OutputStreamWriter writer = new OutputStreamWriter(exchange.getResponseBody())) {
writer.write(response);
}
}
}
@@ -22,7 +22,6 @@ import com.microsoft.playwright.options.SameSiteAttribute;
import javax.sql.rowset.Predicate;
import java.io.IOException;
import java.io.InputStream;
import java.security.Provider;
import java.time.Duration;
import java.time.Instant;
@@ -43,11 +42,9 @@ public class TestBase {
Browser browser;
static final boolean isMac = Utils.getOS() == Utils.OS.MAC;
static final boolean isLinux = Utils.getOS() == Utils.OS.LINUX;
static final boolean isWindows = Utils.getOS() == Utils.OS.WINDOWS;
static final boolean headful;
static final SameSiteAttribute defaultSameSiteCookieValue;
static {
String headfulEnv = System.getenv("HEADFUL");
headful = headfulEnv != null && !"0".equals(headfulEnv) && !"false".equals(headfulEnv);
@@ -163,28 +160,14 @@ public class TestBase {
void waitForCondition(BooleanSupplier predicate) {
waitForCondition(predicate, 5_000);
}
void waitForCondition(BooleanSupplier predicate, int timeoutMs) {
page.waitForCondition(predicate, new Page.WaitForConditionOptions().setTimeout(timeoutMs));
}
private static SameSiteAttribute initSameSiteAttribute() {
if (isChromium()) return SameSiteAttribute.LAX;
if (isWebKit() && isLinux) return SameSiteAttribute.LAX;
if (isWebKit() && !isLinux) return SameSiteAttribute.NONE;
if (isWebKit()) return SameSiteAttribute.NONE;
// for firefox version >= 103 'None' is used.
return SameSiteAttribute.NONE;
}
static boolean chromiumVersionLessThan(String a, String b) {
String[] aParts = a.split("\\.");
String[] bParts = b.split("\\.");
for (int i = 0; i < 4; i++) {
int aPart = Integer.parseInt(aParts[i]);
int bPart = Integer.parseInt(bParts[i]);
if (aPart > bPart) return false;
if (aPart < bPart) return true;
}
return false;
}
}
@@ -26,7 +26,7 @@ import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import static com.microsoft.playwright.TestBase.defaultSameSiteCookieValue;
import static com.microsoft.playwright.TestOptionsFactories.isChromium;
import static com.microsoft.playwright.TestOptionsFactories.isFirefox;
import static com.microsoft.playwright.Utils.assertJsonEquals;
import static java.util.Arrays.asList;
@@ -227,7 +227,7 @@ public class TestBrowserContextAddCookies {
" expires: -1,\n" +
" httpOnly: false,\n" +
" secure: false,\n" +
" sameSite: '" + defaultSameSiteCookieValue +"'\n" +
" sameSite: '" + (isChromium() ? "LAX" : "NONE") +"'\n" +
"}]", cookies);
}
@@ -246,7 +246,7 @@ public class TestBrowserContextAddCookies {
" expires: -1,\n" +
" httpOnly: false,\n" +
" secure: false,\n" +
" sameSite: '" + defaultSameSiteCookieValue +"'\n" +
" sameSite: '" + (isChromium() ? "LAX" : "NONE") +"'\n" +
"}]", cookies);
assertEquals("gridcookie=GRID", page.evaluate("document.cookie"));
page.navigate(server.EMPTY_PAGE);
@@ -311,7 +311,7 @@ public class TestBrowserContextAddCookies {
" expires: -1,\n" +
" httpOnly: false,\n" +
" secure: true,\n" +
" sameSite: '" + defaultSameSiteCookieValue +"'\n" +
" sameSite: '" + (isChromium() ? "LAX" : "NONE") +"'\n" +
"}]", context.cookies("https://www.example.com"));
}
@@ -48,7 +48,7 @@ public class TestBrowserContextCookies extends TestBase {
" expires: -1,\n" +
" httpOnly: false,\n" +
" secure: false,\n" +
" sameSite: '" + defaultSameSiteCookieValue +"'\n" +
" sameSite: '" + (isChromium() ? "LAX" : "NONE") +"'\n" +
" }]", cookies);
}
@@ -72,7 +72,6 @@ public class TestBrowserContextCookies extends TestBase {
assertFalse(cookies.get(0).httpOnly);
assertFalse(cookies.get(0).secure);
assertEquals(defaultSameSiteCookieValue, cookies.get(0).sameSite);
assertEquals(defaultSameSiteCookieValue, cookies.get(0).sameSite);
// Browsers start to cap cookies with 400 days max expires value.
// See https://github.com/httpwg/http-extensions/pull/1732
@@ -148,7 +147,7 @@ public class TestBrowserContextCookies extends TestBase {
" expires: -1,\n" +
" httpOnly: false,\n" +
" secure: false,\n" +
" sameSite: '" + defaultSameSiteCookieValue +"'\n" +
" sameSite: '" + (isChromium() ? "LAX" : "NONE") +"'\n" +
" },\n" +
" {\n" +
" name: 'username',\n" +
@@ -158,7 +157,7 @@ public class TestBrowserContextCookies extends TestBase {
" expires: -1,\n" +
" httpOnly: false,\n" +
" secure: false,\n" +
" sameSite: '" + defaultSameSiteCookieValue +"'\n" +
" sameSite: '" + (isChromium() ? "LAX" : "NONE") +"'\n" +
" }\n" +
"]", cookies);
}
@@ -179,7 +178,7 @@ public class TestBrowserContextCookies extends TestBase {
" expires: -1.0,\n" +
" httpOnly: false,\n" +
" secure: true,\n" +
" sameSite: '" + defaultSameSiteCookieValue +"'\n" +
" sameSite: '" + (isChromium() ? "LAX" : "NONE") +"'\n" +
"}, {\n" +
" name: 'doggo',\n" +
" value: 'woofs',\n" +
@@ -188,7 +187,7 @@ public class TestBrowserContextCookies extends TestBase {
" expires: -1.0,\n" +
" httpOnly: false,\n" +
" secure: true,\n" +
" sameSite: '" + defaultSameSiteCookieValue +"'\n" +
" sameSite: '" + (isChromium() ? "LAX" : "NONE") +"'\n" +
"}]", cookies);
}
@@ -206,14 +205,14 @@ public class TestBrowserContextCookies extends TestBase {
page.navigate(server.EMPTY_PAGE);
Object documentCookie = page.evaluate("document.cookie.split('; ').sort().join('; ')");
if (isChromium() || (isLinux && isWebKit())) {
if (isChromium()) {
assertEquals("one=uno; two=dos", documentCookie);
} else {
assertEquals("one=uno; three=tres; two=dos", documentCookie);
}
List<SameSiteAttribute> list = context.cookies().stream().map(c -> c.sameSite).sorted().collect(Collectors.toList());
if (isChromium() || (isLinux && isWebKit())) {
if (isChromium()) {
assertEquals(asList(SameSiteAttribute.STRICT, SameSiteAttribute.LAX), list);
} else {
assertEquals(asList(SameSiteAttribute.STRICT, SameSiteAttribute.LAX, SameSiteAttribute.NONE), list);
@@ -23,12 +23,10 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
import java.io.*;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.text.ParseException;
import java.time.LocalDateTime;
import java.time.OffsetDateTime;
import java.time.ZoneId;
import java.util.*;
import java.util.concurrent.ExecutionException;
@@ -518,20 +516,10 @@ public class TestBrowserContextFetch extends TestBase {
testData.date = new Date(currentMillis);
testData.localDateTime = testData.date.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
context.request().fetch(pageReq, RequestOptions.create().setMethod("POST").setData(testData));
assertEquals("{\"name\":\"foo\",\"localDateTime\":\"2022-12-23T06:14:58.818Z\",\"date\":\"2022-12-23T06:14:58.818Z\",\"nullLocalDateTime\":null,\"nullDate\":null}",
assertEquals("{\"name\":\"foo\",\"localDateTime\":\"2022-12-23T06:14:58.818Z\",\"date\":\"2022-12-23T06:14:58.818Z\"}",
new String(req.get().postBody));
}
@Test
void shouldSupportOffsetDateTimeInData() throws ExecutionException, InterruptedException {
APIRequestContext request = playwright.request().newContext();
OffsetDateTime offsetDateTime = OffsetDateTime.parse("2024-07-10T10:15:30-08:00");
Future<Server.Request> serverRequest = server.futureRequest("/empty.html");
request.get(server.EMPTY_PAGE, RequestOptions.create().setData(mapOf("date", offsetDateTime)));
byte[] body = serverRequest.get().postBody;
assertEquals("{\"date\":\"2024-07-10T18:15:30.000Z\"}", new String(body));
}
@Test
void shouldSupportApplicationXWwwFormUrlencoded() throws ExecutionException, InterruptedException {
Future<Server.Request> req = server.futureRequest("/empty.html");
@@ -808,85 +796,4 @@ public class TestBrowserContextFetch extends TestBase {
assertEquals(401, response.status());
}
}
@Test
void shouldSerializeNullValuesInPostData() throws ExecutionException, InterruptedException {
Future<Server.Request> req = server.futureRequest("/empty.html");
APIResponse response = context.request().post(server.EMPTY_PAGE, RequestOptions.create().setData(mapOf("foo", null)));
assertEquals(200, response.status());
assertEquals("{\"foo\":null}", new String(req.get().postBody));
}
@Test
void shouldSupportHTTPCredentialsSendImmediatelyForNewContext() throws ExecutionException, InterruptedException {
Browser.NewContextOptions options = new Browser.NewContextOptions().setHttpCredentials(
new HttpCredentials("user", "pass")
.setOrigin(server.PREFIX.toUpperCase())
.setSend(HttpCredentialsSend.ALWAYS));
try (BrowserContext context = browser.newContext(options)) {
Future<Server.Request> serverRequest = server.futureRequest("/empty.html");
APIResponse response = context.request().get(server.EMPTY_PAGE);
assertEquals("Basic " + java.util.Base64.getEncoder().encodeToString("user:pass".getBytes()),
serverRequest.get().headers.getFirst("authorization"));
assertEquals(200, response.status());
serverRequest = server.futureRequest("/empty.html");
response = context.request().get(server.CROSS_PROCESS_PREFIX + "/empty.html");
// Not sent to another origin.
assertNull(serverRequest.get().headers.get("authorization"));
assertEquals(200, response.status());
}
}
@Test
void shouldSupportHTTPCredentialsSendImmediatelyForBrowserNewPage() throws ExecutionException, InterruptedException {
Browser.NewPageOptions options = new Browser.NewPageOptions().setHttpCredentials(
new HttpCredentials("user", "pass")
.setOrigin(server.PREFIX.toUpperCase())
.setSend(HttpCredentialsSend.ALWAYS));
try (Page newPage = browser.newPage(options)) {
Future<Server.Request> serverRequest = server.futureRequest("/empty.html");
APIResponse response = newPage.request().get(server.EMPTY_PAGE);
assertEquals("Basic " + java.util.Base64.getEncoder().encodeToString("user:pass".getBytes()),
serverRequest.get().headers.getFirst("authorization"));
assertEquals(200, response.status());
serverRequest = server.futureRequest("/empty.html");
response = newPage.request().get(server.CROSS_PROCESS_PREFIX + "/empty.html");
// Not sent to another origin.
assertNull(serverRequest.get().headers.get("authorization"));
assertEquals(200, response.status());
}
}
@Test
void shouldNotWorkAfterContextDispose() {
context.close(new BrowserContext.CloseOptions().setReason("Test ended."));
PlaywrightException e = assertThrows(PlaywrightException.class, () -> context.request().get(server.EMPTY_PAGE));
assertTrue(e.getMessage().contains("Test ended."), e.getMessage());
}
@Test
public void shouldRetryECONNRESET() {
int[] requestCount = {0};
server.setRoute("/test", exchange -> {
if (requestCount[0]++ < 3) {
exchange.close();
return;
}
exchange.getResponseHeaders().add("Content-Type", "text/plain");
exchange.sendResponseHeaders(200, 0);
try (OutputStreamWriter writer = new OutputStreamWriter(exchange.getResponseBody())) {
writer.write("Hello!");
}
});
APIRequestContext requestContext = context.request();
APIResponse response = requestContext.get(server.PREFIX + "/test",
RequestOptions.create().setMaxRetries(3));
assertEquals(200, response.status());
assertEquals("Hello!", response.text());
assertEquals(4, requestCount[0]);
}
}
@@ -98,20 +98,6 @@ public class TestBrowserContextStorageState extends TestBase {
"}");
Path path = tempDir.resolve("storage-state.json");
context.storageState(new BrowserContext.StorageStateOptions().setPath(path));
String sameSiteCamelCase = "Lax";
switch (defaultSameSiteCookieValue) {
case STRICT:
sameSiteCamelCase = "Strict";
break;
case LAX:
sameSiteCamelCase = "Lax";
break;
case NONE:
sameSiteCamelCase = "None";
break;
}
JsonObject expected = new Gson().fromJson(
"{\n" +
" 'cookies':[\n" +
@@ -123,7 +109,7 @@ public class TestBrowserContextStorageState extends TestBase {
" 'expires':-1,\n" +
" 'httpOnly':false,\n" +
" 'secure':false,\n" +
" 'sameSite':'" + sameSiteCamelCase + "'\n" +
" 'sameSite':'" + (isChromium() ? "Lax" : "None") + "'\n" +
" }],\n" +
" 'origins':[\n" +
" {\n" +
@@ -506,7 +506,7 @@ public class TestBrowserTypeConnect extends TestBase {
}
@Test
void setInputFilesShouldPreserveLastModifiedTimestamp() throws IOException {
void setInputFilesDhouldPreserveLastModifiedTimestamp() throws IOException {
page.setContent("<input type=file multiple=true/>");
Locator input = page.locator("input");
input.setInputFiles(FILE_TO_UPLOAD);
@@ -1,194 +0,0 @@
package com.microsoft.playwright;
import com.microsoft.playwright.options.ClientCertificate;
import com.microsoft.playwright.options.Proxy;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledIf;
import org.junit.jupiter.api.io.TempDir;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.file.Path;
import java.nio.file.Paths;
import static com.microsoft.playwright.Utils.nextFreePort;
import static com.microsoft.playwright.assertions.PlaywrightAssertions.assertThat;
import static java.util.Arrays.asList;
import static org.junit.jupiter.api.Assertions.*;
public class TestClientCertificates extends TestBase {
private ServerWithClientCertificate customServer;
private static Path asset(String path) {
return Paths.get("src/test/resources/" + path).toAbsolutePath();
}
private static String origin(String urlString) {
try {
URL url = new URL(urlString);
String origin = url.getProtocol() + "://" + url.getHost();
if (url.getPort() != -1 && url.getPort() != url.getDefaultPort()) {
origin += ":" + url.getPort();
}
return origin;
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
}
@BeforeAll
@Override
void startServer() throws IOException {
super.startServer();
customServer = ServerWithClientCertificate.create(nextFreePort());
}
@AfterAll
@Override
void stopServer() {
if (customServer != null) {
customServer.stop();
customServer = null;
}
super.stopServer();
}
@BeforeAll
@Override
void launchBrowser() {
// TODO: remove once Chromium Stable tests pass without it on Windows.
launchBrowser(createLaunchOptions().setProxy(new Proxy("per-context")));
}
@Test
public void shouldFailWithNoClientCertificatesProvided() {
APIRequestContext request = playwright.request().newContext(
new APIRequest.NewContextOptions().setIgnoreHTTPSErrors(true));
PlaywrightException e = assertThrows(PlaywrightException.class, () -> request.get(customServer.url));
assertTrue(e.getMessage().contains("Error: socket hang up"), e.getMessage());
request.dispose();
}
@Test
public void shouldKeepSupportingHttp() {
APIRequest.NewContextOptions requestOptions = new APIRequest.NewContextOptions()
.setIgnoreHTTPSErrors(true) // TODO: remove once we can pass a custom CA.
.setClientCertificates(asList(
new ClientCertificate(origin(server.PREFIX))
.setCertPath(asset("client-certificates/client/trusted/cert.pem"))
.setKeyPath(asset("client-certificates/client/trusted/key.pem"))));
APIRequestContext request = playwright.request().newContext(requestOptions);
APIResponse response = request.get(server.PREFIX + "/one-style.html");
assertEquals(server.PREFIX + "/one-style.html", response.url());
assertEquals(200, response.status());
assertTrue(response.text().contains("<div>hello, world!</div>"));
request.dispose();
}
@Test
public void shouldThrowWithUntrustedClientCerts() {
APIRequest.NewContextOptions requestOptions = new APIRequest.NewContextOptions()
.setIgnoreHTTPSErrors(true) // TODO: remove once we can pass a custom CA.
.setClientCertificates(asList(
new ClientCertificate(customServer.origin)
.setCertPath(asset("client-certificates/client/self-signed/cert.pem"))
.setKeyPath(asset("client-certificates/client/self-signed/key.pem"))));
APIRequestContext request = playwright.request().newContext(requestOptions);
APIResponse response = request.get(customServer.url);
assertEquals(customServer.url, response.url());
assertEquals(403, response.status());
assertTrue(response.text().contains("Sorry CN=Bob, certificates from CN=Bob are not welcome here."), response.text());
request.dispose();
}
@Test
public void passWithTrustedClientCertificates() {
APIRequest.NewContextOptions requestOptions = new APIRequest.NewContextOptions()
.setIgnoreHTTPSErrors(true) // TODO: remove once we can pass a custom CA.
.setClientCertificates(asList(
new ClientCertificate(customServer.origin)
.setCertPath(asset("client-certificates/client/trusted/cert.pem"))
.setKeyPath(asset("client-certificates/client/trusted/key.pem"))));
APIRequestContext request = playwright.request().newContext(requestOptions);
APIResponse response = request.get(customServer.url);
assertEquals(customServer.url, response.url());
assertEquals(200, response.status());
assertTrue(response.text().contains("Hello CN=Alice, your certificate was issued by O=Client Certificate Demo,CN=localhost!"), response.text());
request.dispose();
}
static boolean isWebKitMacOS() {
return isWebKit() && isMac;
}
@Test
@DisabledIf(value="com.microsoft.playwright.TestClientCertificates#isWebKitMacOS", disabledReason="The network connection was lost.")
public void shouldWorkWithBrowserNewContext() {
Browser.NewContextOptions options = new Browser.NewContextOptions()
.setIgnoreHTTPSErrors(true) // TODO: remove once we can pass a custom CA.
.setClientCertificates(asList(
new ClientCertificate(customServer.origin)
.setCertPath(asset("client-certificates/client/trusted/cert.pem"))
.setKeyPath(asset("client-certificates/client/trusted/key.pem"))));
try (BrowserContext context = browser.newContext(options)) {
Page page = context.newPage();
assertThrows(PlaywrightException.class, () -> page.navigate(customServer.crossOrigin));
assertThrows(PlaywrightException.class, () -> page.request().get(customServer.crossOrigin));
page.navigate(customServer.url);
assertThat(page.getByText("Hello CN=Alice")).isVisible();
APIResponse response = page.request().get(customServer.url);
assertTrue(response.text().contains("Hello CN=Alice"), response.text());
}
}
@Test
@DisabledIf(value="com.microsoft.playwright.TestClientCertificates#isWebKitMacOS", disabledReason="The network connection was lost.")
public void shouldWorkWithBrowserNewPage() {
Browser.NewPageOptions options = new Browser.NewPageOptions()
.setIgnoreHTTPSErrors(true) // TODO: remove once we can pass a custom CA.
.setClientCertificates(asList(
new ClientCertificate(customServer.origin)
.setCertPath(asset("client-certificates/client/trusted/cert.pem"))
.setKeyPath(asset("client-certificates/client/trusted/key.pem"))));
try (Page page = browser.newPage(options)) {
assertThrows(PlaywrightException.class, () -> page.navigate(customServer.crossOrigin));
assertThrows(PlaywrightException.class, () -> page.request().get(customServer.crossOrigin));
page.navigate(customServer.url);
assertThat(page.getByText("Hello CN=Alice")).isVisible();
APIResponse response = page.request().get(customServer.url);
assertTrue(response.text().contains("Hello CN=Alice"), response.text());
}
}
@Test
@DisabledIf(value="com.microsoft.playwright.TestClientCertificates#isWebKitMacOS", disabledReason="The network connection was lost.")
public void shouldWorkWithBrowserLaunchPersistentContext(@TempDir Path tmpDir) {
BrowserType.LaunchPersistentContextOptions options = new BrowserType.LaunchPersistentContextOptions()
.setIgnoreHTTPSErrors(true) // TODO: remove once we can pass a custom CA.
.setClientCertificates(asList(
new ClientCertificate(customServer.origin)
.setCertPath(asset("client-certificates/client/trusted/cert.pem"))
.setKeyPath(asset("client-certificates/client/trusted/key.pem"))));
try (BrowserContext context = browser.browserType().launchPersistentContext(tmpDir.resolve("profile") , options)) {
Page page = context.pages().get(0);
assertThrows(PlaywrightException.class, () -> page.navigate(customServer.crossOrigin));
assertThrows(PlaywrightException.class, () -> page.request().get(customServer.crossOrigin));
page.navigate(customServer.url);
assertThat(page.getByText("Hello CN=Alice")).isVisible();
APIResponse response = page.request().get(customServer.url);
assertTrue(response.text().contains("Hello CN=Alice"), response.text());
}
}
}
@@ -43,9 +43,9 @@ public class TestElementHandleConvenience extends TestBase {
String text = String.join("", Collections.nCopies(100, "😛"));
page.setContent("<div title='" + text + "'>" + text + "</div>");
ElementHandle handle = page.querySelector("div");
context.waitForCondition(() -> "JSHandle@<div title=\"😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛\">😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛…</div>"
context.waitForCondition(() -> "JSHandle@<div title=\"😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛>😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛…</div>"
.equals(handle.toString()), new BrowserContext.WaitForConditionOptions().setTimeout(5_000));
assertEquals("JSHandle@<div title=\"😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛\">😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛…</div>", handle.toString());
assertEquals("JSHandle@<div title=\"😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛>😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛…</div>", handle.toString());
}
@Test
@@ -18,7 +18,6 @@ package com.microsoft.playwright;
import com.google.gson.Gson;
import com.microsoft.playwright.options.HttpCredentials;
import com.microsoft.playwright.options.HttpCredentialsSend;
import com.microsoft.playwright.options.HttpHeader;
import com.microsoft.playwright.options.RequestOptions;
import org.junit.jupiter.api.Disabled;
@@ -26,7 +25,6 @@ import org.junit.jupiter.api.Test;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.util.Base64;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.ExecutionException;
@@ -492,60 +490,4 @@ public class TestGlobalFetch extends TestBase {
assertEquals(401, response.status());
}
@Test
void shouldSupportHTTPCredentialsSendImmediately() throws InterruptedException, ExecutionException {
APIRequestContext request = playwright.request().newContext(new APIRequest.NewContextOptions()
.setHttpCredentials(new HttpCredentials("user", "pass")
.setOrigin(server.PREFIX.toUpperCase())
.setSend(HttpCredentialsSend.ALWAYS)));
Future<Server.Request> serverRequestFuture = server.futureRequest("/empty.html");
APIResponse response = request.get(server.EMPTY_PAGE);
assertEquals("Basic " + Base64.getEncoder().encodeToString("user:pass".getBytes()),
serverRequestFuture.get().headers.getFirst("authorization"));
assertEquals(200, response.status());
// Second request and response to another origin
serverRequestFuture = server.futureRequest("/empty.html");
response = request.get(server.CROSS_PROCESS_PREFIX + "/empty.html");
// Not sent to another origin
assertNull(serverRequestFuture.get().headers.get("authorization"));
assertEquals(200, response.status());
request.dispose();
}
@Test
void shouldSupportDisposeReason() {
APIRequestContext request = playwright.request().newContext();
request.dispose(new APIRequestContext.DisposeOptions().setReason("My reason"));
PlaywrightException e = assertThrows(PlaywrightException.class, () -> request.get(server.EMPTY_PAGE));
assertTrue(e.getMessage().contains("My reason"), e.getMessage());
}
@Test
public void shouldRetryECONNRESET() {
int[] requestCount = {0};
server.setRoute("/test", exchange -> {
if (requestCount[0]++ < 3) {
exchange.close();
return;
}
exchange.getResponseHeaders().add("Content-Type", "text/plain");
exchange.sendResponseHeaders(200, 0);
try (OutputStreamWriter writer = new OutputStreamWriter(exchange.getResponseBody())) {
writer.write("Hello!");
}
});
APIRequestContext requestContext = playwright.request().newContext();
APIResponse response = requestContext.get(server.PREFIX + "/test",
RequestOptions.create().setMaxRetries(3));
assertEquals(200, response.status());
assertEquals("Hello!", response.text());
assertEquals(4, requestCount[0]);
requestContext.dispose();
}
}
@@ -16,12 +16,9 @@
package com.microsoft.playwright;
import com.microsoft.playwright.options.KeyboardModifier;
import org.junit.jupiter.api.Test;
import static com.microsoft.playwright.assertions.PlaywrightAssertions.assertThat;
import static java.util.Arrays.asList;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.*;
public class TestLocatorClick extends TestBase {
@@ -57,12 +54,4 @@ public class TestLocatorClick extends TestBase {
assertEquals(true, page.evaluate("double"));
assertEquals("Clicked", page.evaluate("result"));
}
@Test
void shouldSupportCotrolOrMetaModifier() {
page.setContent("<a href='" + server.PREFIX + "/title.html'>Go</a>");
Page newPage = page.context().waitForPage(() ->
page.getByText("Go").click(new Locator.ClickOptions().setModifiers(asList(KeyboardModifier.CONTROLORMETA))));
assertThat(newPage).hasURL(server.PREFIX + "/title.html");
}
}
@@ -16,12 +16,14 @@
package com.microsoft.playwright;
import com.microsoft.playwright.options.HttpHeader;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledIf;
import java.io.OutputStreamWriter;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.stream.Collectors;
@@ -111,50 +113,15 @@ public class TestNetworkRequest extends TestBase {
assertTrue(response.request().headers().get("user-agent").contains("WebKit"));
}
static boolean isWebKitWindowsOrChromium() {
return (isWebKit() && getOS() == Utils.OS.WINDOWS) || isChromium();
}
static boolean isWebKitWindows() {
return isWebKit() && getOS() == Utils.OS.WINDOWS;
}
// HTTP server in java does not preserve headers order.
static List<HttpHeader> normalizeServerHeaders(Map<String,List<String>> headers) {
List<HttpHeader> serverHeaders = new ArrayList<>();
for (Map.Entry<String, List<String>> entry : headers.entrySet()) {
for (String value: entry.getValue()) {
HttpHeader header = new HttpHeader();
header.name = entry.getKey().toLowerCase();
header.value = value;
serverHeaders.add(header);
}
}
Comparator<HttpHeader> comparator = Comparator.comparing(h -> h.name);
serverHeaders.sort(comparator);
return serverHeaders;
}
static List<HttpHeader> normalizeAllHeaders(Map<String, String> headers) {
List<HttpHeader> serverHeaders = new ArrayList<>();
for (Map.Entry<String, String> entry : headers.entrySet()) {
HttpHeader header = new HttpHeader();
header.name = entry.getKey().toLowerCase();
header.value = entry.getValue();
serverHeaders.add(header);
}
Comparator<HttpHeader> comparator = Comparator.comparing(h -> h.name);
serverHeaders.sort(comparator);
return serverHeaders;
}
static List<HttpHeader> adjustServerHeaders(List<HttpHeader> headers) {
if (isFirefox()) {
for (Iterator<HttpHeader> it = headers.iterator(); it.hasNext(); ) {
if ("priority".equals(it.next().name)) {
it.remove();
}
}
}
return headers;
}
@Test
@DisabledIf(value="isWebKitWindows", disabledReason="Flaky, see https://github.com/microsoft/playwright/issues/6690")
void shouldGetTheSameHeadersAsTheServer() throws ExecutionException, InterruptedException {
@@ -166,10 +133,9 @@ public class TestNetworkRequest extends TestBase {
}
});
Response response = page.navigate(server.PREFIX + "/empty.html");
List<HttpHeader> expectedHeaders = adjustServerHeaders(normalizeServerHeaders(serverRequest.get().headers));
List<HttpHeader> allHeaders = normalizeAllHeaders(response.request().allHeaders());
assertJsonEquals(expectedHeaders, allHeaders);
Map<String, String> expectedHeaders = serverRequest.get().headers.entrySet().stream().collect(
Collectors.toMap(e -> e.getKey().toLowerCase(), e -> e.getValue().get(0)));
assertEquals(expectedHeaders, response.request().allHeaders());
}
@Test
@@ -191,9 +157,9 @@ public class TestNetworkRequest extends TestBase {
"}", server.CROSS_PROCESS_PREFIX + "/something");
assertEquals("done", text);
});
List<HttpHeader> expectedHeaders = adjustServerHeaders(normalizeServerHeaders(serverRequest.get().headers));
List<HttpHeader> allHeaders = normalizeAllHeaders(response.request().allHeaders());
assertJsonEquals(expectedHeaders, allHeaders);
Map<String, String> expectedHeaders = serverRequest.get().headers.entrySet().stream().collect(
Collectors.toMap(e -> e.getKey().toLowerCase(), e -> e.getValue().get(0)));
assertEquals(expectedHeaders, response.request().allHeaders());
}
@Test
@@ -1,464 +0,0 @@
package com.microsoft.playwright;
import com.microsoft.playwright.junit.FixtureTest;
import com.microsoft.playwright.junit.UsePlaywright;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import static com.microsoft.playwright.Utils.assertJsonEquals;
import static org.junit.jupiter.api.Assertions.*;
@FixtureTest
@UsePlaywright
public class TestPageClock {
private ArrayList<Object> calls;
@BeforeEach
void exposeStubFunction(Page page) {
calls = new ArrayList();
page.exposeFunction("stub", (Object... params) -> {
calls.add(params);
return null;
});
}
private void setupRunForTest(Page page) {
page.clock().install(new Clock.InstallOptions().setTime(0));
page.clock().pauseAt(1000);
}
@Test
void runForTriggersImmediatelyWithoutSpecifiedDelay(Page page) {
setupRunForTest(page);
page.evaluate("() => setTimeout(window.stub)");
page.clock().runFor(0);
assertEquals(1, calls.size());
}
@Test
void runForDoesNotTriggerWithoutSufficientDelay(Page page) {
setupRunForTest(page);
// Trigger the stub with a delay
page.evaluate("() => setTimeout(window.stub, 100)");
page.clock().runFor(11);
assertEquals(0, calls.size());
}
@Test
void runForTriggersAfterSufficientDelay(Page page) {
setupRunForTest(page);
page.evaluate("() => setTimeout(window.stub, 100)");
page.clock().runFor(100);
assertEquals(1, calls.size());
}
@Test
void runForTriggersSimultaneousTimers(Page page) {
setupRunForTest(page);
page.evaluate("() => { setTimeout(window.stub, 100);" +
"setTimeout(window.stub, 100); }");
page.clock().runFor(100);
assertEquals(2, calls.size());
}
@Test
void runForTriggersMultipleSimultaneousTimers(Page page) {
setupRunForTest(page);
page.evaluate("() => { setTimeout(window.stub, 100);" +
"setTimeout(window.stub, 100);" +
"setTimeout(window.stub, 99);" +
"setTimeout(window.stub, 100); }");
page.clock().runFor(100);
assertEquals(4, calls.size());
}
@Test
void runForWaitsAfterSetTimeoutWasCalled(Page page) {
setupRunForTest(page);
page.evaluate("() => setTimeout(window.stub, 150)");
page.clock().runFor(50);
assertEquals(0, calls.size());
page.clock().runFor(100);
assertEquals(1, calls.size());
}
@Test
void runForTriggersEventWhenSomeThrow(Page page) {
setupRunForTest(page);
page.evaluate("() => {\n" +
" setTimeout(() => {throw new Error(); }, 100);\n" +
" setTimeout(window.stub, 120);\n" +
"}");
assertThrows(PlaywrightException.class, () -> page.clock().runFor(120));
assertEquals(1, calls.size());
}
@Test
void runForCreatesUpdatedDateWhileTicking(Page page) {
setupRunForTest(page);
page.clock().setSystemTime(0);
page.evaluate("() => setInterval(() => { window.stub(new Date().getTime()); }, 10)");
page.clock().runFor(100);
assertJsonEquals("[[10],[20],[30],[40],[50],[60],[70],[80],[90],[100]]", calls);
}
@Test
void runForPasses8Seconds(Page page) {
setupRunForTest(page);
page.evaluate("() => setInterval(window.stub, 4000)");
page.clock().runFor("08");
assertEquals(2, calls.size());
}
@Test
void runForPasses1Minute(Page page) {
setupRunForTest(page);
page.evaluate("() => setInterval(window.stub, 6000)");
page.clock().runFor("01:00");
assertEquals(10, calls.size());
}
@Test
void runForPasses2Hours34MinutesAnd10Seconds(Page page) {
setupRunForTest(page);
page.evaluate("() => setInterval(window.stub, 10000)");
page.clock().runFor("02:34:10");
assertEquals(925, calls.size());
}
@Test
void runForThrowsForInvalidFormat(Page page) {
setupRunForTest(page);
page.evaluate("() => setInterval(window.stub, 10000)");
assertThrows(PlaywrightException.class, () -> page.clock().runFor("12:02:34:10"));
assertEquals(0, calls.size());
}
@Test
void runForReturnsTheCurrentNowValue(Page page) {
setupRunForTest(page);
page.clock().setSystemTime(0);
final int value = 200;
page.clock().runFor(value);
assertEquals(value, page.evaluate("() => Date.now()"));
}
private void setupFastForwardTest(Page page) {
page.clock().install(new Clock.InstallOptions().setTime(0));
page.clock().pauseAt(1000);
}
@Test
void fastForwardIgnoresTimersWhichWouldntBeRun(Page page) {
setupFastForwardTest(page);
page.evaluate("() => setTimeout(() => { window.stub('should not be logged'); }, 1000)");
page.clock().fastForward(500);
assertEquals(0, calls.size());
}
@Test
void fastForwardPushesBackExecutionTimeForSkippedTimers(Page page) {
setupFastForwardTest(page);
page.evaluate("() => setTimeout(() => { window.stub(Date.now()); }, 1000)");
page.clock().fastForward(2000);
assertEquals(1, calls.size());
assertEquals(1000 + 2000, ((Object[])calls.get(0))[0]);
}
@Test
void fastForwardSupportsStringTimeArguments(Page page) {
setupFastForwardTest(page);
page.evaluate("() => setTimeout(() => { window.stub(Date.now()); }, 100000)");
page.clock().fastForward("01:50");
assertEquals(1, calls.size());
assertEquals(1000 + 110000, ((Object[])calls.get(0))[0]);
}
private void setupStubTimers(Page page) {
page.clock().install(new Clock.InstallOptions().setTime(0));
page.clock().pauseAt(1000);
}
@Test
void setsInitialTimestamp(Page page) {
setupStubTimers(page);
page.clock().setSystemTime(1400);
assertEquals(1400, page.evaluate("() => Date.now()"));
}
@Test
void replacesGlobalSetTimeout(Page page) {
setupStubTimers(page);
page.evaluate("() => setTimeout(window.stub, 1000)");
page.clock().runFor(1000);
assertEquals(1, calls.size());
}
@Test
void globalFakeSetTimeoutShouldReturnId(Page page) {
setupStubTimers(page);
Double to = (Double) page.evaluate("() => setTimeout(window.stub, 1000)");
assertTrue(to > 0);
}
@Test
void replacesGlobalClearTimeout(Page page) {
setupStubTimers(page);
page.evaluate("() => { const to = setTimeout(window.stub, 1000); clearTimeout(to); }");
page.clock().runFor(1000);
assertEquals(0, calls.size());
}
@Test
void replacesGlobalSetInterval(Page page) {
setupStubTimers(page);
page.evaluate("() => setInterval(window.stub, 500)");
page.clock().runFor(1000);
assertEquals(2, calls.size());
}
@Test
void replacesGlobalClearInterval(Page page) {
setupStubTimers(page);
page.evaluate("() => { const to = setInterval(window.stub, 500); clearInterval(to); }");
page.clock().runFor(1000);
assertEquals(0, calls.size());
}
@Test
void replacesGlobalPerformanceNow(Page page) {
}
@Test
void fakesDateConstructor(Page page) {
setupStubTimers(page);
Integer now = (Integer) page.evaluate("() => new Date().getTime()");
assertEquals(1000, now);
}
@Test
void replacesGlobalPerformanceTimeOrigin(Page page) {
}
@Test
void shouldTickAfterPopup(Page page) throws ParseException {
page.clock().install(new Clock.InstallOptions().setTime(0));
Date now = new SimpleDateFormat("yyyy-MM-dd").parse("2015-09-25");
page.clock().pauseAt(now.getTime());
Page popup = page.waitForPopup(() -> {
page.evaluate("() => window.open('about:blank')");
});
Double popupTime = (Double) popup.evaluate("() => Date.now()");
assertEquals(now.getTime(), popupTime);
page.clock().runFor(1000);
Double popupTimeAfter = (Double) popup.evaluate("() => Date.now()");
assertEquals(now.getTime() + 1000, popupTimeAfter);
}
@Test
void shouldTickBeforePopup(Page page) throws ParseException {
page.clock().install(new Clock.InstallOptions().setTime(0));
Date now = new SimpleDateFormat("yyyy-MM-dd").parse("2015-09-25");
page.clock().pauseAt(now.getTime());
page.clock().runFor(1000);
Page popup = page.waitForPopup(() -> {
page.evaluate("() => window.open('about:blank')");
});
Double popupTime = (Double) popup.evaluate("() => Date.now()");
assertEquals(now.getTime() + 1000, popupTime);
}
@Test
void shouldRunTimeBeforePopup(Page page, Server server) {
server.setRoute("/popup.html", exchange -> {
exchange.getResponseHeaders().set("Content-type", "text/html");
exchange.sendResponseHeaders(200, 0);
try (Writer writer = new OutputStreamWriter(exchange.getResponseBody())) {
writer.write("<script>window.time = Date.now()</script>");
}
});
page.navigate(server.EMPTY_PAGE);
page.waitForTimeout(2000);
Page popup = page.waitForPopup(() -> {
page.evaluate("url => window.open(url)", server.PREFIX + "/popup.html");
});
Double popupTime = (Double) popup.evaluate("time");
assertTrue(popupTime >= 2000);
}
@Test
void shouldNotRunTimeBeforePopupOnPause(Page page, Server server) {
server.setRoute("/popup.html", exchange -> {
exchange.getResponseHeaders().set("Content-type", "text/html");
exchange.sendResponseHeaders(200, 0);
try (Writer writer = new OutputStreamWriter(exchange.getResponseBody())) {
writer.write("<script>window.time = Date.now()</script>");
}
});
page.clock().install(new Clock.InstallOptions().setTime(0));
page.clock().pauseAt(1000);
page.navigate(server.EMPTY_PAGE);
page.waitForTimeout(2000);
Page popup = page.waitForPopup(() -> {
page.evaluate("url => window.open(url)", server.PREFIX + "/popup.html");
});
Object popupTime = popup.evaluate("time");
assertEquals(1000, popupTime);
}
@Test
void setFixedTimeDoesNotFakeMethods(Page page) {
page.clock().setFixedTime(0);
// Should not stall.
page.evaluate("() => new Promise(f => setTimeout(f, 1))");
}
@Test
void setFixedTimeAllowsSettingTimeMultipleTimes(Page page) {
page.clock().setFixedTime(100);
assertEquals(100, page.evaluate("() => Date.now()"));
page.clock().setFixedTime(200);
assertEquals(200, page.evaluate("() => Date.now()"));
}
@Test
void setFixedTimeFixedTimeIsNotAffectedByClockManipulation(Page page) {
page.clock().setFixedTime(100);
assertEquals(100, page.evaluate("() => Date.now()"));
page.clock().fastForward(20);
assertEquals(100, page.evaluate("() => Date.now()"));
}
@Test
void setFixedTimeAllowsInstallingFakeTimersAfterSettingTime(Page page) {
page.clock().setFixedTime(100);
assertEquals(100, page.evaluate("() => Date.now()"));
page.clock().setFixedTime(200);
page.evaluate("async () => { setTimeout(() => window.stub(Date.now()), 0); }");
page.clock().runFor(0);
assertEquals(1, calls.size());
assertEquals(200, ((Object[]) calls.get(0))[0]);
}
@Test
void whileRunningShouldProgressTime(Page page) {
page.clock().install(new Clock.InstallOptions().setTime(0));
page.navigate("data:text/html,");
page.waitForTimeout(1000);
int now = (int) page.evaluate("() => Date.now()");
assertTrue(now >= 1000 && now <= 2000);
}
@Test
void whileRunningShouldRunFor(Page page) {
page.clock().install(new Clock.InstallOptions().setTime(0));
page.navigate("data:text/html,");
page.clock().runFor(10000);
int now = (int) page.evaluate("() => Date.now()");
assertTrue(now >= 10000 && now <= 11000);
}
@Test
void whileRunningShouldFastForward(Page page) {
page.clock().install(new Clock.InstallOptions().setTime(0));
page.navigate("data:text/html,");
page.clock().fastForward(10000);
int now = (int) page.evaluate("() => Date.now()");
assertTrue(now >= 10000 && now <= 11000);
}
@Test
void whileRunningShouldFastForwardTo(Page page) {
page.clock().install(new Clock.InstallOptions().setTime(0));
page.navigate("data:text/html,");
page.clock().fastForward(10000);
int now = (int) page.evaluate("() => Date.now()");
assertTrue(now >= 10000 && now <= 11000);
}
@Test
void whileRunningShouldPause(Page page) {
page.clock().install(new Clock.InstallOptions().setTime(0));
page.navigate("data:text/html,");
page.clock().pauseAt(1000);
page.waitForTimeout(1000);
page.clock().resume();
int now = (int) page.evaluate("() => Date.now()");
assertTrue(now >= 0 && now <= 1000);
}
@Test
void whileRunningShouldPauseAndFastForward(Page page) {
page.clock().install(new Clock.InstallOptions().setTime(0));
page.navigate("data:text/html,");
page.clock().pauseAt(1000);
page.clock().fastForward(1000);
int now = (int) page.evaluate("() => Date.now()");
assertEquals(2000, now);
}
@Test
void whileRunningShouldSetSystemTimeOnPause(Page page) {
page.clock().install(new Clock.InstallOptions().setTime(0));
page.navigate("data:text/html,");
page.clock().pauseAt(1000);
int now = (int) page.evaluate("() => Date.now()");
assertEquals(1000, now);
}
@Test
void whileOnPauseFastForwardShouldNotRunNestedImmediate(Page page) {
page.clock().install(new Clock.InstallOptions().setTime(0));
page.navigate("data:text/html,");
page.clock().pauseAt(1000);
page.evaluate("() => { setTimeout(() => { window.stub('outer'); setTimeout(() => window.stub('inner'), 0); }, 1000); }");
page.clock().fastForward(1000);
assertEquals(1, calls.size());
assertEquals("outer", ((Object[]) calls.get(0))[0]);
page.clock().fastForward(1);
assertEquals(2, calls.size());
assertEquals("inner", ((Object[]) calls.get(1))[0]);
}
@Test
void whileOnPauseRunForShouldNotRunNestedImmediate(Page page) {
page.clock().install(new Clock.InstallOptions().setTime(0));
page.navigate("data:text/html,");
page.clock().pauseAt(1000);
page.evaluate("() => { setTimeout(() => { window.stub('outer'); setTimeout(() => window.stub('inner'), 0); }, 1000); }");
page.clock().runFor(1000);
assertEquals(1, calls.size());
assertEquals("outer", ((Object[]) calls.get(0))[0]);
page.clock().runFor(1);
assertEquals(2, calls.size());
assertEquals("inner", ((Object[]) calls.get(1))[0]);
}
@Test
void whileOnPauseRunForShouldNotRunNestedImmediateFromMicrotask(Page page) {
page.clock().install(new Clock.InstallOptions().setTime(0));
page.navigate("data:text/html,");
page.clock().pauseAt(1000);
page.evaluate("() => { setTimeout(() => { window.stub('outer'); void Promise.resolve().then(() => setTimeout(() => window.stub('inner'), 0)); }, 1000); }");
page.clock().runFor(1000);
assertEquals(1, calls.size());
assertEquals("outer", ((Object[]) calls.get(0))[0]);
page.clock().runFor(1);
assertEquals(2, calls.size());
assertEquals("inner", ((Object[]) calls.get(1))[0]);
}
@Test
void shouldThrowForInvalidDate(Page page) {
Exception exception1 = assertThrows(PlaywrightException.class, () -> page.clock().setSystemTime("invalid"));
assertTrue(exception1.getMessage().contains("Invalid date: invalid"), exception1.getMessage());
}
}
@@ -539,30 +539,19 @@ public class TestPageEvaluate extends TestBase {
@Test
void shouldEvaluateException() {
Exception result = (Exception) page.evaluate("() => {\n" +
String result = (String) page.evaluate("() => {\n" +
" return (function functionOnStack() {\n" +
" return new Error('error message');\n" +
" })();\n" +
"}");
assertTrue(result.getMessage().contains("Error: error message"), result.getMessage());
assertTrue(result.getMessage().contains("functionOnStack"), result.getMessage());
assertTrue(result.contains("Error: error message"));
assertTrue(result.contains("functionOnStack"));
}
@Test
void shouldEvaluateException2() {
Exception error = (Exception) page.evaluate("new Error('error message')");
assertTrue(error.getMessage().contains("Error: error message"), error.getMessage());
}
@Test
void shouldPassExceptionArgument() {
Exception e = new Exception("error message");
Map<String, Object> received = (Map<String, Object>) page.evaluate("e => { return { message: e.message, name: e.name, stack: e.stack }; }", e);
assertEquals("error message", received.get("message"));
assertEquals("Exception", received.get("name"));
assertNotNull(received.get("stack"));
assertTrue(received.get("stack").toString().contains("shouldPassExceptionArgument"), received.get("stack").toString());
Object error = page.evaluate("new Error('error message')");
assertTrue(((String) error).contains("Error: error message"));
}
@Test
@@ -62,18 +62,12 @@ public class TestPageNetworkRequest extends TestBase {
});
responseWritten.acquire();
List<HttpHeader> expectedHeaders = serverHeaders;
if (isWebKit() && isWindows) {
expectedHeaders = expectedHeaders.stream()
.filter(h -> !"accept-encoding".equals(h.name.toLowerCase()) && !"accept-language".equals(h.name.toLowerCase()))
.collect(Collectors.toList());
}
if (isFirefox()) {
expectedHeaders = expectedHeaders.stream()
.filter(h -> !"priority".equals(h.name.toLowerCase()))
.collect(Collectors.toList());
}
List<HttpHeader> headers = request.headersArray();
// Java HTTP server normalizes header names, work around that:
@@ -21,6 +21,7 @@ import com.microsoft.playwright.options.FilePayload;
import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
import org.junit.platform.commons.support.AnnotationSupport;
import java.io.*;
import java.nio.file.Files;
@@ -428,85 +429,5 @@ public class TestPageSetInputFiles extends TestBase {
// rounds it to seconds in WebKit: 1696272058110 -> 1696272058000.
assertTrue(Math.abs(timestamps.get(0) - expected.toMillis()) < 1000, "expected: " + expected.toMillis() + "; actual: " + timestamps.get(0));
}
static void writeFile(Path file, String content) throws IOException {
try (Writer stream = new OutputStreamWriter(Files.newOutputStream(file))) {
stream.write(content);
}
}
@Test
void shouldUploadAFolder(@TempDir Path tmpDir) throws IOException {
page.navigate(server.PREFIX + "/input/folderupload.html");
Locator input = page.locator("input[name=\"file1\"]");
Path dir = tmpDir.resolve("file-upload-test");
Files.createDirectories(dir);
writeFile(dir.resolve("file1.txt"), "file1 content");
writeFile(dir.resolve("file2"), "file2 content");
Files.createDirectories(dir.resolve("sub-dir"));
writeFile(dir.resolve("sub-dir").resolve("really.txt"), "sub-dir file content");
input.setInputFiles(dir);
List<String> webkitRelativePaths = (List<String>) input.evaluate("e => [...e.files].map(f => f.webkitRelativePath)");
List<String> relativePathsSorted = new ArrayList<>(webkitRelativePaths);
relativePathsSorted.sort(String::compareTo);
// https://issues.chromium.org/issues/345393164
if (isChromium() && !isHeadful() && chromiumVersionLessThan(browser.version(), "127.0.6533.0")) {
assertEquals(asList("file-upload-test/file1.txt", "file-upload-test/file2"), relativePathsSorted);
} else {
assertEquals(asList("file-upload-test/file1.txt", "file-upload-test/file2", "file-upload-test/sub-dir/really.txt"), relativePathsSorted);
}
for (int i = 0; i < webkitRelativePaths.size(); i++) {
String relativePath = webkitRelativePaths.get(i);
Object content = input.evaluate("(e, i) => {\n" +
" const reader = new FileReader();\n" +
" const promise = new Promise(fulfill => reader.onload = fulfill);\n" +
" reader.readAsText(e.files[i]);\n" +
" return promise.then(() => reader.result);\n" +
" }", i);
String expectedContent = new String(Files.readAllBytes(tmpDir.resolve(relativePath)));
assertEquals(expectedContent, content);
}
}
@Test
void shouldUploadAFolderAndThrowForMultipleDirectories() throws IOException {
page.navigate(server.PREFIX + "/input/folderupload.html");
Locator input = page.locator("input[name=\"file1\"]");
Path dir = Paths.get("file-upload-test"); // Adjust path as necessary
Files.createDirectories(dir.resolve("folder1"));
writeFile(dir.resolve("folder1").resolve("file1.txt"), "file1 content");
Files.createDirectories(dir.resolve("folder2"));
writeFile(dir.resolve("folder2").resolve("file2.txt"), "file2 content");
PlaywrightException e = assertThrows(PlaywrightException.class,
() -> input.setInputFiles(new Path[]{dir.resolve("folder1"), dir.resolve("folder2")}));
assertTrue(e.getMessage().contains("Multiple directories are not supported"), e.getMessage());
}
@Test
void shouldThrowIfADirectoryAndFilesArePassed() throws IOException {
// Skipping conditions based on environment not directly translatable to Java; needs custom implementation
page.navigate(server.PREFIX + "/input/folderupload.html");
Locator input = page.locator("input[name=\"file1\"]");
Path dir = Paths.get("file-upload-test"); // Adjust path as necessary
Files.createDirectories(dir.resolve("folder1"));
writeFile(dir.resolve("folder1").resolve("file1.txt"), "file1 content");
PlaywrightException e = assertThrows(PlaywrightException.class,
() -> input.setInputFiles(new Path[]{ dir.resolve("folder1"), dir.resolve("folder1").resolve("file1.txt") }));
assertTrue(e.getMessage().contains("File paths must be all files or a single directory"), e.getMessage());
}
@Test
void shouldThrowWhenUploadingAFolderInANormalFileUploadInput() throws IOException {
page.navigate(server.PREFIX + "/input/fileupload.html");
Locator input = page.locator("input[name=\"file1\"]");
Path dir = Paths.get("file-upload-test"); // Adjust path as necessary
Files.createDirectories(dir);
writeFile(dir.resolve("file1.txt"), "file1 content");
PlaywrightException e = assertThrows(PlaywrightException.class,
() -> input.setInputFiles(dir));
assertTrue(e.getMessage().contains("File input does not support directories, pass individual files instead"), e.getMessage());
}
}
@@ -18,13 +18,16 @@ package com.microsoft.playwright;
import org.junit.jupiter.api.Test;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.List;
import java.util.concurrent.Semaphore;
import static com.microsoft.playwright.Utils.mapOf;
import static com.microsoft.playwright.options.KeyboardModifier.ALT;
import static com.microsoft.playwright.Utils.mapOf;
import static java.util.Arrays.asList;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class TestTap extends TestBase {
@@ -94,13 +97,26 @@ public class TestTap extends TestBase {
}
@Test
void shouldNotWaitForANavigationCausedByATap() throws InterruptedException, ExecutionException {
void shouldWaitForANavigationCausedByATap() throws InterruptedException {
page.navigate(server.EMPTY_PAGE);
page.setContent("<a href='/intercept-this.html'>link</a>;");
Future<Server.Request> serverReq = server.futureRequest("/intercept-this.html");
server.setRoute("/intercept-this.html", exchange -> {});
Semaphore responseWritten = new Semaphore(0);
List<String> events = Collections.synchronizedList(new ArrayList<>());
server.setRoute("/intercept-this.html", exchange -> {
// make sure the tap doesnt resolve too early
assertDoesNotThrow(() -> Thread.sleep(100));
exchange.getResponseHeaders().add("Content-Type", "application/octet-stream");
exchange.sendResponseHeaders(200, 0);
try (OutputStreamWriter writer = new OutputStreamWriter(exchange.getResponseBody())) {
writer.write("foo");
}
events.add("sent response");
responseWritten.release();
});
page.tap("a");
serverReq.get();
events.add("tap finished");
responseWritten.acquire();
assertEquals(asList("sent response", "tap finished"), events);
}
@Test
@@ -1,66 +0,0 @@
# Client Certificate test-certificates
## Server
```bash
openssl req \
-x509 \
-newkey rsa:4096 \
-keyout server/server_key.pem \
-out server/server_cert.pem \
-nodes \
-days 365 \
-subj "/CN=localhost/O=Client\ Certificate\ Demo" \
-addext "subjectAltName=DNS:localhost,DNS:local.playwright"
```
## Trusted client-certificate (server signed/valid)
```
mkdir -p client/trusted
# generate server-signed (valid) certifcate
openssl req \
-newkey rsa:4096 \
-keyout client/trusted/key.pem \
-out client/trusted/csr.pem \
-nodes \
-days 365 \
-subj "/CN=Alice"
# sign with server_cert.pem
openssl x509 \
-req \
-in client/trusted/csr.pem \
-CA server/server_cert.pem \
-CAkey server/server_key.pem \
-out client/trusted/cert.pem \
-set_serial 01 \
-days 365
```
## Self-signed certificate (invalid)
```
mkdir -p client/self-signed
openssl req \
-newkey rsa:4096 \
-keyout client/self-signed/key.pem \
-out client/self-signed/csr.pem \
-nodes \
-days 365 \
-subj "/CN=Bob"
# sign with self-signed/key.pem
openssl x509 \
-req \
-in client/self-signed/csr.pem \
-signkey client/self-signed/key.pem \
-out client/self-signed/cert.pem \
-days 365
```
## Java: Convert PEM Files to PKCS12
```
openssl pkcs12 -export -in server_cert.pem -inkey server_key.pem -out server_keystore.p12 -name myalias
```
@@ -1,28 +0,0 @@
-----BEG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cdEvDLT81W+JZ2mX
8ynLaTs3oV3BjQya9pAUyzIX5L67
-----END PRIVATE KEY-----
@@ -1,12 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Folder upload test</title>
</head>
<body>
<form action="/upload" method="post" enctype="multipart/form-data">
<input type="file" name="file1" webkitdirectory>
<input type="submit">
</form>
</body>
</html>
+8 -8
View File
@@ -6,7 +6,7 @@
<groupId>com.microsoft.playwright</groupId>
<artifactId>parent-pom</artifactId>
<version>1.46.0</version>
<version>1.44.0</version>
<packaging>pom</packaging>
<name>Playwright Parent Project</name>
<description>Java library to automate Chromium, Firefox and WebKit with a single API.
@@ -44,10 +44,10 @@
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<maven.compiler.parameters>true</maven.compiler.parameters>
<gson.version>2.11.0</gson.version>
<junit.version>5.10.3</junit.version>
<gson.version>2.10.1</gson.version>
<junit.version>5.10.2</junit.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<websocket.version>1.5.7</websocket.version>
<websocket.version>1.5.6</websocket.version>
<opentest4j.version>1.3.0</opentest4j.version>
</properties>
@@ -100,7 +100,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.4.0</version>
<version>3.3.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -130,7 +130,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.8.0</version>
<version>3.6.3</version>
<configuration>
<additionalOptions>--allow-script-in-comments</additionalOptions>
<failOnError>false</failOnError>
@@ -141,7 +141,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.3.1</version>
<version>3.2.5</version>
<configuration>
<properties>
<configurationParameters>
@@ -166,7 +166,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.4.2</version>
<version>3.4.1</version>
<configuration>
<archive>
<manifest>
+1
View File
@@ -0,0 +1 @@
1.44.0
-1
View File
@@ -1 +0,0 @@
1.46.0
-57
View File
@@ -1,57 +0,0 @@
#!/bin/bash
set -e
set +x
trap "cd $(pwd -P)" EXIT
cd "$(dirname $0)"
if [[ ($1 == '-h') || ($1 == '--help') ]]; then
echo ""
echo "This script for downloading playwright driver for all platforms."
echo "The downloaded files will be put under 'driver-bundle/src/main/resources/driver'."
echo ""
echo "Usage: scripts/download_driver.sh [option]"
echo ""
echo "Options:"
echo " -h, --help display help information"
echo ""
exit 0
fi
DRIVER_VERSION=$(head -1 ./DRIVER_VERSION)
FILE_PREFIX=playwright-$DRIVER_VERSION
cd ../driver-bundle/src/main/resources
if [[ -d 'driver' ]]; then
echo "Deleting existing drivers from $(pwd)"
rm -rf driver
fi
mkdir -p driver
cd driver
for PLATFORM in mac mac-arm64 linux linux-arm64 win32_x64
do
FILE_NAME=$FILE_PREFIX-$PLATFORM.zip
mkdir $PLATFORM
cd $PLATFORM
echo "Downloading driver for $PLATFORM to $(pwd)"
URL=https://playwright.azureedge.net/builds/driver
if [[ "$DRIVER_VERSION" == *-alpha* || "$DRIVER_VERSION" == *-beta* || "$DRIVER_VERSION" == *-next* ]]; then
URL=$URL/next
fi
URL=$URL/$FILE_NAME
echo "Using url: $URL"
curl -O $URL
unzip $FILE_NAME -d .
rm $FILE_NAME
cd -
done
echo ""
echo "All drivers have been successfully downloaded."
echo ""
+63
View File
@@ -0,0 +1,63 @@
#!/bin/bash
set -e
set +x
trap "cd $(pwd -P)" EXIT
cd "$(dirname $0)"
if [[ ($1 == '-h') || ($1 == '--help') ]]; then
echo ""
echo "This script for downloading playwright-cli binaries for all platforms."
echo "The downloaded files will be put into directory 'driver-bundle/src/main/resources/driver'."
echo ""
echo "Usage: scripts/download_driver_for_all_platforms.sh [option]"
echo ""
echo "Options:"
echo " -h, --help display help information"
echo " -f, --force delete existing drivers and download them again"
echo ""
exit 0
fi
CLI_VERSION=$(head -1 ./CLI_VERSION)
FILE_PREFIX=playwright-$CLI_VERSION
cd ../driver-bundle/src/main/resources
if [[ ($1 == '-f') || ($1 == '--force') ]]; then
echo "Deleting existing drivers from $(pwd)"
rm -rf driver
fi
mkdir -p driver
cd driver
for PLATFORM in mac mac-arm64 linux linux-arm64 win32_x64
do
FILE_NAME=$FILE_PREFIX-$PLATFORM.zip
if [[ -d $PLATFORM ]]; then
echo "Skipping driver download for $PLATFORM ($(pwd)/$PLATFORM already exists)"
continue
fi
mkdir $PLATFORM
cd $PLATFORM
echo "Downloading driver for $PLATFORM to $(pwd)"
URL=https://playwright.azureedge.net/builds/driver
if [[ "$CLI_VERSION" == *-alpha* || "$CLI_VERSION" == *-beta* || "$CLI_VERSION" == *-next* ]]; then
URL=$URL/next
fi
URL=$URL/$FILE_NAME
echo "Using url: $URL"
curl -O $URL
unzip $FILE_NAME -d .
rm $FILE_NAME
cd -
done
echo ""
echo "All drivers have been downloaded successfully, use '-f' or '--force' option to delete and download them again if you want."
echo "For more details, you can use '-h' or '--help' option, or read the CONTRIBUTING.md for reference."
echo ""
-27
View File
@@ -1,27 +0,0 @@
#!/bin/bash
set -e
set +x
trap "cd $(pwd -P)" EXIT
cd "$(dirname $0)"
if [ "$#" -ne 1 ]; then
echo ""
echo "Usage: scripts/roll_driver.sh [new version]"
echo ""
exit 1
fi
NEW_VERSION=$1
CURRENT_VERSION=$(head -1 ./DRIVER_VERSION)
if [[ "$CURRENT_VERSION" == "$NEW_VERSION" ]]; then
echo "Current version is up to date. Skipping driver download.";
else
echo $NEW_VERSION > ./DRIVER_VERSION
./download_driver.sh
fi;
./generate_api.sh
./update_readme.sh
+1 -1
View File
@@ -6,7 +6,7 @@
<groupId>com.microsoft.playwright</groupId>
<artifactId>api-generator</artifactId>
<version>1.46.0</version>
<version>1.44.0</version>
<name>Playwright - API Generator</name>
<description>
This is an internal module used to generate Java API from the upstream Playwright
@@ -276,11 +276,6 @@ class TypeRef extends Element {
private static final Map<String, String> customTypeNames = new HashMap<>();
static {
customTypeNames.put("APIRequest.newContext.options.clientCertificates", "ClientCertificate");
customTypeNames.put("Browser.newContext.options.clientCertificates", "ClientCertificate");
customTypeNames.put("Browser.newPage.options.clientCertificates", "ClientCertificate");
customTypeNames.put("BrowserType.launchPersistentContext.options.clientCertificates", "ClientCertificate");
customTypeNames.put("BrowserContext.addCookies.cookies", "Cookie");
customTypeNames.put("BrowserContext.cookies", "Cookie");
@@ -983,9 +978,6 @@ class Interface extends TypeDefinition {
if (asList("Page", "Frame", "ElementHandle", "Locator", "FormData", "APIRequest", "APIRequestContext", "FileChooser", "Browser", "BrowserContext", "BrowserType", "Download", "Route", "Selectors", "Tracing", "Video").contains(jsonName)) {
output.add("import java.nio.file.Path;");
}
if ("Clock".equals(jsonName)) {
output.add("import java.util.Date;");
}
if (asList("Page", "Frame", "ElementHandle", "Locator", "APIRequest", "Browser", "BrowserContext", "BrowserType", "Route", "Request", "Response", "JSHandle", "ConsoleMessage", "APIResponse", "Playwright").contains(jsonName)) {
output.add("import java.util.*;");
}
@@ -1100,9 +1092,8 @@ class CustomClass extends TypeDefinition {
@Override
void writeTo(List<String> output, String offset) {
if (asList("ClientCertificate").contains(name)) {
if (asList("RecordHar", "RecordVideo").contains(name)) {
output.add("import java.nio.file.Path;");
output.add("");
}
String access = (parent.typeScope() instanceof CustomClass) || topLevelTypes().containsKey(name) ? "public " : "";
output.add(offset + access + "class " + name + " {");
+1 -1
View File
@@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.microsoft.playwright</groupId>
<artifactId>test-cli-fatjar</artifactId>
<version>1.46.0</version>
<version>1.44.0</version>
<name>Test Playwright Command Line FatJar</name>
<properties>
<compiler.version>1.8</compiler.version>
+1 -1
View File
@@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.microsoft.playwright</groupId>
<artifactId>test-cli-version</artifactId>
<version>1.46.0</version>
<version>1.44.0</version>
<name>Test Playwright Command Line Version</name>
<properties>
<compiler.version>1.8</compiler.version>
+3 -3
View File
@@ -15,14 +15,14 @@ mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="--ve
echo "Running TestApp..."
mvn compile exec:java -e -Dexec.mainClass=com.microsoft.playwright.testcliversion.TestApp 2>&1 | tee ${TMP_DIR}/app.txt
DRIVER_VERSION=$(cat ${TMP_DIR}/cli.txt | tail -n 1 | cut -d\ -f2)
CLI_VERSION=$(cat ${TMP_DIR}/cli.txt | tail -n 1 | cut -d\ -f2)
PACKAGE_VERSION=$(cat ${TMP_DIR}/app.txt | grep ImplementationVersion | cut -d\ -f2)
rm -rf $TMP_DIR
echo "Comparing versions: ${DRIVER_VERSION} and ${PACKAGE_VERSION}"
echo "Comparing versions: ${CLI_VERSION} and ${PACKAGE_VERSION}"
if [[ "$DRIVER_VERSION" == "$PACKAGE_VERSION" ]];
if [[ "$CLI_VERSION" == "$PACKAGE_VERSION" ]];
then
echo "SUCCESS.";
else
+1 -1
View File
@@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.microsoft.playwright</groupId>
<artifactId>test-local-installation</artifactId>
<version>1.46.0</version>
<version>1.44.0</version>
<name>Test local installation</name>
<description>Runs Playwright test suite (copied from playwright module) against locally cached Playwright</description>
<properties>
+1 -1
View File
@@ -9,7 +9,7 @@
</parent>
<groupId>com.microsoft.playwright</groupId>
<artifactId>test-spring-boot-starter</artifactId>
<version>1.46.0</version>
<version>1.44.0</version>
<name>Test Playwright With Spring Boot</name>
<properties>
<spring.version>2.4.3</spring.version>
+1 -1
View File
@@ -6,7 +6,7 @@
<groupId>com.microsoft.playwright</groupId>
<artifactId>update-version</artifactId>
<version>1.46.0</version>
<version>1.44.0</version>
<name>Playwright - Update Version in Documentation</name>
<description>
This is an internal module used to update versions in the documentation based on
+1 -1
View File
@@ -41,7 +41,7 @@ RUN mkdir /ms-playwright && \
COPY . /tmp/pw-java
RUN cd /tmp/pw-java && \
./scripts/download_driver.sh && \
./scripts/download_driver_for_all_platforms.sh && \
mvn install -D skipTests --no-transfer-progress && \
DEBIAN_FRONTEND=noninteractive mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI \
-D exec.args="install-deps" -f playwright/pom.xml --no-transfer-progress && \
+1 -1
View File
@@ -41,7 +41,7 @@ RUN mkdir /ms-playwright && \
COPY . /tmp/pw-java
RUN cd /tmp/pw-java && \
./scripts/download_driver.sh && \
./scripts/download_driver_for_all_platforms.sh && \
mvn install -D skipTests --no-transfer-progress && \
DEBIAN_FRONTEND=noninteractive mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI \
-D exec.args="install-deps" -f playwright/pom.xml --no-transfer-progress && \