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

Compare commits

...

16 Commits

Author SHA1 Message Date
Yury Semikhatsky fc07c91276 chore: roll driver, mark 1.20.1 (#862) 2022-03-23 16:49:11 -07:00
Yury Semikhatsky 6ae0df89fa fix: docker publishing (#851) 2022-03-14 20:22:53 -07:00
Yury Semikhatsky 5faf1b028a chore: update driver to 1.20.0 (#846) 2022-03-14 19:51:14 -07:00
Yury Semikhatsky 0212ebe3df devops: do not cache mvn packages (#848) (#850) 2022-03-14 19:04:43 -07:00
Yury Semikhatsky eee7732f1f chore: set version to 1.20.0 (#845) 2022-03-14 17:14:56 -07:00
Yury Semikhatsky 43ba37817b fix: send x-playwright-browser (#844) 2022-03-14 15:31:19 -07:00
Yury Semikhatsky 4916ba22af chore: roll driver (#838) 2022-03-14 12:04:20 -07:00
uchagani 94f72694f1 chore: move chmod command to after browsers are installed and consolidate co… (#835)
Co-authored-by: Max Schmitt <max@schmitt.mx>
2022-03-09 18:22:00 +01:00
Max Schmitt be167a161b devops: trigger Docker tests on Dockerfile changes (#839) 2022-03-09 09:08:36 -08:00
Yury Semikhatsky 187d2ad6c6 devops: restore test docker trigger (#840) 2022-03-09 09:07:07 -08:00
Max Schmitt 68a7dbc1e3 devops: publish no arm Docker for now (#837) 2022-03-08 22:01:54 +01:00
Yury Semikhatsky 1153d473fb feat: roll driver to 3/3/22 (#832) 2022-03-04 08:31:13 -08:00
Max Schmitt 00d53bd1ea devops: fix Docker publishing 2 2022-03-04 00:05:14 +01:00
Max Schmitt d423733d9d devops: fix Docker publishing 2022-03-04 00:00:16 +01:00
Max Schmitt e127abb68e chore: align Docker with upstream Docker infra (#831) 2022-03-03 22:55:21 +01:00
Yury Semikhatsky 5ee8f23380 fix(docs): drop trailing slash from link path (#818) 2022-02-17 15:26:10 -08:00
60 changed files with 1300 additions and 695 deletions
+6 -7
View File
@@ -17,10 +17,9 @@ jobs:
username: playwright
password: ${{ secrets.DOCKER_PASSWORD }}
- uses: actions/checkout@v2
- name: Build Docker image
run: docker build -t playwright-java:localbuild-focal -f Dockerfile.focal .
- name: tag & publish
run: |
./scripts/tag_image_and_push.sh playwright-java:localbuild-focal playwright.azurecr.io/public/playwright/java:next
./scripts/tag_image_and_push.sh playwright-java:localbuild-focal playwright.azurecr.io/public/playwright/java:next-focal
./scripts/tag_image_and_push.sh playwright-java:localbuild-focal playwright.azurecr.io/public/playwright/java:sha-${{ github.sha }}
- name: Set up Docker QEMU for arm64 docker builds
uses: docker/setup-qemu-action@v1
with:
platforms: arm64
- name: publish docker canary
run: ./utils/docker/publish_docker.sh canary
+8 -16
View File
@@ -17,20 +17,12 @@ jobs:
login-server: playwright.azurecr.io
username: playwright
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up Docker QEMU for arm64 docker builds
uses: docker/setup-qemu-action@v1
with:
platforms: arm64
- uses: actions/checkout@v2
- name: Build Docker image
run: docker build -t playwright-java:localbuild-focal -f Dockerfile.focal .
- name: tag & publish
run: |
# GITHUB_REF has a form of `refs/tags/v1.3.0`.
# TAG_NAME would be `v1.3.0`
TAG_NAME=${GITHUB_REF#refs/tags/}
if [[ ! "$TAG_NAME" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]];
then
echo "Wrong TAG_NAME format: $TAG_NAME"
exit 1
fi
./scripts/tag_image_and_push.sh playwright-java:localbuild-focal playwright.azurecr.io/public/playwright/java:latest
./scripts/tag_image_and_push.sh playwright-java:localbuild-focal playwright.azurecr.io/public/playwright/java:focal
./scripts/tag_image_and_push.sh playwright-java:localbuild-focal playwright.azurecr.io/public/playwright/java:${TAG_NAME}
./scripts/tag_image_and_push.sh playwright-java:localbuild-focal playwright.azurecr.io/public/playwright/java:${TAG_NAME}-focal
- run: ./utils/docker/publish_docker.sh stable
if: (github.event_name != 'workflow_dispatch' && !github.event.release.prerelease) || (github.event_name == 'workflow_dispatch' && github.event.inputs.is_release == 'true')
- run: ./utils/docker/publish_docker.sh canary
if: (github.event_name != 'workflow_dispatch' && github.event.release.prerelease) || (github.event_name == 'workflow_dispatch' && github.event.inputs.is_release != 'true')
+9 -29
View File
@@ -19,23 +19,17 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: microsoft/playwright-github-action@v1.5.0
- uses: microsoft/playwright-github-action@v1
- name: Set up JDK 1.8
uses: actions/setup-java@v2
with:
distribution: zulu
java-version: 8
- name: Cache Maven packages
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Download drivers
shell: bash
run: scripts/download_driver_for_all_platforms.sh
- name: Build with Maven
run: mvn -B package -D skipTests --no-transfer-progress
- name: Build & Install
run: mvn -B install -D skipTests --no-transfer-progress
- name: Run tests
run: mvn test --no-transfer-progress --fail-at-end
env:
@@ -50,7 +44,6 @@ jobs:
env:
BROWSER: ${{ matrix.browser }}
run: |
mvn -B install -D skipTests --no-transfer-progress
cd tools/test-spring-boot-starter
mvn package -D skipTests --no-transfer-progress
java -jar target/test-spring-boot*.jar
@@ -70,7 +63,7 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: microsoft/playwright-github-action@v1.5.0
- uses: microsoft/playwright-github-action@v1
- name: Install Media Pack
if: matrix.os == 'windows-latest'
shell: powershell
@@ -80,17 +73,11 @@ jobs:
with:
distribution: zulu
java-version: 8
- name: Cache Maven packages
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Download drivers
shell: bash
run: scripts/download_driver_for_all_platforms.sh
- name: Build with Maven
run: mvn -B package -D skipTests --no-transfer-progress
- name: Build & Install
run: mvn -B install -D skipTests --no-transfer-progress
- name: Run tests
run: mvn test --no-transfer-progress --fail-at-end
env:
@@ -106,23 +93,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: microsoft/playwright-github-action@v1.5.0
- uses: microsoft/playwright-github-action@v1
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: adopt
java-version: 17
- name: Cache Maven packages
uses: actions/cache@v2
with:
path: ~/.m2
key: m2-${{ hashFiles('**/pom.xml') }}
restore-keys: m2
- name: Download drivers
shell: bash
run: scripts/download_driver_for_all_platforms.sh
- name: Build with Maven
run: mvn -B package -D skipTests --no-transfer-progress
- name: Build & Install
run: mvn -B install -D skipTests --no-transfer-progress
- name: Run tests
run: mvn test --no-transfer-progress --fail-at-end
env:
@@ -132,7 +113,6 @@ jobs:
env:
BROWSER: ${{ matrix.browser }}
run: |
mvn -B install -D skipTests --no-transfer-progress
cd tools/test-spring-boot-starter
mvn package -D skipTests --no-transfer-progress
java -jar target/test-spring-boot*.jar
+3 -3
View File
@@ -3,14 +3,14 @@ on:
push:
paths:
- '.github/workflows/test_docker.yml'
- 'Dockerfile*'
- '**/Dockerfile*'
branches:
- main
- release-*
pull_request:
paths:
- .github/workflows/test_docker.yml
- Dockerfile.*
- '**/Dockerfile*'
- scripts/CLI_VERSION
- '**/pom.xml'
branches:
@@ -23,7 +23,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Build Docker image
run: docker build -t playwright-java:localbuild-focal -f Dockerfile.focal .
run: bash utils/docker/build.sh --amd64 focal playwright-java:localbuild-focal
- name: Test
run: |
CONTAINER_ID="$(docker run --rm --ipc=host -v $(pwd):/root/playwright --name playwright-docker-test -d -t playwright-java:localbuild-focal /bin/bash)"
+2 -2
View File
@@ -11,9 +11,9 @@ Playwright is a Java library to automate [Chromium](https://www.chromium.org/Hom
| | Linux | macOS | Windows |
| :--- | :---: | :---: | :---: |
| Chromium <!-- GEN:chromium-version -->100.0.4863.0<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| Chromium <!-- GEN:chromium-version -->101.0.4929.0<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| WebKit <!-- GEN:webkit-version -->15.4<!-- GEN:stop --> | ✅ | ✅ | ✅ |
| Firefox <!-- GEN:firefox-version -->96.0.1<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| Firefox <!-- GEN:firefox-version -->97.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/next/intro/#system-requirements) for details.
+1 -1
View File
@@ -6,7 +6,7 @@
<parent>
<groupId>com.microsoft.playwright</groupId>
<artifactId>parent-pom</artifactId>
<version>1.19.0-SNAPSHOT</version>
<version>1.20.1</version>
</parent>
<artifactId>driver-bundle</artifactId>
+1 -1
View File
@@ -6,7 +6,7 @@
<parent>
<groupId>com.microsoft.playwright</groupId>
<artifactId>parent-pom</artifactId>
<version>1.19.0-SNAPSHOT</version>
<version>1.20.1</version>
</parent>
<artifactId>driver</artifactId>
+1 -1
View File
@@ -6,7 +6,7 @@
<groupId>org.example</groupId>
<artifactId>examples</artifactId>
<version>1.19.0-SNAPSHOT</version>
<version>1.20.1</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.19.0-SNAPSHOT</version>
<version>1.20.1</version>
</parent>
<artifactId>playwright</artifactId>
@@ -21,9 +21,9 @@ import java.nio.file.Path;
import java.util.*;
/**
* Exposes API that can be used for the Web API testing. Each Playwright browser context has a APIRequestContext instance
* attached which shares cookies with the page context. Its also possible to create a new APIRequestContext instance
* manually. For more information see <a href="https://playwright.dev/java/docs/class-apirequestcontext">here</a>.
* Exposes API that can be used for the Web API testing. This class is used for creating {@code APIRequestContext} instance which
* in turn can be used for sending web requests. An instance of this class can be obtained via {@link Playwright#request
* Playwright.request()}. For more information see {@code APIRequestContext}.
*/
public interface APIRequest {
class NewContextOptions {
@@ -21,9 +21,24 @@ import java.nio.file.Path;
/**
* This API is used for the Web API testing. You can use it to trigger API endpoints, configure micro-services, prepare
* environment or the service to your e2e test. When used on {@code Page} or a {@code BrowserContext}, this API will automatically use
* the cookies from the corresponding {@code BrowserContext}. This means that if you log in using this API, your e2e test will be
* logged in and vice versa.
* environment or the service to your e2e test.
*
* <p> Each Playwright browser context has associated with it {@code APIRequestContext} instance which shares cookie storage with the
* browser context and can be accessed via {@link BrowserContext#request BrowserContext.request()} or {@link Page#request
* Page.request()}. It is also possible to create a new APIRequestContext instance manually by calling {@link
* APIRequest#newContext APIRequest.newContext()}.
*
* <p> **Cookie management**
*
* <p> {@code APIRequestContext} retuned by {@link BrowserContext#request BrowserContext.request()} and {@link Page#request
* Page.request()} shares cookie storage with the corresponding {@code BrowserContext}. Each API request will have {@code Cookie}
* header populated with the values from the browser context. If the API response contains {@code Set-Cookie} header it will
* automatically update {@code BrowserContext} cookies and requests made from the page will pick them up. This means that if you
* log in using this API, your e2e test will be logged in and vice versa.
*
* <p> If you want API requests to not interfere with the browser cookies you shoud create a new {@code APIRequestContext} by calling
* {@link APIRequest#newContext APIRequest.newContext()}. Such {@code APIRequestContext} object will have its own isolated cookie
* storage.
*/
public interface APIRequestContext {
class StorageStateOptions {
@@ -497,7 +497,6 @@ public interface BrowserContext extends AutoCloseable {
* <li> {@code "midi"}</li>
* <li> {@code "midi-sysex"} (system-exclusive midi)</li>
* <li> {@code "notifications"}</li>
* <li> {@code "push"}</li>
* <li> {@code "camera"}</li>
* <li> {@code "microphone"}</li>
* <li> {@code "background-sync"}</li>
@@ -524,7 +523,6 @@ public interface BrowserContext extends AutoCloseable {
* <li> {@code "midi"}</li>
* <li> {@code "midi-sysex"} (system-exclusive midi)</li>
* <li> {@code "notifications"}</li>
* <li> {@code "push"}</li>
* <li> {@code "camera"}</li>
* <li> {@code "microphone"}</li>
* <li> {@code "background-sync"}</li>
@@ -130,7 +130,7 @@ public interface BrowserType {
/**
* Browser distribution channel. Supported values are "chrome", "chrome-beta", "chrome-dev", "chrome-canary", "msedge",
* "msedge-beta", "msedge-dev", "msedge-canary". Read more about using <a
* href="https://playwright.dev/java/docs/browsers/#google-chrome--microsoft-edge">Google Chrome and Microsoft Edge</a>.
* href="https://playwright.dev/java/docs/browsers#google-chrome--microsoft-edge">Google Chrome and Microsoft Edge</a>.
*/
public Object channel;
/**
@@ -222,7 +222,7 @@ public interface BrowserType {
/**
* Browser distribution channel. Supported values are "chrome", "chrome-beta", "chrome-dev", "chrome-canary", "msedge",
* "msedge-beta", "msedge-dev", "msedge-canary". Read more about using <a
* href="https://playwright.dev/java/docs/browsers/#google-chrome--microsoft-edge">Google Chrome and Microsoft Edge</a>.
* href="https://playwright.dev/java/docs/browsers#google-chrome--microsoft-edge">Google Chrome and Microsoft Edge</a>.
*/
public LaunchOptions setChannel(BrowserChannel channel) {
this.channel = channel;
@@ -231,7 +231,7 @@ public interface BrowserType {
/**
* Browser distribution channel. Supported values are "chrome", "chrome-beta", "chrome-dev", "chrome-canary", "msedge",
* "msedge-beta", "msedge-dev", "msedge-canary". Read more about using <a
* href="https://playwright.dev/java/docs/browsers/#google-chrome--microsoft-edge">Google Chrome and Microsoft Edge</a>.
* href="https://playwright.dev/java/docs/browsers#google-chrome--microsoft-edge">Google Chrome and Microsoft Edge</a>.
*/
public LaunchOptions setChannel(String channel) {
this.channel = channel;
@@ -399,7 +399,7 @@ public interface BrowserType {
/**
* Browser distribution channel. Supported values are "chrome", "chrome-beta", "chrome-dev", "chrome-canary", "msedge",
* "msedge-beta", "msedge-dev", "msedge-canary". Read more about using <a
* href="https://playwright.dev/java/docs/browsers/#google-chrome--microsoft-edge">Google Chrome and Microsoft Edge</a>.
* href="https://playwright.dev/java/docs/browsers#google-chrome--microsoft-edge">Google Chrome and Microsoft Edge</a>.
*/
public Object channel;
/**
@@ -625,7 +625,7 @@ public interface BrowserType {
/**
* Browser distribution channel. Supported values are "chrome", "chrome-beta", "chrome-dev", "chrome-canary", "msedge",
* "msedge-beta", "msedge-dev", "msedge-canary". Read more about using <a
* href="https://playwright.dev/java/docs/browsers/#google-chrome--microsoft-edge">Google Chrome and Microsoft Edge</a>.
* href="https://playwright.dev/java/docs/browsers#google-chrome--microsoft-edge">Google Chrome and Microsoft Edge</a>.
*/
public LaunchPersistentContextOptions setChannel(BrowserChannel channel) {
this.channel = channel;
@@ -634,7 +634,7 @@ public interface BrowserType {
/**
* Browser distribution channel. Supported values are "chrome", "chrome-beta", "chrome-dev", "chrome-canary", "msedge",
* "msedge-beta", "msedge-dev", "msedge-canary". Read more about using <a
* href="https://playwright.dev/java/docs/browsers/#google-chrome--microsoft-edge">Google Chrome and Microsoft Edge</a>.
* href="https://playwright.dev/java/docs/browsers#google-chrome--microsoft-edge">Google Chrome and Microsoft Edge</a>.
*/
public LaunchPersistentContextOptions setChannel(String channel) {
this.channel = channel;
@@ -59,7 +59,7 @@ import java.util.*;
public interface ElementHandle extends JSHandle {
class CheckOptions {
/**
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks. Defaults to
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
* {@code false}.
*/
public Boolean force;
@@ -81,14 +81,14 @@ public interface ElementHandle extends JSHandle {
*/
public Double timeout;
/**
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability/">actionability</a>
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
* performing it.
*/
public Boolean trial;
/**
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks. Defaults to
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
* {@code false}.
*/
public CheckOptions setForce(boolean force) {
@@ -129,7 +129,7 @@ public interface ElementHandle extends JSHandle {
return this;
}
/**
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability/">actionability</a>
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
* performing it.
*/
@@ -152,7 +152,7 @@ public interface ElementHandle extends JSHandle {
*/
public Double delay;
/**
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks. Defaults to
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
* {@code false}.
*/
public Boolean force;
@@ -179,7 +179,7 @@ public interface ElementHandle extends JSHandle {
*/
public Double timeout;
/**
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability/">actionability</a>
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
* performing it.
*/
@@ -207,7 +207,7 @@ public interface ElementHandle extends JSHandle {
return this;
}
/**
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks. Defaults to
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
* {@code false}.
*/
public ClickOptions setForce(boolean force) {
@@ -256,7 +256,7 @@ public interface ElementHandle extends JSHandle {
return this;
}
/**
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability/">actionability</a>
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
* performing it.
*/
@@ -275,7 +275,7 @@ public interface ElementHandle extends JSHandle {
*/
public Double delay;
/**
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks. Defaults to
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
* {@code false}.
*/
public Boolean force;
@@ -302,7 +302,7 @@ public interface ElementHandle extends JSHandle {
*/
public Double timeout;
/**
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability/">actionability</a>
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
* performing it.
*/
@@ -323,7 +323,7 @@ public interface ElementHandle extends JSHandle {
return this;
}
/**
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks. Defaults to
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
* {@code false}.
*/
public DblclickOptions setForce(boolean force) {
@@ -372,7 +372,7 @@ public interface ElementHandle extends JSHandle {
return this;
}
/**
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability/">actionability</a>
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
* performing it.
*/
@@ -383,7 +383,7 @@ public interface ElementHandle extends JSHandle {
}
class FillOptions {
/**
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks. Defaults to
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
* {@code false}.
*/
public Boolean force;
@@ -401,7 +401,7 @@ public interface ElementHandle extends JSHandle {
public Double timeout;
/**
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks. Defaults to
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
* {@code false}.
*/
public FillOptions setForce(boolean force) {
@@ -429,7 +429,7 @@ public interface ElementHandle extends JSHandle {
}
class HoverOptions {
/**
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks. Defaults to
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
* {@code false}.
*/
public Boolean force;
@@ -450,14 +450,14 @@ public interface ElementHandle extends JSHandle {
*/
public Double timeout;
/**
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability/">actionability</a>
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
* performing it.
*/
public Boolean trial;
/**
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks. Defaults to
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
* {@code false}.
*/
public HoverOptions setForce(boolean force) {
@@ -497,7 +497,7 @@ public interface ElementHandle extends JSHandle {
return this;
}
/**
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability/">actionability</a>
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
* performing it.
*/
@@ -569,6 +569,20 @@ public interface ElementHandle extends JSHandle {
}
}
class ScreenshotOptions {
/**
* When set to {@code "disabled"}, stops CSS animations, CSS transitions and Web Animations. Animations get different treatment
* depending on their duration:
* <ul>
* <li> finite animations are fast-forwarded to completion, so they'll fire {@code transitionend} event.</li>
* <li> infinite animations are canceled to initial state, and then played over after the screenshot.</li>
* </ul>
*/
public ScreenshotAnimations animations;
/**
* Specify locators that should be masked when the screenshot is taken. Masked elements will be overlayed with a pink box
* {@code #FF00FF} that completely covers its bounding box.
*/
public List<Locator> mask;
/**
* Hides default white background and allows capturing screenshots with transparency. Not applicable to {@code jpeg} images.
* Defaults to {@code false}.
@@ -595,6 +609,26 @@ public interface ElementHandle extends JSHandle {
*/
public ScreenshotType type;
/**
* When set to {@code "disabled"}, stops CSS animations, CSS transitions and Web Animations. Animations get different treatment
* depending on their duration:
* <ul>
* <li> finite animations are fast-forwarded to completion, so they'll fire {@code transitionend} event.</li>
* <li> infinite animations are canceled to initial state, and then played over after the screenshot.</li>
* </ul>
*/
public ScreenshotOptions setAnimations(ScreenshotAnimations animations) {
this.animations = animations;
return this;
}
/**
* Specify locators that should be masked when the screenshot is taken. Masked elements will be overlayed with a pink box
* {@code #FF00FF} that completely covers its bounding box.
*/
public ScreenshotOptions setMask(List<Locator> mask) {
this.mask = mask;
return this;
}
/**
* Hides default white background and allows capturing screenshots with transparency. Not applicable to {@code jpeg} images.
* Defaults to {@code false}.
@@ -656,7 +690,7 @@ public interface ElementHandle extends JSHandle {
}
class SelectOptionOptions {
/**
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks. Defaults to
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
* {@code false}.
*/
public Boolean force;
@@ -674,7 +708,7 @@ public interface ElementHandle extends JSHandle {
public Double timeout;
/**
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks. Defaults to
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
* {@code false}.
*/
public SelectOptionOptions setForce(boolean force) {
@@ -702,7 +736,7 @@ public interface ElementHandle extends JSHandle {
}
class SelectTextOptions {
/**
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks. Defaults to
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
* {@code false}.
*/
public Boolean force;
@@ -714,7 +748,7 @@ public interface ElementHandle extends JSHandle {
public Double timeout;
/**
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks. Defaults to
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
* {@code false}.
*/
public SelectTextOptions setForce(boolean force) {
@@ -733,7 +767,7 @@ public interface ElementHandle extends JSHandle {
}
class SetCheckedOptions {
/**
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks. Defaults to
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
* {@code false}.
*/
public Boolean force;
@@ -755,14 +789,14 @@ public interface ElementHandle extends JSHandle {
*/
public Double timeout;
/**
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability/">actionability</a>
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
* performing it.
*/
public Boolean trial;
/**
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks. Defaults to
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
* {@code false}.
*/
public SetCheckedOptions setForce(boolean force) {
@@ -803,7 +837,7 @@ public interface ElementHandle extends JSHandle {
return this;
}
/**
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability/">actionability</a>
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
* performing it.
*/
@@ -847,7 +881,7 @@ public interface ElementHandle extends JSHandle {
}
class TapOptions {
/**
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks. Defaults to
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
* {@code false}.
*/
public Boolean force;
@@ -874,14 +908,14 @@ public interface ElementHandle extends JSHandle {
*/
public Double timeout;
/**
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability/">actionability</a>
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
* performing it.
*/
public Boolean trial;
/**
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks. Defaults to
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
* {@code false}.
*/
public TapOptions setForce(boolean force) {
@@ -930,7 +964,7 @@ public interface ElementHandle extends JSHandle {
return this;
}
/**
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability/">actionability</a>
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
* performing it.
*/
@@ -985,7 +1019,7 @@ public interface ElementHandle extends JSHandle {
}
class UncheckOptions {
/**
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks. Defaults to
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
* {@code false}.
*/
public Boolean force;
@@ -1007,14 +1041,14 @@ public interface ElementHandle extends JSHandle {
*/
public Double timeout;
/**
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability/">actionability</a>
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
* performing it.
*/
public Boolean trial;
/**
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks. Defaults to
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
* {@code false}.
*/
public UncheckOptions setForce(boolean force) {
@@ -1055,7 +1089,7 @@ public interface ElementHandle extends JSHandle {
return this;
}
/**
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability/">actionability</a>
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
* performing it.
*/
@@ -1164,7 +1198,7 @@ public interface ElementHandle extends JSHandle {
* <ol>
* <li> Ensure that element is a checkbox or a radio input. If not, this method throws. If the element is already checked, this
* method returns immediately.</li>
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks on the element, unless
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the element, unless
* {@code force} option is set.</li>
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link Page#mouse Page.mouse()} to click in the center of the element.</li>
@@ -1185,7 +1219,7 @@ public interface ElementHandle extends JSHandle {
* <ol>
* <li> Ensure that element is a checkbox or a radio input. If not, this method throws. If the element is already checked, this
* method returns immediately.</li>
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks on the element, unless
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the element, unless
* {@code force} option is set.</li>
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link Page#mouse Page.mouse()} to click in the center of the element.</li>
@@ -1202,7 +1236,7 @@ public interface ElementHandle extends JSHandle {
/**
* This method clicks the element by performing the following steps:
* <ol>
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks on the element, unless
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the element, unless
* {@code force} option is set.</li>
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link Page#mouse Page.mouse()} to click in the center of the element, or the specified {@code position}.</li>
@@ -1220,7 +1254,7 @@ public interface ElementHandle extends JSHandle {
/**
* This method clicks the element by performing the following steps:
* <ol>
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks on the element, unless
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the element, unless
* {@code force} option is set.</li>
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link Page#mouse Page.mouse()} to click in the center of the element, or the specified {@code position}.</li>
@@ -1240,7 +1274,7 @@ public interface ElementHandle extends JSHandle {
/**
* This method double clicks the element by performing the following steps:
* <ol>
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks on the element, unless
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the element, unless
* {@code force} option is set.</li>
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link Page#mouse Page.mouse()} to double click in the center of the element, or the specified {@code position}.</li>
@@ -1261,7 +1295,7 @@ public interface ElementHandle extends JSHandle {
/**
* This method double clicks the element by performing the following steps:
* <ol>
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks on the element, unless
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the element, unless
* {@code force} option is set.</li>
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link Page#mouse Page.mouse()} to double click in the center of the element, or the specified {@code position}.</li>
@@ -1352,7 +1386,7 @@ public interface ElementHandle extends JSHandle {
* Returns the return value of {@code expression}.
*
* <p> The method finds an element matching the specified selector in the {@code ElementHandle}s subtree and passes it as a first
* argument to {@code expression}. See <a href="https://playwright.dev/java/docs/selectors/">Working with selectors</a> for more
* argument to {@code expression}. See <a href="https://playwright.dev/java/docs/selectors">Working with selectors</a> for more
* details. If no elements match the selector, the method throws an error.
*
* <p> If {@code expression} returns a <a
@@ -1366,7 +1400,7 @@ public interface ElementHandle extends JSHandle {
* assertEquals("10", tweetHandle.evalOnSelector(".retweets", "node => node.innerText"));
* }</pre>
*
* @param selector A selector to query for. See <a href="https://playwright.dev/java/docs/selectors/">working with selectors</a> for more
* @param selector A selector to query for. See <a href="https://playwright.dev/java/docs/selectors">working with selectors</a> for more
* details.
* @param expression JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted
* as a function. Otherwise, evaluated as an expression.
@@ -1378,7 +1412,7 @@ public interface ElementHandle extends JSHandle {
* Returns the return value of {@code expression}.
*
* <p> The method finds an element matching the specified selector in the {@code ElementHandle}s subtree and passes it as a first
* argument to {@code expression}. See <a href="https://playwright.dev/java/docs/selectors/">Working with selectors</a> for more
* argument to {@code expression}. See <a href="https://playwright.dev/java/docs/selectors">Working with selectors</a> for more
* details. If no elements match the selector, the method throws an error.
*
* <p> If {@code expression} returns a <a
@@ -1392,7 +1426,7 @@ public interface ElementHandle extends JSHandle {
* assertEquals("10", tweetHandle.evalOnSelector(".retweets", "node => node.innerText"));
* }</pre>
*
* @param selector A selector to query for. See <a href="https://playwright.dev/java/docs/selectors/">working with selectors</a> for more
* @param selector A selector to query for. See <a href="https://playwright.dev/java/docs/selectors">working with selectors</a> for more
* details.
* @param expression JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted
* as a function. Otherwise, evaluated as an expression.
@@ -1403,7 +1437,7 @@ public interface ElementHandle extends JSHandle {
* Returns the return value of {@code expression}.
*
* <p> The method finds all elements matching the specified selector in the {@code ElementHandle}'s subtree and passes an array of
* matched elements as a first argument to {@code expression}. See <a href="https://playwright.dev/java/docs/selectors/">Working
* matched elements as a first argument to {@code expression}. See <a href="https://playwright.dev/java/docs/selectors">Working
* with selectors</a> for more details.
*
* <p> If {@code expression} returns a <a
@@ -1417,7 +1451,7 @@ public interface ElementHandle extends JSHandle {
* assertEquals(Arrays.asList("Hello!", "Hi!"), feedHandle.evalOnSelectorAll(".tweet", "nodes => nodes.map(n => n.innerText)"));
* }</pre>
*
* @param selector A selector to query for. See <a href="https://playwright.dev/java/docs/selectors/">working with selectors</a> for more
* @param selector A selector to query for. See <a href="https://playwright.dev/java/docs/selectors">working with selectors</a> for more
* details.
* @param expression JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted
* as a function. Otherwise, evaluated as an expression.
@@ -1429,7 +1463,7 @@ public interface ElementHandle extends JSHandle {
* Returns the return value of {@code expression}.
*
* <p> The method finds all elements matching the specified selector in the {@code ElementHandle}'s subtree and passes an array of
* matched elements as a first argument to {@code expression}. See <a href="https://playwright.dev/java/docs/selectors/">Working
* matched elements as a first argument to {@code expression}. See <a href="https://playwright.dev/java/docs/selectors">Working
* with selectors</a> for more details.
*
* <p> If {@code expression} returns a <a
@@ -1443,7 +1477,7 @@ public interface ElementHandle extends JSHandle {
* assertEquals(Arrays.asList("Hello!", "Hi!"), feedHandle.evalOnSelectorAll(".tweet", "nodes => nodes.map(n => n.innerText)"));
* }</pre>
*
* @param selector A selector to query for. See <a href="https://playwright.dev/java/docs/selectors/">working with selectors</a> for more
* @param selector A selector to query for. See <a href="https://playwright.dev/java/docs/selectors">working with selectors</a> for more
* details.
* @param expression JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted
* as a function. Otherwise, evaluated as an expression.
@@ -1451,7 +1485,7 @@ public interface ElementHandle extends JSHandle {
*/
Object evalOnSelectorAll(String selector, String expression, Object arg);
/**
* This method waits for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks, focuses the
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, focuses the
* element, fills it and triggers an {@code input} event after filling. Note that you can pass an empty string to clear the input
* field.
*
@@ -1468,7 +1502,7 @@ public interface ElementHandle extends JSHandle {
fill(value, null);
}
/**
* This method waits for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks, focuses the
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, focuses the
* element, fills it and triggers an {@code input} event after filling. Note that you can pass an empty string to clear the input
* field.
*
@@ -1495,7 +1529,7 @@ public interface ElementHandle extends JSHandle {
/**
* This method hovers over the element by performing the following steps:
* <ol>
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks on the element, unless
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the element, unless
* {@code force} option is set.</li>
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link Page#mouse Page.mouse()} to hover over the center of the element, or the specified {@code position}.</li>
@@ -1513,7 +1547,7 @@ public interface ElementHandle extends JSHandle {
/**
* This method hovers over the element by performing the following steps:
* <ol>
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks on the element, unless
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the element, unless
* {@code force} option is set.</li>
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link Page#mouse Page.mouse()} to hover over the center of the element, or the specified {@code position}.</li>
@@ -1550,24 +1584,24 @@ public interface ElementHandle extends JSHandle {
boolean isChecked();
/**
* Returns whether the element is disabled, the opposite of <a
* href="https://playwright.dev/java/docs/actionability/#enabled">enabled</a>.
* href="https://playwright.dev/java/docs/actionability#enabled">enabled</a>.
*/
boolean isDisabled();
/**
* Returns whether the element is <a href="https://playwright.dev/java/docs/actionability/#editable">editable</a>.
* Returns whether the element is <a href="https://playwright.dev/java/docs/actionability#editable">editable</a>.
*/
boolean isEditable();
/**
* Returns whether the element is <a href="https://playwright.dev/java/docs/actionability/#enabled">enabled</a>.
* Returns whether the element is <a href="https://playwright.dev/java/docs/actionability#enabled">enabled</a>.
*/
boolean isEnabled();
/**
* Returns whether the element is hidden, the opposite of <a
* href="https://playwright.dev/java/docs/actionability/#visible">visible</a>.
* href="https://playwright.dev/java/docs/actionability#visible">visible</a>.
*/
boolean isHidden();
/**
* Returns whether the element is <a href="https://playwright.dev/java/docs/actionability/#visible">visible</a>.
* Returns whether the element is <a href="https://playwright.dev/java/docs/actionability#visible">visible</a>.
*/
boolean isVisible();
/**
@@ -1626,26 +1660,26 @@ public interface ElementHandle extends JSHandle {
void press(String key, PressOptions options);
/**
* The method finds an element matching the specified selector in the {@code ElementHandle}'s subtree. See <a
* href="https://playwright.dev/java/docs/selectors/">Working with selectors</a> for more details. If no elements match the
* href="https://playwright.dev/java/docs/selectors">Working with selectors</a> for more details. If no elements match the
* selector, returns {@code null}.
*
* @param selector A selector to query for. See <a href="https://playwright.dev/java/docs/selectors/">working with selectors</a> for more
* @param selector A selector to query for. See <a href="https://playwright.dev/java/docs/selectors">working with selectors</a> for more
* details.
*/
ElementHandle querySelector(String selector);
/**
* The method finds all elements matching the specified selector in the {@code ElementHandle}s subtree. See <a
* href="https://playwright.dev/java/docs/selectors/">Working with selectors</a> for more details. If no elements match the
* href="https://playwright.dev/java/docs/selectors">Working with selectors</a> for more details. If no elements match the
* selector, returns empty array.
*
* @param selector A selector to query for. See <a href="https://playwright.dev/java/docs/selectors/">working with selectors</a> for more
* @param selector A selector to query for. See <a href="https://playwright.dev/java/docs/selectors">working with selectors</a> for more
* details.
*/
List<ElementHandle> querySelectorAll(String selector);
/**
* Returns the buffer with the captured screenshot.
*
* <p> This method waits for the <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks, then
* <p> This method waits for the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, then
* scrolls element into view before taking a screenshot. If the element is detached from DOM, the method throws an error.
*/
default byte[] screenshot() {
@@ -1654,12 +1688,12 @@ public interface ElementHandle extends JSHandle {
/**
* Returns the buffer with the captured screenshot.
*
* <p> This method waits for the <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks, then
* <p> This method waits for the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, then
* scrolls element into view before taking a screenshot. If the element is detached from DOM, the method throws an error.
*/
byte[] screenshot(ScreenshotOptions options);
/**
* This method waits for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks, then tries to
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, then tries to
* scroll element into view, unless it is completely visible as defined by <a
* href="https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API">IntersectionObserver</a>'s {@code ratio}.
*
@@ -1670,7 +1704,7 @@ public interface ElementHandle extends JSHandle {
scrollIntoViewIfNeeded(null);
}
/**
* This method waits for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks, then tries to
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, then tries to
* scroll element into view, unless it is completely visible as defined by <a
* href="https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API">IntersectionObserver</a>'s {@code ratio}.
*
@@ -1679,8 +1713,8 @@ public interface ElementHandle extends JSHandle {
*/
void scrollIntoViewIfNeeded(ScrollIntoViewIfNeededOptions options);
/**
* This method waits for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks, waits until
* all specified options are present in the {@code <select>} element and selects these options.
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, waits until all
* specified options are present in the {@code <select>} element and selects these options.
*
* <p> If the target element is not a {@code <select>} element, this method throws an error. However, if the element is inside the
* {@code <label>} element that has an associated <a
@@ -1707,8 +1741,8 @@ public interface ElementHandle extends JSHandle {
return selectOption(values, null);
}
/**
* This method waits for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks, waits until
* all specified options are present in the {@code <select>} element and selects these options.
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, waits until all
* specified options are present in the {@code <select>} element and selects these options.
*
* <p> If the target element is not a {@code <select>} element, this method throws an error. However, if the element is inside the
* {@code <label>} element that has an associated <a
@@ -1733,8 +1767,8 @@ public interface ElementHandle extends JSHandle {
*/
List<String> selectOption(String values, SelectOptionOptions options);
/**
* This method waits for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks, waits until
* all specified options are present in the {@code <select>} element and selects these options.
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, waits until all
* specified options are present in the {@code <select>} element and selects these options.
*
* <p> If the target element is not a {@code <select>} element, this method throws an error. However, if the element is inside the
* {@code <label>} element that has an associated <a
@@ -1761,8 +1795,8 @@ public interface ElementHandle extends JSHandle {
return selectOption(values, null);
}
/**
* This method waits for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks, waits until
* all specified options are present in the {@code <select>} element and selects these options.
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, waits until all
* specified options are present in the {@code <select>} element and selects these options.
*
* <p> If the target element is not a {@code <select>} element, this method throws an error. However, if the element is inside the
* {@code <label>} element that has an associated <a
@@ -1787,8 +1821,8 @@ public interface ElementHandle extends JSHandle {
*/
List<String> selectOption(ElementHandle values, SelectOptionOptions options);
/**
* This method waits for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks, waits until
* all specified options are present in the {@code <select>} element and selects these options.
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, waits until all
* specified options are present in the {@code <select>} element and selects these options.
*
* <p> If the target element is not a {@code <select>} element, this method throws an error. However, if the element is inside the
* {@code <label>} element that has an associated <a
@@ -1815,8 +1849,8 @@ public interface ElementHandle extends JSHandle {
return selectOption(values, null);
}
/**
* This method waits for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks, waits until
* all specified options are present in the {@code <select>} element and selects these options.
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, waits until all
* specified options are present in the {@code <select>} element and selects these options.
*
* <p> If the target element is not a {@code <select>} element, this method throws an error. However, if the element is inside the
* {@code <label>} element that has an associated <a
@@ -1841,8 +1875,8 @@ public interface ElementHandle extends JSHandle {
*/
List<String> selectOption(String[] values, SelectOptionOptions options);
/**
* This method waits for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks, waits until
* all specified options are present in the {@code <select>} element and selects these options.
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, waits until all
* specified options are present in the {@code <select>} element and selects these options.
*
* <p> If the target element is not a {@code <select>} element, this method throws an error. However, if the element is inside the
* {@code <label>} element that has an associated <a
@@ -1869,8 +1903,8 @@ public interface ElementHandle extends JSHandle {
return selectOption(values, null);
}
/**
* This method waits for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks, waits until
* all specified options are present in the {@code <select>} element and selects these options.
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, waits until all
* specified options are present in the {@code <select>} element and selects these options.
*
* <p> If the target element is not a {@code <select>} element, this method throws an error. However, if the element is inside the
* {@code <label>} element that has an associated <a
@@ -1895,8 +1929,8 @@ public interface ElementHandle extends JSHandle {
*/
List<String> selectOption(SelectOption values, SelectOptionOptions options);
/**
* This method waits for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks, waits until
* all specified options are present in the {@code <select>} element and selects these options.
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, waits until all
* specified options are present in the {@code <select>} element and selects these options.
*
* <p> If the target element is not a {@code <select>} element, this method throws an error. However, if the element is inside the
* {@code <label>} element that has an associated <a
@@ -1923,8 +1957,8 @@ public interface ElementHandle extends JSHandle {
return selectOption(values, null);
}
/**
* This method waits for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks, waits until
* all specified options are present in the {@code <select>} element and selects these options.
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, waits until all
* specified options are present in the {@code <select>} element and selects these options.
*
* <p> If the target element is not a {@code <select>} element, this method throws an error. However, if the element is inside the
* {@code <label>} element that has an associated <a
@@ -1949,8 +1983,8 @@ public interface ElementHandle extends JSHandle {
*/
List<String> selectOption(ElementHandle[] values, SelectOptionOptions options);
/**
* This method waits for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks, waits until
* all specified options are present in the {@code <select>} element and selects these options.
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, waits until all
* specified options are present in the {@code <select>} element and selects these options.
*
* <p> If the target element is not a {@code <select>} element, this method throws an error. However, if the element is inside the
* {@code <label>} element that has an associated <a
@@ -1977,8 +2011,8 @@ public interface ElementHandle extends JSHandle {
return selectOption(values, null);
}
/**
* This method waits for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks, waits until
* all specified options are present in the {@code <select>} element and selects these options.
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, waits until all
* specified options are present in the {@code <select>} element and selects these options.
*
* <p> If the target element is not a {@code <select>} element, this method throws an error. However, if the element is inside the
* {@code <label>} element that has an associated <a
@@ -2003,14 +2037,14 @@ public interface ElementHandle extends JSHandle {
*/
List<String> selectOption(SelectOption[] values, SelectOptionOptions options);
/**
* This method waits for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks, then focuses
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, then focuses
* the element and selects all its text content.
*/
default void selectText() {
selectText(null);
}
/**
* This method waits for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks, then focuses
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, then focuses
* the element and selects all its text content.
*/
void selectText(SelectTextOptions options);
@@ -2019,7 +2053,7 @@ public interface ElementHandle extends JSHandle {
* <ol>
* <li> Ensure that element is a checkbox or a radio input. If not, this method throws.</li>
* <li> If the element already has the right checked state, this method returns immediately.</li>
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks on the matched element,
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the matched element,
* unless {@code force} option is set. If the element is detached during the checks, the whole action is retried.</li>
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link Page#mouse Page.mouse()} to click in the center of the element.</li>
@@ -2040,7 +2074,7 @@ public interface ElementHandle extends JSHandle {
* <ol>
* <li> Ensure that element is a checkbox or a radio input. If not, this method throws.</li>
* <li> If the element already has the right checked state, this method returns immediately.</li>
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks on the matched element,
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the matched element,
* unless {@code force} option is set. If the element is detached during the checks, the whole action is retried.</li>
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link Page#mouse Page.mouse()} to click in the center of the element.</li>
@@ -2129,7 +2163,7 @@ public interface ElementHandle extends JSHandle {
/**
* This method taps the element by performing the following steps:
* <ol>
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks on the element, unless
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the element, unless
* {@code force} option is set.</li>
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link Page#touchscreen Page.touchscreen()} to tap the center of the element, or the specified {@code position}.</li>
@@ -2149,7 +2183,7 @@ public interface ElementHandle extends JSHandle {
/**
* This method taps the element by performing the following steps:
* <ol>
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks on the element, unless
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the element, unless
* {@code force} option is set.</li>
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link Page#touchscreen Page.touchscreen()} to tap the center of the element, or the specified {@code position}.</li>
@@ -2213,7 +2247,7 @@ public interface ElementHandle extends JSHandle {
* <ol>
* <li> Ensure that element is a checkbox or a radio input. If not, this method throws. If the element is already unchecked,
* this method returns immediately.</li>
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks on the element, unless
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the element, unless
* {@code force} option is set.</li>
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link Page#mouse Page.mouse()} to click in the center of the element.</li>
@@ -2234,7 +2268,7 @@ public interface ElementHandle extends JSHandle {
* <ol>
* <li> Ensure that element is a checkbox or a radio input. If not, this method throws. If the element is already unchecked,
* this method returns immediately.</li>
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks on the element, unless
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the element, unless
* {@code force} option is set.</li>
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link Page#mouse Page.mouse()} to click in the center of the element.</li>
@@ -2252,19 +2286,18 @@ public interface ElementHandle extends JSHandle {
* Returns when the element satisfies the {@code state}.
*
* <p> Depending on the {@code state} parameter, this method waits for one of the <a
* href="https://playwright.dev/java/docs/actionability/">actionability</a> checks to pass. This method throws when the
* href="https://playwright.dev/java/docs/actionability">actionability</a> checks to pass. This method throws when the
* element is detached while waiting, unless waiting for the {@code "hidden"} state.
* <ul>
* <li> {@code "visible"} Wait until the element is <a href="https://playwright.dev/java/docs/actionability/#visible">visible</a>.</li>
* <li> {@code "hidden"} Wait until the element is <a href="https://playwright.dev/java/docs/actionability/#visible">not visible</a>
* or <a href="https://playwright.dev/java/docs/actionability/#attached">not attached</a>. Note that waiting for hidden
* does not throw when the element detaches.</li>
* <li> {@code "stable"} Wait until the element is both <a href="https://playwright.dev/java/docs/actionability/#visible">visible</a>
* and <a href="https://playwright.dev/java/docs/actionability/#stable">stable</a>.</li>
* <li> {@code "enabled"} Wait until the element is <a href="https://playwright.dev/java/docs/actionability/#enabled">enabled</a>.</li>
* <li> {@code "disabled"} Wait until the element is <a href="https://playwright.dev/java/docs/actionability/#enabled">not
* enabled</a>.</li>
* <li> {@code "editable"} Wait until the element is <a href="https://playwright.dev/java/docs/actionability/#editable">editable</a>.</li>
* <li> {@code "visible"} Wait until the element is <a href="https://playwright.dev/java/docs/actionability#visible">visible</a>.</li>
* <li> {@code "hidden"} Wait until the element is <a href="https://playwright.dev/java/docs/actionability#visible">not visible</a> or
* <a href="https://playwright.dev/java/docs/actionability#attached">not attached</a>. Note that waiting for hidden does
* not throw when the element detaches.</li>
* <li> {@code "stable"} Wait until the element is both <a href="https://playwright.dev/java/docs/actionability#visible">visible</a>
* and <a href="https://playwright.dev/java/docs/actionability#stable">stable</a>.</li>
* <li> {@code "enabled"} Wait until the element is <a href="https://playwright.dev/java/docs/actionability#enabled">enabled</a>.</li>
* <li> {@code "disabled"} Wait until the element is <a href="https://playwright.dev/java/docs/actionability#enabled">not enabled</a>.</li>
* <li> {@code "editable"} Wait until the element is <a href="https://playwright.dev/java/docs/actionability#editable">editable</a>.</li>
* </ul>
*
* <p> If the element does not satisfy the condition for the {@code timeout} milliseconds, this method will throw.
@@ -2278,19 +2311,18 @@ public interface ElementHandle extends JSHandle {
* Returns when the element satisfies the {@code state}.
*
* <p> Depending on the {@code state} parameter, this method waits for one of the <a
* href="https://playwright.dev/java/docs/actionability/">actionability</a> checks to pass. This method throws when the
* href="https://playwright.dev/java/docs/actionability">actionability</a> checks to pass. This method throws when the
* element is detached while waiting, unless waiting for the {@code "hidden"} state.
* <ul>
* <li> {@code "visible"} Wait until the element is <a href="https://playwright.dev/java/docs/actionability/#visible">visible</a>.</li>
* <li> {@code "hidden"} Wait until the element is <a href="https://playwright.dev/java/docs/actionability/#visible">not visible</a>
* or <a href="https://playwright.dev/java/docs/actionability/#attached">not attached</a>. Note that waiting for hidden
* does not throw when the element detaches.</li>
* <li> {@code "stable"} Wait until the element is both <a href="https://playwright.dev/java/docs/actionability/#visible">visible</a>
* and <a href="https://playwright.dev/java/docs/actionability/#stable">stable</a>.</li>
* <li> {@code "enabled"} Wait until the element is <a href="https://playwright.dev/java/docs/actionability/#enabled">enabled</a>.</li>
* <li> {@code "disabled"} Wait until the element is <a href="https://playwright.dev/java/docs/actionability/#enabled">not
* enabled</a>.</li>
* <li> {@code "editable"} Wait until the element is <a href="https://playwright.dev/java/docs/actionability/#editable">editable</a>.</li>
* <li> {@code "visible"} Wait until the element is <a href="https://playwright.dev/java/docs/actionability#visible">visible</a>.</li>
* <li> {@code "hidden"} Wait until the element is <a href="https://playwright.dev/java/docs/actionability#visible">not visible</a> or
* <a href="https://playwright.dev/java/docs/actionability#attached">not attached</a>. Note that waiting for hidden does
* not throw when the element detaches.</li>
* <li> {@code "stable"} Wait until the element is both <a href="https://playwright.dev/java/docs/actionability#visible">visible</a>
* and <a href="https://playwright.dev/java/docs/actionability#stable">stable</a>.</li>
* <li> {@code "enabled"} Wait until the element is <a href="https://playwright.dev/java/docs/actionability#enabled">enabled</a>.</li>
* <li> {@code "disabled"} Wait until the element is <a href="https://playwright.dev/java/docs/actionability#enabled">not enabled</a>.</li>
* <li> {@code "editable"} Wait until the element is <a href="https://playwright.dev/java/docs/actionability#editable">editable</a>.</li>
* </ul>
*
* <p> If the element does not satisfy the condition for the {@code timeout} milliseconds, this method will throw.
@@ -2316,7 +2348,7 @@ public interface ElementHandle extends JSHandle {
*
* <p> <strong>NOTE:</strong> This method does not work across navigations, use {@link Page#waitForSelector Page.waitForSelector()} instead.
*
* @param selector A selector to query for. See <a href="https://playwright.dev/java/docs/selectors/">working with selectors</a> for more
* @param selector A selector to query for. See <a href="https://playwright.dev/java/docs/selectors">working with selectors</a> for more
* details.
*/
default ElementHandle waitForSelector(String selector) {
@@ -2340,7 +2372,7 @@ public interface ElementHandle extends JSHandle {
*
* <p> <strong>NOTE:</strong> This method does not work across navigations, use {@link Page#waitForSelector Page.waitForSelector()} instead.
*
* @param selector A selector to query for. See <a href="https://playwright.dev/java/docs/selectors/">working with selectors</a> for more
* @param selector A selector to query for. See <a href="https://playwright.dev/java/docs/selectors">working with selectors</a> for more
* details.
*/
ElementHandle waitForSelector(String selector, WaitForSelectorOptions options);
File diff suppressed because it is too large Load Diff
@@ -97,7 +97,7 @@ public interface FrameLocator {
* When working with iframes, you can create a frame locator that will enter the iframe and allow selecting elements in
* that iframe.
*
* @param selector A selector to use when resolving DOM element. See <a href="https://playwright.dev/java/docs/selectors/">working with
* @param selector A selector to use when resolving DOM element. See <a href="https://playwright.dev/java/docs/selectors">working with
* selectors</a> for more details.
*/
FrameLocator frameLocator(String selector);
@@ -108,7 +108,7 @@ public interface FrameLocator {
/**
* The method finds an element matching the specified selector in the FrameLocator's subtree.
*
* @param selector A selector to use when resolving DOM element. See <a href="https://playwright.dev/java/docs/selectors/">working with
* @param selector A selector to use when resolving DOM element. See <a href="https://playwright.dev/java/docs/selectors">working with
* selectors</a> for more details.
*/
default Locator locator(String selector) {
@@ -117,7 +117,7 @@ public interface FrameLocator {
/**
* The method finds an element matching the specified selector in the FrameLocator's subtree.
*
* @param selector A selector to use when resolving DOM element. See <a href="https://playwright.dev/java/docs/selectors/">working with
* @param selector A selector to use when resolving DOM element. See <a href="https://playwright.dev/java/docs/selectors">working with
* selectors</a> for more details.
*/
Locator locator(String selector, LocatorOptions options);
@@ -26,7 +26,7 @@ import java.util.regex.Pattern;
* to find element(s) on the page at any moment. Locator can be created with the {@link Page#locator Page.locator()}
* method.
*
* <p> <a href="https://playwright.dev/java/docs/locators/">Learn more about locators</a>.
* <p> <a href="https://playwright.dev/java/docs/locators">Learn more about locators</a>.
*/
public interface Locator {
class BoundingBoxOptions {
@@ -49,7 +49,7 @@ public interface Locator {
}
class CheckOptions {
/**
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks. Defaults to
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
* {@code false}.
*/
public Boolean force;
@@ -71,14 +71,14 @@ public interface Locator {
*/
public Double timeout;
/**
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability/">actionability</a>
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
* performing it.
*/
public Boolean trial;
/**
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks. Defaults to
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
* {@code false}.
*/
public CheckOptions setForce(boolean force) {
@@ -119,7 +119,7 @@ public interface Locator {
return this;
}
/**
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability/">actionability</a>
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
* performing it.
*/
@@ -142,7 +142,7 @@ public interface Locator {
*/
public Double delay;
/**
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks. Defaults to
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
* {@code false}.
*/
public Boolean force;
@@ -169,7 +169,7 @@ public interface Locator {
*/
public Double timeout;
/**
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability/">actionability</a>
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
* performing it.
*/
@@ -197,7 +197,7 @@ public interface Locator {
return this;
}
/**
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks. Defaults to
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
* {@code false}.
*/
public ClickOptions setForce(boolean force) {
@@ -246,7 +246,7 @@ public interface Locator {
return this;
}
/**
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability/">actionability</a>
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
* performing it.
*/
@@ -265,7 +265,7 @@ public interface Locator {
*/
public Double delay;
/**
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks. Defaults to
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
* {@code false}.
*/
public Boolean force;
@@ -292,7 +292,7 @@ public interface Locator {
*/
public Double timeout;
/**
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability/">actionability</a>
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
* performing it.
*/
@@ -313,7 +313,7 @@ public interface Locator {
return this;
}
/**
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks. Defaults to
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
* {@code false}.
*/
public DblclickOptions setForce(boolean force) {
@@ -362,7 +362,7 @@ public interface Locator {
return this;
}
/**
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability/">actionability</a>
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
* performing it.
*/
@@ -391,7 +391,7 @@ public interface Locator {
}
class DragToOptions {
/**
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks. Defaults to
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
* {@code false}.
*/
public Boolean force;
@@ -418,14 +418,14 @@ public interface Locator {
*/
public Double timeout;
/**
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability/">actionability</a>
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
* performing it.
*/
public Boolean trial;
/**
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks. Defaults to
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
* {@code false}.
*/
public DragToOptions setForce(boolean force) {
@@ -481,7 +481,7 @@ public interface Locator {
return this;
}
/**
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability/">actionability</a>
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
* performing it.
*/
@@ -546,7 +546,7 @@ public interface Locator {
}
class FillOptions {
/**
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks. Defaults to
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
* {@code false}.
*/
public Boolean force;
@@ -564,7 +564,7 @@ public interface Locator {
public Double timeout;
/**
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks. Defaults to
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
* {@code false}.
*/
public FillOptions setForce(boolean force) {
@@ -628,7 +628,7 @@ public interface Locator {
}
class HoverOptions {
/**
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks. Defaults to
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
* {@code false}.
*/
public Boolean force;
@@ -649,14 +649,14 @@ public interface Locator {
*/
public Double timeout;
/**
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability/">actionability</a>
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
* performing it.
*/
public Boolean trial;
/**
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks. Defaults to
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
* {@code false}.
*/
public HoverOptions setForce(boolean force) {
@@ -696,7 +696,7 @@ public interface Locator {
return this;
}
/**
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability/">actionability</a>
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
* performing it.
*/
@@ -949,6 +949,20 @@ public interface Locator {
}
}
class ScreenshotOptions {
/**
* When set to {@code "disabled"}, stops CSS animations, CSS transitions and Web Animations. Animations get different treatment
* depending on their duration:
* <ul>
* <li> finite animations are fast-forwarded to completion, so they'll fire {@code transitionend} event.</li>
* <li> infinite animations are canceled to initial state, and then played over after the screenshot.</li>
* </ul>
*/
public ScreenshotAnimations animations;
/**
* Specify locators that should be masked when the screenshot is taken. Masked elements will be overlayed with a pink box
* {@code #FF00FF} that completely covers its bounding box.
*/
public List<Locator> mask;
/**
* Hides default white background and allows capturing screenshots with transparency. Not applicable to {@code jpeg} images.
* Defaults to {@code false}.
@@ -975,6 +989,26 @@ public interface Locator {
*/
public ScreenshotType type;
/**
* When set to {@code "disabled"}, stops CSS animations, CSS transitions and Web Animations. Animations get different treatment
* depending on their duration:
* <ul>
* <li> finite animations are fast-forwarded to completion, so they'll fire {@code transitionend} event.</li>
* <li> infinite animations are canceled to initial state, and then played over after the screenshot.</li>
* </ul>
*/
public ScreenshotOptions setAnimations(ScreenshotAnimations animations) {
this.animations = animations;
return this;
}
/**
* Specify locators that should be masked when the screenshot is taken. Masked elements will be overlayed with a pink box
* {@code #FF00FF} that completely covers its bounding box.
*/
public ScreenshotOptions setMask(List<Locator> mask) {
this.mask = mask;
return this;
}
/**
* Hides default white background and allows capturing screenshots with transparency. Not applicable to {@code jpeg} images.
* Defaults to {@code false}.
@@ -1036,7 +1070,7 @@ public interface Locator {
}
class SelectOptionOptions {
/**
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks. Defaults to
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
* {@code false}.
*/
public Boolean force;
@@ -1054,7 +1088,7 @@ public interface Locator {
public Double timeout;
/**
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks. Defaults to
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
* {@code false}.
*/
public SelectOptionOptions setForce(boolean force) {
@@ -1082,7 +1116,7 @@ public interface Locator {
}
class SelectTextOptions {
/**
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks. Defaults to
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
* {@code false}.
*/
public Boolean force;
@@ -1094,7 +1128,7 @@ public interface Locator {
public Double timeout;
/**
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks. Defaults to
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
* {@code false}.
*/
public SelectTextOptions setForce(boolean force) {
@@ -1113,7 +1147,7 @@ public interface Locator {
}
class SetCheckedOptions {
/**
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks. Defaults to
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
* {@code false}.
*/
public Boolean force;
@@ -1135,14 +1169,14 @@ public interface Locator {
*/
public Double timeout;
/**
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability/">actionability</a>
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
* performing it.
*/
public Boolean trial;
/**
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks. Defaults to
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
* {@code false}.
*/
public SetCheckedOptions setForce(boolean force) {
@@ -1183,7 +1217,7 @@ public interface Locator {
return this;
}
/**
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability/">actionability</a>
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
* performing it.
*/
@@ -1227,7 +1261,7 @@ public interface Locator {
}
class TapOptions {
/**
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks. Defaults to
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
* {@code false}.
*/
public Boolean force;
@@ -1254,14 +1288,14 @@ public interface Locator {
*/
public Double timeout;
/**
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability/">actionability</a>
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
* performing it.
*/
public Boolean trial;
/**
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks. Defaults to
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
* {@code false}.
*/
public TapOptions setForce(boolean force) {
@@ -1310,7 +1344,7 @@ public interface Locator {
return this;
}
/**
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability/">actionability</a>
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
* performing it.
*/
@@ -1383,7 +1417,7 @@ public interface Locator {
}
class UncheckOptions {
/**
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks. Defaults to
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
* {@code false}.
*/
public Boolean force;
@@ -1405,14 +1439,14 @@ public interface Locator {
*/
public Double timeout;
/**
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability/">actionability</a>
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
* performing it.
*/
public Boolean trial;
/**
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks. Defaults to
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
* {@code false}.
*/
public UncheckOptions setForce(boolean force) {
@@ -1453,7 +1487,7 @@ public interface Locator {
return this;
}
/**
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability/">actionability</a>
* When set, this method only performs the <a href="https://playwright.dev/java/docs/actionability">actionability</a>
* checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without
* performing it.
*/
@@ -1560,7 +1594,7 @@ public interface Locator {
* <ol>
* <li> Ensure that element is a checkbox or a radio input. If not, this method throws. If the element is already checked, this
* method returns immediately.</li>
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks on the element, unless
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the element, unless
* {@code force} option is set.</li>
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link Page#mouse Page.mouse()} to click in the center of the element.</li>
@@ -1581,7 +1615,7 @@ public interface Locator {
* <ol>
* <li> Ensure that element is a checkbox or a radio input. If not, this method throws. If the element is already checked, this
* method returns immediately.</li>
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks on the element, unless
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the element, unless
* {@code force} option is set.</li>
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link Page#mouse Page.mouse()} to click in the center of the element.</li>
@@ -1598,7 +1632,7 @@ public interface Locator {
/**
* This method clicks the element by performing the following steps:
* <ol>
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks on the element, unless
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the element, unless
* {@code force} option is set.</li>
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link Page#mouse Page.mouse()} to click in the center of the element, or the specified {@code position}.</li>
@@ -1616,7 +1650,7 @@ public interface Locator {
/**
* This method clicks the element by performing the following steps:
* <ol>
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks on the element, unless
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the element, unless
* {@code force} option is set.</li>
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link Page#mouse Page.mouse()} to click in the center of the element, or the specified {@code position}.</li>
@@ -1636,7 +1670,7 @@ public interface Locator {
/**
* This method double clicks the element by performing the following steps:
* <ol>
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks on the element, unless
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the element, unless
* {@code force} option is set.</li>
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link Page#mouse Page.mouse()} to double click in the center of the element, or the specified {@code position}.</li>
@@ -1657,7 +1691,7 @@ public interface Locator {
/**
* This method double clicks the element by performing the following steps:
* <ol>
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks on the element, unless
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the element, unless
* {@code force} option is set.</li>
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link Page#mouse Page.mouse()} to double click in the center of the element, or the specified {@code position}.</li>
@@ -1974,7 +2008,7 @@ public interface Locator {
*/
JSHandle evaluateHandle(String expression, Object arg, EvaluateHandleOptions options);
/**
* This method waits for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks, focuses the
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, focuses the
* element, fills it and triggers an {@code input} event after filling. Note that you can pass an empty string to clear the input
* field.
*
@@ -1991,7 +2025,7 @@ public interface Locator {
fill(value, null);
}
/**
* This method waits for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks, focuses the
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, focuses the
* element, fills it and triggers an {@code input} event after filling. Note that you can pass an empty string to clear the input
* field.
*
@@ -2027,7 +2061,7 @@ public interface Locator {
* locator.click();
* }</pre>
*
* @param selector A selector to use when resolving DOM element. See <a href="https://playwright.dev/java/docs/selectors/">working with
* @param selector A selector to use when resolving DOM element. See <a href="https://playwright.dev/java/docs/selectors">working with
* selectors</a> for more details.
*/
FrameLocator frameLocator(String selector);
@@ -2045,10 +2079,15 @@ public interface Locator {
* @param name Attribute name to get the value for.
*/
String getAttribute(String name, GetAttributeOptions options);
/**
* Highlight the corresponding element(s) on the screen. Useful for debugging, don't commit the code that uses {@link
* Locator#highlight Locator.highlight()}.
*/
void highlight();
/**
* This method hovers over the element by performing the following steps:
* <ol>
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks on the element, unless
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the element, unless
* {@code force} option is set.</li>
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link Page#mouse Page.mouse()} to hover over the center of the element, or the specified {@code position}.</li>
@@ -2066,7 +2105,7 @@ public interface Locator {
/**
* This method hovers over the element by performing the following steps:
* <ol>
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks on the element, unless
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the element, unless
* {@code force} option is set.</li>
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link Page#mouse Page.mouse()} to hover over the center of the element, or the specified {@code position}.</li>
@@ -2121,56 +2160,56 @@ public interface Locator {
boolean isChecked(IsCheckedOptions options);
/**
* Returns whether the element is disabled, the opposite of <a
* href="https://playwright.dev/java/docs/actionability/#enabled">enabled</a>.
* href="https://playwright.dev/java/docs/actionability#enabled">enabled</a>.
*/
default boolean isDisabled() {
return isDisabled(null);
}
/**
* Returns whether the element is disabled, the opposite of <a
* href="https://playwright.dev/java/docs/actionability/#enabled">enabled</a>.
* href="https://playwright.dev/java/docs/actionability#enabled">enabled</a>.
*/
boolean isDisabled(IsDisabledOptions options);
/**
* Returns whether the element is <a href="https://playwright.dev/java/docs/actionability/#editable">editable</a>.
* Returns whether the element is <a href="https://playwright.dev/java/docs/actionability#editable">editable</a>.
*/
default boolean isEditable() {
return isEditable(null);
}
/**
* Returns whether the element is <a href="https://playwright.dev/java/docs/actionability/#editable">editable</a>.
* Returns whether the element is <a href="https://playwright.dev/java/docs/actionability#editable">editable</a>.
*/
boolean isEditable(IsEditableOptions options);
/**
* Returns whether the element is <a href="https://playwright.dev/java/docs/actionability/#enabled">enabled</a>.
* Returns whether the element is <a href="https://playwright.dev/java/docs/actionability#enabled">enabled</a>.
*/
default boolean isEnabled() {
return isEnabled(null);
}
/**
* Returns whether the element is <a href="https://playwright.dev/java/docs/actionability/#enabled">enabled</a>.
* Returns whether the element is <a href="https://playwright.dev/java/docs/actionability#enabled">enabled</a>.
*/
boolean isEnabled(IsEnabledOptions options);
/**
* Returns whether the element is hidden, the opposite of <a
* href="https://playwright.dev/java/docs/actionability/#visible">visible</a>.
* href="https://playwright.dev/java/docs/actionability#visible">visible</a>.
*/
default boolean isHidden() {
return isHidden(null);
}
/**
* Returns whether the element is hidden, the opposite of <a
* href="https://playwright.dev/java/docs/actionability/#visible">visible</a>.
* href="https://playwright.dev/java/docs/actionability#visible">visible</a>.
*/
boolean isHidden(IsHiddenOptions options);
/**
* Returns whether the element is <a href="https://playwright.dev/java/docs/actionability/#visible">visible</a>.
* Returns whether the element is <a href="https://playwright.dev/java/docs/actionability#visible">visible</a>.
*/
default boolean isVisible() {
return isVisible(null);
}
/**
* Returns whether the element is <a href="https://playwright.dev/java/docs/actionability/#visible">visible</a>.
* Returns whether the element is <a href="https://playwright.dev/java/docs/actionability#visible">visible</a>.
*/
boolean isVisible(IsVisibleOptions options);
/**
@@ -2180,7 +2219,7 @@ public interface Locator {
/**
* The method finds an element matching the specified selector in the {@code Locator}'s subtree.
*
* @param selector A selector to use when resolving DOM element. See <a href="https://playwright.dev/java/docs/selectors/">working with
* @param selector A selector to use when resolving DOM element. See <a href="https://playwright.dev/java/docs/selectors">working with
* selectors</a> for more details.
*/
default Locator locator(String selector) {
@@ -2189,7 +2228,7 @@ public interface Locator {
/**
* The method finds an element matching the specified selector in the {@code Locator}'s subtree.
*
* @param selector A selector to use when resolving DOM element. See <a href="https://playwright.dev/java/docs/selectors/">working with
* @param selector A selector to use when resolving DOM element. See <a href="https://playwright.dev/java/docs/selectors">working with
* selectors</a> for more details.
*/
Locator locator(String selector, LocatorOptions options);
@@ -2254,7 +2293,7 @@ public interface Locator {
/**
* Returns the buffer with the captured screenshot.
*
* <p> This method waits for the <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks, then
* <p> This method waits for the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, then
* scrolls element into view before taking a screenshot. If the element is detached from DOM, the method throws an error.
*/
default byte[] screenshot() {
@@ -2263,12 +2302,12 @@ public interface Locator {
/**
* Returns the buffer with the captured screenshot.
*
* <p> This method waits for the <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks, then
* <p> This method waits for the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, then
* scrolls element into view before taking a screenshot. If the element is detached from DOM, the method throws an error.
*/
byte[] screenshot(ScreenshotOptions options);
/**
* This method waits for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks, then tries to
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, then tries to
* scroll element into view, unless it is completely visible as defined by <a
* href="https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API">IntersectionObserver</a>'s {@code ratio}.
*/
@@ -2276,14 +2315,14 @@ public interface Locator {
scrollIntoViewIfNeeded(null);
}
/**
* This method waits for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks, then tries to
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, then tries to
* scroll element into view, unless it is completely visible as defined by <a
* href="https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API">IntersectionObserver</a>'s {@code ratio}.
*/
void scrollIntoViewIfNeeded(ScrollIntoViewIfNeededOptions options);
/**
* This method waits for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks, waits until
* all specified options are present in the {@code <select>} element and selects these options.
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, waits until all
* specified options are present in the {@code <select>} element and selects these options.
*
* <p> If the target element is not a {@code <select>} element, this method throws an error. However, if the element is inside the
* {@code <label>} element that has an associated <a
@@ -2310,8 +2349,8 @@ public interface Locator {
return selectOption(values, null);
}
/**
* This method waits for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks, waits until
* all specified options are present in the {@code <select>} element and selects these options.
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, waits until all
* specified options are present in the {@code <select>} element and selects these options.
*
* <p> If the target element is not a {@code <select>} element, this method throws an error. However, if the element is inside the
* {@code <label>} element that has an associated <a
@@ -2336,8 +2375,8 @@ public interface Locator {
*/
List<String> selectOption(String values, SelectOptionOptions options);
/**
* This method waits for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks, waits until
* all specified options are present in the {@code <select>} element and selects these options.
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, waits until all
* specified options are present in the {@code <select>} element and selects these options.
*
* <p> If the target element is not a {@code <select>} element, this method throws an error. However, if the element is inside the
* {@code <label>} element that has an associated <a
@@ -2364,8 +2403,8 @@ public interface Locator {
return selectOption(values, null);
}
/**
* This method waits for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks, waits until
* all specified options are present in the {@code <select>} element and selects these options.
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, waits until all
* specified options are present in the {@code <select>} element and selects these options.
*
* <p> If the target element is not a {@code <select>} element, this method throws an error. However, if the element is inside the
* {@code <label>} element that has an associated <a
@@ -2390,8 +2429,8 @@ public interface Locator {
*/
List<String> selectOption(ElementHandle values, SelectOptionOptions options);
/**
* This method waits for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks, waits until
* all specified options are present in the {@code <select>} element and selects these options.
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, waits until all
* specified options are present in the {@code <select>} element and selects these options.
*
* <p> If the target element is not a {@code <select>} element, this method throws an error. However, if the element is inside the
* {@code <label>} element that has an associated <a
@@ -2418,8 +2457,8 @@ public interface Locator {
return selectOption(values, null);
}
/**
* This method waits for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks, waits until
* all specified options are present in the {@code <select>} element and selects these options.
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, waits until all
* specified options are present in the {@code <select>} element and selects these options.
*
* <p> If the target element is not a {@code <select>} element, this method throws an error. However, if the element is inside the
* {@code <label>} element that has an associated <a
@@ -2444,8 +2483,8 @@ public interface Locator {
*/
List<String> selectOption(String[] values, SelectOptionOptions options);
/**
* This method waits for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks, waits until
* all specified options are present in the {@code <select>} element and selects these options.
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, waits until all
* specified options are present in the {@code <select>} element and selects these options.
*
* <p> If the target element is not a {@code <select>} element, this method throws an error. However, if the element is inside the
* {@code <label>} element that has an associated <a
@@ -2472,8 +2511,8 @@ public interface Locator {
return selectOption(values, null);
}
/**
* This method waits for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks, waits until
* all specified options are present in the {@code <select>} element and selects these options.
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, waits until all
* specified options are present in the {@code <select>} element and selects these options.
*
* <p> If the target element is not a {@code <select>} element, this method throws an error. However, if the element is inside the
* {@code <label>} element that has an associated <a
@@ -2498,8 +2537,8 @@ public interface Locator {
*/
List<String> selectOption(SelectOption values, SelectOptionOptions options);
/**
* This method waits for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks, waits until
* all specified options are present in the {@code <select>} element and selects these options.
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, waits until all
* specified options are present in the {@code <select>} element and selects these options.
*
* <p> If the target element is not a {@code <select>} element, this method throws an error. However, if the element is inside the
* {@code <label>} element that has an associated <a
@@ -2526,8 +2565,8 @@ public interface Locator {
return selectOption(values, null);
}
/**
* This method waits for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks, waits until
* all specified options are present in the {@code <select>} element and selects these options.
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, waits until all
* specified options are present in the {@code <select>} element and selects these options.
*
* <p> If the target element is not a {@code <select>} element, this method throws an error. However, if the element is inside the
* {@code <label>} element that has an associated <a
@@ -2552,8 +2591,8 @@ public interface Locator {
*/
List<String> selectOption(ElementHandle[] values, SelectOptionOptions options);
/**
* This method waits for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks, waits until
* all specified options are present in the {@code <select>} element and selects these options.
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, waits until all
* specified options are present in the {@code <select>} element and selects these options.
*
* <p> If the target element is not a {@code <select>} element, this method throws an error. However, if the element is inside the
* {@code <label>} element that has an associated <a
@@ -2580,8 +2619,8 @@ public interface Locator {
return selectOption(values, null);
}
/**
* This method waits for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks, waits until
* all specified options are present in the {@code <select>} element and selects these options.
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, waits until all
* specified options are present in the {@code <select>} element and selects these options.
*
* <p> If the target element is not a {@code <select>} element, this method throws an error. However, if the element is inside the
* {@code <label>} element that has an associated <a
@@ -2606,14 +2645,14 @@ public interface Locator {
*/
List<String> selectOption(SelectOption[] values, SelectOptionOptions options);
/**
* This method waits for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks, then focuses
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, then focuses
* the element and selects all its text content.
*/
default void selectText() {
selectText(null);
}
/**
* This method waits for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks, then focuses
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, then focuses
* the element and selects all its text content.
*/
void selectText(SelectTextOptions options);
@@ -2622,7 +2661,7 @@ public interface Locator {
* <ol>
* <li> Ensure that matched element is a checkbox or a radio input. If not, this method throws.</li>
* <li> If the element already has the right checked state, this method returns immediately.</li>
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks on the matched element,
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the matched element,
* unless {@code force} option is set. If the element is detached during the checks, the whole action is retried.</li>
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link Page#mouse Page.mouse()} to click in the center of the element.</li>
@@ -2643,7 +2682,7 @@ public interface Locator {
* <ol>
* <li> Ensure that matched element is a checkbox or a radio input. If not, this method throws.</li>
* <li> If the element already has the right checked state, this method returns immediately.</li>
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks on the matched element,
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the matched element,
* unless {@code force} option is set. If the element is detached during the checks, the whole action is retried.</li>
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link Page#mouse Page.mouse()} to click in the center of the element.</li>
@@ -2732,7 +2771,7 @@ public interface Locator {
/**
* This method taps the element by performing the following steps:
* <ol>
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks on the element, unless
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the element, unless
* {@code force} option is set.</li>
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link Page#touchscreen Page.touchscreen()} to tap the center of the element, or the specified {@code position}.</li>
@@ -2752,7 +2791,7 @@ public interface Locator {
/**
* This method taps the element by performing the following steps:
* <ol>
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks on the element, unless
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the element, unless
* {@code force} option is set.</li>
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link Page#touchscreen Page.touchscreen()} to tap the center of the element, or the specified {@code position}.</li>
@@ -2822,7 +2861,7 @@ public interface Locator {
* <ol>
* <li> Ensure that element is a checkbox or a radio input. If not, this method throws. If the element is already unchecked,
* this method returns immediately.</li>
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks on the element, unless
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the element, unless
* {@code force} option is set.</li>
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link Page#mouse Page.mouse()} to click in the center of the element.</li>
@@ -2843,7 +2882,7 @@ public interface Locator {
* <ol>
* <li> Ensure that element is a checkbox or a radio input. If not, this method throws. If the element is already unchecked,
* this method returns immediately.</li>
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability/">actionability</a> checks on the element, unless
* <li> Wait for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks on the element, unless
* {@code force} option is set.</li>
* <li> Scroll the element into view if needed.</li>
* <li> Use {@link Page#mouse Page.mouse()} to click in the center of the element.</li>
File diff suppressed because it is too large Load Diff
@@ -70,7 +70,7 @@ public interface Playwright extends AutoCloseable {
APIRequest request();
/**
* Selectors can be used to install custom selector engines. See <a
* href="https://playwright.dev/java/docs/selectors/">Working with selectors</a> for more information.
* href="https://playwright.dev/java/docs/selectors">Working with selectors</a> for more information.
*/
Selectors selectors();
/**
@@ -20,7 +20,7 @@ import java.nio.file.Path;
/**
* Selectors can be used to install custom selector engines. See <a
* href="https://playwright.dev/java/docs/selectors/">Working with selectors</a> for more information.
* href="https://playwright.dev/java/docs/selectors">Working with selectors</a> for more information.
*/
public interface Selectors {
class RegisterOptions {
@@ -20,7 +20,7 @@ import java.nio.file.Path;
/**
* API for collecting and saving Playwright traces. Playwright traces can be opened in <a
* href="https://playwright.dev/java/docs/trace-viewer/">Trace Viewer</a> after Playwright script runs.
* href="https://playwright.dev/java/docs/trace-viewer">Trace Viewer</a> after Playwright script runs.
*
* <p> Start recording a trace before performing actions. At the end, stop tracing and save it to a file.
* <pre>{@code
@@ -409,7 +409,7 @@ public interface LocatorAssertions {
void isFocused(IsFocusedOptions options);
/**
* Ensures the {@code Locator} points to a hidden DOM node, which is the opposite of <a
* href="https://playwright.dev/java/docs/actionability/#visible">visible</a>.
* href="https://playwright.dev/java/docs/actionability#visible">visible</a>.
* <pre>{@code
* assertThat(page.locator(".my-element")).isHidden();
* }</pre>
@@ -419,15 +419,14 @@ public interface LocatorAssertions {
}
/**
* Ensures the {@code Locator} points to a hidden DOM node, which is the opposite of <a
* href="https://playwright.dev/java/docs/actionability/#visible">visible</a>.
* href="https://playwright.dev/java/docs/actionability#visible">visible</a>.
* <pre>{@code
* assertThat(page.locator(".my-element")).isHidden();
* }</pre>
*/
void isHidden(IsHiddenOptions options);
/**
* Ensures the {@code Locator} points to a <a href="https://playwright.dev/java/docs/actionability/#visible">visible</a> DOM
* node.
* Ensures the {@code Locator} points to a <a href="https://playwright.dev/java/docs/actionability#visible">visible</a> DOM node.
* <pre>{@code
* assertThat(page.locator(".my-element")).toBeVisible();
* }</pre>
@@ -436,8 +435,7 @@ public interface LocatorAssertions {
isVisible(null);
}
/**
* Ensures the {@code Locator} points to a <a href="https://playwright.dev/java/docs/actionability/#visible">visible</a> DOM
* node.
* Ensures the {@code Locator} points to a <a href="https://playwright.dev/java/docs/actionability#visible">visible</a> DOM node.
* <pre>{@code
* assertThat(page.locator(".my-element")).toBeVisible();
* }</pre>
@@ -24,8 +24,8 @@ import com.microsoft.playwright.impl.LocatorAssertionsImpl;
import com.microsoft.playwright.impl.PageAssertionsImpl;
/**
* The {@code PlaywrightAssertions} class provides convenience methods for creating assertions that will wait until the expected
* condition is met.
* Playwright gives you Web-First Assertions with convenience methods for creating assertions that will wait and retry
* until the expected condition is met.
*
* <p> Consider the following example:
* <pre>{@code
@@ -64,6 +64,22 @@ class BrowserTypeImpl extends ChannelOwner implements BrowserType {
// We don't use gson() here as the headers map should be serialized to a json object.
JsonObject params = new Gson().toJsonTree(options).getAsJsonObject();
params.addProperty("wsEndpoint", wsEndpoint);
if (!params.has("headers")) {
params.add("headers", new JsonObject());
}
JsonObject headers = params.get("headers").getAsJsonObject();
boolean foundBrowserHeader = false;
for (String name : headers.keySet()) {
if ("x-playwright-browser".equalsIgnoreCase(name)) {
foundBrowserHeader = true;
break;
}
}
if (!foundBrowserHeader) {
headers.addProperty("x-playwright-browser", name());
}
JsonObject json = sendMessage("connect", params).getAsJsonObject();
JsonPipe pipe = connection.getExistingObject(json.getAsJsonObject("pipe").get("guid").getAsString());
Connection connection = new Connection(pipe);
@@ -1024,6 +1024,12 @@ public class FrameImpl extends ChannelOwner implements Frame {
return result.get("value").getAsInt();
}
void highlightImpl(String selector) {
JsonObject params = new JsonObject();
params.addProperty("selector", selector);
sendMessage("highlight", params);
}
protected void handleEvent(String event, JsonObject params) {
if ("loadstate".equals(event)) {
JsonElement add = params.get("add");
@@ -196,6 +196,11 @@ class LocatorImpl implements Locator {
return frame.getAttribute(selector, name, convertType(options, Frame.GetAttributeOptions.class).setStrict(true));
}
@Override
public void highlight() {
frame.highlightImpl(selector);
}
@Override
public void hover(HoverOptions options) {
if (options == null) {
@@ -466,6 +471,15 @@ class LocatorImpl implements Locator {
return frame.withLogging("Locator.expect", () -> expectImpl(expression, options));
}
JsonObject toProtocol() {
JsonObject result = new JsonObject();
JsonObject frameJson = new JsonObject();
frameJson.addProperty("guid", frame.guid);
result.add("frame", frameJson);
result.addProperty("selector", selector);
return result;
}
private FrameExpectResult expectImpl(String expression, FrameExpectOptions options) {
if (options == null) {
options = new FrameExpectOptions();
@@ -28,11 +28,11 @@ import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.regex.Pattern;
import static com.microsoft.playwright.impl.Serialization.gson;
import static com.microsoft.playwright.impl.Utils.convertType;
import static com.microsoft.playwright.impl.Utils.isSafeCloseError;
import static com.microsoft.playwright.options.ScreenshotType.JPEG;
import static com.microsoft.playwright.options.ScreenshotType.PNG;
import static com.microsoft.playwright.impl.Serialization.gson;
import static com.microsoft.playwright.impl.Utils.isSafeCloseError;
import static java.nio.charset.StandardCharsets.UTF_8;
import static java.nio.file.Files.readAllBytes;
import static java.util.Arrays.asList;
@@ -1034,8 +1034,18 @@ public class PageImpl extends ChannelOwner implements Page {
}
}
}
List<Locator> mask = options.mask;
options.mask = null;
JsonObject params = gson().toJsonTree(options).getAsJsonObject();
options.mask = mask;
params.remove("path");
if (mask != null) {
JsonArray maskArray = new JsonArray();
for (Locator locator: mask) {
maskArray.add(((LocatorImpl) locator).toProtocol());
}
params.add("mask", maskArray);
}
JsonObject json = sendMessage("screenshot", params).getAsJsonObject();
byte[] buffer = Base64.getDecoder().decode(json.get("binary").getAsString());
@@ -40,6 +40,7 @@ class Serialization {
.registerTypeAdapter(Media.class, new ToLowerCaseSerializer<Media>())
.registerTypeAdapter(ForcedColors.class, new ToLowerCaseSerializer<ForcedColors>())
.registerTypeAdapter(ReducedMotion.class, new ToLowerCaseAndDashSerializer<ReducedMotion>())
.registerTypeAdapter(ScreenshotAnimations.class, new ToLowerCaseSerializer<ScreenshotAnimations>())
.registerTypeAdapter(ScreenshotType.class, new ToLowerCaseSerializer<ScreenshotType>())
.registerTypeAdapter(MouseButton.class, new ToLowerCaseSerializer<MouseButton>())
.registerTypeAdapter(LoadState.class, new ToLowerCaseSerializer<LoadState>())
@@ -0,0 +1,21 @@
/*
* 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 ScreenshotAnimations {
DISABLED
}
@@ -346,7 +346,21 @@ public class TestBrowserContextAddCookies extends TestBase {
"}", server.CROSS_PROCESS_PREFIX + "/grid.html");
page.frames().get(1).evaluate("document.cookie = 'username=John Doe'");
page.waitForTimeout(2000);
boolean allowsThirdParty = isFirefox();
List<Cookie> cookies = context.cookies(server.CROSS_PROCESS_PREFIX + "/grid.html");
assertEquals(0, cookies.size());
if (allowsThirdParty) {
assertJsonEquals("[{\n" +
" 'domain': '127.0.0.1',\n" +
" 'expires': -1,\n" +
" 'httpOnly': false,\n" +
" 'name': 'username',\n" +
" 'path': '/',\n" +
" 'sameSite': 'NONE',\n" +
" 'secure': false,\n" +
" 'value': 'John Doe'\n" +
"}]", cookies);
} else {
assertEquals(0, cookies.size());
}
}
}
@@ -50,7 +50,7 @@ public class TestBrowserContextCookies extends TestBase {
" expires: -1,\n" +
" httpOnly: false,\n" +
" secure: false,\n" +
" sameSite: '" + (isChromium() || isFirefox() ? "LAX" : "NONE") +"'\n" +
" sameSite: '" + (isChromium() ? "LAX" : "NONE") +"'\n" +
" }]", cookies);
}
@@ -74,7 +74,7 @@ public class TestBrowserContextCookies extends TestBase {
assertEquals(timestamp, cookie.expires);
assertEquals(false, cookie.httpOnly);
assertEquals(false, cookie.secure);
if (isChromium() || isFirefox()) {
if (isChromium()) {
assertEquals(SameSiteAttribute.LAX, cookie.sameSite);
} else {
assertEquals(SameSiteAttribute.NONE, cookie.sameSite);
@@ -146,7 +146,7 @@ public class TestBrowserContextCookies extends TestBase {
" expires: -1,\n" +
" httpOnly: false,\n" +
" secure: false,\n" +
" sameSite: '" + (isChromium() || isFirefox() ? "LAX" : "NONE") +"'\n" +
" sameSite: '" + (isChromium() ? "LAX" : "NONE") +"'\n" +
" },\n" +
" {\n" +
" name: 'username',\n" +
@@ -156,7 +156,7 @@ public class TestBrowserContextCookies extends TestBase {
" expires: -1,\n" +
" httpOnly: false,\n" +
" secure: false,\n" +
" sameSite: '" + (isChromium() || isFirefox() ? "LAX" : "NONE") +"'\n" +
" sameSite: '" + (isChromium() ? "LAX" : "NONE") +"'\n" +
" }\n" +
"]", cookies);
}
@@ -16,6 +16,7 @@
package com.microsoft.playwright;
import com.sun.net.httpserver.Filter;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
@@ -33,10 +34,19 @@ public class TestBrowserContextNetworkEvents extends TestBase {
page.setContent("<a target=_blank rel=noopener href='/one-style.html'>yo</a>");
Page page1 = context.waitForPage(() -> page.click("a"));
page1.waitForLoadState();
assertEquals(asList(
server.EMPTY_PAGE,
server.PREFIX + "/one-style.html",
server.PREFIX + "/one-style.css"), requests);
// In firefox one-style.css is requested multiple times.
if (isFirefox()) {
assertEquals(asList(
server.EMPTY_PAGE,
server.PREFIX + "/one-style.html",
server.PREFIX + "/one-style.css",
server.PREFIX + "/one-style.css"), requests);
} else {
assertEquals(asList(
server.EMPTY_PAGE,
server.PREFIX + "/one-style.html",
server.PREFIX + "/one-style.css"), requests);
}
}
@Test
@@ -47,10 +57,19 @@ public class TestBrowserContextNetworkEvents extends TestBase {
page.setContent("<a target=_blank rel=noopener href='/one-style.html'>yo</a>");
Page page1 = context.waitForPage(() -> page.click("a"));
page1.waitForLoadState();
assertEquals(asList(
server.EMPTY_PAGE,
server.PREFIX + "/one-style.html",
server.PREFIX + "/one-style.css"), responses);
// In firefox one-style.css is requested multiple times.
if (isFirefox()) {
assertEquals(asList(
server.EMPTY_PAGE,
server.PREFIX + "/one-style.html",
server.PREFIX + "/one-style.css",
server.PREFIX + "/one-style.css"), responses);
} else {
assertEquals(asList(
server.EMPTY_PAGE,
server.PREFIX + "/one-style.html",
server.PREFIX + "/one-style.css"), responses);
}
}
@Test
@@ -59,7 +78,12 @@ public class TestBrowserContextNetworkEvents extends TestBase {
List<Request> failedRequests = new ArrayList<>();
context.onRequestFailed(request -> failedRequests.add(request));
page.navigate(server.PREFIX + "/one-style.html");
assertEquals(1, failedRequests.size());
// In firefox one-style.css is requested multiple times.
if (isFirefox()) {
assertTrue(failedRequests.size() > 0);
} else {
assertEquals(1, failedRequests.size());
}
assertTrue(failedRequests.get(0).url().contains("one-style.css"));
assertNull(failedRequests.get(0).response());
assertEquals("stylesheet", failedRequests.get(0).resourceType());
@@ -140,8 +140,10 @@ public class TestBrowserContextRoute extends TestBase {
@Test
void shouldOverwritePostBodyWithEmptyString() throws ExecutionException, InterruptedException {
boolean[] routeHandled = {false};
context.route("**/empty.html", route -> {
route.resume(new Route.ResumeOptions().setPostData(""));
routeHandled[0] = true;
});
Future<Server.Request> req = server.futureRequest("/empty.html");
@@ -153,7 +155,9 @@ public class TestBrowserContextRoute extends TestBase {
" });\n" +
" })()\n" +
" </script>");
while (!routeHandled[0]) {
page.waitForTimeout(100);
}
byte[] body = req.get().postBody;
assertEquals(0, body.length);
}
@@ -109,7 +109,7 @@ public class TestBrowserContextStorageState extends TestBase {
" 'expires':-1,\n" +
" 'httpOnly':false,\n" +
" 'secure':false,\n" +
" 'sameSite':'" + (isChromium() || isFirefox() ? "Lax" : "None") + "'\n" +
" 'sameSite':'" + (isChromium() ? "Lax" : "None") + "'\n" +
" }],\n" +
" 'origins':[\n" +
" {\n" +
@@ -32,8 +32,7 @@ import java.nio.file.Paths;
import java.util.*;
import java.util.stream.Collectors;
import static com.microsoft.playwright.Utils.mapOf;
import static com.microsoft.playwright.Utils.parseTrace;
import static com.microsoft.playwright.Utils.*;
import static java.nio.charset.StandardCharsets.UTF_8;
import static java.util.Arrays.asList;
import static org.junit.jupiter.api.Assertions.*;
@@ -66,7 +65,7 @@ public class TestBrowserTypeConnect extends TestBase {
String cliJs = dir.resolve("package/lib/cli/cli.js").toString();
// We launch node process directly instead of using playwright.sh script as killing the script
// process will leave node process running and killing it would be more hassle.
ProcessBuilder pb = new ProcessBuilder(node, cliJs, "launch-server", browserType.name());
ProcessBuilder pb = new ProcessBuilder(node, cliJs, "launch-server", "--browser", browserType.name());
pb.directory(dir.toFile());
pb.redirectError(ProcessBuilder.Redirect.INHERIT);
BrowserServer result = new BrowserServer();
@@ -166,6 +165,7 @@ public class TestBrowserTypeConnect extends TestBase {
}
assertNotNull(webSocketServer.lastClientHandshake);
assertEquals("Playwright", webSocketServer.lastClientHandshake.getFieldValue("User-Agent"));
assertEquals(browserType.name(), webSocketServer.lastClientHandshake.getFieldValue("x-playwright-browser"));
assertEquals("bar", webSocketServer.lastClientHandshake.getFieldValue("foo"));
}
}
@@ -48,6 +48,6 @@ public class TestElementHandlePress extends TestBase {
void shouldWorkWithNumberInput() {
page.setContent("<input type='number' value=2 />");
page.press("input", "1");
assertEquals("12", page.evalOnSelector("input", "input => input.value"));
assertEquals(isWebKit() ? "1" : "12", page.evalOnSelector("input", "input => input.value"));
}
}
@@ -48,6 +48,6 @@ public class TestElementHandleType extends TestBase {
void shouldWorkWithNumberInput() {
page.setContent("<input type='number' value=2 />");
page.type("input", "13");
assertEquals("132", page.evalOnSelector("input", "input => input.value"));
assertEquals(isWebKit() ? "13" : "132", page.evalOnSelector("input", "input => input.value"));
}
}
@@ -137,7 +137,7 @@ public class TestGlobalFetch extends TestBase {
Optional<HttpHeader> contentType = response.headersArray().stream().filter(h -> "content-type".equals(h.name.toLowerCase())).findFirst();
assertTrue(contentType.isPresent());
assertEquals("application/json", contentType.get().value);
assertEquals("", response.text());
assertEquals("{\"foo\": \"bar\"}\n", response.text());
}
@Test
@@ -0,0 +1,23 @@
package com.microsoft.playwright;
import com.google.gson.Gson;
import com.microsoft.playwright.options.BoundingBox;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import static com.microsoft.playwright.assertions.PlaywrightAssertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class TestLocatorHighlight extends TestBase {
@Disabled("Requires isUnderTest to be true https://github.com/microsoft/playwright/pull/12420")
@Test
void shouldHighlightLocator() {
page.setContent("<input type='text' />");
page.locator("input").highlight();
assertThat(page.locator("x-pw-tooltip")).hasText("input");
assertThat(page.locator("x-pw-highlight")).isVisible();
BoundingBox box1 = page.locator("input").boundingBox();
BoundingBox box2 = page.locator("x-pw-highlight").boundingBox();
assertEquals(new Gson().toJson(box2), new Gson().toJson(box1));
}
}
@@ -57,7 +57,12 @@ public class TestPageEventNetwork extends TestBase {
List<Request> failedRequests = new ArrayList<>();
page.onRequestFailed(request -> failedRequests.add(request));
page.navigate(server.PREFIX + "/one-style.html");
assertEquals(1, failedRequests.size());
// In firefox one-style.css is requested multiple times.
if (isFirefox()) {
assertTrue(failedRequests.size() > 0);
} else {
assertEquals(1, failedRequests.size());
}
assertTrue(failedRequests.get(0).url().contains("one-style.css"));
assertNull(failedRequests.get(0).response());
assertEquals("stylesheet", failedRequests.get(0).resourceType());
@@ -347,7 +347,12 @@ public class TestPageRoute extends TestBase {
assertEquals(200, response.status());
assertTrue(response.url().contains("one-style.html"));
assertEquals(2, intercepted.size());
// In firefox one-style.css is requested multiple times.
if (isFirefox()) {
assertTrue(intercepted.size() > 1);
} else {
assertEquals(2, intercepted.size());
}
assertEquals("document", intercepted.get(0).resourceType());
assertTrue(intercepted.get(0).url().contains("one-style.html"));
@@ -460,7 +465,12 @@ public class TestPageRoute extends TestBase {
});
Response response = page.navigate("data:text/html,<link rel='stylesheet' href='" + server.PREFIX + "/fonts?helvetica|arial'/>");
assertNull(response);
assertEquals(1, requests.size());
// In firefox linked resource is requested multiple times.
if (isFirefox()) {
assertTrue(requests.size() > 0);
} else {
assertEquals(1, requests.size());
}
assertEquals(400, (requests.get(0).response()).status());
}
@@ -17,14 +17,20 @@
package com.microsoft.playwright;
import com.microsoft.playwright.options.Clip;
import com.microsoft.playwright.options.ScreenshotAnimations;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.opentest4j.AssertionFailedError;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.nio.file.Paths;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static com.microsoft.playwright.options.ScreenshotAnimations.DISABLED;
import static java.util.Arrays.asList;
import static org.junit.jupiter.api.Assertions.*;
// TODO: suite.skip(browserName === "firefox" && headful");
public class TestPageScreenshot extends TestBase {
@@ -50,4 +56,101 @@ public class TestPageScreenshot extends TestBase {
assertEquals(100, image.getHeight());
// expect(screenshot).toMatchSnapshot("screenshot-clip-rect.png");
}
static private void rafraf(Page page) {
// Do a double raf since single raf does not
// actually guarantee a new animation frame.
page.evaluate("() => new Promise(x => {\n" +
" requestAnimationFrame(() => requestAnimationFrame(x));\n" +
" })");
}
@Test
void shouldNotCaptureInfiniteCssAnimation() {
page.navigate(server.PREFIX + "/rotate-z.html");
Locator div = page.locator("div");
byte[] screenshot = div.screenshot(new Locator.ScreenshotOptions().setAnimations(DISABLED));
for (int i = 0; i < 10; ++i) {
rafraf(page);
byte[] newScreenshot = div.screenshot(new Locator.ScreenshotOptions().setAnimations(DISABLED));
assertArrayEquals(screenshot, newScreenshot);
}
}
@Test
void shouldNotCapturePseudoElementCssAnimation() {
page.navigate(server.PREFIX + "/rotate-pseudo.html");
Locator div = page.locator("div");
byte[] screenshot = div.screenshot(new Locator.ScreenshotOptions().setAnimations(DISABLED));
for (int i = 0; i < 10; ++i) {
rafraf(page);
byte[] newScreenshot = div.screenshot(new Locator.ScreenshotOptions().setAnimations(DISABLED));
assertArrayEquals(screenshot, newScreenshot);
}
}
@Test
void shouldNotCaptureCssAnimationsInShadowDOM() {
page.navigate(server.PREFIX + "/rotate-z-shadow-dom.html");
byte[] screenshot = page.screenshot(new Page.ScreenshotOptions().setAnimations(DISABLED));
for (int i = 0; i < 10; ++i) {
rafraf(page);
byte[] newScreenshot = page.screenshot(new Page.ScreenshotOptions().setAnimations(DISABLED));
assertArrayEquals(screenshot, newScreenshot);
}
}
@Test
void shouldResumeInfiniteAnimations() {
page.navigate(server.PREFIX + "/rotate-z.html");
page.screenshot(new Page.ScreenshotOptions().setAnimations(DISABLED));
byte[] buffer1 = page.screenshot();
rafraf(page);
byte[] buffer2 = page.screenshot();
try {
assertArrayEquals(buffer1, buffer2);
} catch (AssertionFailedError e) {
return;
}
fail("Screenshots are equal");
}
@Test
void shouldNotCaptureInfiniteWebAnimations() {
page.navigate(server.PREFIX + "/web-animation.html");
Locator div = page.locator("div");
byte[] screenshot = div.screenshot(new Locator.ScreenshotOptions().setAnimations(DISABLED));
for (int i = 0; i < 10; ++i) {
rafraf(page);
byte[] newScreenshot = div.screenshot(new Locator.ScreenshotOptions().setAnimations(DISABLED));
assertArrayEquals(screenshot, newScreenshot);
}
// Should resume infinite web animation.
byte[] buffer1 = page.screenshot();
rafraf(page);
byte[] buffer2 = page.screenshot();
try {
assertArrayEquals(buffer1, buffer2);
} catch (AssertionFailedError e) {
return;
}
fail("Screenshots are equal");
}
@Test
void maskShouldWork() {
page.setViewportSize(500, 500);
page.navigate(server.PREFIX + "/grid.html");
byte[] screenshot = page.screenshot(new Page.ScreenshotOptions()
.setMask(asList(page.locator("div").nth(5))));
// TODO: toMatchSnapshot is not present in java, so we only checks that masked screenshot is different.
byte[] originalScreenshot = page.screenshot();
try {
assertArrayEquals(screenshot, originalScreenshot);
} catch (AssertionFailedError e) {
return;
}
fail("Screenshots are equal");
}
}
@@ -0,0 +1,21 @@
<!DOCTYPE HTML>
<style>
div {
position: absolute;
top: 0;
left: 0;
width: 200px;
height: 100px;
background-color: red;
transition: all 10s;
}
.transition {
transform: rotate(360deg);
}
</style>
<div></div>
<script>
window.addEventListener('load', () => {
document.querySelector('div').classList.add('transition');
}, false);
</script>
@@ -0,0 +1,32 @@
<html>
<head>
<style type="text/css">
div::after {
position: absolute;
content: " ";
top: 0;
left: 0;
width: 200px;
height: 100px;
background-color: red;
animation-name: z-spin;
animation-duration: 5s;
animation-iteration-count: infinite;
animation-timing-function: linear;
}
div {
position: absolute;
width: 10px;
height: 10px;
}
@keyframes z-spin {
0% { transform: rotateZ(0deg); }
100% { transform: rotateZ(360deg); }
}
</style>
</head>
<body >
<div class="square"></div>
</body>
</html>
@@ -0,0 +1,31 @@
<html>
<head></head>
<body></body>
<script>
window.addEventListener('DOMContentLoaded', () => {
const shadow = document.body.attachShadow({mode: 'open'});
shadow.append(document.createElement('div'));
const style = document.createElement('style');
style.textContent = `
div {
position: absolute;
top: 0;
left: 0;
width: 200px;
height: 100px;
background-color: red;
animation-name: z-spin;
animation-duration: 5s;
animation-iteration-count: infinite;
animation-timing-function: linear;
}
@keyframes z-spin {
0% { transform: rotateZ(0deg); }
100% { transform: rotateZ(360deg); }
}
`;
shadow.append(style);
}, false);
</script>
</html>
+1 -1
View File
@@ -13,7 +13,7 @@
animation-iteration-count: infinite;
animation-timing-function: linear;
}
@keyframes z-spin {
0% { transform: rotateZ(0deg); }
100% { transform: rotateZ(360deg); }
@@ -0,0 +1,23 @@
<!DOCTYPE HTML>
<style>
div {
position: absolute;
top: 0;
left: 0;
width: 200px;
height: 100px;
background-color: red;
}
</style>
<div></div>
<script>
document.querySelector('div').animate(
[
{ transform: 'rotate(0deg)' },
{ transform: 'rotate(360deg)' }
], {
duration: 3000,
iterations: Infinity
}
);
</script>
+1 -1
View File
@@ -6,7 +6,7 @@
<groupId>com.microsoft.playwright</groupId>
<artifactId>parent-pom</artifactId>
<version>1.19.0-SNAPSHOT</version>
<version>1.20.1</version>
<packaging>pom</packaging>
<name>Playwright Parent Project</name>
<description>Java library to automate Chromium, Firefox and WebKit with a single API.
+1 -1
View File
@@ -1 +1 @@
1.19.0
1.20.1
-5
View File
@@ -1,5 +0,0 @@
#!/bin/bash
echo "-- tagging: $2"
docker tag $1 $2
docker push $2
+1 -1
View File
@@ -6,7 +6,7 @@
<groupId>com.microsoft.playwright</groupId>
<artifactId>api-generator</artifactId>
<version>1.19.0-SNAPSHOT</version>
<version>1.20.1</version>
<name>Playwright - API Generator</name>
<description>
This is an internal module used to generate Java API from the upstream Playwright
@@ -183,7 +183,7 @@ abstract class Element {
String url = matcher.group(2);
if (url.startsWith("./")) {
// ./actionability.md#editable => https://playwright.dev/java/docs/actionability/#editable
url = url.replace(".md", "/");
url = url.replace(".md", "");
url = url.replace("./", "https://playwright.dev/java/docs/");
}
String link = "<a href=\"" + url + "\">" + matcher.group(1) + "</a>";
+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.19.0-SNAPSHOT</version>
<version>1.20.1</version>
<name>Test Playwright Command Line Version</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-local-installation</artifactId>
<version>1.19.0-SNAPSHOT</version>
<version>1.20.1</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.19.0-SNAPSHOT</version>
<version>1.20.1</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.19.0-SNAPSHOT</version>
<version>1.20.1</version>
<name>Playwright - Update Version in Documentation</name>
<description>
This is an internal module used to update versions in the documentation based on
@@ -2,26 +2,32 @@ FROM ubuntu:focal
# === INSTALL JDK and Maven ===
RUN apt-get update && apt-get install -y --no-install-recommends \
openjdk-11-jdk maven
RUN apt-get update && \
apt-get install -y --no-install-recommends \
openjdk-11-jdk maven \
# Install utilities required for downloading browsers
curl \
# Install utilities required for downloading driver
unzip && \
rm -rf /var/lib/apt/lists/* && \
# Create the pwuser
adduser pwuser
ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
# Install utilities required for downloading driver
RUN apt-get update && apt-get install -y --no-install-recommends \
curl unzip
# === INSTALL playwright maven modules & browsers ===
# === BAKE BROWSERS INTO IMAGE ===
# Browsers will remain downloaded in `/ms-playwright`.
# Note: make sure to set 777 to the registry so that any user can access
# registry.
ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
RUN mkdir /ms-playwright && chmod -R 777 $PLAYWRIGHT_BROWSERS_PATH
RUN mkdir /ms-playwright && \
mkdir /tmp/pw-java
RUN mkdir /tmp/pw-java
COPY . /tmp/pw-java
RUN cd /tmp/pw-java && \
./scripts/download_driver_for_all_platforms.sh && \
mvn install -D skipTests --no-transfer-progress && \
@@ -29,4 +35,5 @@ RUN cd /tmp/pw-java && \
-D exec.args="install-deps" -f playwright/pom.xml --no-transfer-progress && \
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI \
-D exec.args="install" -f playwright/pom.xml --no-transfer-progress && \
rm -rf /tmp/pw-java
rm -rf /tmp/pw-java && \
chmod -R 777 $PLAYWRIGHT_BROWSERS_PATH
+4
View File
@@ -0,0 +1,4 @@
# Docker build infra
This folder contains the infra to build the Docker images for Java. It's based on
the upstream code located in [`microsoft/playwright/utils/docker`](https://github.com/microsoft/playwright/tree/main/utils/docker).
+35
View File
@@ -0,0 +1,35 @@
#!/bin/bash
set -e
set +x
if [[ ($1 == '--help') || ($1 == '-h') || ($1 == '') || ($2 == '') ]]; then
echo "usage: $(basename $0) {--arm64,--amd64} {focal} playwright:localbuild-focal"
echo
echo "Build Playwright docker image and tag it as 'playwright:localbuild-focal'."
echo "Once image is built, you can run it with"
echo ""
echo " docker run --rm -it playwright:localbuild-focal /bin/bash"
echo ""
echo "NOTE: this requires on Playwright PIP dependencies to be installed"
echo ""
exit 0
fi
function cleanup() {
:
}
trap "cleanup; cd $(pwd -P)" EXIT
cd "$(dirname "$0")"
PLATFORM=""
if [[ "$1" == "--arm64" ]]; then
PLATFORM="linux/arm64";
elif [[ "$1" == "--amd64" ]]; then
PLATFORM="linux/amd64"
else
echo "ERROR: unknown platform specifier - $1. Only --arm64 or --amd64 is supported"
exit 1
fi
docker build --platform "${PLATFORM}" -t "$3" -f "Dockerfile.$2" ../../
+117
View File
@@ -0,0 +1,117 @@
#!/bin/bash
set -e
set +x
trap "cd $(pwd -P)" EXIT
cd "$(dirname "$0")"
MCR_IMAGE_NAME="playwright/java"
# GITHUB_REF has a form of `refs/tags/v1.3.0`.
# TAG_NAME would be `v1.3.0`
TAG_NAME=${GITHUB_REF#refs/tags/}
PW_VERSION="${TAG_NAME#v}"
RELEASE_CHANNEL="$1"
if [[ "${RELEASE_CHANNEL}" == "stable" ]]; then
if [[ ! "${PW_VERSION}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "ERROR: cannot publish stable docker with Playwright version '${PW_VERSION}'"
exit 1
fi
elif [[ "${RELEASE_CHANNEL}" == "canary" ]]; then
:
else
echo "ERROR: unknown release channel - ${RELEASE_CHANNEL}"
echo "Must be either 'stable' or 'canary'"
exit 1
fi
if [[ -z "${GITHUB_SHA}" ]]; then
echo "ERROR: GITHUB_SHA env variable must be specified"
exit 1
fi
BIONIC_TAGS=(
"next-bionic"
"v${PW_VERSION}-bionic"
)
if [[ "$RELEASE_CHANNEL" == "stable" ]]; then
BIONIC_TAGS+=("bionic")
fi
FOCAL_TAGS=(
"next"
"sha-${GITHUB_SHA}"
"next-focal"
)
if [[ "$RELEASE_CHANNEL" == "stable" ]]; then
FOCAL_TAGS+=("latest")
FOCAL_TAGS+=("focal")
FOCAL_TAGS+=("v${PW_VERSION}-focal")
FOCAL_TAGS+=("v${PW_VERSION}")
fi
tag_and_push() {
local source="$1"
local target="$2"
echo "-- tagging: $target"
docker tag $source $target
docker push $target
}
publish_docker_images_with_arch_suffix() {
local FLAVOR="$1"
local TAGS=()
if [[ "$FLAVOR" == "bionic" ]]; then
TAGS=("${BIONIC_TAGS[@]}")
elif [[ "$FLAVOR" == "focal" ]]; then
TAGS=("${FOCAL_TAGS[@]}")
else
echo "ERROR: unknown flavor - $FLAVOR. Must be either 'bionic' or 'focal'"
exit 1
fi
local ARCH="$2"
if [[ "$ARCH" != "amd64" && "$ARCH" != "arm64" ]]; then
echo "ERROR: unknown arch - $ARCH. Must be either 'amd64' or 'arm64'"
exit 1
fi
# Prune docker images to avoid platform conflicts
docker system prune -fa
./build.sh "--${ARCH}" "${FLAVOR}" "${MCR_IMAGE_NAME}:localbuild"
for ((i = 0; i < ${#TAGS[@]}; i++)) do
local TAG="${TAGS[$i]}"
tag_and_push "${MCR_IMAGE_NAME}:localbuild" "playwright.azurecr.io/public/${MCR_IMAGE_NAME}:${TAG}-${ARCH}"
done
}
publish_docker_manifest () {
local FLAVOR="$1"
local TAGS=()
if [[ "$FLAVOR" == "bionic" ]]; then
TAGS=("${BIONIC_TAGS[@]}")
elif [[ "$FLAVOR" == "focal" ]]; then
TAGS=("${FOCAL_TAGS[@]}")
else
echo "ERROR: unknown flavor - $FLAVOR. Must be either 'bionic' or 'focal'"
exit 1
fi
for ((i = 0; i < ${#TAGS[@]}; i++)) do
local TAG="${TAGS[$i]}"
local BASE_IMAGE_TAG="playwright.azurecr.io/public/${MCR_IMAGE_NAME}:${TAG}"
local IMAGE_NAMES=""
if [[ "$2" == "arm64" || "$2" == "amd64" ]]; then
IMAGE_NAMES="${IMAGE_NAMES} ${BASE_IMAGE_TAG}-$2"
fi
if [[ "$3" == "arm64" || "$3" == "amd64" ]]; then
IMAGE_NAMES="${IMAGE_NAMES} ${BASE_IMAGE_TAG}-$3"
fi
docker manifest create "${BASE_IMAGE_TAG}" $IMAGE_NAMES
docker manifest push "${BASE_IMAGE_TAG}"
done
}
publish_docker_images_with_arch_suffix focal amd64
publish_docker_manifest focal amd64