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

Compare commits

..

2 Commits

Author SHA1 Message Date
Yury Semikhatsky 80fa0c6e98 chore: roll driver to 1.31.1 (#1219) 2023-02-27 19:58:18 -08:00
Yury Semikhatsky 3d9dc8429c chore: set release version to 1.31.0 (#1211) 2023-02-22 08:57:24 -08:00
88 changed files with 867 additions and 2712 deletions
-3
View File
@@ -1,8 +1,5 @@
trigger:
none
# don't trigger for Pull Requests
pr: none
pool:
vmImage: ubuntu-22.04
+12 -35
View File
@@ -7,34 +7,19 @@ assignees: ''
---
<!-- ⚠️⚠️ Do not delete this template ⚠️⚠️ -->
**Context:**
- Playwright Version: [what Playwright version do you use?]
- Operating System: [e.g. Windows, Linux or Mac]
- Browser: [e.g. All, Chromium, Firefox, WebKit]
- Extra: [any specific details about your environment]
<!-- 🔎 Search existing issues to avoid creating duplicates. -->
<!-- 🧪 Test using the latest Playwright release to see if your issue has already been fixed -->
<!-- 💡 Provide enough information for us to be able to reproduce your issue locally -->
<!-- CLI to auto-capture this info -->
<!-- npx envinfo --preset playwright --markdown -->
### System info
- Playwright Version: [v1.XX]
- Operating System: [All, Windows 11, Ubuntu 20, macOS 13.2, etc.]
- Browser: [All, Chromium, Firefox, WebKit]
- Other info:
**Code Snippet**
### Source code
- [ ] I provided exact source code that allows reproducing the issue locally.
<!-- For simple cases, please provide a self-contained test file along with the config file -->
<!-- For larger cases, you can provide a GitHub repo you created for this issue -->
<!-- If we can not reproduce the problem locally, we won't be able to act on it -->
<!-- You can still file without the exact code and we will try to help, but if we can't repro, it will be closed -->
**Link to the GitHub repository with the repro**
[https://github.com/your_profile/playwright_issue_title]
or
**Test file (self-contained)**
Help us help you! Put down a short code snippet that illustrates your bug and
that we can run and debug locally. For example:
```java
import com.microsoft.playwright.*;
@@ -51,14 +36,6 @@ public class ExampleReproducible {
}
```
**Steps**
- [Run the test]
- [...]
**Describe the bug**
**Expected**
[Describe expected behavior]
**Actual**
[Describe actual behavior]
Add any other details about the problem here.
+3 -3
View File
@@ -1,4 +1,4 @@
contact_links:
- name: Join our Discord Server
url: https://aka.ms/playwright/discord
about: Ask questions and discuss with other community members
- name: Join our Slack community
url: https://aka.ms/playwright-slack
about: Ask questions and discuss with other community members
+10
View File
@@ -0,0 +1,10 @@
---
name: I have a question
about: Feel free to ask us your questions!
title: "[Question]"
labels: ''
assignees: ''
---
+3 -3
View File
@@ -31,11 +31,11 @@ jobs:
- name: Build & Install
run: mvn -B install -D skipTests --no-transfer-progress
- name: Run tests
run: mvn test --no-transfer-progress --fail-at-end -D org.slf4j.simpleLogger.showDateTime=true -D org.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss
run: mvn test --no-transfer-progress --fail-at-end
env:
BROWSER: ${{ matrix.browser }}
- name: Run tracing tests w/ sources
run: mvn test --no-transfer-progress --fail-at-end -D test=*TestTracing* -D org.slf4j.simpleLogger.showDateTime=true -D org.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss
run: mvn test --no-transfer-progress --fail-at-end -D test=*TestTracing*
env:
BROWSER: ${{ matrix.browser }}
PLAYWRIGHT_JAVA_SRC: src/test/java
@@ -79,7 +79,7 @@ jobs:
- name: Build & Install
run: mvn -B install -D skipTests --no-transfer-progress
- name: Run tests
run: mvn test --no-transfer-progress --fail-at-end -D org.slf4j.simpleLogger.showDateTime=true -D org.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss
run: mvn test --no-transfer-progress --fail-at-end
env:
BROWSER: chromium
BROWSER_CHANNEL: ${{ matrix.browser-channel }}
+6 -11
View File
@@ -1,4 +1,4 @@
name: Docker
name: Test Docker
on:
push:
paths:
@@ -18,18 +18,13 @@ on:
- release-*
jobs:
test:
name: Test
timeout-minutes: 120
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
flavor: [focal, jammy]
timeout-minutes: 60
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v2
- name: Build Docker image
run: bash utils/docker/build.sh --amd64 ${{ matrix.flavor }} playwright-java:localbuild-${{ matrix.flavor }}
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-${{ matrix.flavor }} /bin/bash)"
CONTAINER_ID="$(docker run --rm --ipc=host -v $(pwd):/root/playwright --name playwright-docker-test -d -t playwright-java:localbuild-focal /bin/bash)"
docker exec "${CONTAINER_ID}" /root/playwright/tools/test-local-installation/create_project_and_run_tests.sh
+4 -4
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 -->114.0.5735.35<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| Chromium <!-- GEN:chromium-version -->111.0.5563.19<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| WebKit <!-- GEN:webkit-version -->16.4<!-- GEN:stop --> | ✅ | ✅ | ✅ |
| Firefox <!-- GEN:firefox-version -->113.0<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| Firefox <!-- GEN:firefox-version -->109.0<!-- 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.
@@ -65,7 +65,7 @@ You can find Maven project with the examples [here](./examples).
#### Page screenshot
This code snippet navigates to Playwright homepage in Chromium, Firefox and WebKit, and saves 3 screenshots.
This code snippet navigates to whatsmyuseragent.org in Chromium, Firefox and WebKit, and saves 3 screenshots.
```java
import com.microsoft.playwright.*;
@@ -86,7 +86,7 @@ public class PageScreenshot {
try (Browser browser = browserType.launch()) {
BrowserContext context = browser.newContext();
Page page = context.newPage();
page.navigate("https://playwright.dev/");
page.navigate("http://whatsmyuseragent.org/");
page.screenshot(new Page.ScreenshotOptions().setPath(Paths.get("screenshot-" + browserType.name() + ".png")));
}
}
+1 -1
View File
@@ -6,7 +6,7 @@
<parent>
<groupId>com.microsoft.playwright</groupId>
<artifactId>parent-pom</artifactId>
<version>1.34.0</version>
<version>1.31.0</version>
</parent>
<artifactId>driver-bundle</artifactId>
@@ -194,11 +194,7 @@ public class DriverJar extends Driver {
}
}
if (name.contains("mac os x")) {
if (arch.equals("aarch64")) {
return "mac-arm64";
} else {
return "mac";
}
return "mac";
}
throw new RuntimeException("Unexpected os.name value: " + name);
}
+1 -1
View File
@@ -6,7 +6,7 @@
<parent>
<groupId>com.microsoft.playwright</groupId>
<artifactId>parent-pom</artifactId>
<version>1.34.0</version>
<version>1.31.0</version>
</parent>
<artifactId>driver</artifactId>
+1 -1
View File
@@ -6,7 +6,7 @@
<groupId>org.example</groupId>
<artifactId>examples</artifactId>
<version>1.34.0</version>
<version>1.31.0</version>
<name>Playwright Client Examples</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -34,7 +34,7 @@ public class PageScreenshot {
try (Browser browser = browserType.launch()) {
BrowserContext context = browser.newContext();
Page page = context.newPage();
page.navigate("https://playwright.dev/");
page.navigate("http://whatsmyuseragent.org/");
page.screenshot(new Page.ScreenshotOptions().setPath(Paths.get("screenshot-" + browserType.name() + ".png")));
}
}
@@ -24,7 +24,7 @@ public class WebKitScreenshot {
try (Playwright playwright = Playwright.create()) {
Browser browser = playwright.webkit().launch();
Page page = browser.newPage();
page.navigate("https://playwright.dev/");
page.navigate("http://whatsmyuseragent.org/");
page.screenshot(new Page.ScreenshotOptions().setPath(Paths.get("example.png")));
}
}
+1 -1
View File
@@ -7,7 +7,7 @@
<parent>
<groupId>com.microsoft.playwright</groupId>
<artifactId>parent-pom</artifactId>
<version>1.34.0</version>
<version>1.31.0</version>
</parent>
<artifactId>playwright</artifactId>
@@ -46,8 +46,7 @@ public interface APIRequest {
*/
public Map<String, String> extraHTTPHeaders;
/**
* Credentials for <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication">HTTP authentication</a>. If
* no origin is specified, the username and password are sent to any servers upon unauthorized responses.
* Credentials for <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication">HTTP authentication</a>.
*/
public HttpCredentials httpCredentials;
/**
@@ -107,15 +106,13 @@ public interface APIRequest {
return this;
}
/**
* Credentials for <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication">HTTP authentication</a>. If
* no origin is specified, the username and password are sent to any servers upon unauthorized responses.
* Credentials for <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication">HTTP authentication</a>.
*/
public NewContextOptions setHttpCredentials(String username, String password) {
return setHttpCredentials(new HttpCredentials(username, password));
}
/**
* Credentials for <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication">HTTP authentication</a>. If
* no origin is specified, the username and password are sent to any servers upon unauthorized responses.
* Credentials for <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication">HTTP authentication</a>.
*/
public NewContextOptions setHttpCredentials(HttpCredentials httpCredentials) {
this.httpCredentials = httpCredentials;
@@ -88,8 +88,7 @@ public interface Browser extends AutoCloseable {
*/
public Optional<ColorScheme> colorScheme;
/**
* Specify device scale factor (can be thought of as dpr). Defaults to {@code 1}. Learn more about <a
* href="https://playwright.dev/java/docs/emulation#devices">emulating devices with device scale factor</a>.
* Specify device scale factor (can be thought of as dpr). Defaults to {@code 1}.
*/
public Double deviceScaleFactor;
/**
@@ -104,13 +103,11 @@ public interface Browser extends AutoCloseable {
public Optional<ForcedColors> forcedColors;
public Geolocation geolocation;
/**
* Specifies if viewport supports touch events. Defaults to false. Learn more about <a
* href="https://playwright.dev/java/docs/emulation#devices">mobile emulation</a>.
* Specifies if viewport supports touch events. Defaults to false.
*/
public Boolean hasTouch;
/**
* Credentials for <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication">HTTP authentication</a>. If
* no origin is specified, the username and password are sent to any servers upon unauthorized responses.
* Credentials for <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication">HTTP authentication</a>.
*/
public HttpCredentials httpCredentials;
/**
@@ -118,25 +115,21 @@ public interface Browser extends AutoCloseable {
*/
public Boolean ignoreHTTPSErrors;
/**
* Whether the {@code meta viewport} tag is taken into account and touch events are enabled. isMobile is a part of device,
* so you don't actually need to set it manually. Defaults to {@code false} and is not supported in Firefox. Learn more
* about <a href="https://playwright.dev/java/docs/emulation#isMobile">mobile emulation</a>.
* Whether the {@code meta viewport} tag is taken into account and touch events are enabled. Defaults to {@code false}. Not
* supported in Firefox.
*/
public Boolean isMobile;
/**
* Whether or not to enable JavaScript in the context. Defaults to {@code true}. Learn more about <a
* href="https://playwright.dev/java/docs/emulation#javascript-enabled">disabling JavaScript</a>.
* Whether or not to enable JavaScript in the context. Defaults to {@code true}.
*/
public Boolean javaScriptEnabled;
/**
* Specify user locale, for example {@code en-GB}, {@code de-DE}, etc. Locale will affect {@code navigator.language} value,
* {@code Accept-Language} request header value as well as number and date formatting rules. Learn more about emulation in
* our <a href="https://playwright.dev/java/docs/emulation#locale--timezone">emulation guide</a>.
* {@code Accept-Language} request header value as well as number and date formatting rules.
*/
public String locale;
/**
* Whether to emulate network being offline. Defaults to {@code false}. Learn more about <a
* href="https://playwright.dev/java/docs/emulation#offline">network emulation</a>.
* Whether to emulate network being offline. Defaults to {@code false}.
*/
public Boolean offline;
/**
@@ -234,9 +227,8 @@ public interface Browser extends AutoCloseable {
*/
public String userAgent;
/**
* Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use {@code null} to disable the
* consistent viewport emulation. Learn more about <a href="https://playwright.dev/java/docs/emulation#viewport">viewport
* emulation</a>.
* Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use {@code null} to disable the consistent
* viewport emulation.
*
* <p> <strong>NOTE:</strong> The {@code null} value opts out from the default presets, makes viewport depend on the host window size defined by the
* operating system. It makes the execution of the tests non-deterministic.
@@ -286,8 +278,7 @@ public interface Browser extends AutoCloseable {
return this;
}
/**
* Specify device scale factor (can be thought of as dpr). Defaults to {@code 1}. Learn more about <a
* href="https://playwright.dev/java/docs/emulation#devices">emulating devices with device scale factor</a>.
* Specify device scale factor (can be thought of as dpr). Defaults to {@code 1}.
*/
public NewContextOptions setDeviceScaleFactor(double deviceScaleFactor) {
this.deviceScaleFactor = deviceScaleFactor;
@@ -317,23 +308,20 @@ public interface Browser extends AutoCloseable {
return this;
}
/**
* Specifies if viewport supports touch events. Defaults to false. Learn more about <a
* href="https://playwright.dev/java/docs/emulation#devices">mobile emulation</a>.
* Specifies if viewport supports touch events. Defaults to false.
*/
public NewContextOptions setHasTouch(boolean hasTouch) {
this.hasTouch = hasTouch;
return this;
}
/**
* Credentials for <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication">HTTP authentication</a>. If
* no origin is specified, the username and password are sent to any servers upon unauthorized responses.
* Credentials for <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication">HTTP authentication</a>.
*/
public NewContextOptions setHttpCredentials(String username, String password) {
return setHttpCredentials(new HttpCredentials(username, password));
}
/**
* Credentials for <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication">HTTP authentication</a>. If
* no origin is specified, the username and password are sent to any servers upon unauthorized responses.
* Credentials for <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication">HTTP authentication</a>.
*/
public NewContextOptions setHttpCredentials(HttpCredentials httpCredentials) {
this.httpCredentials = httpCredentials;
@@ -347,17 +335,15 @@ public interface Browser extends AutoCloseable {
return this;
}
/**
* Whether the {@code meta viewport} tag is taken into account and touch events are enabled. isMobile is a part of device,
* so you don't actually need to set it manually. Defaults to {@code false} and is not supported in Firefox. Learn more
* about <a href="https://playwright.dev/java/docs/emulation#isMobile">mobile emulation</a>.
* Whether the {@code meta viewport} tag is taken into account and touch events are enabled. Defaults to {@code false}. Not
* supported in Firefox.
*/
public NewContextOptions setIsMobile(boolean isMobile) {
this.isMobile = isMobile;
return this;
}
/**
* Whether or not to enable JavaScript in the context. Defaults to {@code true}. Learn more about <a
* href="https://playwright.dev/java/docs/emulation#javascript-enabled">disabling JavaScript</a>.
* Whether or not to enable JavaScript in the context. Defaults to {@code true}.
*/
public NewContextOptions setJavaScriptEnabled(boolean javaScriptEnabled) {
this.javaScriptEnabled = javaScriptEnabled;
@@ -365,16 +351,14 @@ public interface Browser extends AutoCloseable {
}
/**
* Specify user locale, for example {@code en-GB}, {@code de-DE}, etc. Locale will affect {@code navigator.language} value,
* {@code Accept-Language} request header value as well as number and date formatting rules. Learn more about emulation in
* our <a href="https://playwright.dev/java/docs/emulation#locale--timezone">emulation guide</a>.
* {@code Accept-Language} request header value as well as number and date formatting rules.
*/
public NewContextOptions setLocale(String locale) {
this.locale = locale;
return this;
}
/**
* Whether to emulate network being offline. Defaults to {@code false}. Learn more about <a
* href="https://playwright.dev/java/docs/emulation#offline">network emulation</a>.
* Whether to emulate network being offline. Defaults to {@code false}.
*/
public NewContextOptions setOffline(boolean offline) {
this.offline = offline;
@@ -555,9 +539,8 @@ public interface Browser extends AutoCloseable {
return this;
}
/**
* Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use {@code null} to disable the
* consistent viewport emulation. Learn more about <a href="https://playwright.dev/java/docs/emulation#viewport">viewport
* emulation</a>.
* Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use {@code null} to disable the consistent
* viewport emulation.
*
* <p> <strong>NOTE:</strong> The {@code null} value opts out from the default presets, makes viewport depend on the host window size defined by the
* operating system. It makes the execution of the tests non-deterministic.
@@ -566,9 +549,8 @@ public interface Browser extends AutoCloseable {
return setViewportSize(new ViewportSize(width, height));
}
/**
* Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use {@code null} to disable the
* consistent viewport emulation. Learn more about <a href="https://playwright.dev/java/docs/emulation#viewport">viewport
* emulation</a>.
* Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use {@code null} to disable the consistent
* viewport emulation.
*
* <p> <strong>NOTE:</strong> The {@code null} value opts out from the default presets, makes viewport depend on the host window size defined by the
* operating system. It makes the execution of the tests non-deterministic.
@@ -610,8 +592,7 @@ public interface Browser extends AutoCloseable {
*/
public Optional<ColorScheme> colorScheme;
/**
* Specify device scale factor (can be thought of as dpr). Defaults to {@code 1}. Learn more about <a
* href="https://playwright.dev/java/docs/emulation#devices">emulating devices with device scale factor</a>.
* Specify device scale factor (can be thought of as dpr). Defaults to {@code 1}.
*/
public Double deviceScaleFactor;
/**
@@ -626,13 +607,11 @@ public interface Browser extends AutoCloseable {
public Optional<ForcedColors> forcedColors;
public Geolocation geolocation;
/**
* Specifies if viewport supports touch events. Defaults to false. Learn more about <a
* href="https://playwright.dev/java/docs/emulation#devices">mobile emulation</a>.
* Specifies if viewport supports touch events. Defaults to false.
*/
public Boolean hasTouch;
/**
* Credentials for <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication">HTTP authentication</a>. If
* no origin is specified, the username and password are sent to any servers upon unauthorized responses.
* Credentials for <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication">HTTP authentication</a>.
*/
public HttpCredentials httpCredentials;
/**
@@ -640,25 +619,21 @@ public interface Browser extends AutoCloseable {
*/
public Boolean ignoreHTTPSErrors;
/**
* Whether the {@code meta viewport} tag is taken into account and touch events are enabled. isMobile is a part of device,
* so you don't actually need to set it manually. Defaults to {@code false} and is not supported in Firefox. Learn more
* about <a href="https://playwright.dev/java/docs/emulation#isMobile">mobile emulation</a>.
* Whether the {@code meta viewport} tag is taken into account and touch events are enabled. Defaults to {@code false}. Not
* supported in Firefox.
*/
public Boolean isMobile;
/**
* Whether or not to enable JavaScript in the context. Defaults to {@code true}. Learn more about <a
* href="https://playwright.dev/java/docs/emulation#javascript-enabled">disabling JavaScript</a>.
* Whether or not to enable JavaScript in the context. Defaults to {@code true}.
*/
public Boolean javaScriptEnabled;
/**
* Specify user locale, for example {@code en-GB}, {@code de-DE}, etc. Locale will affect {@code navigator.language} value,
* {@code Accept-Language} request header value as well as number and date formatting rules. Learn more about emulation in
* our <a href="https://playwright.dev/java/docs/emulation#locale--timezone">emulation guide</a>.
* {@code Accept-Language} request header value as well as number and date formatting rules.
*/
public String locale;
/**
* Whether to emulate network being offline. Defaults to {@code false}. Learn more about <a
* href="https://playwright.dev/java/docs/emulation#offline">network emulation</a>.
* Whether to emulate network being offline. Defaults to {@code false}.
*/
public Boolean offline;
/**
@@ -756,9 +731,8 @@ public interface Browser extends AutoCloseable {
*/
public String userAgent;
/**
* Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use {@code null} to disable the
* consistent viewport emulation. Learn more about <a href="https://playwright.dev/java/docs/emulation#viewport">viewport
* emulation</a>.
* Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use {@code null} to disable the consistent
* viewport emulation.
*
* <p> <strong>NOTE:</strong> The {@code null} value opts out from the default presets, makes viewport depend on the host window size defined by the
* operating system. It makes the execution of the tests non-deterministic.
@@ -808,8 +782,7 @@ public interface Browser extends AutoCloseable {
return this;
}
/**
* Specify device scale factor (can be thought of as dpr). Defaults to {@code 1}. Learn more about <a
* href="https://playwright.dev/java/docs/emulation#devices">emulating devices with device scale factor</a>.
* Specify device scale factor (can be thought of as dpr). Defaults to {@code 1}.
*/
public NewPageOptions setDeviceScaleFactor(double deviceScaleFactor) {
this.deviceScaleFactor = deviceScaleFactor;
@@ -839,23 +812,20 @@ public interface Browser extends AutoCloseable {
return this;
}
/**
* Specifies if viewport supports touch events. Defaults to false. Learn more about <a
* href="https://playwright.dev/java/docs/emulation#devices">mobile emulation</a>.
* Specifies if viewport supports touch events. Defaults to false.
*/
public NewPageOptions setHasTouch(boolean hasTouch) {
this.hasTouch = hasTouch;
return this;
}
/**
* Credentials for <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication">HTTP authentication</a>. If
* no origin is specified, the username and password are sent to any servers upon unauthorized responses.
* Credentials for <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication">HTTP authentication</a>.
*/
public NewPageOptions setHttpCredentials(String username, String password) {
return setHttpCredentials(new HttpCredentials(username, password));
}
/**
* Credentials for <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication">HTTP authentication</a>. If
* no origin is specified, the username and password are sent to any servers upon unauthorized responses.
* Credentials for <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication">HTTP authentication</a>.
*/
public NewPageOptions setHttpCredentials(HttpCredentials httpCredentials) {
this.httpCredentials = httpCredentials;
@@ -869,17 +839,15 @@ public interface Browser extends AutoCloseable {
return this;
}
/**
* Whether the {@code meta viewport} tag is taken into account and touch events are enabled. isMobile is a part of device,
* so you don't actually need to set it manually. Defaults to {@code false} and is not supported in Firefox. Learn more
* about <a href="https://playwright.dev/java/docs/emulation#isMobile">mobile emulation</a>.
* Whether the {@code meta viewport} tag is taken into account and touch events are enabled. Defaults to {@code false}. Not
* supported in Firefox.
*/
public NewPageOptions setIsMobile(boolean isMobile) {
this.isMobile = isMobile;
return this;
}
/**
* Whether or not to enable JavaScript in the context. Defaults to {@code true}. Learn more about <a
* href="https://playwright.dev/java/docs/emulation#javascript-enabled">disabling JavaScript</a>.
* Whether or not to enable JavaScript in the context. Defaults to {@code true}.
*/
public NewPageOptions setJavaScriptEnabled(boolean javaScriptEnabled) {
this.javaScriptEnabled = javaScriptEnabled;
@@ -887,16 +855,14 @@ public interface Browser extends AutoCloseable {
}
/**
* Specify user locale, for example {@code en-GB}, {@code de-DE}, etc. Locale will affect {@code navigator.language} value,
* {@code Accept-Language} request header value as well as number and date formatting rules. Learn more about emulation in
* our <a href="https://playwright.dev/java/docs/emulation#locale--timezone">emulation guide</a>.
* {@code Accept-Language} request header value as well as number and date formatting rules.
*/
public NewPageOptions setLocale(String locale) {
this.locale = locale;
return this;
}
/**
* Whether to emulate network being offline. Defaults to {@code false}. Learn more about <a
* href="https://playwright.dev/java/docs/emulation#offline">network emulation</a>.
* Whether to emulate network being offline. Defaults to {@code false}.
*/
public NewPageOptions setOffline(boolean offline) {
this.offline = offline;
@@ -1077,9 +1043,8 @@ public interface Browser extends AutoCloseable {
return this;
}
/**
* Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use {@code null} to disable the
* consistent viewport emulation. Learn more about <a href="https://playwright.dev/java/docs/emulation#viewport">viewport
* emulation</a>.
* Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use {@code null} to disable the consistent
* viewport emulation.
*
* <p> <strong>NOTE:</strong> The {@code null} value opts out from the default presets, makes viewport depend on the host window size defined by the
* operating system. It makes the execution of the tests non-deterministic.
@@ -1088,9 +1053,8 @@ public interface Browser extends AutoCloseable {
return setViewportSize(new ViewportSize(width, height));
}
/**
* Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use {@code null} to disable the
* consistent viewport emulation. Learn more about <a href="https://playwright.dev/java/docs/emulation#viewport">viewport
* emulation</a>.
* Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use {@code null} to disable the consistent
* viewport emulation.
*
* <p> <strong>NOTE:</strong> The {@code null} value opts out from the default presets, makes viewport depend on the host window size defined by the
* operating system. It makes the execution of the tests non-deterministic.
@@ -20,7 +20,6 @@ import com.microsoft.playwright.options.*;
import java.nio.file.Path;
import java.util.*;
import java.util.function.Consumer;
import java.util.function.BooleanSupplier;
import java.util.function.Predicate;
import java.util.regex.Pattern;
@@ -58,51 +57,6 @@ public interface BrowserContext extends AutoCloseable {
*/
void offClose(Consumer<BrowserContext> handler);
/**
* Emitted when JavaScript within the page calls one of console API methods, e.g. {@code console.log} or {@code
* console.dir}. Also emitted if the page throws an error or a warning.
*
* <p> The arguments passed into {@code console.log} and the page are available on the {@code ConsoleMessage} event handler
* argument.
*
* <p> **Usage**
* <pre>{@code
* context.onConsoleMessage(msg -> {
* for (int i = 0; i < msg.args().size(); ++i)
* System.out.println(i + ": " + msg.args().get(i).jsonValue());
* });
* page.evaluate("() => console.log('hello', 5, { foo: 'bar' })");
* }</pre>
*/
void onConsoleMessage(Consumer<ConsoleMessage> handler);
/**
* Removes handler that was previously added with {@link #onConsoleMessage onConsoleMessage(handler)}.
*/
void offConsoleMessage(Consumer<ConsoleMessage> handler);
/**
* Emitted when a JavaScript dialog appears, such as {@code alert}, {@code prompt}, {@code confirm} or {@code
* beforeunload}. Listener **must** either {@link Dialog#accept Dialog.accept()} or {@link Dialog#dismiss Dialog.dismiss()}
* the dialog - otherwise the page will <a
* href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/EventLoop#never_blocking">freeze</a> waiting for the
* dialog, and actions like click will never finish.
*
* <p> **Usage**
* <pre>{@code
* context.onDialog(dialog -> {
* dialog.accept();
* });
* }</pre>
*
* <p> <strong>NOTE:</strong> When no {@link Page#onDialog Page.onDialog()} or {@link BrowserContext#onDialog BrowserContext.onDialog()} listeners are
* present, all dialogs are automatically dismissed.
*/
void onDialog(Consumer<Dialog> handler);
/**
* Removes handler that was previously added with {@link #onDialog onDialog(handler)}.
*/
void offDialog(Consumer<Dialog> handler);
/**
* The event is emitted when a new Page is created in the BrowserContext. The page may still be loading. The event will
* also fire for popup pages. See also {@link Page#onPopup Page.onPopup()} to receive events about popups relevant to a
@@ -235,17 +189,6 @@ public interface BrowserContext extends AutoCloseable {
* written to disk when {@link BrowserContext#close BrowserContext.close()} is called.
*/
public Boolean update;
/**
* Optional setting to control resource content management. If {@code attach} is specified, resources are persisted as
* separate files or entries in the ZIP archive. If {@code embed} is specified, content is stored inline the HAR file.
*/
public RouteFromHarUpdateContentPolicy updateContent;
/**
* When set to {@code minimal}, only record information necessary for routing from HAR. This omits sizes, timing, page,
* cookies, security and other types of HAR information that are not used when replaying from HAR. Defaults to {@code
* minimal}.
*/
public HarMode updateMode;
/**
* A glob pattern, regular expression or predicate to match the request URL. Only requests with URL matching the pattern
* will be served from the HAR file. If not specified, all requests are served from the HAR file.
@@ -272,23 +215,6 @@ public interface BrowserContext extends AutoCloseable {
this.update = update;
return this;
}
/**
* Optional setting to control resource content management. If {@code attach} is specified, resources are persisted as
* separate files or entries in the ZIP archive. If {@code embed} is specified, content is stored inline the HAR file.
*/
public RouteFromHAROptions setUpdateContent(RouteFromHarUpdateContentPolicy updateContent) {
this.updateContent = updateContent;
return this;
}
/**
* When set to {@code minimal}, only record information necessary for routing from HAR. This omits sizes, timing, page,
* cookies, security and other types of HAR information that are not used when replaying from HAR. Defaults to {@code
* minimal}.
*/
public RouteFromHAROptions setUpdateMode(HarMode updateMode) {
this.updateMode = updateMode;
return this;
}
/**
* A glob pattern, regular expression or predicate to match the request URL. Only requests with URL matching the pattern
* will be served from the HAR file. If not specified, all requests are served from the HAR file.
@@ -322,51 +248,6 @@ public interface BrowserContext extends AutoCloseable {
return this;
}
}
class WaitForConditionOptions {
/**
* Maximum time to wait for in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The
* default value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or
* {@link Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
/**
* Maximum time to wait for in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The
* default value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or
* {@link Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public WaitForConditionOptions setTimeout(double timeout) {
this.timeout = timeout;
return this;
}
}
class WaitForConsoleMessageOptions {
/**
* Receives the {@code ConsoleMessage} object and resolves to truthy value when the waiting should resolve.
*/
public Predicate<ConsoleMessage> predicate;
/**
* Maximum time to wait for in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The
* default value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()}.
*/
public Double timeout;
/**
* Receives the {@code ConsoleMessage} object and resolves to truthy value when the waiting should resolve.
*/
public WaitForConsoleMessageOptions setPredicate(Predicate<ConsoleMessage> predicate) {
this.predicate = predicate;
return this;
}
/**
* Maximum time to wait for in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The
* default value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()}.
*/
public WaitForConsoleMessageOptions setTimeout(double timeout) {
this.timeout = timeout;
return this;
}
}
class WaitForPageOptions {
/**
* Receives the {@code Page} object and resolves to truthy value when the waiting should resolve.
@@ -403,9 +284,6 @@ public interface BrowserContext extends AutoCloseable {
* browserContext.addCookies(Arrays.asList(cookieObject1, cookieObject2));
* }</pre>
*
* @param cookies Adds cookies to the browser context.
*
* <p> For the cookie to apply to all subdomains as well, prefix domain with a dot, like this: ".example.com".
* @since v1.8
*/
void addCookies(List<Cookie> cookies);
@@ -1269,76 +1147,6 @@ public interface BrowserContext extends AutoCloseable {
* @since v1.8
*/
void unroute(Predicate<String> url, Consumer<Route> handler);
/**
* The method will block until the condition returns true. All Playwright events will be dispatched while the method is
* waiting for the condition.
*
* <p> **Usage**
*
* <p> Use the method to wait for a condition that depends on page events:
* <pre>{@code
* List<String> failedUrls = new ArrayList<>();
* context.onResponse(response -> {
* if (!response.ok()) {
* failedUrls.add(response.url());
* }
* });
* page1.getByText("Create user").click();
* page2.getByText("Submit button").click();
* context.waitForCondition(() -> failedUrls.size() > 3);
* }</pre>
*
* @param condition Condition to wait for.
* @since v1.32
*/
default void waitForCondition(BooleanSupplier condition) {
waitForCondition(condition, null);
}
/**
* The method will block until the condition returns true. All Playwright events will be dispatched while the method is
* waiting for the condition.
*
* <p> **Usage**
*
* <p> Use the method to wait for a condition that depends on page events:
* <pre>{@code
* List<String> failedUrls = new ArrayList<>();
* context.onResponse(response -> {
* if (!response.ok()) {
* failedUrls.add(response.url());
* }
* });
* page1.getByText("Create user").click();
* page2.getByText("Submit button").click();
* context.waitForCondition(() -> failedUrls.size() > 3);
* }</pre>
*
* @param condition Condition to wait for.
* @since v1.32
*/
void waitForCondition(BooleanSupplier condition, WaitForConditionOptions options);
/**
* Performs action and waits for a {@code ConsoleMessage} to be logged by in the pages in the context. If predicate is
* provided, it passes {@code ConsoleMessage} value into the {@code predicate} function and waits for {@code
* predicate(message)} to return a truthy value. Will throw an error if the page is closed before the {@link
* BrowserContext#onConsoleMessage BrowserContext.onConsoleMessage()} event is fired.
*
* @param callback Callback that performs the action triggering the event.
* @since v1.34
*/
default ConsoleMessage waitForConsoleMessage(Runnable callback) {
return waitForConsoleMessage(null, callback);
}
/**
* Performs action and waits for a {@code ConsoleMessage} to be logged by in the pages in the context. If predicate is
* provided, it passes {@code ConsoleMessage} value into the {@code predicate} function and waits for {@code
* predicate(message)} to return a truthy value. Will throw an error if the page is closed before the {@link
* BrowserContext#onConsoleMessage BrowserContext.onConsoleMessage()} event is fired.
*
* @param callback Callback that performs the action triggering the event.
* @since v1.34
*/
ConsoleMessage waitForConsoleMessage(WaitForConsoleMessageOptions options, Runnable callback);
/**
* Performs action and waits for a new {@code Page} to be created in the context. If predicate is provided, it passes
* {@code Page} value into the {@code predicate} function and waits for {@code predicate(event)} to return a truthy value.
@@ -414,8 +414,7 @@ public interface BrowserType {
*/
public Optional<ColorScheme> colorScheme;
/**
* Specify device scale factor (can be thought of as dpr). Defaults to {@code 1}. Learn more about <a
* href="https://playwright.dev/java/docs/emulation#devices">emulating devices with device scale factor</a>.
* Specify device scale factor (can be thought of as dpr). Defaults to {@code 1}.
*/
public Double deviceScaleFactor;
/**
@@ -463,8 +462,7 @@ public interface BrowserType {
*/
public Boolean handleSIGTERM;
/**
* Specifies if viewport supports touch events. Defaults to false. Learn more about <a
* href="https://playwright.dev/java/docs/emulation#devices">mobile emulation</a>.
* Specifies if viewport supports touch events. Defaults to false.
*/
public Boolean hasTouch;
/**
@@ -475,8 +473,7 @@ public interface BrowserType {
*/
public Boolean headless;
/**
* Credentials for <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication">HTTP authentication</a>. If
* no origin is specified, the username and password are sent to any servers upon unauthorized responses.
* Credentials for <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication">HTTP authentication</a>.
*/
public HttpCredentials httpCredentials;
/**
@@ -494,25 +491,21 @@ public interface BrowserType {
*/
public Boolean ignoreHTTPSErrors;
/**
* Whether the {@code meta viewport} tag is taken into account and touch events are enabled. isMobile is a part of device,
* so you don't actually need to set it manually. Defaults to {@code false} and is not supported in Firefox. Learn more
* about <a href="https://playwright.dev/java/docs/emulation#isMobile">mobile emulation</a>.
* Whether the {@code meta viewport} tag is taken into account and touch events are enabled. Defaults to {@code false}. Not
* supported in Firefox.
*/
public Boolean isMobile;
/**
* Whether or not to enable JavaScript in the context. Defaults to {@code true}. Learn more about <a
* href="https://playwright.dev/java/docs/emulation#javascript-enabled">disabling JavaScript</a>.
* Whether or not to enable JavaScript in the context. Defaults to {@code true}.
*/
public Boolean javaScriptEnabled;
/**
* Specify user locale, for example {@code en-GB}, {@code de-DE}, etc. Locale will affect {@code navigator.language} value,
* {@code Accept-Language} request header value as well as number and date formatting rules. Learn more about emulation in
* our <a href="https://playwright.dev/java/docs/emulation#locale--timezone">emulation guide</a>.
* {@code Accept-Language} request header value as well as number and date formatting rules.
*/
public String locale;
/**
* Whether to emulate network being offline. Defaults to {@code false}. Learn more about <a
* href="https://playwright.dev/java/docs/emulation#offline">network emulation</a>.
* Whether to emulate network being offline. Defaults to {@code false}.
*/
public Boolean offline;
/**
@@ -608,9 +601,8 @@ public interface BrowserType {
*/
public String userAgent;
/**
* Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use {@code null} to disable the
* consistent viewport emulation. Learn more about <a href="https://playwright.dev/java/docs/emulation#viewport">viewport
* emulation</a>.
* Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use {@code null} to disable the consistent
* viewport emulation.
*
* <p> <strong>NOTE:</strong> The {@code null} value opts out from the default presets, makes viewport depend on the host window size defined by the
* operating system. It makes the execution of the tests non-deterministic.
@@ -694,8 +686,7 @@ public interface BrowserType {
return this;
}
/**
* Specify device scale factor (can be thought of as dpr). Defaults to {@code 1}. Learn more about <a
* href="https://playwright.dev/java/docs/emulation#devices">emulating devices with device scale factor</a>.
* Specify device scale factor (can be thought of as dpr). Defaults to {@code 1}.
*/
public LaunchPersistentContextOptions setDeviceScaleFactor(double deviceScaleFactor) {
this.deviceScaleFactor = deviceScaleFactor;
@@ -779,8 +770,7 @@ public interface BrowserType {
return this;
}
/**
* Specifies if viewport supports touch events. Defaults to false. Learn more about <a
* href="https://playwright.dev/java/docs/emulation#devices">mobile emulation</a>.
* Specifies if viewport supports touch events. Defaults to false.
*/
public LaunchPersistentContextOptions setHasTouch(boolean hasTouch) {
this.hasTouch = hasTouch;
@@ -797,15 +787,13 @@ public interface BrowserType {
return this;
}
/**
* Credentials for <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication">HTTP authentication</a>. If
* no origin is specified, the username and password are sent to any servers upon unauthorized responses.
* Credentials for <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication">HTTP authentication</a>.
*/
public LaunchPersistentContextOptions setHttpCredentials(String username, String password) {
return setHttpCredentials(new HttpCredentials(username, password));
}
/**
* Credentials for <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication">HTTP authentication</a>. If
* no origin is specified, the username and password are sent to any servers upon unauthorized responses.
* Credentials for <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication">HTTP authentication</a>.
*/
public LaunchPersistentContextOptions setHttpCredentials(HttpCredentials httpCredentials) {
this.httpCredentials = httpCredentials;
@@ -835,17 +823,15 @@ public interface BrowserType {
return this;
}
/**
* Whether the {@code meta viewport} tag is taken into account and touch events are enabled. isMobile is a part of device,
* so you don't actually need to set it manually. Defaults to {@code false} and is not supported in Firefox. Learn more
* about <a href="https://playwright.dev/java/docs/emulation#isMobile">mobile emulation</a>.
* Whether the {@code meta viewport} tag is taken into account and touch events are enabled. Defaults to {@code false}. Not
* supported in Firefox.
*/
public LaunchPersistentContextOptions setIsMobile(boolean isMobile) {
this.isMobile = isMobile;
return this;
}
/**
* Whether or not to enable JavaScript in the context. Defaults to {@code true}. Learn more about <a
* href="https://playwright.dev/java/docs/emulation#javascript-enabled">disabling JavaScript</a>.
* Whether or not to enable JavaScript in the context. Defaults to {@code true}.
*/
public LaunchPersistentContextOptions setJavaScriptEnabled(boolean javaScriptEnabled) {
this.javaScriptEnabled = javaScriptEnabled;
@@ -853,16 +839,14 @@ public interface BrowserType {
}
/**
* Specify user locale, for example {@code en-GB}, {@code de-DE}, etc. Locale will affect {@code navigator.language} value,
* {@code Accept-Language} request header value as well as number and date formatting rules. Learn more about emulation in
* our <a href="https://playwright.dev/java/docs/emulation#locale--timezone">emulation guide</a>.
* {@code Accept-Language} request header value as well as number and date formatting rules.
*/
public LaunchPersistentContextOptions setLocale(String locale) {
this.locale = locale;
return this;
}
/**
* Whether to emulate network being offline. Defaults to {@code false}. Learn more about <a
* href="https://playwright.dev/java/docs/emulation#offline">network emulation</a>.
* Whether to emulate network being offline. Defaults to {@code false}.
*/
public LaunchPersistentContextOptions setOffline(boolean offline) {
this.offline = offline;
@@ -1040,9 +1024,8 @@ public interface BrowserType {
return this;
}
/**
* Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use {@code null} to disable the
* consistent viewport emulation. Learn more about <a href="https://playwright.dev/java/docs/emulation#viewport">viewport
* emulation</a>.
* Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use {@code null} to disable the consistent
* viewport emulation.
*
* <p> <strong>NOTE:</strong> The {@code null} value opts out from the default presets, makes viewport depend on the host window size defined by the
* operating system. It makes the execution of the tests non-deterministic.
@@ -1051,9 +1034,8 @@ public interface BrowserType {
return setViewportSize(new ViewportSize(width, height));
}
/**
* Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use {@code null} to disable the
* consistent viewport emulation. Learn more about <a href="https://playwright.dev/java/docs/emulation#viewport">viewport
* emulation</a>.
* Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use {@code null} to disable the consistent
* viewport emulation.
*
* <p> <strong>NOTE:</strong> The {@code null} value opts out from the default presets, makes viewport depend on the host window size defined by the
* operating system. It makes the execution of the tests non-deterministic.
@@ -56,12 +56,6 @@ public interface ConsoleMessage {
* @since v1.8
*/
String location();
/**
* The page that produced this console message, if any.
*
* @since v1.33
*/
Page page();
/**
* The text of the console message.
*
@@ -81,12 +81,6 @@ public interface Dialog {
* @since v1.8
*/
String message();
/**
* The page that initiated this dialog, if available.
*
* @since v1.33
*/
Page page();
/**
* Returns dialog's type, can be one of {@code alert}, {@code beforeunload}, {@code confirm} or {@code prompt}.
*
@@ -75,8 +75,8 @@ public interface ElementHandle extends JSHandle {
*/
public Position position;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -120,8 +120,8 @@ public interface ElementHandle extends JSHandle {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public CheckOptions setTimeout(double timeout) {
@@ -173,8 +173,8 @@ public interface ElementHandle extends JSHandle {
*/
public Position position;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -247,8 +247,8 @@ public interface ElementHandle extends JSHandle {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public ClickOptions setTimeout(double timeout) {
@@ -296,8 +296,8 @@ public interface ElementHandle extends JSHandle {
*/
public Position position;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -363,8 +363,8 @@ public interface ElementHandle extends JSHandle {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public DblclickOptions setTimeout(double timeout) {
@@ -394,8 +394,8 @@ public interface ElementHandle extends JSHandle {
*/
public Boolean noWaitAfter;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -418,8 +418,8 @@ public interface ElementHandle extends JSHandle {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public FillOptions setTimeout(double timeout) {
@@ -450,8 +450,8 @@ public interface ElementHandle extends JSHandle {
*/
public Position position;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -503,8 +503,8 @@ public interface ElementHandle extends JSHandle {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public HoverOptions setTimeout(double timeout) {
@@ -523,15 +523,15 @@ public interface ElementHandle extends JSHandle {
}
class InputValueOptions {
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public InputValueOptions setTimeout(double timeout) {
@@ -551,8 +551,8 @@ public interface ElementHandle extends JSHandle {
*/
public Boolean noWaitAfter;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -574,8 +574,8 @@ public interface ElementHandle extends JSHandle {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public PressOptions setTimeout(double timeout) {
@@ -629,8 +629,8 @@ public interface ElementHandle extends JSHandle {
*/
public ScreenshotScale scale;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -705,8 +705,8 @@ public interface ElementHandle extends JSHandle {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public ScreenshotOptions setTimeout(double timeout) {
@@ -723,15 +723,15 @@ public interface ElementHandle extends JSHandle {
}
class ScrollIntoViewIfNeededOptions {
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public ScrollIntoViewIfNeededOptions setTimeout(double timeout) {
@@ -752,8 +752,8 @@ public interface ElementHandle extends JSHandle {
*/
public Boolean noWaitAfter;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -776,8 +776,8 @@ public interface ElementHandle extends JSHandle {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public SelectOptionOptions setTimeout(double timeout) {
@@ -792,8 +792,8 @@ public interface ElementHandle extends JSHandle {
*/
public Boolean force;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -807,8 +807,8 @@ public interface ElementHandle extends JSHandle {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public SelectTextOptions setTimeout(double timeout) {
@@ -834,8 +834,8 @@ public interface ElementHandle extends JSHandle {
*/
public Position position;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -879,8 +879,8 @@ public interface ElementHandle extends JSHandle {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public SetCheckedOptions setTimeout(double timeout) {
@@ -905,8 +905,8 @@ public interface ElementHandle extends JSHandle {
*/
public Boolean noWaitAfter;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -921,8 +921,8 @@ public interface ElementHandle extends JSHandle {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public SetInputFilesOptions setTimeout(double timeout) {
@@ -953,8 +953,8 @@ public interface ElementHandle extends JSHandle {
*/
public Position position;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -1006,8 +1006,8 @@ public interface ElementHandle extends JSHandle {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public TapOptions setTimeout(double timeout) {
@@ -1036,8 +1036,8 @@ public interface ElementHandle extends JSHandle {
*/
public Boolean noWaitAfter;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -1059,8 +1059,8 @@ public interface ElementHandle extends JSHandle {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public TypeOptions setTimeout(double timeout) {
@@ -1086,8 +1086,8 @@ public interface ElementHandle extends JSHandle {
*/
public Position position;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -1131,8 +1131,8 @@ public interface ElementHandle extends JSHandle {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public UncheckOptions setTimeout(double timeout) {
@@ -1151,15 +1151,15 @@ public interface ElementHandle extends JSHandle {
}
class WaitForElementStateOptions {
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public WaitForElementStateOptions setTimeout(double timeout) {
@@ -1186,8 +1186,8 @@ public interface ElementHandle extends JSHandle {
*/
public Boolean strict;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -1216,8 +1216,8 @@ public interface ElementHandle extends JSHandle {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public WaitForSelectorOptions setTimeout(double timeout) {
@@ -35,8 +35,8 @@ public interface FileChooser {
*/
public Boolean noWaitAfter;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -51,8 +51,8 @@ public interface FileChooser {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public SetFilesOptions setTimeout(double timeout) {
@@ -172,8 +172,8 @@ public interface Frame {
*/
public Boolean strict;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -225,8 +225,8 @@ public interface Frame {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public CheckOptions setTimeout(double timeout) {
@@ -283,8 +283,8 @@ public interface Frame {
*/
public Boolean strict;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -365,8 +365,8 @@ public interface Frame {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public ClickOptions setTimeout(double timeout) {
@@ -419,8 +419,8 @@ public interface Frame {
*/
public Boolean strict;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -494,8 +494,8 @@ public interface Frame {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public DblclickOptions setTimeout(double timeout) {
@@ -519,8 +519,8 @@ public interface Frame {
*/
public Boolean strict;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -534,8 +534,8 @@ public interface Frame {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public DispatchEventOptions setTimeout(double timeout) {
@@ -571,8 +571,8 @@ public interface Frame {
*/
public Position targetPosition;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -639,8 +639,8 @@ public interface Frame {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public DragAndDropOptions setTimeout(double timeout) {
@@ -691,8 +691,8 @@ public interface Frame {
*/
public Boolean strict;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -723,8 +723,8 @@ public interface Frame {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public FillOptions setTimeout(double timeout) {
@@ -739,8 +739,8 @@ public interface Frame {
*/
public Boolean strict;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -754,8 +754,8 @@ public interface Frame {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public FocusOptions setTimeout(double timeout) {
@@ -770,8 +770,8 @@ public interface Frame {
*/
public Boolean strict;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -785,8 +785,8 @@ public interface Frame {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public GetAttributeOptions setTimeout(double timeout) {
@@ -1046,8 +1046,8 @@ public interface Frame {
* <ul>
* <li> {@code "domcontentloaded"} - consider operation to be finished when the {@code DOMContentLoaded} event is fired.</li>
* <li> {@code "load"} - consider operation to be finished when the {@code load} event is fired.</li>
* <li> {@code "networkidle"} - **DISCOURAGED** consider operation to be finished when there are no network connections for at
* least {@code 500} ms. Don't use this method for testing, rely on web assertions to assess readiness instead.</li>
* <li> {@code "networkidle"} - consider operation to be finished when there are no network connections for at least {@code 500}
* ms.</li>
* <li> {@code "commit"} - consider operation to be finished when network response is received and the document started loading.</li>
* </ul>
*/
@@ -1076,8 +1076,8 @@ public interface Frame {
* <ul>
* <li> {@code "domcontentloaded"} - consider operation to be finished when the {@code DOMContentLoaded} event is fired.</li>
* <li> {@code "load"} - consider operation to be finished when the {@code load} event is fired.</li>
* <li> {@code "networkidle"} - **DISCOURAGED** consider operation to be finished when there are no network connections for at
* least {@code 500} ms. Don't use this method for testing, rely on web assertions to assess readiness instead.</li>
* <li> {@code "networkidle"} - consider operation to be finished when there are no network connections for at least {@code 500}
* ms.</li>
* <li> {@code "commit"} - consider operation to be finished when network response is received and the document started loading.</li>
* </ul>
*/
@@ -1114,8 +1114,8 @@ public interface Frame {
*/
public Boolean strict;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -1175,8 +1175,8 @@ public interface Frame {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public HoverOptions setTimeout(double timeout) {
@@ -1200,8 +1200,8 @@ public interface Frame {
*/
public Boolean strict;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -1215,8 +1215,8 @@ public interface Frame {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public InnerHTMLOptions setTimeout(double timeout) {
@@ -1231,8 +1231,8 @@ public interface Frame {
*/
public Boolean strict;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -1246,8 +1246,8 @@ public interface Frame {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public InnerTextOptions setTimeout(double timeout) {
@@ -1262,8 +1262,8 @@ public interface Frame {
*/
public Boolean strict;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -1277,8 +1277,8 @@ public interface Frame {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public InputValueOptions setTimeout(double timeout) {
@@ -1293,8 +1293,8 @@ public interface Frame {
*/
public Boolean strict;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -1308,8 +1308,8 @@ public interface Frame {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public IsCheckedOptions setTimeout(double timeout) {
@@ -1324,8 +1324,8 @@ public interface Frame {
*/
public Boolean strict;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -1339,8 +1339,8 @@ public interface Frame {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public IsDisabledOptions setTimeout(double timeout) {
@@ -1355,8 +1355,8 @@ public interface Frame {
*/
public Boolean strict;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -1370,8 +1370,8 @@ public interface Frame {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public IsEditableOptions setTimeout(double timeout) {
@@ -1386,8 +1386,8 @@ public interface Frame {
*/
public Boolean strict;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -1401,8 +1401,8 @@ public interface Frame {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public IsEnabledOptions setTimeout(double timeout) {
@@ -1476,19 +1476,6 @@ public interface Frame {
* <p> Note that outer and inner locators must belong to the same frame. Inner locator must not contain {@code FrameLocator}s.
*/
public Locator has;
/**
* Matches elements that do not contain an element that matches an inner locator. Inner locator is queried against the
* outer one. For example, {@code article} that does not have {@code div} matches {@code
* <article><span>Playwright</span></article>}.
*
* <p> Note that outer and inner locators must belong to the same frame. Inner locator must not contain {@code FrameLocator}s.
*/
public Locator hasNot;
/**
* Matches elements that do not contain specified text somewhere inside, possibly in a child or a descendant element. When
* passed a [string], matching is case-insensitive and searches for a substring.
*/
public Object hasNotText;
/**
* Matches elements containing specified text somewhere inside, possibly in a child or a descendant element. When passed a
* [string], matching is case-insensitive and searches for a substring. For example, {@code "Playwright"} matches {@code
@@ -1506,33 +1493,6 @@ public interface Frame {
this.has = has;
return this;
}
/**
* Matches elements that do not contain an element that matches an inner locator. Inner locator is queried against the
* outer one. For example, {@code article} that does not have {@code div} matches {@code
* <article><span>Playwright</span></article>}.
*
* <p> Note that outer and inner locators must belong to the same frame. Inner locator must not contain {@code FrameLocator}s.
*/
public LocatorOptions setHasNot(Locator hasNot) {
this.hasNot = hasNot;
return this;
}
/**
* Matches elements that do not contain specified text somewhere inside, possibly in a child or a descendant element. When
* passed a [string], matching is case-insensitive and searches for a substring.
*/
public LocatorOptions setHasNotText(String hasNotText) {
this.hasNotText = hasNotText;
return this;
}
/**
* Matches elements that do not contain specified text somewhere inside, possibly in a child or a descendant element. When
* passed a [string], matching is case-insensitive and searches for a substring.
*/
public LocatorOptions setHasNotText(Pattern hasNotText) {
this.hasNotText = hasNotText;
return this;
}
/**
* Matches elements containing specified text somewhere inside, possibly in a child or a descendant element. When passed a
* [string], matching is case-insensitive and searches for a substring. For example, {@code "Playwright"} matches {@code
@@ -1569,8 +1529,8 @@ public interface Frame {
*/
public Boolean strict;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -1600,8 +1560,8 @@ public interface Frame {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public PressOptions setTimeout(double timeout) {
@@ -1643,8 +1603,8 @@ public interface Frame {
*/
public Boolean strict;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -1675,8 +1635,8 @@ public interface Frame {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public SelectOptionOptions setTimeout(double timeout) {
@@ -1707,8 +1667,8 @@ public interface Frame {
*/
public Boolean strict;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -1760,8 +1720,8 @@ public interface Frame {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public SetCheckedOptions setTimeout(double timeout) {
@@ -1791,8 +1751,8 @@ public interface Frame {
* <ul>
* <li> {@code "domcontentloaded"} - consider operation to be finished when the {@code DOMContentLoaded} event is fired.</li>
* <li> {@code "load"} - consider operation to be finished when the {@code load} event is fired.</li>
* <li> {@code "networkidle"} - **DISCOURAGED** consider operation to be finished when there are no network connections for at
* least {@code 500} ms. Don't use this method for testing, rely on web assertions to assess readiness instead.</li>
* <li> {@code "networkidle"} - consider operation to be finished when there are no network connections for at least {@code 500}
* ms.</li>
* <li> {@code "commit"} - consider operation to be finished when network response is received and the document started loading.</li>
* </ul>
*/
@@ -1813,8 +1773,8 @@ public interface Frame {
* <ul>
* <li> {@code "domcontentloaded"} - consider operation to be finished when the {@code DOMContentLoaded} event is fired.</li>
* <li> {@code "load"} - consider operation to be finished when the {@code load} event is fired.</li>
* <li> {@code "networkidle"} - **DISCOURAGED** consider operation to be finished when there are no network connections for at
* least {@code 500} ms. Don't use this method for testing, rely on web assertions to assess readiness instead.</li>
* <li> {@code "networkidle"} - consider operation to be finished when there are no network connections for at least {@code 500}
* ms.</li>
* <li> {@code "commit"} - consider operation to be finished when network response is received and the document started loading.</li>
* </ul>
*/
@@ -1836,8 +1796,8 @@ public interface Frame {
*/
public Boolean strict;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -1860,8 +1820,8 @@ public interface Frame {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public SetInputFilesOptions setTimeout(double timeout) {
@@ -1897,8 +1857,8 @@ public interface Frame {
*/
public Boolean strict;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -1958,8 +1918,8 @@ public interface Frame {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public TapOptions setTimeout(double timeout) {
@@ -1983,8 +1943,8 @@ public interface Frame {
*/
public Boolean strict;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -1998,8 +1958,8 @@ public interface Frame {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public TextContentOptions setTimeout(double timeout) {
@@ -2024,8 +1984,8 @@ public interface Frame {
*/
public Boolean strict;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -2055,8 +2015,8 @@ public interface Frame {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public TypeOptions setTimeout(double timeout) {
@@ -2087,8 +2047,8 @@ public interface Frame {
*/
public Boolean strict;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -2140,8 +2100,8 @@ public interface Frame {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public UncheckOptions setTimeout(double timeout) {
@@ -2165,9 +2125,8 @@ public interface Frame {
*/
public Double pollingInterval;
/**
* Maximum time to wait for in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The
* default value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or
* {@link Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
* maximum time to wait for in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The
* default value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()}.
*/
public Double timeout;
@@ -2180,9 +2139,8 @@ public interface Frame {
return this;
}
/**
* Maximum time to wait for in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The
* default value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or
* {@link Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
* maximum time to wait for in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The
* default value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()}.
*/
public WaitForFunctionOptions setTimeout(double timeout) {
this.timeout = timeout;
@@ -2228,8 +2186,8 @@ public interface Frame {
* <ul>
* <li> {@code "domcontentloaded"} - consider operation to be finished when the {@code DOMContentLoaded} event is fired.</li>
* <li> {@code "load"} - consider operation to be finished when the {@code load} event is fired.</li>
* <li> {@code "networkidle"} - **DISCOURAGED** consider operation to be finished when there are no network connections for at
* least {@code 500} ms. Don't use this method for testing, rely on web assertions to assess readiness instead.</li>
* <li> {@code "networkidle"} - consider operation to be finished when there are no network connections for at least {@code 500}
* ms.</li>
* <li> {@code "commit"} - consider operation to be finished when network response is received and the document started loading.</li>
* </ul>
*/
@@ -2277,8 +2235,8 @@ public interface Frame {
* <ul>
* <li> {@code "domcontentloaded"} - consider operation to be finished when the {@code DOMContentLoaded} event is fired.</li>
* <li> {@code "load"} - consider operation to be finished when the {@code load} event is fired.</li>
* <li> {@code "networkidle"} - **DISCOURAGED** consider operation to be finished when there are no network connections for at
* least {@code 500} ms. Don't use this method for testing, rely on web assertions to assess readiness instead.</li>
* <li> {@code "networkidle"} - consider operation to be finished when there are no network connections for at least {@code 500}
* ms.</li>
* <li> {@code "commit"} - consider operation to be finished when network response is received and the document started loading.</li>
* </ul>
*/
@@ -2306,8 +2264,8 @@ public interface Frame {
*/
public Boolean strict;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -2336,8 +2294,8 @@ public interface Frame {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public WaitForSelectorOptions setTimeout(double timeout) {
@@ -2358,8 +2316,8 @@ public interface Frame {
* <ul>
* <li> {@code "domcontentloaded"} - consider operation to be finished when the {@code DOMContentLoaded} event is fired.</li>
* <li> {@code "load"} - consider operation to be finished when the {@code load} event is fired.</li>
* <li> {@code "networkidle"} - **DISCOURAGED** consider operation to be finished when there are no network connections for at
* least {@code 500} ms. Don't use this method for testing, rely on web assertions to assess readiness instead.</li>
* <li> {@code "networkidle"} - consider operation to be finished when there are no network connections for at least {@code 500}
* ms.</li>
* <li> {@code "commit"} - consider operation to be finished when network response is received and the document started loading.</li>
* </ul>
*/
@@ -2380,8 +2338,8 @@ public interface Frame {
* <ul>
* <li> {@code "domcontentloaded"} - consider operation to be finished when the {@code DOMContentLoaded} event is fired.</li>
* <li> {@code "load"} - consider operation to be finished when the {@code load} event is fired.</li>
* <li> {@code "networkidle"} - **DISCOURAGED** consider operation to be finished when there are no network connections for at
* least {@code 500} ms. Don't use this method for testing, rely on web assertions to assess readiness instead.</li>
* <li> {@code "networkidle"} - consider operation to be finished when there are no network connections for at least {@code 500}
* ms.</li>
* <li> {@code "commit"} - consider operation to be finished when network response is received and the document started loading.</li>
* </ul>
*/
@@ -3145,14 +3103,12 @@ public interface Frame {
*/
Locator getByAltText(Pattern text, GetByAltTextOptions options);
/**
* Allows locating input elements by the text of the associated {@code <label>} or {@code aria-labelledby} element, or by
* the {@code aria-label} attribute.
* Allows locating input elements by the text of the associated label.
*
* <p> **Usage**
*
* <p> For example, this method will find inputs by label "Username" and "Password" in the following DOM:
* <p> For example, this method will find the input by label text "Password" in the following DOM:
* <pre>{@code
* page.getByLabel("Username").fill("john");
* page.getByLabel("Password").fill("secret");
* }</pre>
*
@@ -3163,14 +3119,12 @@ public interface Frame {
return getByLabel(text, null);
}
/**
* Allows locating input elements by the text of the associated {@code <label>} or {@code aria-labelledby} element, or by
* the {@code aria-label} attribute.
* Allows locating input elements by the text of the associated label.
*
* <p> **Usage**
*
* <p> For example, this method will find inputs by label "Username" and "Password" in the following DOM:
* <p> For example, this method will find the input by label text "Password" in the following DOM:
* <pre>{@code
* page.getByLabel("Username").fill("john");
* page.getByLabel("Password").fill("secret");
* }</pre>
*
@@ -3179,14 +3133,12 @@ public interface Frame {
*/
Locator getByLabel(String text, GetByLabelOptions options);
/**
* Allows locating input elements by the text of the associated {@code <label>} or {@code aria-labelledby} element, or by
* the {@code aria-label} attribute.
* Allows locating input elements by the text of the associated label.
*
* <p> **Usage**
*
* <p> For example, this method will find inputs by label "Username" and "Password" in the following DOM:
* <p> For example, this method will find the input by label text "Password" in the following DOM:
* <pre>{@code
* page.getByLabel("Username").fill("john");
* page.getByLabel("Password").fill("secret");
* }</pre>
*
@@ -3197,14 +3149,12 @@ public interface Frame {
return getByLabel(text, null);
}
/**
* Allows locating input elements by the text of the associated {@code <label>} or {@code aria-labelledby} element, or by
* the {@code aria-label} attribute.
* Allows locating input elements by the text of the associated label.
*
* <p> **Usage**
*
* <p> For example, this method will find inputs by label "Username" and "Password" in the following DOM:
* <p> For example, this method will find the input by label text "Password" in the following DOM:
* <pre>{@code
* page.getByLabel("Username").fill("john");
* page.getByLabel("Password").fill("secret");
* }</pre>
*
@@ -4889,8 +4839,7 @@ public interface Frame {
* <ul>
* <li> {@code "load"} - wait for the {@code load} event to be fired.</li>
* <li> {@code "domcontentloaded"} - wait for the {@code DOMContentLoaded} event to be fired.</li>
* <li> {@code "networkidle"} - **DISCOURAGED** wait until there are no network connections for at least {@code 500} ms. Don't
* use this method for testing, rely on web assertions to assess readiness instead.</li>
* <li> {@code "networkidle"} - wait until there are no network connections for at least {@code 500} ms.</li>
* </ul>
* @since v1.8
*/
@@ -4931,14 +4880,30 @@ public interface Frame {
* <ul>
* <li> {@code "load"} - wait for the {@code load} event to be fired.</li>
* <li> {@code "domcontentloaded"} - wait for the {@code DOMContentLoaded} event to be fired.</li>
* <li> {@code "networkidle"} - **DISCOURAGED** wait until there are no network connections for at least {@code 500} ms. Don't
* use this method for testing, rely on web assertions to assess readiness instead.</li>
* <li> {@code "networkidle"} - wait until there are no network connections for at least {@code 500} ms.</li>
* </ul>
* @since v1.8
*/
void waitForLoadState(LoadState state, WaitForLoadStateOptions options);
/**
* @deprecated This method is inherently racy, please use {@link Frame#waitForURL Frame.waitForURL()} instead.
* Waits for the frame navigation and returns the main resource response. In case of multiple redirects, the navigation
* will resolve with the response of the last redirect. In case of navigation to a different anchor or navigation due to
* History API usage, the navigation will resolve with {@code null}.
*
* <p> **Usage**
*
* <p> This method waits for the frame to navigate to a new URL. It is useful for when you run code which will indirectly cause
* the frame to navigate. Consider this example:
* <pre>{@code
* // The method returns after navigation has finished
* frame.waitForNavigation(() -> {
* // Clicking the link will indirectly cause a navigation
* frame.click("a.delayed-navigation");
* });
* }</pre>
*
* <p> <strong>NOTE:</strong> Usage of the <a href="https://developer.mozilla.org/en-US/docs/Web/API/History_API">History API</a> to change the URL is
* considered a navigation.
*
* @param callback Callback that performs the action triggering the event.
* @since v1.8
@@ -4947,7 +4912,24 @@ public interface Frame {
return waitForNavigation(null, callback);
}
/**
* @deprecated This method is inherently racy, please use {@link Frame#waitForURL Frame.waitForURL()} instead.
* Waits for the frame navigation and returns the main resource response. In case of multiple redirects, the navigation
* will resolve with the response of the last redirect. In case of navigation to a different anchor or navigation due to
* History API usage, the navigation will resolve with {@code null}.
*
* <p> **Usage**
*
* <p> This method waits for the frame to navigate to a new URL. It is useful for when you run code which will indirectly cause
* the frame to navigate. Consider this example:
* <pre>{@code
* // The method returns after navigation has finished
* frame.waitForNavigation(() -> {
* // Clicking the link will indirectly cause a navigation
* frame.click("a.delayed-navigation");
* });
* }</pre>
*
* <p> <strong>NOTE:</strong> Usage of the <a href="https://developer.mozilla.org/en-US/docs/Web/API/History_API">History API</a> to change the URL is
* considered a navigation.
*
* @param callback Callback that performs the action triggering the event.
* @since v1.8
@@ -291,19 +291,6 @@ public interface FrameLocator {
* <p> Note that outer and inner locators must belong to the same frame. Inner locator must not contain {@code FrameLocator}s.
*/
public Locator has;
/**
* Matches elements that do not contain an element that matches an inner locator. Inner locator is queried against the
* outer one. For example, {@code article} that does not have {@code div} matches {@code
* <article><span>Playwright</span></article>}.
*
* <p> Note that outer and inner locators must belong to the same frame. Inner locator must not contain {@code FrameLocator}s.
*/
public Locator hasNot;
/**
* Matches elements that do not contain specified text somewhere inside, possibly in a child or a descendant element. When
* passed a [string], matching is case-insensitive and searches for a substring.
*/
public Object hasNotText;
/**
* Matches elements containing specified text somewhere inside, possibly in a child or a descendant element. When passed a
* [string], matching is case-insensitive and searches for a substring. For example, {@code "Playwright"} matches {@code
@@ -321,33 +308,6 @@ public interface FrameLocator {
this.has = has;
return this;
}
/**
* Matches elements that do not contain an element that matches an inner locator. Inner locator is queried against the
* outer one. For example, {@code article} that does not have {@code div} matches {@code
* <article><span>Playwright</span></article>}.
*
* <p> Note that outer and inner locators must belong to the same frame. Inner locator must not contain {@code FrameLocator}s.
*/
public LocatorOptions setHasNot(Locator hasNot) {
this.hasNot = hasNot;
return this;
}
/**
* Matches elements that do not contain specified text somewhere inside, possibly in a child or a descendant element. When
* passed a [string], matching is case-insensitive and searches for a substring.
*/
public LocatorOptions setHasNotText(String hasNotText) {
this.hasNotText = hasNotText;
return this;
}
/**
* Matches elements that do not contain specified text somewhere inside, possibly in a child or a descendant element. When
* passed a [string], matching is case-insensitive and searches for a substring.
*/
public LocatorOptions setHasNotText(Pattern hasNotText) {
this.hasNotText = hasNotText;
return this;
}
/**
* Matches elements containing specified text somewhere inside, possibly in a child or a descendant element. When passed a
* [string], matching is case-insensitive and searches for a substring. For example, {@code "Playwright"} matches {@code
@@ -442,14 +402,12 @@ public interface FrameLocator {
*/
Locator getByAltText(Pattern text, GetByAltTextOptions options);
/**
* Allows locating input elements by the text of the associated {@code <label>} or {@code aria-labelledby} element, or by
* the {@code aria-label} attribute.
* Allows locating input elements by the text of the associated label.
*
* <p> **Usage**
*
* <p> For example, this method will find inputs by label "Username" and "Password" in the following DOM:
* <p> For example, this method will find the input by label text "Password" in the following DOM:
* <pre>{@code
* page.getByLabel("Username").fill("john");
* page.getByLabel("Password").fill("secret");
* }</pre>
*
@@ -460,14 +418,12 @@ public interface FrameLocator {
return getByLabel(text, null);
}
/**
* Allows locating input elements by the text of the associated {@code <label>} or {@code aria-labelledby} element, or by
* the {@code aria-label} attribute.
* Allows locating input elements by the text of the associated label.
*
* <p> **Usage**
*
* <p> For example, this method will find inputs by label "Username" and "Password" in the following DOM:
* <p> For example, this method will find the input by label text "Password" in the following DOM:
* <pre>{@code
* page.getByLabel("Username").fill("john");
* page.getByLabel("Password").fill("secret");
* }</pre>
*
@@ -476,14 +432,12 @@ public interface FrameLocator {
*/
Locator getByLabel(String text, GetByLabelOptions options);
/**
* Allows locating input elements by the text of the associated {@code <label>} or {@code aria-labelledby} element, or by
* the {@code aria-label} attribute.
* Allows locating input elements by the text of the associated label.
*
* <p> **Usage**
*
* <p> For example, this method will find inputs by label "Username" and "Password" in the following DOM:
* <p> For example, this method will find the input by label text "Password" in the following DOM:
* <pre>{@code
* page.getByLabel("Username").fill("john");
* page.getByLabel("Password").fill("secret");
* }</pre>
*
@@ -494,14 +448,12 @@ public interface FrameLocator {
return getByLabel(text, null);
}
/**
* Allows locating input elements by the text of the associated {@code <label>} or {@code aria-labelledby} element, or by
* the {@code aria-label} attribute.
* Allows locating input elements by the text of the associated label.
*
* <p> **Usage**
*
* <p> For example, this method will find inputs by label "Username" and "Password" in the following DOM:
* <p> For example, this method will find the input by label text "Password" in the following DOM:
* <pre>{@code
* page.getByLabel("Username").fill("john");
* page.getByLabel("Password").fill("secret");
* }</pre>
*
@@ -947,11 +899,11 @@ public interface FrameLocator {
*
* <p> <a href="https://playwright.dev/java/docs/locators">Learn more about locators</a>.
*
* @param selectorOrLocator A selector or locator to use when resolving DOM element.
* @param selector A selector to use when resolving DOM element.
* @since v1.17
*/
default Locator locator(String selectorOrLocator) {
return locator(selectorOrLocator, null);
default Locator locator(String selector) {
return locator(selector, null);
}
/**
* The method finds an element matching the specified selector in the locator's subtree. It also accepts filter options,
@@ -959,32 +911,10 @@ public interface FrameLocator {
*
* <p> <a href="https://playwright.dev/java/docs/locators">Learn more about locators</a>.
*
* @param selectorOrLocator A selector or locator to use when resolving DOM element.
* @param selector A selector to use when resolving DOM element.
* @since v1.17
*/
Locator locator(String selectorOrLocator, LocatorOptions options);
/**
* The method finds an element matching the specified selector in the locator's subtree. It also accepts filter options,
* similar to {@link Locator#filter Locator.filter()} method.
*
* <p> <a href="https://playwright.dev/java/docs/locators">Learn more about locators</a>.
*
* @param selectorOrLocator A selector or locator to use when resolving DOM element.
* @since v1.17
*/
default Locator locator(Locator selectorOrLocator) {
return locator(selectorOrLocator, null);
}
/**
* The method finds an element matching the specified selector in the locator's subtree. It also accepts filter options,
* similar to {@link Locator#filter Locator.filter()} method.
*
* <p> <a href="https://playwright.dev/java/docs/locators">Learn more about locators</a>.
*
* @param selectorOrLocator A selector or locator to use when resolving DOM element.
* @since v1.17
*/
Locator locator(Locator selectorOrLocator, LocatorOptions options);
Locator locator(String selector, LocatorOptions options);
/**
* Returns locator to the n-th matching frame. It's zero based, {@code nth(0)} selects the first frame.
*
@@ -135,7 +135,7 @@ public interface JSHandle {
*
* <p> **Usage**
* <pre>{@code
* JSHandle handle = page.evaluateHandle("() => ({window, document})");
* JSHandle handle = page.evaluateHandle("() => ({window, document}"););
* Map<String, JSHandle> properties = handle.getProperties();
* JSHandle windowHandle = properties.get("window");
* JSHandle documentHandle = properties.get("document");
@@ -31,15 +31,15 @@ import java.util.regex.Pattern;
public interface Locator {
class BlurOptions {
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public BlurOptions setTimeout(double timeout) {
@@ -49,15 +49,15 @@ public interface Locator {
}
class BoundingBoxOptions {
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public BoundingBoxOptions setTimeout(double timeout) {
@@ -83,8 +83,8 @@ public interface Locator {
*/
public Position position;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -128,8 +128,8 @@ public interface Locator {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public CheckOptions setTimeout(double timeout) {
@@ -159,8 +159,8 @@ public interface Locator {
*/
public Boolean noWaitAfter;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -183,8 +183,8 @@ public interface Locator {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public ClearOptions setTimeout(double timeout) {
@@ -227,8 +227,8 @@ public interface Locator {
*/
public Position position;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -301,8 +301,8 @@ public interface Locator {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public ClickOptions setTimeout(double timeout) {
@@ -350,8 +350,8 @@ public interface Locator {
*/
public Position position;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -417,8 +417,8 @@ public interface Locator {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public DblclickOptions setTimeout(double timeout) {
@@ -437,15 +437,15 @@ public interface Locator {
}
class DispatchEventOptions {
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public DispatchEventOptions setTimeout(double timeout) {
@@ -476,8 +476,8 @@ public interface Locator {
*/
public Position targetPosition;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -536,8 +536,8 @@ public interface Locator {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public DragToOptions setTimeout(double timeout) {
@@ -556,15 +556,15 @@ public interface Locator {
}
class ElementHandleOptions {
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public ElementHandleOptions setTimeout(double timeout) {
@@ -574,15 +574,15 @@ public interface Locator {
}
class EvaluateOptions {
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public EvaluateOptions setTimeout(double timeout) {
@@ -592,15 +592,15 @@ public interface Locator {
}
class EvaluateHandleOptions {
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public EvaluateHandleOptions setTimeout(double timeout) {
@@ -621,8 +621,8 @@ public interface Locator {
*/
public Boolean noWaitAfter;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -645,8 +645,8 @@ public interface Locator {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public FillOptions setTimeout(double timeout) {
@@ -662,19 +662,6 @@ public interface Locator {
* <p> Note that outer and inner locators must belong to the same frame. Inner locator must not contain {@code FrameLocator}s.
*/
public Locator has;
/**
* Matches elements that do not contain an element that matches an inner locator. Inner locator is queried against the
* outer one. For example, {@code article} that does not have {@code div} matches {@code
* <article><span>Playwright</span></article>}.
*
* <p> Note that outer and inner locators must belong to the same frame. Inner locator must not contain {@code FrameLocator}s.
*/
public Locator hasNot;
/**
* Matches elements that do not contain specified text somewhere inside, possibly in a child or a descendant element. When
* passed a [string], matching is case-insensitive and searches for a substring.
*/
public Object hasNotText;
/**
* Matches elements containing specified text somewhere inside, possibly in a child or a descendant element. When passed a
* [string], matching is case-insensitive and searches for a substring. For example, {@code "Playwright"} matches {@code
@@ -692,33 +679,6 @@ public interface Locator {
this.has = has;
return this;
}
/**
* Matches elements that do not contain an element that matches an inner locator. Inner locator is queried against the
* outer one. For example, {@code article} that does not have {@code div} matches {@code
* <article><span>Playwright</span></article>}.
*
* <p> Note that outer and inner locators must belong to the same frame. Inner locator must not contain {@code FrameLocator}s.
*/
public FilterOptions setHasNot(Locator hasNot) {
this.hasNot = hasNot;
return this;
}
/**
* Matches elements that do not contain specified text somewhere inside, possibly in a child or a descendant element. When
* passed a [string], matching is case-insensitive and searches for a substring.
*/
public FilterOptions setHasNotText(String hasNotText) {
this.hasNotText = hasNotText;
return this;
}
/**
* Matches elements that do not contain specified text somewhere inside, possibly in a child or a descendant element. When
* passed a [string], matching is case-insensitive and searches for a substring.
*/
public FilterOptions setHasNotText(Pattern hasNotText) {
this.hasNotText = hasNotText;
return this;
}
/**
* Matches elements containing specified text somewhere inside, possibly in a child or a descendant element. When passed a
* [string], matching is case-insensitive and searches for a substring. For example, {@code "Playwright"} matches {@code
@@ -740,15 +700,15 @@ public interface Locator {
}
class FocusOptions {
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public FocusOptions setTimeout(double timeout) {
@@ -758,15 +718,15 @@ public interface Locator {
}
class GetAttributeOptions {
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public GetAttributeOptions setTimeout(double timeout) {
@@ -1031,8 +991,8 @@ public interface Locator {
*/
public Position position;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -1084,8 +1044,8 @@ public interface Locator {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public HoverOptions setTimeout(double timeout) {
@@ -1104,15 +1064,15 @@ public interface Locator {
}
class InnerHTMLOptions {
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public InnerHTMLOptions setTimeout(double timeout) {
@@ -1122,15 +1082,15 @@ public interface Locator {
}
class InnerTextOptions {
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public InnerTextOptions setTimeout(double timeout) {
@@ -1140,15 +1100,15 @@ public interface Locator {
}
class InputValueOptions {
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public InputValueOptions setTimeout(double timeout) {
@@ -1158,15 +1118,15 @@ public interface Locator {
}
class IsCheckedOptions {
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public IsCheckedOptions setTimeout(double timeout) {
@@ -1176,15 +1136,15 @@ public interface Locator {
}
class IsDisabledOptions {
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public IsDisabledOptions setTimeout(double timeout) {
@@ -1194,15 +1154,15 @@ public interface Locator {
}
class IsEditableOptions {
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public IsEditableOptions setTimeout(double timeout) {
@@ -1212,15 +1172,15 @@ public interface Locator {
}
class IsEnabledOptions {
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public IsEnabledOptions setTimeout(double timeout) {
@@ -1268,19 +1228,6 @@ public interface Locator {
* <p> Note that outer and inner locators must belong to the same frame. Inner locator must not contain {@code FrameLocator}s.
*/
public Locator has;
/**
* Matches elements that do not contain an element that matches an inner locator. Inner locator is queried against the
* outer one. For example, {@code article} that does not have {@code div} matches {@code
* <article><span>Playwright</span></article>}.
*
* <p> Note that outer and inner locators must belong to the same frame. Inner locator must not contain {@code FrameLocator}s.
*/
public Locator hasNot;
/**
* Matches elements that do not contain specified text somewhere inside, possibly in a child or a descendant element. When
* passed a [string], matching is case-insensitive and searches for a substring.
*/
public Object hasNotText;
/**
* Matches elements containing specified text somewhere inside, possibly in a child or a descendant element. When passed a
* [string], matching is case-insensitive and searches for a substring. For example, {@code "Playwright"} matches {@code
@@ -1298,33 +1245,6 @@ public interface Locator {
this.has = has;
return this;
}
/**
* Matches elements that do not contain an element that matches an inner locator. Inner locator is queried against the
* outer one. For example, {@code article} that does not have {@code div} matches {@code
* <article><span>Playwright</span></article>}.
*
* <p> Note that outer and inner locators must belong to the same frame. Inner locator must not contain {@code FrameLocator}s.
*/
public LocatorOptions setHasNot(Locator hasNot) {
this.hasNot = hasNot;
return this;
}
/**
* Matches elements that do not contain specified text somewhere inside, possibly in a child or a descendant element. When
* passed a [string], matching is case-insensitive and searches for a substring.
*/
public LocatorOptions setHasNotText(String hasNotText) {
this.hasNotText = hasNotText;
return this;
}
/**
* Matches elements that do not contain specified text somewhere inside, possibly in a child or a descendant element. When
* passed a [string], matching is case-insensitive and searches for a substring.
*/
public LocatorOptions setHasNotText(Pattern hasNotText) {
this.hasNotText = hasNotText;
return this;
}
/**
* Matches elements containing specified text somewhere inside, possibly in a child or a descendant element. When passed a
* [string], matching is case-insensitive and searches for a substring. For example, {@code "Playwright"} matches {@code
@@ -1356,8 +1276,8 @@ public interface Locator {
*/
public Boolean noWaitAfter;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -1379,8 +1299,8 @@ public interface Locator {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public PressOptions setTimeout(double timeout) {
@@ -1434,8 +1354,8 @@ public interface Locator {
*/
public ScreenshotScale scale;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -1510,8 +1430,8 @@ public interface Locator {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public ScreenshotOptions setTimeout(double timeout) {
@@ -1528,15 +1448,15 @@ public interface Locator {
}
class ScrollIntoViewIfNeededOptions {
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public ScrollIntoViewIfNeededOptions setTimeout(double timeout) {
@@ -1557,8 +1477,8 @@ public interface Locator {
*/
public Boolean noWaitAfter;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -1581,8 +1501,8 @@ public interface Locator {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public SelectOptionOptions setTimeout(double timeout) {
@@ -1597,8 +1517,8 @@ public interface Locator {
*/
public Boolean force;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -1612,8 +1532,8 @@ public interface Locator {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public SelectTextOptions setTimeout(double timeout) {
@@ -1639,8 +1559,8 @@ public interface Locator {
*/
public Position position;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -1684,8 +1604,8 @@ public interface Locator {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public SetCheckedOptions setTimeout(double timeout) {
@@ -1710,8 +1630,8 @@ public interface Locator {
*/
public Boolean noWaitAfter;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -1726,8 +1646,8 @@ public interface Locator {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public SetInputFilesOptions setTimeout(double timeout) {
@@ -1758,8 +1678,8 @@ public interface Locator {
*/
public Position position;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -1811,8 +1731,8 @@ public interface Locator {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public TapOptions setTimeout(double timeout) {
@@ -1831,15 +1751,15 @@ public interface Locator {
}
class TextContentOptions {
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public TextContentOptions setTimeout(double timeout) {
@@ -1859,8 +1779,8 @@ public interface Locator {
*/
public Boolean noWaitAfter;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -1882,8 +1802,8 @@ public interface Locator {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public TypeOptions setTimeout(double timeout) {
@@ -1909,8 +1829,8 @@ public interface Locator {
*/
public Position position;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -1954,8 +1874,8 @@ public interface Locator {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public UncheckOptions setTimeout(double timeout) {
@@ -1986,8 +1906,8 @@ public interface Locator {
*/
public WaitForSelectorState state;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -2008,8 +1928,8 @@ public interface Locator {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public WaitForOptions setTimeout(double timeout) {
@@ -2020,11 +1940,6 @@ public interface Locator {
/**
* When locator points to a list of elements, returns array of locators, pointing to respective elements.
*
* <p> <strong>NOTE:</strong> {@link Locator#all Locator.all()} does not wait for elements to match the locator, and instead immediately returns
* whatever is present in the page. When the list of elements changes dynamically, {@link Locator#all Locator.all()} will
* produce unpredictable and flaky results. When the list of elements is stable, but loaded dynamically, wait for the full
* list to finish loading before calling {@link Locator#all Locator.all()}.
*
* <p> **Usage**
* <pre>{@code
* for (Locator li : page.getByRole('listitem').all())
@@ -2056,20 +1971,6 @@ public interface Locator {
* @since v1.14
*/
List<String> allTextContents();
/**
* Creates a locator that matches both this locator and the argument locator.
*
* <p> **Usage**
*
* <p> The following example finds a button with a specific title.
* <pre>{@code
* Locator button = page.getByRole(AriaRole.BUTTON).and(page.getByTitle("Subscribe"));
* }</pre>
*
* @param locator Additional locator to match.
* @since v1.33
*/
Locator and(Locator locator);
/**
* Calls <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/blur">blur</a> on the element.
*
@@ -3001,14 +2902,12 @@ public interface Locator {
*/
Locator getByAltText(Pattern text, GetByAltTextOptions options);
/**
* Allows locating input elements by the text of the associated {@code <label>} or {@code aria-labelledby} element, or by
* the {@code aria-label} attribute.
* Allows locating input elements by the text of the associated label.
*
* <p> **Usage**
*
* <p> For example, this method will find inputs by label "Username" and "Password" in the following DOM:
* <p> For example, this method will find the input by label text "Password" in the following DOM:
* <pre>{@code
* page.getByLabel("Username").fill("john");
* page.getByLabel("Password").fill("secret");
* }</pre>
*
@@ -3019,14 +2918,12 @@ public interface Locator {
return getByLabel(text, null);
}
/**
* Allows locating input elements by the text of the associated {@code <label>} or {@code aria-labelledby} element, or by
* the {@code aria-label} attribute.
* Allows locating input elements by the text of the associated label.
*
* <p> **Usage**
*
* <p> For example, this method will find inputs by label "Username" and "Password" in the following DOM:
* <p> For example, this method will find the input by label text "Password" in the following DOM:
* <pre>{@code
* page.getByLabel("Username").fill("john");
* page.getByLabel("Password").fill("secret");
* }</pre>
*
@@ -3035,14 +2932,12 @@ public interface Locator {
*/
Locator getByLabel(String text, GetByLabelOptions options);
/**
* Allows locating input elements by the text of the associated {@code <label>} or {@code aria-labelledby} element, or by
* the {@code aria-label} attribute.
* Allows locating input elements by the text of the associated label.
*
* <p> **Usage**
*
* <p> For example, this method will find inputs by label "Username" and "Password" in the following DOM:
* <p> For example, this method will find the input by label text "Password" in the following DOM:
* <pre>{@code
* page.getByLabel("Username").fill("john");
* page.getByLabel("Password").fill("secret");
* }</pre>
*
@@ -3053,14 +2948,12 @@ public interface Locator {
return getByLabel(text, null);
}
/**
* Allows locating input elements by the text of the associated {@code <label>} or {@code aria-labelledby} element, or by
* the {@code aria-label} attribute.
* Allows locating input elements by the text of the associated label.
*
* <p> **Usage**
*
* <p> For example, this method will find inputs by label "Username" and "Password" in the following DOM:
* <p> For example, this method will find the input by label text "Password" in the following DOM:
* <pre>{@code
* page.getByLabel("Username").fill("john");
* page.getByLabel("Password").fill("secret");
* }</pre>
*
@@ -3790,11 +3683,11 @@ public interface Locator {
*
* <p> <a href="https://playwright.dev/java/docs/locators">Learn more about locators</a>.
*
* @param selectorOrLocator A selector or locator to use when resolving DOM element.
* @param selector A selector to use when resolving DOM element.
* @since v1.14
*/
default Locator locator(String selectorOrLocator) {
return locator(selectorOrLocator, null);
default Locator locator(String selector) {
return locator(selector, null);
}
/**
* The method finds an element matching the specified selector in the locator's subtree. It also accepts filter options,
@@ -3802,32 +3695,10 @@ public interface Locator {
*
* <p> <a href="https://playwright.dev/java/docs/locators">Learn more about locators</a>.
*
* @param selectorOrLocator A selector or locator to use when resolving DOM element.
* @param selector A selector to use when resolving DOM element.
* @since v1.14
*/
Locator locator(String selectorOrLocator, LocatorOptions options);
/**
* The method finds an element matching the specified selector in the locator's subtree. It also accepts filter options,
* similar to {@link Locator#filter Locator.filter()} method.
*
* <p> <a href="https://playwright.dev/java/docs/locators">Learn more about locators</a>.
*
* @param selectorOrLocator A selector or locator to use when resolving DOM element.
* @since v1.14
*/
default Locator locator(Locator selectorOrLocator) {
return locator(selectorOrLocator, null);
}
/**
* The method finds an element matching the specified selector in the locator's subtree. It also accepts filter options,
* similar to {@link Locator#filter Locator.filter()} method.
*
* <p> <a href="https://playwright.dev/java/docs/locators">Learn more about locators</a>.
*
* @param selectorOrLocator A selector or locator to use when resolving DOM element.
* @since v1.14
*/
Locator locator(Locator selectorOrLocator, LocatorOptions options);
Locator locator(String selector, LocatorOptions options);
/**
* Returns locator to the n-th matching element. It's zero based, {@code nth(0)} selects the first element.
*
@@ -3839,26 +3710,6 @@ public interface Locator {
* @since v1.14
*/
Locator nth(int index);
/**
* Creates a locator that matches either of the two locators.
*
* <p> **Usage**
*
* <p> Consider a scenario where you'd like to click on a "New email" button, but sometimes a security settings dialog shows up
* instead. In this case, you can wait for either a "New email" button, or a dialog and act accordingly.
* <pre>{@code
* Locator newEmail = page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("New"));
* Locator dialog = page.getByText("Confirm security settings");
* assertThat(newEmail.or(dialog)).isVisible();
* if (dialog.isVisible())
* page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("Dismiss")).click();
* newEmail.click();
* }</pre>
*
* @param locator Alternative locator to match.
* @since v1.33
*/
Locator or(Locator locator);
/**
* A page this locator belongs to.
*
@@ -20,7 +20,6 @@ import com.microsoft.playwright.options.*;
import java.nio.file.Path;
import java.util.*;
import java.util.function.Consumer;
import java.util.function.BooleanSupplier;
import java.util.function.Predicate;
import java.util.regex.Pattern;
@@ -82,15 +81,15 @@ public interface Page extends AutoCloseable {
* Emitted when JavaScript within the page calls one of console API methods, e.g. {@code console.log} or {@code
* console.dir}. Also emitted if the page throws an error or a warning.
*
* <p> The arguments passed into {@code console.log} are available on the {@code ConsoleMessage} event handler argument.
* <p> The arguments passed into {@code console.log} appear as arguments on the event handler.
*
* <p> **Usage**
* <p> An example of handling {@code console} event:
* <pre>{@code
* page.onConsoleMessage(msg -> {
* for (int i = 0; i < msg.args().size(); ++i)
* System.out.println(i + ": " + msg.args().get(i).jsonValue());
* });
* page.evaluate("() => console.log('hello', 5, { foo: 'bar' })");
* page.evaluate("() => console.log('hello', 5, {foo: 'bar'})");
* }</pre>
*/
void onConsoleMessage(Consumer<ConsoleMessage> handler);
@@ -127,16 +126,13 @@ public interface Page extends AutoCloseable {
* the dialog - otherwise the page will <a
* href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/EventLoop#never_blocking">freeze</a> waiting for the
* dialog, and actions like click will never finish.
*
* <p> **Usage**
* <pre>{@code
* page.onDialog(dialog -> {
* dialog.accept();
* });
* }</pre>
*
* <p> <strong>NOTE:</strong> When no {@link Page#onDialog Page.onDialog()} or {@link BrowserContext#onDialog BrowserContext.onDialog()} listeners are
* present, all dialogs are automatically dismissed.
* <p> <strong>NOTE:</strong> When no {@link Page#onDialog Page.onDialog()} listeners are present, all dialogs are automatically dismissed.
*/
void onDialog(Consumer<Dialog> handler);
/**
@@ -438,8 +434,8 @@ public interface Page extends AutoCloseable {
*/
public Boolean strict;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -491,8 +487,8 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public CheckOptions setTimeout(double timeout) {
@@ -549,8 +545,8 @@ public interface Page extends AutoCloseable {
*/
public Boolean strict;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -631,8 +627,8 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public ClickOptions setTimeout(double timeout) {
@@ -701,8 +697,8 @@ public interface Page extends AutoCloseable {
*/
public Boolean strict;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -776,8 +772,8 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public DblclickOptions setTimeout(double timeout) {
@@ -801,8 +797,8 @@ public interface Page extends AutoCloseable {
*/
public Boolean strict;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -816,8 +812,8 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public DispatchEventOptions setTimeout(double timeout) {
@@ -853,8 +849,8 @@ public interface Page extends AutoCloseable {
*/
public Position targetPosition;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -921,8 +917,8 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public DragAndDropOptions setTimeout(double timeout) {
@@ -1044,8 +1040,8 @@ public interface Page extends AutoCloseable {
*/
public Boolean strict;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -1076,8 +1072,8 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public FillOptions setTimeout(double timeout) {
@@ -1092,8 +1088,8 @@ public interface Page extends AutoCloseable {
*/
public Boolean strict;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -1107,8 +1103,8 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public FocusOptions setTimeout(double timeout) {
@@ -1123,8 +1119,8 @@ public interface Page extends AutoCloseable {
*/
public Boolean strict;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -1138,8 +1134,8 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public GetAttributeOptions setTimeout(double timeout) {
@@ -1394,8 +1390,8 @@ public interface Page extends AutoCloseable {
* <ul>
* <li> {@code "domcontentloaded"} - consider operation to be finished when the {@code DOMContentLoaded} event is fired.</li>
* <li> {@code "load"} - consider operation to be finished when the {@code load} event is fired.</li>
* <li> {@code "networkidle"} - **DISCOURAGED** consider operation to be finished when there are no network connections for at
* least {@code 500} ms. Don't use this method for testing, rely on web assertions to assess readiness instead.</li>
* <li> {@code "networkidle"} - consider operation to be finished when there are no network connections for at least {@code 500}
* ms.</li>
* <li> {@code "commit"} - consider operation to be finished when network response is received and the document started loading.</li>
* </ul>
*/
@@ -1416,8 +1412,8 @@ public interface Page extends AutoCloseable {
* <ul>
* <li> {@code "domcontentloaded"} - consider operation to be finished when the {@code DOMContentLoaded} event is fired.</li>
* <li> {@code "load"} - consider operation to be finished when the {@code load} event is fired.</li>
* <li> {@code "networkidle"} - **DISCOURAGED** consider operation to be finished when there are no network connections for at
* least {@code 500} ms. Don't use this method for testing, rely on web assertions to assess readiness instead.</li>
* <li> {@code "networkidle"} - consider operation to be finished when there are no network connections for at least {@code 500}
* ms.</li>
* <li> {@code "commit"} - consider operation to be finished when network response is received and the document started loading.</li>
* </ul>
*/
@@ -1439,8 +1435,8 @@ public interface Page extends AutoCloseable {
* <ul>
* <li> {@code "domcontentloaded"} - consider operation to be finished when the {@code DOMContentLoaded} event is fired.</li>
* <li> {@code "load"} - consider operation to be finished when the {@code load} event is fired.</li>
* <li> {@code "networkidle"} - **DISCOURAGED** consider operation to be finished when there are no network connections for at
* least {@code 500} ms. Don't use this method for testing, rely on web assertions to assess readiness instead.</li>
* <li> {@code "networkidle"} - consider operation to be finished when there are no network connections for at least {@code 500}
* ms.</li>
* <li> {@code "commit"} - consider operation to be finished when network response is received and the document started loading.</li>
* </ul>
*/
@@ -1461,8 +1457,8 @@ public interface Page extends AutoCloseable {
* <ul>
* <li> {@code "domcontentloaded"} - consider operation to be finished when the {@code DOMContentLoaded} event is fired.</li>
* <li> {@code "load"} - consider operation to be finished when the {@code load} event is fired.</li>
* <li> {@code "networkidle"} - **DISCOURAGED** consider operation to be finished when there are no network connections for at
* least {@code 500} ms. Don't use this method for testing, rely on web assertions to assess readiness instead.</li>
* <li> {@code "networkidle"} - consider operation to be finished when there are no network connections for at least {@code 500}
* ms.</li>
* <li> {@code "commit"} - consider operation to be finished when network response is received and the document started loading.</li>
* </ul>
*/
@@ -1489,8 +1485,8 @@ public interface Page extends AutoCloseable {
* <ul>
* <li> {@code "domcontentloaded"} - consider operation to be finished when the {@code DOMContentLoaded} event is fired.</li>
* <li> {@code "load"} - consider operation to be finished when the {@code load} event is fired.</li>
* <li> {@code "networkidle"} - **DISCOURAGED** consider operation to be finished when there are no network connections for at
* least {@code 500} ms. Don't use this method for testing, rely on web assertions to assess readiness instead.</li>
* <li> {@code "networkidle"} - consider operation to be finished when there are no network connections for at least {@code 500}
* ms.</li>
* <li> {@code "commit"} - consider operation to be finished when network response is received and the document started loading.</li>
* </ul>
*/
@@ -1519,8 +1515,8 @@ public interface Page extends AutoCloseable {
* <ul>
* <li> {@code "domcontentloaded"} - consider operation to be finished when the {@code DOMContentLoaded} event is fired.</li>
* <li> {@code "load"} - consider operation to be finished when the {@code load} event is fired.</li>
* <li> {@code "networkidle"} - **DISCOURAGED** consider operation to be finished when there are no network connections for at
* least {@code 500} ms. Don't use this method for testing, rely on web assertions to assess readiness instead.</li>
* <li> {@code "networkidle"} - consider operation to be finished when there are no network connections for at least {@code 500}
* ms.</li>
* <li> {@code "commit"} - consider operation to be finished when network response is received and the document started loading.</li>
* </ul>
*/
@@ -1557,8 +1553,8 @@ public interface Page extends AutoCloseable {
*/
public Boolean strict;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -1618,8 +1614,8 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public HoverOptions setTimeout(double timeout) {
@@ -1643,8 +1639,8 @@ public interface Page extends AutoCloseable {
*/
public Boolean strict;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -1658,8 +1654,8 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public InnerHTMLOptions setTimeout(double timeout) {
@@ -1674,8 +1670,8 @@ public interface Page extends AutoCloseable {
*/
public Boolean strict;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -1689,8 +1685,8 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public InnerTextOptions setTimeout(double timeout) {
@@ -1705,8 +1701,8 @@ public interface Page extends AutoCloseable {
*/
public Boolean strict;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -1720,8 +1716,8 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public InputValueOptions setTimeout(double timeout) {
@@ -1736,8 +1732,8 @@ public interface Page extends AutoCloseable {
*/
public Boolean strict;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -1751,8 +1747,8 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public IsCheckedOptions setTimeout(double timeout) {
@@ -1767,8 +1763,8 @@ public interface Page extends AutoCloseable {
*/
public Boolean strict;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -1782,8 +1778,8 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public IsDisabledOptions setTimeout(double timeout) {
@@ -1798,8 +1794,8 @@ public interface Page extends AutoCloseable {
*/
public Boolean strict;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -1813,8 +1809,8 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public IsEditableOptions setTimeout(double timeout) {
@@ -1829,8 +1825,8 @@ public interface Page extends AutoCloseable {
*/
public Boolean strict;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -1844,8 +1840,8 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public IsEnabledOptions setTimeout(double timeout) {
@@ -1919,19 +1915,6 @@ public interface Page extends AutoCloseable {
* <p> Note that outer and inner locators must belong to the same frame. Inner locator must not contain {@code FrameLocator}s.
*/
public Locator has;
/**
* Matches elements that do not contain an element that matches an inner locator. Inner locator is queried against the
* outer one. For example, {@code article} that does not have {@code div} matches {@code
* <article><span>Playwright</span></article>}.
*
* <p> Note that outer and inner locators must belong to the same frame. Inner locator must not contain {@code FrameLocator}s.
*/
public Locator hasNot;
/**
* Matches elements that do not contain specified text somewhere inside, possibly in a child or a descendant element. When
* passed a [string], matching is case-insensitive and searches for a substring.
*/
public Object hasNotText;
/**
* Matches elements containing specified text somewhere inside, possibly in a child or a descendant element. When passed a
* [string], matching is case-insensitive and searches for a substring. For example, {@code "Playwright"} matches {@code
@@ -1949,33 +1932,6 @@ public interface Page extends AutoCloseable {
this.has = has;
return this;
}
/**
* Matches elements that do not contain an element that matches an inner locator. Inner locator is queried against the
* outer one. For example, {@code article} that does not have {@code div} matches {@code
* <article><span>Playwright</span></article>}.
*
* <p> Note that outer and inner locators must belong to the same frame. Inner locator must not contain {@code FrameLocator}s.
*/
public LocatorOptions setHasNot(Locator hasNot) {
this.hasNot = hasNot;
return this;
}
/**
* Matches elements that do not contain specified text somewhere inside, possibly in a child or a descendant element. When
* passed a [string], matching is case-insensitive and searches for a substring.
*/
public LocatorOptions setHasNotText(String hasNotText) {
this.hasNotText = hasNotText;
return this;
}
/**
* Matches elements that do not contain specified text somewhere inside, possibly in a child or a descendant element. When
* passed a [string], matching is case-insensitive and searches for a substring.
*/
public LocatorOptions setHasNotText(Pattern hasNotText) {
this.hasNotText = hasNotText;
return this;
}
/**
* Matches elements containing specified text somewhere inside, possibly in a child or a descendant element. When passed a
* [string], matching is case-insensitive and searches for a substring. For example, {@code "Playwright"} matches {@code
@@ -2178,8 +2134,8 @@ public interface Page extends AutoCloseable {
*/
public Boolean strict;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -2209,8 +2165,8 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public PressOptions setTimeout(double timeout) {
@@ -2247,8 +2203,8 @@ public interface Page extends AutoCloseable {
* <ul>
* <li> {@code "domcontentloaded"} - consider operation to be finished when the {@code DOMContentLoaded} event is fired.</li>
* <li> {@code "load"} - consider operation to be finished when the {@code load} event is fired.</li>
* <li> {@code "networkidle"} - **DISCOURAGED** consider operation to be finished when there are no network connections for at
* least {@code 500} ms. Don't use this method for testing, rely on web assertions to assess readiness instead.</li>
* <li> {@code "networkidle"} - consider operation to be finished when there are no network connections for at least {@code 500}
* ms.</li>
* <li> {@code "commit"} - consider operation to be finished when network response is received and the document started loading.</li>
* </ul>
*/
@@ -2269,8 +2225,8 @@ public interface Page extends AutoCloseable {
* <ul>
* <li> {@code "domcontentloaded"} - consider operation to be finished when the {@code DOMContentLoaded} event is fired.</li>
* <li> {@code "load"} - consider operation to be finished when the {@code load} event is fired.</li>
* <li> {@code "networkidle"} - **DISCOURAGED** consider operation to be finished when there are no network connections for at
* least {@code 500} ms. Don't use this method for testing, rely on web assertions to assess readiness instead.</li>
* <li> {@code "networkidle"} - consider operation to be finished when there are no network connections for at least {@code 500}
* ms.</li>
* <li> {@code "commit"} - consider operation to be finished when network response is received and the document started loading.</li>
* </ul>
*/
@@ -2308,17 +2264,6 @@ public interface Page extends AutoCloseable {
* written to disk when {@link BrowserContext#close BrowserContext.close()} is called.
*/
public Boolean update;
/**
* Optional setting to control resource content management. If {@code attach} is specified, resources are persisted as
* separate files or entries in the ZIP archive. If {@code embed} is specified, content is stored inline the HAR file.
*/
public RouteFromHarUpdateContentPolicy updateContent;
/**
* When set to {@code minimal}, only record information necessary for routing from HAR. This omits sizes, timing, page,
* cookies, security and other types of HAR information that are not used when replaying from HAR. Defaults to {@code
* full}.
*/
public HarMode updateMode;
/**
* A glob pattern, regular expression or predicate to match the request URL. Only requests with URL matching the pattern
* will be served from the HAR file. If not specified, all requests are served from the HAR file.
@@ -2345,23 +2290,6 @@ public interface Page extends AutoCloseable {
this.update = update;
return this;
}
/**
* Optional setting to control resource content management. If {@code attach} is specified, resources are persisted as
* separate files or entries in the ZIP archive. If {@code embed} is specified, content is stored inline the HAR file.
*/
public RouteFromHAROptions setUpdateContent(RouteFromHarUpdateContentPolicy updateContent) {
this.updateContent = updateContent;
return this;
}
/**
* When set to {@code minimal}, only record information necessary for routing from HAR. This omits sizes, timing, page,
* cookies, security and other types of HAR information that are not used when replaying from HAR. Defaults to {@code
* full}.
*/
public RouteFromHAROptions setUpdateMode(HarMode updateMode) {
this.updateMode = updateMode;
return this;
}
/**
* A glob pattern, regular expression or predicate to match the request URL. Only requests with URL matching the pattern
* will be served from the HAR file. If not specified, all requests are served from the HAR file.
@@ -2397,7 +2325,7 @@ public interface Page extends AutoCloseable {
*/
public ScreenshotCaret caret;
/**
* An object which specifies clipping of the resulting image.
* An object which specifies clipping of the resulting image. Should have the following fields:
*/
public Clip clip;
/**
@@ -2434,8 +2362,8 @@ public interface Page extends AutoCloseable {
*/
public ScreenshotScale scale;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -2467,13 +2395,13 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* An object which specifies clipping of the resulting image.
* An object which specifies clipping of the resulting image. Should have the following fields:
*/
public ScreenshotOptions setClip(double x, double y, double width, double height) {
return setClip(new Clip(x, y, width, height));
}
/**
* An object which specifies clipping of the resulting image.
* An object which specifies clipping of the resulting image. Should have the following fields:
*/
public ScreenshotOptions setClip(Clip clip) {
this.clip = clip;
@@ -2531,8 +2459,8 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public ScreenshotOptions setTimeout(double timeout) {
@@ -2565,8 +2493,8 @@ public interface Page extends AutoCloseable {
*/
public Boolean strict;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -2597,8 +2525,8 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public SelectOptionOptions setTimeout(double timeout) {
@@ -2629,8 +2557,8 @@ public interface Page extends AutoCloseable {
*/
public Boolean strict;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -2682,8 +2610,8 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public SetCheckedOptions setTimeout(double timeout) {
@@ -2713,8 +2641,8 @@ public interface Page extends AutoCloseable {
* <ul>
* <li> {@code "domcontentloaded"} - consider operation to be finished when the {@code DOMContentLoaded} event is fired.</li>
* <li> {@code "load"} - consider operation to be finished when the {@code load} event is fired.</li>
* <li> {@code "networkidle"} - **DISCOURAGED** consider operation to be finished when there are no network connections for at
* least {@code 500} ms. Don't use this method for testing, rely on web assertions to assess readiness instead.</li>
* <li> {@code "networkidle"} - consider operation to be finished when there are no network connections for at least {@code 500}
* ms.</li>
* <li> {@code "commit"} - consider operation to be finished when network response is received and the document started loading.</li>
* </ul>
*/
@@ -2735,8 +2663,8 @@ public interface Page extends AutoCloseable {
* <ul>
* <li> {@code "domcontentloaded"} - consider operation to be finished when the {@code DOMContentLoaded} event is fired.</li>
* <li> {@code "load"} - consider operation to be finished when the {@code load} event is fired.</li>
* <li> {@code "networkidle"} - **DISCOURAGED** consider operation to be finished when there are no network connections for at
* least {@code 500} ms. Don't use this method for testing, rely on web assertions to assess readiness instead.</li>
* <li> {@code "networkidle"} - consider operation to be finished when there are no network connections for at least {@code 500}
* ms.</li>
* <li> {@code "commit"} - consider operation to be finished when network response is received and the document started loading.</li>
* </ul>
*/
@@ -2758,8 +2686,8 @@ public interface Page extends AutoCloseable {
*/
public Boolean strict;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -2782,8 +2710,8 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public SetInputFilesOptions setTimeout(double timeout) {
@@ -2819,8 +2747,8 @@ public interface Page extends AutoCloseable {
*/
public Boolean strict;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -2880,8 +2808,8 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public TapOptions setTimeout(double timeout) {
@@ -2905,8 +2833,8 @@ public interface Page extends AutoCloseable {
*/
public Boolean strict;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -2920,8 +2848,8 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public TextContentOptions setTimeout(double timeout) {
@@ -2946,8 +2874,8 @@ public interface Page extends AutoCloseable {
*/
public Boolean strict;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -2977,8 +2905,8 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public TypeOptions setTimeout(double timeout) {
@@ -3009,8 +2937,8 @@ public interface Page extends AutoCloseable {
*/
public Boolean strict;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -3062,8 +2990,8 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public UncheckOptions setTimeout(double timeout) {
@@ -3184,9 +3112,8 @@ public interface Page extends AutoCloseable {
*/
public Double pollingInterval;
/**
* Maximum time to wait for in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The
* default value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or
* {@link Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
* maximum time to wait for in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The
* default value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()}.
*/
public Double timeout;
@@ -3199,9 +3126,8 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* Maximum time to wait for in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The
* default value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or
* {@link Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
* maximum time to wait for in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The
* default value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()}.
*/
public WaitForFunctionOptions setTimeout(double timeout) {
this.timeout = timeout;
@@ -3247,8 +3173,8 @@ public interface Page extends AutoCloseable {
* <ul>
* <li> {@code "domcontentloaded"} - consider operation to be finished when the {@code DOMContentLoaded} event is fired.</li>
* <li> {@code "load"} - consider operation to be finished when the {@code load} event is fired.</li>
* <li> {@code "networkidle"} - **DISCOURAGED** consider operation to be finished when there are no network connections for at
* least {@code 500} ms. Don't use this method for testing, rely on web assertions to assess readiness instead.</li>
* <li> {@code "networkidle"} - consider operation to be finished when there are no network connections for at least {@code 500}
* ms.</li>
* <li> {@code "commit"} - consider operation to be finished when network response is received and the document started loading.</li>
* </ul>
*/
@@ -3296,8 +3222,8 @@ public interface Page extends AutoCloseable {
* <ul>
* <li> {@code "domcontentloaded"} - consider operation to be finished when the {@code DOMContentLoaded} event is fired.</li>
* <li> {@code "load"} - consider operation to be finished when the {@code load} event is fired.</li>
* <li> {@code "networkidle"} - **DISCOURAGED** consider operation to be finished when there are no network connections for at
* least {@code 500} ms. Don't use this method for testing, rely on web assertions to assess readiness instead.</li>
* <li> {@code "networkidle"} - consider operation to be finished when there are no network connections for at least {@code 500}
* ms.</li>
* <li> {@code "commit"} - consider operation to be finished when network response is received and the document started loading.</li>
* </ul>
*/
@@ -3413,8 +3339,8 @@ public interface Page extends AutoCloseable {
*/
public Boolean strict;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
@@ -3443,8 +3369,8 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be
* changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
* Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public WaitForSelectorOptions setTimeout(double timeout) {
@@ -3452,24 +3378,6 @@ public interface Page extends AutoCloseable {
return this;
}
}
class WaitForConditionOptions {
/**
* Maximum time to wait for in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The
* default value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or
* {@link Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public Double timeout;
/**
* Maximum time to wait for in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The
* default value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or
* {@link Page#setDefaultTimeout Page.setDefaultTimeout()} methods.
*/
public WaitForConditionOptions setTimeout(double timeout) {
this.timeout = timeout;
return this;
}
}
class WaitForURLOptions {
/**
* Maximum operation time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can
@@ -3483,8 +3391,8 @@ public interface Page extends AutoCloseable {
* <ul>
* <li> {@code "domcontentloaded"} - consider operation to be finished when the {@code DOMContentLoaded} event is fired.</li>
* <li> {@code "load"} - consider operation to be finished when the {@code load} event is fired.</li>
* <li> {@code "networkidle"} - **DISCOURAGED** consider operation to be finished when there are no network connections for at
* least {@code 500} ms. Don't use this method for testing, rely on web assertions to assess readiness instead.</li>
* <li> {@code "networkidle"} - consider operation to be finished when there are no network connections for at least {@code 500}
* ms.</li>
* <li> {@code "commit"} - consider operation to be finished when network response is received and the document started loading.</li>
* </ul>
*/
@@ -3505,8 +3413,8 @@ public interface Page extends AutoCloseable {
* <ul>
* <li> {@code "domcontentloaded"} - consider operation to be finished when the {@code DOMContentLoaded} event is fired.</li>
* <li> {@code "load"} - consider operation to be finished when the {@code load} event is fired.</li>
* <li> {@code "networkidle"} - **DISCOURAGED** consider operation to be finished when there are no network connections for at
* least {@code 500} ms. Don't use this method for testing, rely on web assertions to assess readiness instead.</li>
* <li> {@code "networkidle"} - consider operation to be finished when there are no network connections for at least {@code 500}
* ms.</li>
* <li> {@code "commit"} - consider operation to be finished when network response is received and the document started loading.</li>
* </ul>
*/
@@ -4702,14 +4610,12 @@ public interface Page extends AutoCloseable {
*/
Locator getByAltText(Pattern text, GetByAltTextOptions options);
/**
* Allows locating input elements by the text of the associated {@code <label>} or {@code aria-labelledby} element, or by
* the {@code aria-label} attribute.
* Allows locating input elements by the text of the associated label.
*
* <p> **Usage**
*
* <p> For example, this method will find inputs by label "Username" and "Password" in the following DOM:
* <p> For example, this method will find the input by label text "Password" in the following DOM:
* <pre>{@code
* page.getByLabel("Username").fill("john");
* page.getByLabel("Password").fill("secret");
* }</pre>
*
@@ -4720,14 +4626,12 @@ public interface Page extends AutoCloseable {
return getByLabel(text, null);
}
/**
* Allows locating input elements by the text of the associated {@code <label>} or {@code aria-labelledby} element, or by
* the {@code aria-label} attribute.
* Allows locating input elements by the text of the associated label.
*
* <p> **Usage**
*
* <p> For example, this method will find inputs by label "Username" and "Password" in the following DOM:
* <p> For example, this method will find the input by label text "Password" in the following DOM:
* <pre>{@code
* page.getByLabel("Username").fill("john");
* page.getByLabel("Password").fill("secret");
* }</pre>
*
@@ -4736,14 +4640,12 @@ public interface Page extends AutoCloseable {
*/
Locator getByLabel(String text, GetByLabelOptions options);
/**
* Allows locating input elements by the text of the associated {@code <label>} or {@code aria-labelledby} element, or by
* the {@code aria-label} attribute.
* Allows locating input elements by the text of the associated label.
*
* <p> **Usage**
*
* <p> For example, this method will find inputs by label "Username" and "Password" in the following DOM:
* <p> For example, this method will find the input by label text "Password" in the following DOM:
* <pre>{@code
* page.getByLabel("Username").fill("john");
* page.getByLabel("Password").fill("secret");
* }</pre>
*
@@ -4754,14 +4656,12 @@ public interface Page extends AutoCloseable {
return getByLabel(text, null);
}
/**
* Allows locating input elements by the text of the associated {@code <label>} or {@code aria-labelledby} element, or by
* the {@code aria-label} attribute.
* Allows locating input elements by the text of the associated label.
*
* <p> **Usage**
*
* <p> For example, this method will find inputs by label "Username" and "Password" in the following DOM:
* <p> For example, this method will find the input by label text "Password" in the following DOM:
* <pre>{@code
* page.getByLabel("Username").fill("john");
* page.getByLabel("Password").fill("secret");
* }</pre>
*
@@ -7294,8 +7194,7 @@ public interface Page extends AutoCloseable {
* <ul>
* <li> {@code "load"} - wait for the {@code load} event to be fired.</li>
* <li> {@code "domcontentloaded"} - wait for the {@code DOMContentLoaded} event to be fired.</li>
* <li> {@code "networkidle"} - **DISCOURAGED** wait until there are no network connections for at least {@code 500} ms. Don't
* use this method for testing, rely on web assertions to assess readiness instead.</li>
* <li> {@code "networkidle"} - wait until there are no network connections for at least {@code 500} ms.</li>
* </ul>
* @since v1.8
*/
@@ -7352,8 +7251,7 @@ public interface Page extends AutoCloseable {
* <ul>
* <li> {@code "load"} - wait for the {@code load} event to be fired.</li>
* <li> {@code "domcontentloaded"} - wait for the {@code DOMContentLoaded} event to be fired.</li>
* <li> {@code "networkidle"} - **DISCOURAGED** wait until there are no network connections for at least {@code 500} ms. Don't
* use this method for testing, rely on web assertions to assess readiness instead.</li>
* <li> {@code "networkidle"} - wait until there are no network connections for at least {@code 500} ms.</li>
* </ul>
* @since v1.8
*/
@@ -7818,44 +7716,6 @@ public interface Page extends AutoCloseable {
* @since v1.8
*/
ElementHandle waitForSelector(String selector, WaitForSelectorOptions options);
/**
* The method will block until the codition returns true. All Playwright events will be dispatched while the method is
* waiting for the codition.
*
* <p> **Usage**
*
* <p> Use the method to wait for a condition that depends on page events:
* <pre>{@code
* List<String> messages = new ArrayList<>();
* page.onConsoleMessage(m -> messages.add(m.text()));
* page.getByText("Submit button").click();
* page.waitForCondition(() -> messages.size() > 3);
* }</pre>
*
* @param condition Codition to wait for.
* @since v1.32
*/
default void waitForCondition(BooleanSupplier condition) {
waitForCondition(condition, null);
}
/**
* The method will block until the codition returns true. All Playwright events will be dispatched while the method is
* waiting for the codition.
*
* <p> **Usage**
*
* <p> Use the method to wait for a condition that depends on page events:
* <pre>{@code
* List<String> messages = new ArrayList<>();
* page.onConsoleMessage(m -> messages.add(m.text()));
* page.getByText("Submit button").click();
* page.waitForCondition(() -> messages.size() > 3);
* }</pre>
*
* @param condition Codition to wait for.
* @since v1.32
*/
void waitForCondition(BooleanSupplier condition, WaitForConditionOptions options);
/**
* Waits for the given {@code timeout} in milliseconds.
*
@@ -154,10 +154,6 @@ public interface Route {
* If set changes the post data of request.
*/
public Object postData;
/**
* Request timeout in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout.
*/
public Double timeout;
/**
* If set changes the request URL. New URL must have same protocol as original one.
*/
@@ -199,13 +195,6 @@ public interface Route {
this.postData = postData;
return this;
}
/**
* Request timeout in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout.
*/
public FetchOptions setTimeout(double timeout) {
this.timeout = timeout;
return this;
}
/**
* If set changes the request URL. New URL must have same protocol as original one.
*/
@@ -109,24 +109,11 @@ public interface Tracing {
}
}
class StartChunkOptions {
/**
* If specified, the trace is going to be saved into the file with the given name inside the {@code tracesDir} folder
* specified in {@link BrowserType#launch BrowserType.launch()}.
*/
public String name;
/**
* Trace name to be shown in the Trace Viewer.
*/
public String title;
/**
* If specified, the trace is going to be saved into the file with the given name inside the {@code tracesDir} folder
* specified in {@link BrowserType#launch BrowserType.launch()}.
*/
public StartChunkOptions setName(String name) {
this.name = name;
return this;
}
/**
* Trace name to be shown in the Trace Viewer.
*/
@@ -37,25 +37,6 @@ import java.util.regex.Pattern;
* }</pre>
*/
public interface LocatorAssertions {
class IsAttachedOptions {
public Boolean attached;
/**
* Time to retry the assertion for.
*/
public Double timeout;
public IsAttachedOptions setAttached(boolean attached) {
this.attached = attached;
return this;
}
/**
* Time to retry the assertion for.
*/
public IsAttachedOptions setTimeout(double timeout) {
this.timeout = timeout;
return this;
}
}
class IsCheckedOptions {
public Boolean checked;
/**
@@ -413,32 +394,6 @@ public interface LocatorAssertions {
* @since v1.20
*/
LocatorAssertions not();
/**
* Ensures that {@code Locator} points to an <a href="https://playwright.dev/java/docs/actionability#attached">attached</a>
* DOM node.
*
* <p> **Usage**
* <pre>{@code
* assertThat(page.getByText("Hidden text")).isAttached();
* }</pre>
*
* @since v1.33
*/
default void isAttached() {
isAttached(null);
}
/**
* Ensures that {@code Locator} points to an <a href="https://playwright.dev/java/docs/actionability#attached">attached</a>
* DOM node.
*
* <p> **Usage**
* <pre>{@code
* assertThat(page.getByText("Hidden text")).isAttached();
* }</pre>
*
* @since v1.33
*/
void isAttached(IsAttachedOptions options);
/**
* Ensures the {@code Locator} points to a checked input.
*
@@ -663,7 +618,7 @@ public interface LocatorAssertions {
*
* <p> **Usage**
* <pre>{@code
* assertThat(page.getByText("Welcome")).isVisible();
* assertThat(page.locator(".my-element")).isVisible();
* }</pre>
*
* @since v1.20
@@ -677,7 +632,7 @@ public interface LocatorAssertions {
*
* <p> **Usage**
* <pre>{@code
* assertThat(page.getByText("Welcome")).isVisible();
* assertThat(page.locator(".my-element")).isVisible();
* }</pre>
*
* @since v1.20
@@ -193,7 +193,7 @@ class APIRequestContextImpl extends ChannelOwner implements APIRequestContext {
}
private static RequestOptionsImpl ensureOptions(RequestOptions options, String method) {
RequestOptionsImpl impl = Utils.clone((RequestOptionsImpl) options);
RequestOptionsImpl impl = (RequestOptionsImpl) options;
if (impl == null) {
impl = new RequestOptionsImpl();
}
@@ -29,7 +29,6 @@ import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.*;
import java.util.function.BooleanSupplier;
import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.regex.Pattern;
@@ -47,14 +46,11 @@ class BrowserContextImpl extends ChannelOwner implements BrowserContext {
private final APIRequestContextImpl request;
final List<PageImpl> pages = new ArrayList<>();
final Router routes = new Router();
private boolean closeWasCalled;
private final WaitableEvent<EventType, ?> closePromise;
private boolean isClosedOrClosing;
final Map<String, BindingCallback> bindings = new HashMap<>();
PageImpl ownerPage;
private static final Map<EventType, String> eventSubscriptions() {
Map<EventType, String> result = new HashMap<>();
result.put(EventType.CONSOLE, "console");
result.put(EventType.DIALOG, "dialog");
result.put(EventType.REQUEST, "request");
result.put(EventType.RESPONSE, "response");
result.put(EventType.REQUESTFINISHED, "requestFinished");
@@ -79,8 +75,6 @@ class BrowserContextImpl extends ChannelOwner implements BrowserContext {
enum EventType {
CLOSE,
CONSOLE,
DIALOG,
PAGE,
REQUEST,
REQUESTFAILED,
@@ -95,9 +89,8 @@ class BrowserContextImpl extends ChannelOwner implements BrowserContext {
} else {
browser = null;
}
tracing = connection.getExistingObject(initializer.getAsJsonObject("tracing").get("guid").getAsString());
request = connection.getExistingObject(initializer.getAsJsonObject("requestContext").get("guid").getAsString());
closePromise = new WaitableEvent<>(listeners, EventType.CLOSE);
this.tracing = connection.getExistingObject(initializer.getAsJsonObject("tracing").get("guid").getAsString());
this.request = connection.getExistingObject(initializer.getAsJsonObject("requestContext").get("guid").getAsString());
}
void setRecordHar(Path path, HarContentPolicy policy) {
@@ -124,26 +117,6 @@ class BrowserContextImpl extends ChannelOwner implements BrowserContext {
listeners.remove(EventType.CLOSE, handler);
}
@Override
public void onConsoleMessage(Consumer<ConsoleMessage> handler) {
listeners.add(EventType.CONSOLE, handler);
}
@Override
public void offConsoleMessage(Consumer<ConsoleMessage> handler) {
listeners.remove(EventType.CONSOLE, handler);
}
@Override
public void onDialog(Consumer<Dialog> handler) {
listeners.add(EventType.DIALOG, handler);
}
@Override
public void offDialog(Consumer<Dialog> handler) {
listeners.remove(EventType.DIALOG, handler);
}
@Override
public void onPage(Consumer<Page> handler) {
listeners.add(EventType.PAGE, handler);
@@ -225,8 +198,11 @@ class BrowserContextImpl extends ChannelOwner implements BrowserContext {
}
private void closeImpl() {
if (!closeWasCalled) {
closeWasCalled = true;
if (isClosedOrClosing) {
return;
}
isClosedOrClosing = true;
try {
for (Map.Entry<String, HarRecorder> entry : harRecorders.entrySet()) {
JsonObject params = new JsonObject();
params.addProperty("harId", entry.getKey());
@@ -248,9 +224,13 @@ class BrowserContextImpl extends ChannelOwner implements BrowserContext {
}
artifact.delete();
}
sendMessage("close");
} catch (PlaywrightException e) {
if (!isSafeCloseError(e)) {
throw e;
}
}
runUntil(() -> {}, closePromise);
}
@Override
@@ -430,12 +410,8 @@ class BrowserContextImpl extends ChannelOwner implements BrowserContext {
}
JsonObject jsonOptions = new JsonObject();
jsonOptions.addProperty("path", har.toAbsolutePath().toString());
jsonOptions.addProperty("content", options.updateContent == null ?
HarContentPolicy.ATTACH.name().toLowerCase() :
options.updateContent.name().toLowerCase());
jsonOptions.addProperty("mode", options.updateMode == null ?
HarMode.MINIMAL.name().toLowerCase() :
options.updateMode.name().toLowerCase());
jsonOptions.addProperty("content", HarContentPolicy.ATTACH.name().toLowerCase());
jsonOptions.addProperty("mode", HarMode.MINIMAL.name().toLowerCase());
addHarUrlFilter(jsonOptions, options.url);
params.add("options", jsonOptions);
JsonObject json = sendMessage("harStart", params).getAsJsonObject();
@@ -531,27 +507,6 @@ class BrowserContextImpl extends ChannelOwner implements BrowserContext {
unroute(new UrlMatcher(url), handler);
}
@Override
public void waitForCondition(BooleanSupplier predicate, WaitForConditionOptions options) {
List<Waitable<Void>> waitables = new ArrayList<>();
waitables.add(new WaitableContextClose<>());
waitables.add(timeoutSettings.createWaitable(options == null ? null : options.timeout));
waitables.add(new WaitablePredicate<>(predicate));
runUntil(() -> {}, new WaitableRace<>(waitables));
}
@Override
public ConsoleMessage waitForConsoleMessage(WaitForConsoleMessageOptions options, Runnable code) {
return withWaitLogging("BrowserContext.waitForConsoleMessage", logger -> waitForConsoleMessageImpl(options, code));
}
private ConsoleMessage waitForConsoleMessageImpl(WaitForConsoleMessageOptions options, Runnable code) {
if (options == null) {
options = new WaitForConsoleMessageOptions();
}
return waitForEventWithTimeout(EventType.CONSOLE, code, options.predicate, options.timeout);
}
private class WaitableContextClose<R> extends WaitableEvent<EventType, R> {
WaitableContextClose() {
super(BrowserContextImpl.this.listeners, EventType.CLOSE);
@@ -590,36 +545,7 @@ class BrowserContextImpl extends ChannelOwner implements BrowserContext {
@Override
protected void handleEvent(String event, JsonObject params) {
if ("dialog".equals(event)) {
String guid = params.getAsJsonObject("dialog").get("guid").getAsString();
DialogImpl dialog = connection.getExistingObject(guid);
boolean hasListeners = false;
if (listeners.hasListeners(EventType.DIALOG)) {
hasListeners = true;
listeners.notify(EventType.DIALOG, dialog);
}
PageImpl page = dialog.page();
if (page != null) {
if (page.listeners.hasListeners(PageImpl.EventType.DIALOG)) {
hasListeners = true;
page.listeners.notify(PageImpl.EventType.DIALOG, dialog);
}
}
// Although we do similar handling on the server side, we still need this logic
// on the client side due to a possible race condition between two async calls:
// a) removing "dialog" listener subscription (client->server)
// b) actual "dialog" event (server->client)
if (!hasListeners) {
if ("beforeunload".equals(dialog.type())) {
try {
dialog.accept();
} catch (PlaywrightException e) {
}
} else {
dialog.dismiss();
}
}
} else if ("route".equals(event)) {
if ("route".equals(event)) {
RouteImpl route = connection.getExistingObject(params.getAsJsonObject("route").get("guid").getAsString());
handleRoute(route);
} else if ("page".equals(event)) {
@@ -635,14 +561,6 @@ class BrowserContextImpl extends ChannelOwner implements BrowserContext {
if (binding != null) {
bindingCall.call(binding);
}
} else if ("console".equals(event)) {
String guid = params.getAsJsonObject("message").get("guid").getAsString();
ConsoleMessageImpl message = connection.getExistingObject(guid);
listeners.notify(BrowserContextImpl.EventType.CONSOLE, message);
PageImpl page = message.page();
if (page != null) {
page.listeners.notify(PageImpl.EventType.CONSOLE, message);
}
} else if ("request".equals(event)) {
String guid = params.getAsJsonObject("request").get("guid").getAsString();
RequestImpl request = connection.getExistingObject(guid);
@@ -692,6 +610,7 @@ class BrowserContextImpl extends ChannelOwner implements BrowserContext {
}
void didClose() {
isClosedOrClosing = true;
if (browser != null) {
browser.contexts.remove(this);
}
@@ -41,7 +41,6 @@ class BrowserImpl extends ChannelOwner implements Browser {
boolean isConnectedOverWebSocket;
private boolean isConnected = true;
BrowserTypeImpl browserType;
BrowserType.LaunchOptions launchOptions;
enum EventType {
DISCONNECTED,
@@ -210,9 +209,6 @@ class BrowserImpl extends ChannelOwner implements Browser {
context.setBaseUrl(options.baseURL);
}
context.setRecordHar(recordHarPath, harContentPolicy);
if (launchOptions != null) {
context.tracing().setTracesDir(launchOptions.tracesDir);
}
contexts.add(context);
return context;
}
@@ -52,7 +52,6 @@ class BrowserTypeImpl extends ChannelOwner implements BrowserType {
JsonElement result = sendMessage("launch", params);
BrowserImpl browser = connection.getExistingObject(result.getAsJsonObject().getAsJsonObject("browser").get("guid").getAsString());
browser.browserType = this;
browser.launchOptions = options;
return browser;
}
@@ -230,7 +229,6 @@ class BrowserTypeImpl extends ChannelOwner implements BrowserType {
context.setBaseUrl(options.baseURL);
}
context.setRecordHar(recordHarPath, harContentPolicy);
context.tracing().setTracesDir(options.tracesDir);
return context;
}
@@ -16,7 +16,6 @@
package com.microsoft.playwright.impl;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.microsoft.playwright.Playwright;
@@ -29,7 +28,6 @@ import java.util.HashMap;
import java.util.Map;
import static com.microsoft.playwright.impl.Serialization.gson;
import static java.lang.System.currentTimeMillis;
class Message {
int id;
@@ -69,7 +67,6 @@ public class Connection {
}
LocalUtils localUtils;
final Map<String, String> env;
private int tracingCount;
class Root extends ChannelOwner {
Root(Connection connection) {
@@ -104,12 +101,8 @@ public class Connection {
stackTraceCollector = StackTraceCollector.createFromEnv(env);
}
void setIsTracing(boolean tracing) {
if (tracing) {
++tracingCount;
} else {
--tracingCount;
}
boolean isCollectingStacks() {
return stackTraceCollector != null;
}
String setApiName(String name) {
@@ -127,10 +120,10 @@ public class Connection {
}
public WaitableResult<JsonElement> sendMessageAsync(String guid, String method, JsonObject params) {
return internalSendMessage(guid, method, params, true);
return internalSendMessage(guid, method, params);
}
private WaitableResult<JsonElement> internalSendMessage(String guid, String method, JsonObject params, boolean sendStack) {
private WaitableResult<JsonElement> internalSendMessage(String guid, String method, JsonObject params) {
int id = ++lastId;
WaitableResult<JsonElement> result = new WaitableResult<>();
callbacks.put(id, result);
@@ -140,8 +133,6 @@ public class Connection {
message.addProperty("method", method);
message.add("params", params);
JsonObject metadata = new JsonObject();
metadata.addProperty("wallTime", currentTimeMillis());
JsonArray stack = null;
if (apiName == null) {
metadata.addProperty("internal", true);
} else {
@@ -149,27 +140,11 @@ public class Connection {
// All but first message in an API call are considered internal and will be hidden from the inspector.
apiName = null;
if (stackTraceCollector != null) {
stack = stackTraceCollector.currentStackTrace();
if (!stack.isEmpty()) {
JsonObject location = new JsonObject();
JsonObject frame = stack.get(0).getAsJsonObject();
location.addProperty("file", frame.get("file").getAsString());
location.addProperty("line", frame.get("line").getAsInt());
location.addProperty("column", frame.get("column").getAsInt());
metadata.add("location", location);
}
metadata.add("stack", stackTraceCollector.currentStackTrace());
}
}
message.add("metadata", metadata);
transport.send(message);
if (sendStack && tracingCount > 0 && stack != null && !method.startsWith("LocalUtils")) {
JsonObject callData = new JsonObject();
callData.addProperty("id", id);
callData.add("stack", stack);
JsonObject stackParams = new JsonObject();
stackParams.add("callData", callData);
internalSendMessage(localUtils.guid,"addStackToTracingNoReply", stackParams, false);
}
return result;
}
@@ -20,7 +20,6 @@ import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.microsoft.playwright.ConsoleMessage;
import com.microsoft.playwright.JSHandle;
import com.microsoft.playwright.Page;
import java.util.ArrayList;
import java.util.List;
@@ -28,16 +27,8 @@ import java.util.List;
import static com.microsoft.playwright.impl.Serialization.gson;
public class ConsoleMessageImpl extends ChannelOwner implements ConsoleMessage {
private PageImpl page;
public ConsoleMessageImpl(ChannelOwner parent, String type, String guid, JsonObject initializer) {
super(parent, type, guid, initializer);
// Note: currently, we only report console messages for pages and they always have a page.
// However, in the future we might report console messages for service workers or something else,
// where page() would be null.
if (initializer.has("page")) {
page = connection.getExistingObject(initializer.getAsJsonObject("page").get("guid").getAsString());
}
}
public String type() {
@@ -64,9 +55,4 @@ public class ConsoleMessageImpl extends ChannelOwner implements ConsoleMessage {
location.get("lineNumber").getAsNumber() + ":" +
location.get("columnNumber").getAsNumber();
}
@Override
public PageImpl page() {
return page;
}
}
@@ -18,18 +18,10 @@ package com.microsoft.playwright.impl;
import com.google.gson.JsonObject;
import com.microsoft.playwright.Dialog;
import com.microsoft.playwright.Page;
class DialogImpl extends ChannelOwner implements Dialog {
private PageImpl page;
DialogImpl(ChannelOwner parent, String type, String guid, JsonObject initializer) {
super(parent, type, guid, initializer);
// Note: dialogs that open early during page initialization block it.
// Therefore, we must report the dialog without a page to be able to handle it.
if (initializer.has("page")) {
page = connection.getExistingObject(initializer.getAsJsonObject("page").get("guid").getAsString());
}
}
@Override
@@ -58,11 +50,6 @@ class DialogImpl extends ChannelOwner implements Dialog {
return initializer.get("message").getAsString();
}
@Override
public PageImpl page() {
return page;
}
@Override
public String type() {
return initializer.get("type").getAsString();
@@ -18,7 +18,6 @@ package com.microsoft.playwright.impl;
import com.microsoft.playwright.FrameLocator;
import com.microsoft.playwright.Locator;
import com.microsoft.playwright.PlaywrightException;
import com.microsoft.playwright.options.AriaRole;
import java.util.regex.Pattern;
@@ -120,15 +119,6 @@ class FrameLocatorImpl implements FrameLocator {
return new LocatorImpl(frame, frameSelector + " >> internal:control=enter-frame >> " + selector, convertType(options, Locator.LocatorOptions.class));
}
@Override
public Locator locator(Locator selectorOrLocator, LocatorOptions options) {
LocatorImpl other = (LocatorImpl) selectorOrLocator;
if (other.frame != frame) {
throw new PlaywrightException("Locators must belong to the same frame.");
}
return locator(other.selector, options);
}
@Override
public FrameLocator nth(int index) {
return new FrameLocatorImpl(frame, frameSelector + " >> nth=" + index);
@@ -20,38 +20,16 @@ import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import java.nio.file.Path;
import java.util.List;
import static com.microsoft.playwright.impl.Serialization.gson;
class LocalUtils extends ChannelOwner {
LocalUtils(ChannelOwner parent, String type, String guid, JsonObject initializer) {
super(parent, type, guid, initializer);
}
void zip(Path zipFile, JsonArray entries, String stacksId, boolean appendMode, boolean includeSources) {
void zip(Path zipFile, JsonArray entries) {
JsonObject params = new JsonObject();
params.addProperty("zipFile", zipFile.toString());
params.add("entries", entries);
params.addProperty("mode", appendMode ? "append" : "write");
params.addProperty("stacksId", stacksId);
params.addProperty("includeSources", includeSources);
sendMessage("zip", params);
}
void traceDiscarded(String stacksId) {
JsonObject params = new JsonObject();
params.addProperty("stacksId", stacksId);
sendMessage("traceDiscarded", params);
}
String tracingStarted(String tracesDir, String traceName) {
JsonObject params = new JsonObject();
if (tracesDir != null) {
params.addProperty("tracesDir", "");
}
params.addProperty("traceName", traceName);
JsonObject json = connection.localUtils().sendMessage("tracingStarted", params).getAsJsonObject();
return json.get("stacksId").getAsString();
}
}
@@ -288,10 +288,8 @@ public class LocatorAssertionsImpl extends AssertionsBase implements LocatorAsse
@Override
public void isChecked(IsCheckedOptions options) {
boolean unchecked = options != null && options.checked != null && !options.checked;
String expression = unchecked ? "to.be.unchecked" : "to.be.checked";
String message = "Locator expected to be " + (unchecked ? "un" : "") + "checked";
expectTrue(expression, message, convertType(options, FrameExpectOptions.class));
String expression = (options != null && options.checked != null && !options.checked) ? "to.be.unchecked" : "to.be.checked";
expectTrue(expression, "Locator expected to be checked", convertType(options, FrameExpectOptions.class));
}
@Override
@@ -303,8 +301,7 @@ public class LocatorAssertionsImpl extends AssertionsBase implements LocatorAsse
public void isEditable(IsEditableOptions options) {
FrameExpectOptions frameOptions = convertType(options, FrameExpectOptions.class);
boolean editable = options == null || options.editable == null || options.editable == true;
String message = "Locator expected to be " + (editable ? "editable" : "readonly");
expectTrue(editable ? "to.be.editable" : "to.be.readonly", message, frameOptions);
expectTrue(editable ? "to.be.editable" : "to.be.readonly", "Locator expected to be editable", frameOptions);
}
@Override
@@ -316,8 +313,7 @@ public class LocatorAssertionsImpl extends AssertionsBase implements LocatorAsse
public void isEnabled(IsEnabledOptions options) {
FrameExpectOptions frameOptions = convertType(options, FrameExpectOptions.class);
boolean enabled = options == null || options.enabled == null || options.enabled == true;
String message = "Locator expected to be " + (enabled ? "enabled" : "disabled");
expectTrue(enabled ? "to.be.enabled" : "to.be.disabled", message, frameOptions);
expectTrue(enabled ? "to.be.enabled" : "to.be.disabled", "Locator expected to be enabled", frameOptions);
}
@Override
@@ -343,8 +339,7 @@ public class LocatorAssertionsImpl extends AssertionsBase implements LocatorAsse
public void isVisible(IsVisibleOptions options) {
FrameExpectOptions frameOptions = convertType(options, FrameExpectOptions.class);
boolean visible = options == null || options.visible == null || options.visible == true;
String message = "Locator expected to be " + (visible ? "visible" : "hidden");
expectTrue(visible ? "to.be.visible" : "to.be.hidden", message, frameOptions);
expectTrue(visible ? "to.be.visible" : "to.be.hidden", "Locator expected to be visible", frameOptions);
}
private void expectTrue(String expression, String message, FrameExpectOptions options) {
@@ -357,14 +352,6 @@ public class LocatorAssertionsImpl extends AssertionsBase implements LocatorAsse
return new LocatorAssertionsImpl(actualLocator, !isNot);
}
@Override
public void isAttached(IsAttachedOptions options) {
FrameExpectOptions frameOptions = convertType(options, FrameExpectOptions.class);
boolean attached = options == null || options.attached == null || options.attached == true;
String message = "Locator expected to be " + (attached ? "attached" : "detached");
expectTrue(attached ? "to.be.attached" : "to.be.detached", message, frameOptions);
}
private static Boolean shouldIgnoreCase(Object options) {
if (options == null) {
return null;
@@ -20,8 +20,8 @@ import static com.microsoft.playwright.impl.Utils.convertType;
import static com.microsoft.playwright.impl.Utils.toJsRegexFlags;
class LocatorImpl implements Locator {
final FrameImpl frame;
final String selector;
private final FrameImpl frame;
private final String selector;
public LocatorImpl(FrameImpl frame, String selector, LocatorOptions options) {
this.frame = frame;
@@ -29,21 +29,12 @@ class LocatorImpl implements Locator {
if (options.hasText != null) {
selector += " >> internal:has-text=" + escapeForTextSelector(options.hasText, false);
}
if (options.hasNotText != null) {
selector += " >> internal:has-not-text=" + escapeForTextSelector(options.hasNotText, false);
}
if (options.has != null) {
LocatorImpl locator = (LocatorImpl) options.has;
if (locator.frame != frame)
throw new Error("Inner 'has' locator must belong to the same frame.");
selector += " >> internal:has=" + gson().toJson(locator.selector);
}
if (options.hasNot != null) {
LocatorImpl locator = (LocatorImpl) options.hasNot;
if (locator.frame != frame)
throw new Error("Inner 'hasNot' locator must belong to the same frame.");
selector += " >> internal:has-not=" + gson().toJson(locator.selector);
}
}
this.selector = selector;
}
@@ -91,14 +82,6 @@ class LocatorImpl implements Locator {
return (List<String>) frame.evalOnSelectorAll(selector, "ee => ee.map(e => e.textContent || '')");
}
@Override
public Locator and(Locator locator) {
LocatorImpl other = (LocatorImpl) locator;
if (other.frame != frame)
throw new Error("Locators must belong to the same frame.");
return new LocatorImpl(frame, selector + " >> internal:and=" + gson().toJson(other.selector), null);
}
@Override
public void blur(BlurOptions options) {
frame.withLogging("Locator.blur", () -> blurImpl(options));
@@ -401,28 +384,11 @@ class LocatorImpl implements Locator {
return new LocatorImpl(frame, this.selector + " >> " + selector, options);
}
@Override
public Locator locator(Locator selectorOrLocator, LocatorOptions options) {
LocatorImpl other = (LocatorImpl) selectorOrLocator;
if (other.frame != frame) {
throw new PlaywrightException("Locators must belong to the same frame.");
}
return locator(other.selector, options);
}
@Override
public Locator nth(int index) {
return new LocatorImpl(frame, selector + " >> nth=" + index, null);
}
@Override
public Locator or(Locator locator) {
LocatorImpl other = (LocatorImpl) locator;
if (other.frame != frame)
throw new Error("Locators must belong to the same frame.");
return new LocatorImpl(frame, selector + " >> internal:or=" + gson().toJson(other.selector), null);
}
@Override
public Page page() {
return frame.page();
@@ -25,7 +25,6 @@ import com.microsoft.playwright.options.*;
import java.io.IOException;
import java.nio.file.Path;
import java.util.*;
import java.util.function.BooleanSupplier;
import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.regex.Pattern;
@@ -51,8 +50,6 @@ public class PageImpl extends ChannelOwner implements Page {
private final Set<FrameImpl> frames = new LinkedHashSet<>();
private static final Map<EventType, String> eventSubscriptions() {
Map<EventType, String> result = new HashMap<>();
result.put(EventType.CONSOLE, "console");
result.put(EventType.DIALOG, "dialog");
result.put(EventType.REQUEST, "request");
result.put(EventType.RESPONSE, "response");
result.put(EventType.REQUESTFINISHED, "requestFinished");
@@ -115,7 +112,22 @@ public class PageImpl extends ChannelOwner implements Page {
@Override
protected void handleEvent(String event, JsonObject params) {
if ("worker".equals(event)) {
if ("dialog".equals(event)) {
String guid = params.getAsJsonObject("dialog").get("guid").getAsString();
DialogImpl dialog = connection.getExistingObject(guid);
if (listeners.hasListeners(EventType.DIALOG)) {
listeners.notify(EventType.DIALOG, dialog);
} else {
if ("beforeunload".equals(dialog.type())) {
try {
dialog.accept();
} catch (PlaywrightException e) {
}
} else {
dialog.dismiss();
}
}
} else if ("worker".equals(event)) {
String guid = params.getAsJsonObject("worker").get("guid").getAsString();
WorkerImpl worker = connection.getExistingObject(guid);
worker.page = this;
@@ -125,6 +137,10 @@ public class PageImpl extends ChannelOwner implements Page {
String guid = params.getAsJsonObject("webSocket").get("guid").getAsString();
WebSocketImpl webSocket = connection.getExistingObject(guid);
listeners.notify(EventType.WEBSOCKET, webSocket);
} else if ("console".equals(event)) {
String guid = params.getAsJsonObject("message").get("guid").getAsString();
ConsoleMessageImpl message = connection.getExistingObject(guid);
listeners.notify(EventType.CONSOLE, message);
} else if ("download".equals(event)) {
String artifactGuid = params.getAsJsonObject("artifact").get("guid").getAsString();
ArtifactImpl artifact = connection.getExistingObject(artifactGuid);
@@ -494,21 +510,19 @@ public class PageImpl extends ChannelOwner implements Page {
@Override
public void close(CloseOptions options) {
if (options == null) {
options = new CloseOptions();
if (isClosed) {
return;
}
JsonObject params = options == null ? new JsonObject() : gson().toJsonTree(options).getAsJsonObject();
try {
if (ownedContext != null) {
ownedContext.close();
} else {
JsonObject params = gson().toJsonTree(options).getAsJsonObject();
sendMessage("close", params);
}
sendMessage("close", params);
} catch (PlaywrightException exception) {
if (isSafeCloseError(exception) && (options.runBeforeUnload == null || !options.runBeforeUnload)) {
return;
if (!isSafeCloseError(exception)) {
throw exception;
}
throw exception;
}
if (ownedContext != null) {
ownedContext.close();
}
}
@@ -1443,15 +1457,6 @@ public class PageImpl extends ChannelOwner implements Page {
() -> mainFrame.waitForSelectorImpl(selector, convertType(options, Frame.WaitForSelectorOptions.class)));
}
@Override
public void waitForCondition(BooleanSupplier predicate, WaitForConditionOptions options) {
List<Waitable<Void>> waitables = new ArrayList<>();
waitables.add(createWaitForCloseHelper());
waitables.add(createWaitableTimeout(options == null ? null : options.timeout));
waitables.add(new WaitablePredicate<>(predicate));
runUntil(() -> {}, new WaitableRace<>(waitables));
}
@Override
public void waitForTimeout(double timeout) {
withLogging("Page.waitForTimeout", () -> mainFrame.waitForTimeoutImpl(timeout));
@@ -47,7 +47,6 @@ public class RouteImpl extends ChannelOwner implements Route {
withLogging("Route.abort", () -> {
JsonObject params = new JsonObject();
params.addProperty("errorCode", errorCode);
params.addProperty("requestUrl", request.initializer.get("url").getAsString());
sendMessageAsync("abort", params);
});
}
@@ -92,14 +91,11 @@ public class RouteImpl extends ChannelOwner implements Route {
} else {
options.data = request.postDataBuffer();
}
if (fetchOptions != null && fetchOptions.timeout != null) {
options.timeout = fetchOptions.timeout;
}
APIRequestContextImpl apiRequest = request.frame().page().context().request();
String url = (fetchOptions == null || fetchOptions.url == null) ? request().url() : fetchOptions.url;
return apiRequest.fetch(url, options);
}
private void applyOverrides(FallbackOptions options) {
if (options == null) {
return;
@@ -131,7 +127,6 @@ public class RouteImpl extends ChannelOwner implements Route {
params.addProperty("postData", base64);
}
}
params.addProperty("requestUrl", request.initializer.get("url").getAsString());
sendMessageAsync("continue", params);
}
@@ -226,7 +221,6 @@ public class RouteImpl extends ChannelOwner implements Route {
if (fetchResponseUid != null) {
params.addProperty("fetchResponseUid", fetchResponseUid);
}
params.addProperty("requestUrl", request.initializer.get("url").getAsString());
sendMessageAsync("fulfill", params);
}
@@ -118,7 +118,6 @@ class StackTraceCollector {
JsonObject jsonFrame = new JsonObject();
jsonFrame.addProperty("file", sourceFile(frame));
jsonFrame.addProperty("line", frame.getLineNumber());
jsonFrame.addProperty("column", 0);
jsonFrame.addProperty("function", frame.getClassName() + "." + frame.getMethodName());
jsonStack.add(jsonFrame);
}
@@ -18,6 +18,7 @@ package com.microsoft.playwright.impl;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.microsoft.playwright.PlaywrightException;
import com.microsoft.playwright.Tracing;
import java.nio.file.Path;
@@ -25,56 +26,36 @@ import java.nio.file.Path;
import static com.microsoft.playwright.impl.Serialization.gson;
class TracingImpl extends ChannelOwner implements Tracing {
private boolean includeSources;
private Path tracesDir;
private boolean isTracing;
private String stacksId;
TracingImpl(ChannelOwner parent, String type, String guid, JsonObject initializer) {
super(parent, type, guid, initializer);
}
private void stopChunkImpl(Path path) {
if (isTracing) {
isTracing = false;
connection.setIsTracing(false);
}
JsonObject params = new JsonObject();
// Not interested in artifacts.
if (path == null) {
params.addProperty("mode", "discard");
sendMessage("tracingStopChunk", params);
if (stacksId != null) {
connection.localUtils().traceDiscarded(stacksId);
String mode = "doNotSave";
if (path != null) {
if (connection.isRemote) {
mode = "compressTrace";
} else {
mode = "compressTraceAndSources";
}
return;
}
boolean isLocal = !connection.isRemote;
if (isLocal) {
params.addProperty("mode", "entries");
JsonObject json = sendMessage("tracingStopChunk", params).getAsJsonObject();
JsonArray entries = json.getAsJsonArray("entries");
connection.localUtils.zip(path, entries, stacksId, false, includeSources);
return;
}
params.addProperty("mode", "archive");
params.addProperty("mode", mode);
JsonObject json = sendMessage("tracingStopChunk", params).getAsJsonObject();
// The artifact may be missing if the browser closed while stopping tracing.
if (!json.has("artifact")) {
if (stacksId != null) {
connection.localUtils().traceDiscarded(stacksId);
}
return;
}
ArtifactImpl artifact = connection.getExistingObject(json.getAsJsonObject("artifact").get("guid").getAsString());
artifact.saveAs(path);
artifact.delete();
connection.localUtils.zip(path, new JsonArray(), stacksId, true, includeSources);
// Add local sources to the remote trace if necessary.
// In case of CDP connection since the connection is established by
// the driver it is safe to consider the artifact local.
if (connection.isRemote && json.has("sourceEntries")) {
JsonArray entries = json.getAsJsonArray("sourceEntries");
connection.localUtils.zip(path, entries);
}
}
@Override
@@ -93,27 +74,8 @@ class TracingImpl extends ChannelOwner implements Tracing {
if (options == null) {
options = new StartChunkOptions();
}
tracingStartChunk(options.name, options.title);
}
private void tracingStartChunk(String name, String title) {
JsonObject params = new JsonObject();
if (name != null) {
params.addProperty("name", name);
}
if (title != null) {
params.addProperty("title", title);
}
JsonObject result = sendMessage("tracingStartChunk", params).getAsJsonObject();
startCollectingStacks(result.get("traceName").getAsString());
}
private void startCollectingStacks(String traceName) {
if (!isTracing) {
isTracing = true;
connection.setIsTracing(true);
}
stacksId = connection.localUtils().tracingStarted(tracesDir == null ? null : tracesDir.toString(), traceName);
JsonObject params = gson().toJsonTree(options).getAsJsonObject();
sendMessage("tracingStartChunk", params);
}
private void startImpl(StartOptions options) {
@@ -121,12 +83,15 @@ class TracingImpl extends ChannelOwner implements Tracing {
options = new StartOptions();
}
JsonObject params = gson().toJsonTree(options).getAsJsonObject();
includeSources = options.sources != null && options.sources;
boolean includeSources = options.sources != null && options.sources;
if (includeSources) {
if (!connection.isCollectingStacks()) {
throw new PlaywrightException("Source root directory must be specified via PLAYWRIGHT_JAVA_SRC environment variable when source collection is enabled");
}
params.addProperty("sources", true);
}
sendMessage("tracingStart", params);
tracingStartChunk(options.name, options.title);
sendMessage("tracingStartChunk");
}
@Override
@@ -143,8 +108,4 @@ class TracingImpl extends ChannelOwner implements Tracing {
stopChunkImpl(options == null ? null : options.path);
});
}
void setTracesDir(Path tracesDir) {
this.tracesDir = tracesDir;
}
}
@@ -90,11 +90,6 @@ class UrlMatcher {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
UrlMatcher that = (UrlMatcher) o;
if (rawSource instanceof Pattern && that.rawSource instanceof Pattern) {
Pattern a = (Pattern) rawSource;
Pattern b = (Pattern) that.rawSource;
return a.pattern().equals(b.pattern()) && a.flags() == b.flags();
}
return Objects.equals(rawSource, that.rawSource);
}
@@ -18,7 +18,6 @@ package com.microsoft.playwright.impl;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.microsoft.playwright.ElementHandle;
import com.microsoft.playwright.PlaywrightException;
import com.microsoft.playwright.options.FilePayload;
import com.microsoft.playwright.options.HttpHeader;
@@ -81,14 +80,6 @@ class Utils {
}
}
static <T> T clone(T f) {
if (f == null) {
return f;
}
return convertType(f, (Class<T>) f.getClass());
}
static Set<Character> escapeGlobChars = new HashSet<>(Arrays.asList('/', '$', '^', '+', '.', '(', ')', '=', '!', '|'));
static String globToRegex(String glob) {
@@ -252,7 +243,7 @@ class Utils {
static void writeToFile(InputStream inputStream, Path path) {
mkParentDirs(path);
try (FileOutputStream out = new FileOutputStream(path.toFile())) {
byte[] buf = new byte[1024 * 1024];
byte[] buf = new byte[8192];
int length;
while ((length = inputStream.read(buf)) > 0) {
out.write(buf, 0, length);
@@ -1,25 +0,0 @@
package com.microsoft.playwright.impl;
import java.util.function.BooleanSupplier;
class WaitablePredicate<T> implements Waitable<T> {
private final BooleanSupplier predicate;
WaitablePredicate(BooleanSupplier predicate) {
this.predicate = predicate;
}
@Override
public boolean isDone() {
return predicate.getAsBoolean();
}
@Override
public T get() {
return null;
}
@Override
public void dispose() {
}
}
@@ -19,20 +19,9 @@ package com.microsoft.playwright.options;
public class HttpCredentials {
public String username;
public String password;
/**
* Restrain sending http credentials on specific origin (scheme://host:port).
*/
public String origin;
public HttpCredentials(String username, String password) {
this.username = username;
this.password = password;
}
/**
* Restrain sending http credentials on specific origin (scheme://host:port).
*/
public HttpCredentials setOrigin(String origin) {
this.origin = origin;
return this;
}
}
@@ -1,22 +0,0 @@
/*
* Copyright (c) Microsoft Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.microsoft.playwright.options;
public enum RouteFromHarUpdateContentPolicy {
EMBED,
ATTACH
}
@@ -52,8 +52,8 @@ public class Timing {
*/
public double requestStart;
/**
* Time immediately after the browser receives the first byte of the response from the server, cache, or local resource.
* The value is given in milliseconds relative to {@code startTime}, -1 if not available.
* Time immediately after the browser starts requesting the resource from the server, cache, or local resource. The value
* is given in milliseconds relative to {@code startTime}, -1 if not available.
*/
public double responseStart;
/**
@@ -20,11 +20,9 @@ import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.List;
import static com.microsoft.playwright.Utils.verifyViewport;
import static java.util.Arrays.asList;
import static org.junit.jupiter.api.Assertions.*;
public class TestBrowserContextBasic extends TestBase {
@@ -255,33 +253,4 @@ public class TestBrowserContextBasic extends TestBase {
assertEquals(true, page.evaluate("() => window.navigator.onLine"));
context.close();
}
@Test
void shouldWaitForCondition() {
List<String> messages = new ArrayList<>();
page.onConsoleMessage(m -> messages.add(m.text()));
page.evaluate("setTimeout(() => {\n" +
" console.log('foo');\n" +
" console.log('bar');\n" +
"}, 100);");
context.waitForCondition(() -> messages.size() > 1);
assertEquals(asList("foo", "bar"), messages);
}
@Test
void waitForConditionTimeout() {
PlaywrightException e = assertThrows(PlaywrightException.class,
() -> context.waitForCondition(() -> false, new BrowserContext.WaitForConditionOptions().setTimeout(100)));
assertTrue(e.getMessage().contains("Timeout"), e.getMessage());
}
@Test
void waitForConditionPageClosed() {
PlaywrightException e = assertThrows(PlaywrightException.class,
() -> context.waitForCondition(() -> {
context.close();
return false;
}));
assertTrue(e.getMessage().contains("Context closed"), e.getMessage());
}
}
@@ -16,7 +16,6 @@
package com.microsoft.playwright;
import com.microsoft.playwright.options.HttpCredentials;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledIf;
@@ -75,66 +74,4 @@ public class TestBrowserContextCredentials extends TestBase {
assertTrue(new String(response.body()).contains("Playground"));
}
}
@Test
void shouldWorkWithCorrectCredentialsAndMatchingOrigin() {
server.setAuth("/empty.html", "user", "pass");
final HttpCredentials httpCredentials = new HttpCredentials("user", "pass");
httpCredentials.setOrigin(server.PREFIX);
try (BrowserContext context = browser.newContext(new Browser.NewContextOptions()
.setHttpCredentials(httpCredentials))) {
Page page = context.newPage();
Response response = page.navigate(server.EMPTY_PAGE);
assertEquals(200, response.status());
}
}
@Test
void shouldWorkWithCorrectCredentialsAndMatchingOriginCaseInsensitive() {
server.setAuth("/empty.html", "user", "pass");
final HttpCredentials httpCredentials = new HttpCredentials("user", "pass");
httpCredentials.setOrigin(server.PREFIX.toUpperCase());
try (BrowserContext context = browser.newContext(new Browser.NewContextOptions()
.setHttpCredentials(httpCredentials))) {
Page page = context.newPage();
Response response = page.navigate(server.EMPTY_PAGE);
assertEquals(200, response.status());
}
}
@Test
void shouldFailWithCorrectCredentialsAndWrongOriginScheme() {
server.setAuth("/empty.html", "user", "pass");
final HttpCredentials httpCredentials = new HttpCredentials("user", "pass");
httpCredentials.setOrigin(Utils.generateDifferentOriginScheme(server));
try (BrowserContext context = browser.newContext(new Browser.NewContextOptions().setHttpCredentials(httpCredentials))) {
Page page = context.newPage();
Response response = page.navigate(server.EMPTY_PAGE);
assertEquals(401, response.status());
}
}
@Test
void shouldFailWithCorrectCredentialsAndWrongOriginHostname() {
server.setAuth("/empty.html", "user", "pass");
final HttpCredentials httpCredentials = new HttpCredentials("user", "pass");
httpCredentials.setOrigin(Utils.generateDifferentOriginHostname(server));
try (BrowserContext context = browser.newContext(new Browser.NewContextOptions().setHttpCredentials(httpCredentials))) {
Page page = context.newPage();
Response response = page.navigate(server.EMPTY_PAGE);
assertEquals(401, response.status());
}
}
@Test
void shouldFailWithCorrectCredentialsAndWrongOriginPort() {
server.setAuth("/empty.html", "user", "pass");
final HttpCredentials httpCredentials = new HttpCredentials("user", "pass");
httpCredentials.setOrigin(Utils.generateDifferentOriginPort(server));
try (BrowserContext context = browser.newContext(new Browser.NewContextOptions().setHttpCredentials(httpCredentials))) {
Page page = context.newPage();
Response response = page.navigate(server.EMPTY_PAGE);
assertEquals(401, response.status());
}
}
}
@@ -1,159 +0,0 @@
package com.microsoft.playwright;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledIf;
import java.io.OutputStreamWriter;
import java.io.Writer;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class TestBrowserContextEvents extends TestBase {
@Test
void consoleEventShouldWorkSmoke() {
ConsoleMessage message = context.waitForConsoleMessage(() -> {
page.evaluate("console.log('hello')");
});
assertEquals("hello", message.text());
assertEquals(page, message.page());
}
@Test
void consoleEventShouldWorkInPopup() {
Page[] popup = { null };
ConsoleMessage message = context.waitForConsoleMessage(() -> {
popup[0] = page.waitForPopup(() -> {
page.evaluate("const win = window.open('');\n" +
"win.console.log('hello');\n");
});
});
assertEquals("hello", message.text());
assertEquals(popup[0], message.page());
}
@Test
@DisabledIf(value="com.microsoft.playwright.TestBase#isFirefox", disabledReason="console message from javascript: url is not reported at all")
void consoleEventShouldWorkInPopup2() {
Page[] popup = { null };
ConsoleMessage message = context.waitForConsoleMessage(
new BrowserContext.WaitForConsoleMessageOptions().setPredicate(msg -> "log".equals(msg.type())),
() -> {
popup[0] = context.waitForPage(() -> {
page.evaluate("async () => {\n" +
" const win = window.open('javascript:console.log(\"hello\")');\n" +
" await new Promise(f => setTimeout(f, 0));\n" +
" win.close();\n" +
"}");
});
});
assertEquals("hello", message.text());
assertEquals(popup[0], message.page());
}
@Test
@DisabledIf(value="com.microsoft.playwright.TestBase#isFirefox", disabledReason="console message is not reported at all")
void consoleEventShouldWorkInImmediatelyClosedPopup() {
Page[] popup = { null };
ConsoleMessage message = context.waitForConsoleMessage(() -> {
popup[0] = page.waitForPopup(() -> {
page.evaluate("async () => {\n" +
" const win = window.open();\n" +
" win.console.log('hello');\n" +
" win.close();\n" +
" }\n");
});
});
assertEquals("hello", message.text());
assertEquals(popup[0], message.page());
}
@Test
void dialogEventShouldWorkSmoke() {
Dialog[] dialog = { null };
context.onDialog(d -> {
dialog[0] = d;
dialog[0].accept("hello");
});
Object result = page.evaluate("prompt('hey?')");
assertEquals("hello", result);
context.waitForCondition(() -> dialog[0] != null);
assertEquals("hey?", dialog[0].message());
assertEquals(page, dialog[0].page());
}
@Test
void dialogEventShouldWorkInPopup() {
Dialog[] dialog = { null };
context.onDialog(d -> {
dialog[0] = d;
d.accept("hello");
});
Page popup = page.waitForPopup(() -> {
Object result = page.evaluate("() => {\n" +
" const win = window.open('');\n" +
" return win.prompt('hey?');\n" +
" }");
assertEquals("hello", result);
});
assertEquals("hey?", dialog[0].message());
assertEquals(popup, dialog[0].page());
}
@Test
@DisabledIf(value="com.microsoft.playwright.TestBase#isFirefox", disabledReason="dialog from javascript: url is not reported at all")
void dialogEventShouldWorkInPopup2() {
Dialog[] dialog = { null };
context.onDialog(d -> {
dialog[0] = d;
d.accept("hello");
});
page.evaluate("window.open('javascript:prompt(\"hey?\")');");
context.waitForCondition(() -> dialog[0] != null);
assertEquals("hey?", dialog[0].message());
assertEquals(null, dialog[0].page());
}
@Test
void dialogEventShouldWorkInImmdiatelyClosedPopup() {
Dialog[] dialog = { null };
context.onDialog(d -> {
dialog[0] = d;
d.accept("hello");
});
Page popup = page.waitForPopup(() -> {
Object result = page.evaluate("async () => {\n" +
" const win = window.open();\n" +
" const result = win.prompt('hey?');\n" +
" win.close();\n" +
" return result;\n" +
" }");
assertEquals("hello", result);
});
assertEquals("hey?", dialog[0].message());
assertEquals(popup, dialog[0].page());
}
@Test
void dialogEventShouldWorkWithInlineScriptTag() {
server.setRoute("/popup.html", exchange -> {
exchange.getResponseHeaders().add("content-type", "text/html");
exchange.sendResponseHeaders(200, 0);
try (Writer writer = new OutputStreamWriter(exchange.getResponseBody())) {
writer.write("<script>window.result = prompt('hey?')</script>");
}
});
page.navigate(server.EMPTY_PAGE);
page.setContent("<a href='popup.html' target=_blank>Click me</a>");
Dialog[] dialog = { null };
context.onDialog(d -> {
dialog[0] = d;
d.accept("hello");
});
Page popup = context.waitForPage(() -> page.click("a"));
page.waitForCondition(() -> dialog[0] != null);
assertEquals("hey?", dialog[0].message());
assertEquals(popup, dialog[0].page());
page.waitForCondition(() -> "hello".equals(popup.evaluate("window.result")),
new Page.WaitForConditionOptions().setTimeout(5_000));
}
}
@@ -671,67 +671,4 @@ public class TestBrowserContextFetch extends TestBase {
e = assertThrows(PlaywrightException.class, () -> context.request().post(server.EMPTY_PAGE));
assertTrue(e.getMessage().contains("Target page, context or browser has been closed"), e.getMessage());
}
@Test
void shouldWorkWithSetHTTPCredentialsAndMatchingOrigin() throws ExecutionException, InterruptedException {
server.setAuth("/empty.html", "user", "pass");
APIResponse response1 = context.request().get(server.EMPTY_PAGE);
assertEquals(401, response1.status());
final HttpCredentials httpCredentials = new HttpCredentials("user", "pass");
httpCredentials.setOrigin(server.PREFIX);
try (BrowserContext context2 = browser.newContext(
new Browser.NewContextOptions().setHttpCredentials(httpCredentials))) {
APIResponse response2 = context2.request().get(server.EMPTY_PAGE);
assertEquals(200, response2.status());
}
}
@Test
void shouldWorkWithSetHTTPCredentialsAndMatchingOriginCaseInsensitive() throws ExecutionException, InterruptedException {
server.setAuth("/empty.html", "user", "pass");
APIResponse response1 = context.request().get(server.EMPTY_PAGE);
assertEquals(401, response1.status());
final HttpCredentials httpCredentials = new HttpCredentials("user", "pass");
httpCredentials.setOrigin(server.PREFIX.toUpperCase());
try (BrowserContext context2 = browser.newContext(
new Browser.NewContextOptions().setHttpCredentials(httpCredentials))) {
APIResponse response2 = context2.request().get(server.EMPTY_PAGE);
assertEquals(200, response2.status());
}
}
@Test
void shouldReturnErrorWithCorrectCredentialsAndWrongOriginScheme() {
server.setAuth("/empty.html", "user", "pass");
final HttpCredentials httpCredentials = new HttpCredentials("user", "pass");
httpCredentials.setOrigin(Utils.generateDifferentOriginScheme(server));
try (BrowserContext context = browser.newContext(new Browser.NewContextOptions().setHttpCredentials(httpCredentials))) {
APIResponse response = context.request().get(server.EMPTY_PAGE);
assertEquals(401, response.status());
}
}
@Test
void shouldReturnErrorWithCorrectCredentialsAndWrongOriginHostname() {
server.setAuth("/empty.html", "user", "pass");
final HttpCredentials httpCredentials = new HttpCredentials("user", "pass");
httpCredentials.setOrigin(Utils.generateDifferentOriginHostname(server));
try (BrowserContext context = browser.newContext(new Browser.NewContextOptions().setHttpCredentials(httpCredentials))) {
APIResponse response = context.request().get(server.EMPTY_PAGE);
assertEquals(401, response.status());
}
}
@Test
void shouldReturnErrorWithCorrectCredentialsAndWrongOriginPort() {
server.setAuth("/empty.html", "user", "pass");
final HttpCredentials httpCredentials = new HttpCredentials("user", "pass");
httpCredentials.setOrigin(Utils.generateDifferentOriginPort(server));
try (BrowserContext context = browser.newContext(new Browser.NewContextOptions().setHttpCredentials(httpCredentials))) {
APIResponse response = context.request().get(server.EMPTY_PAGE);
assertEquals(401, response.status());
}
}
}
@@ -19,7 +19,6 @@ package com.microsoft.playwright;
import com.microsoft.playwright.options.HarContentPolicy;
import com.microsoft.playwright.options.HarMode;
import com.microsoft.playwright.options.HarNotFound;
import com.microsoft.playwright.options.RouteFromHarUpdateContentPolicy;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledIf;
import org.junit.jupiter.api.io.TempDir;
@@ -39,7 +38,6 @@ import static com.microsoft.playwright.Utils.copy;
import static com.microsoft.playwright.Utils.extractZip;
import static com.microsoft.playwright.assertions.PlaywrightAssertions.assertThat;
import static com.microsoft.playwright.options.HarContentPolicy.ATTACH;
import static com.microsoft.playwright.options.HarContentPolicy.EMBED;
import static org.junit.jupiter.api.Assertions.*;
public class TestBrowserContextHar extends TestBase {
@@ -432,27 +430,6 @@ public class TestBrowserContextHar extends TestBase {
}
}
@Test
void shouldUpdateHarZipForPageWithDifferentOptions(@TempDir Path tmpDir) {
Path harPath = tmpDir.resolve("har.zip");
try (BrowserContext context1 = browser.newContext()) {
Page page1 = context1.newPage();
page1.routeFromHAR(harPath, new Page.RouteFromHAROptions()
.setUpdate(true)
.setUpdateContent(RouteFromHarUpdateContentPolicy.EMBED)
.setUpdateMode(HarMode.FULL));
page1.navigate(server.PREFIX + "/one-style.html");
}
try (BrowserContext context2 = browser.newContext()) {
Page page2 = context2.newPage();
page2.routeFromHAR(harPath, new Page.RouteFromHAROptions().setNotFound(HarNotFound.ABORT));
page2.navigate(server.PREFIX + "/one-style.html");
assertTrue(page2.content().contains("hello, world!"));
assertThat(page2.locator("body")).hasCSS("background-color", "rgb(255, 192, 203)");
}
}
@Test
void shouldUpdateExtractedHarZipForPage(@TempDir Path tmpDir) {
Path harPath = tmpDir.resolve("har.har");
@@ -349,7 +349,40 @@ public class TestBrowserTypeConnect extends TestBase {
}
browser.close();
}
@Test
void shouldNotThrowOnContextCloseAfterDisconnect() throws InterruptedException {
BrowserServer remoteServer = launchBrowserServer(browserType);
Browser browser = browserType.connect(remoteServer.wsEndpoint);
BrowserContext context = browser.newContext();
Page page = context.newPage();
remoteServer.kill();
while (browser.isConnected()) {
try {
page.waitForTimeout(10);
} catch (PlaywrightException e) {
}
}
context.close();
}
@Test
void shouldNotThrowOnPageCloseAfterDisconnect() throws InterruptedException {
BrowserServer remoteServer = launchBrowserServer(browserType);
Browser browser = browserType.connect(remoteServer.wsEndpoint);
Page page = browser.newPage();
remoteServer.kill();
while (browser.isConnected()) {
try {
page.waitForTimeout(10);
} catch (PlaywrightException e) {
}
}
page.close();
}
@Test
void shouldSaveAsVideosFromRemoteBrowser(@TempDir Path tempDir) {
Path videosPath = tempDir.resolve("videosPath");
@@ -16,6 +16,8 @@
package com.microsoft.playwright;
import com.microsoft.playwright.options.AriaRole;
import com.microsoft.playwright.options.WaitUntilState;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledIf;
import org.junit.jupiter.api.condition.EnabledIf;
@@ -405,12 +407,6 @@ public class TestClick extends TestBase {
assertEquals(isWebKit() ? 1910 + 8 : 1910, page.evaluate("offsetY"));
}
private static void expectCloseTo(double expected, double actual) {
if (Math.abs(expected - actual) > 2)
fail("Expected: " + expected + ", received: " + actual);
}
@Test
@DisabledIf(value="com.microsoft.playwright.TestBase#isFirefox", disabledReason="skip")
void shouldClickTheButtonWithOffsetWithPageScale() {
@@ -425,10 +421,20 @@ public class TestClick extends TestBase {
"}");
page.click("button", new Page.ClickOptions().setPosition(20, 10));
assertEquals("Clicked", page.evaluate("result"));
// Expect 20;10 + 8px of border in each direction. Allow some delta as different
// browsers round up or down differently during css -> dip -> css conversion.
expectCloseTo(28, (Integer) page.evaluate("pageX"));
expectCloseTo(18, (Integer) page.evaluate("pageY"));
// 20;10 + 8px of border in each direction
int expectedX = 28;
int expectedY = 18;
if (isWebKit()) {
// WebKit rounds up during css -> dip -> css conversion.
expectedX = 26;
expectedY = 17;
} else if (isChromium() && !headful) {
// Headless Chromium rounds down during css -> dip -> css conversion.
expectedX = 27;
expectedY = 18;
}
assertEquals(expectedX, Math.round((Integer) page.evaluate("pageX") + 0.01));
assertEquals(expectedY, Math.round((Integer) page.evaluate("pageY") + 0.01));
context.close();
}
@@ -12,7 +12,7 @@ public class TestElementHandleSelectText extends TestBase {
ElementHandle textarea = page.querySelector("textarea");
textarea.evaluate("textarea => textarea.value = 'some value'");
textarea.selectText();
if (isFirefox() || isWebKit()) {
if (isFirefox()) {
assertEquals(0, textarea.evaluate("el => el.selectionStart"));
assertEquals(10, textarea.evaluate("el => el.selectionEnd"));
} else {
@@ -26,7 +26,7 @@ public class TestElementHandleSelectText extends TestBase {
ElementHandle input = page.querySelector("input");
input.evaluate("input => input.value = 'some value'");
input.selectText();
if (isFirefox() || isWebKit()) {
if (isFirefox()) {
assertEquals(0, input.evaluate("el => el.selectionStart"));
assertEquals(10, input.evaluate("el => el.selectionEnd"));
} else {
@@ -1,7 +1,6 @@
package com.microsoft.playwright;
import com.google.gson.Gson;
import com.microsoft.playwright.options.HttpCredentials;
import com.microsoft.playwright.options.HttpHeader;
import com.microsoft.playwright.options.RequestOptions;
import org.junit.jupiter.api.Disabled;
@@ -381,97 +380,4 @@ public class TestGlobalFetch extends TestBase {
}
request.dispose();
}
@Test
void shouldNotModifyRequestMethodInOptions() {
APIRequestContext request = playwright.request().newContext();
server.setRoute("/empty.html", exchange -> {
exchange.getResponseHeaders().set("Content-type", "text/plain");
exchange.sendResponseHeaders(200, 0);
try (Writer writer = new OutputStreamWriter(exchange.getResponseBody())) {
writer.write(exchange.getRequestMethod());
}
});
RequestOptions options = RequestOptions.create();
options.setTimeout(10000);
{
APIResponse response = request.fetch(server.EMPTY_PAGE, options);
assertTrue(response.ok());
assertEquals("GET", response.text());
}
{
APIResponse response = request.delete(server.EMPTY_PAGE, options);
assertTrue(response.ok());
assertEquals("DELETE", response.text());
}
{
APIResponse response = request.put(server.EMPTY_PAGE, options);
assertTrue(response.ok());
assertEquals("PUT", response.text());
}
request.dispose();
}
@Test
void shouldSupportGlobalHttpCredentialsOptionAndMatchingOrigin() {
server.setAuth("/empty.html", "user", "pass");
APIRequestContext request1 = playwright.request().newContext();
APIResponse response1 = request1.get(server.EMPTY_PAGE);
assertEquals(401, response1.status());
request1.dispose();
final HttpCredentials httpCredentials = new HttpCredentials("user", "pass");
httpCredentials.setOrigin(server.PREFIX);
APIRequestContext request2 = playwright.request().newContext(new APIRequest.NewContextOptions().setHttpCredentials(httpCredentials));
APIResponse response2 = request2.get(server.EMPTY_PAGE);
assertEquals(200, response2.status());
request2.dispose();
}
@Test
void shouldSupportGlobalHttpCredentialsOptionAndMatchingOriginCaseInsensitive() {
server.setAuth("/empty.html", "user", "pass");
APIRequestContext request1 = playwright.request().newContext();
APIResponse response1 = request1.get(server.EMPTY_PAGE);
assertEquals(401, response1.status());
request1.dispose();
final HttpCredentials httpCredentials = new HttpCredentials("user", "pass");
httpCredentials.setOrigin(server.PREFIX.toUpperCase());
APIRequestContext request2 = playwright.request().newContext(new APIRequest.NewContextOptions().setHttpCredentials(httpCredentials));
APIResponse response2 = request2.get(server.EMPTY_PAGE);
assertEquals(200, response2.status());
request2.dispose();
}
@Test
void shouldReturnErrorWithCorrectCredentialsAndWrongOriginScheme() {
server.setAuth("/empty.html", "user", "pass");
final HttpCredentials httpCredentials = new HttpCredentials("user", "pass");
httpCredentials.setOrigin(Utils.generateDifferentOriginScheme(server));
APIRequestContext request = playwright.request().newContext(new APIRequest.NewContextOptions().setHttpCredentials(httpCredentials));
APIResponse response = request.get(server.EMPTY_PAGE);
assertEquals(401, response.status());
}
@Test
void shouldReturnErrorWithCorrectCredentialsAndWrongOriginHostname() {
server.setAuth("/empty.html", "user", "pass");
final HttpCredentials httpCredentials = new HttpCredentials("user", "pass");
httpCredentials.setOrigin(Utils.generateDifferentOriginHostname(server));
APIRequestContext request = playwright.request().newContext(new APIRequest.NewContextOptions().setHttpCredentials(httpCredentials));
APIResponse response = request.get(server.EMPTY_PAGE);
assertEquals(401, response.status());
}
@Test
void shouldReturnErrorWithCorrectCredentialsAndWrongOriginPort() {
server.setAuth("/empty.html", "user", "pass");
final HttpCredentials httpCredentials = new HttpCredentials("user", "pass");
httpCredentials.setOrigin(Utils.generateDifferentOriginPort(server));
APIRequestContext request = playwright.request().newContext(new APIRequest.NewContextOptions().setHttpCredentials(httpCredentials));
APIResponse response = request.get(server.EMPTY_PAGE);
assertEquals(401, response.status());
}
}
@@ -673,15 +673,6 @@ public class TestLocatorAssertions extends TestBase {
assertThat(locator).isChecked(new LocatorAssertions.IsCheckedOptions().setChecked(false));
}
@Test
void isCheckedFalseFail() {
page.setContent("<input checked type=checkbox></input>");
Locator locator = page.locator("input");
AssertionFailedError error = assertThrows(AssertionFailedError.class,
() -> assertThat(locator).isChecked(new LocatorAssertions.IsCheckedOptions().setChecked(false).setTimeout(1000)));
assertTrue(error.getMessage().contains("Locator expected to be unchecked"), error.getMessage());
}
@Test
void isDisabledPass() {
page.setContent("<button disabled>Text</button>");
@@ -732,15 +723,6 @@ public class TestLocatorAssertions extends TestBase {
assertTrue(e.getMessage().contains("Locator expected to be editable"), e.getMessage());
}
@Test
void isEditableFalseFail() {
page.setContent("<input></input>");
Locator locator = page.locator("input");
AssertionFailedError error = assertThrows(AssertionFailedError.class,
() -> assertThat(locator).isEditable(new LocatorAssertions.IsEditableOptions().setEditable(false).setTimeout(1000)));
assertTrue(error.getMessage().contains("Locator expected to be readonly"), error.getMessage());
}
@Test
void notIsEditableFail() {
page.setContent("<input></input>");
@@ -857,15 +839,6 @@ public class TestLocatorAssertions extends TestBase {
assertThat(locator).isEnabled(new LocatorAssertions.IsEnabledOptions().setEnabled(false));
}
@Test
void isEnabledFalseFail() {
page.setContent("<button>Text</button>");
Locator locator = page.locator("button");
AssertionFailedError error = assertThrows(AssertionFailedError.class,
() -> assertThat(locator).isEnabled(new LocatorAssertions.IsEnabledOptions().setEnabled(false).setTimeout(1000)));
assertTrue(error.getMessage().contains("Locator expected to be disabled"), error.getMessage());
}
@Test
void isEnabledEventually() {
page.setContent("<button disabled>Text</button>");
@@ -976,15 +949,6 @@ public class TestLocatorAssertions extends TestBase {
assertTrue(e.getMessage().contains("Locator expected to be visible"), e.getMessage());
}
@Test
void isVisibleFalseFail() {
page.setContent("<input></input>");
Locator locator = page.locator("input");
AssertionFailedError error = assertThrows(AssertionFailedError.class,
() -> assertThat(locator).isVisible(new LocatorAssertions.IsVisibleOptions().setVisible(false).setTimeout(1000)));
assertTrue(error.getMessage().contains("Locator expected to be hidden"), error.getMessage());
}
@Test
void notIsVisibleFail() {
page.setContent("<input></input>");
@@ -1,102 +0,0 @@
package com.microsoft.playwright;
import com.microsoft.playwright.assertions.LocatorAssertions;
import org.junit.jupiter.api.Test;
import org.opentest4j.AssertionFailedError;
import static com.microsoft.playwright.assertions.PlaywrightAssertions.assertThat;
import static org.junit.jupiter.api.Assertions.*;
public class TestLocatorAssertions2 extends TestBase {
@Test
void isAttachedDefault() {
page.setContent("<input></input>");
Locator locator = page.locator("input");
assertThat(locator).isAttached();
}
@Test
void isAttachedWithHiddenElement() {
page.setContent("<button style='display:none'>hello</button>");
Locator locator = page.locator("button");
assertThat(locator).isAttached();
}
@Test
void isAttachedWithNot() {
page.setContent("<button>hello</button>");
Locator locator = page.locator("input");
assertThat(locator).not().isAttached();
}
@Test
void isAttachedWithAttachedTrue() {
page.setContent("<button>hello</button>");
Locator locator = page.locator("button");
assertThat(locator).isAttached(new LocatorAssertions.IsAttachedOptions().setAttached(true));
}
@Test
void isAttachedWithAttachedFalse() {
page.setContent("<button>hello</button>");
Locator locator = page.locator("input");
assertThat(locator).isAttached(new LocatorAssertions.IsAttachedOptions().setAttached(false));
}
@Test
void isAttachedWithNotAndAttachedFalse() {
page.setContent("<button>hello</button>");
Locator locator = page.locator("button");
assertThat(locator).not().isAttached(new LocatorAssertions.IsAttachedOptions().setAttached(false));
}
@Test
void isAttachedEventually() {
page.setContent("<div></div>");
Locator locator = page.locator("span");
page.evalOnSelector("div", "div => setTimeout(() => {\n" +
" div.innerHTML = '<span>Hello</span>'\n" +
" }, 100)");
assertThat(locator).isAttached();
}
@Test
void isAttachedEventuallyWithNot() {
page.setContent("<div><span>Hello</span></div>");
Locator locator = page.locator("span");
page.evalOnSelector("div", "div => setTimeout(() => {\n" +
" div.textContent = '';\n" +
" }, 0)");
assertThat(locator).not().isAttached();
}
@Test
void isAttachedFail() {
page.setContent("<button>Hello</button>");
Locator locator = page.locator("input");
AssertionFailedError error = assertThrows(AssertionFailedError.class,
() -> assertThat(locator).isAttached(new LocatorAssertions.IsAttachedOptions().setTimeout(1000)));
assertFalse(error.getMessage().contains("locator resolved to"), error.getMessage());
}
@Test
void isAttachedFailWithNot() {
page.setContent("<input></input>");
Locator locator = page.locator("input");
AssertionFailedError error = assertThrows(AssertionFailedError.class,
() -> assertThat(locator).not().isAttached(new LocatorAssertions.IsAttachedOptions().setTimeout(1000)));
assertTrue(error.getMessage().contains("locator resolved to <input/>"), error.getMessage());
}
@Test
void isAttachedWithImpossibleTimeout() {
page.setContent("<div id=node>Text content</div>");
assertThat(page.locator("#node")).isAttached(new LocatorAssertions.IsAttachedOptions().setTimeout(1));
}
@Test
void isAttachedWithImpossibleTimeoutNot() {
page.setContent("<div id=node>Text content</div>");
assertThat(page.locator("no-such-thing")).not().isAttached(new LocatorAssertions.IsAttachedOptions().setTimeout(1));
}
}
@@ -102,18 +102,4 @@ public class TestLocatorMisc extends TestBase{
assertTrue(blurred[0]);
assertEquals(false, button.evaluate("button => document.activeElement === button"));
}
@Test
void LocatorLocatorAndFrameLocatorLocatorShouldAcceptLocator() {
page.setContent("<div><input value=outer></div>\n" +
" <iframe srcdoc=\"<div><input value=inner></div>\"></iframe>\n");
Locator inputLocator = page.locator("input");
assertEquals("outer", inputLocator.inputValue());
assertEquals("outer", page.locator("div").locator(inputLocator).inputValue());
assertEquals("inner", page.frameLocator("iframe").locator(inputLocator).inputValue());
assertEquals("inner", page.frameLocator("iframe").locator("div").locator(inputLocator).inputValue());
Locator divLocator = page.locator("div");
assertEquals("outer", divLocator.locator("input").inputValue());
assertEquals("inner", page.frameLocator("iframe").locator(divLocator).locator("input").inputValue());
}
}
@@ -27,7 +27,6 @@ import java.util.stream.Collectors;
import static com.microsoft.playwright.options.LoadState.DOMCONTENTLOADED;
import static com.microsoft.playwright.options.LoadState.LOAD;
import static java.util.Arrays.asList;
import static org.junit.jupiter.api.Assertions.*;
public class TestPageBasic extends TestBase {
@@ -297,7 +296,7 @@ public class TestPageBasic extends TestBase {
void frameFocusShouldWorkMultipleTimes() {
Page page1 = context.newPage();
Page page2 = context.newPage();
for (Page page : asList(page1, page2)) {
for (Page page : Arrays.asList(page1, page2)) {
page.setContent("<button id='foo' onfocus='window.gotFocus=true'></button>");
page.focus("#foo");
assertEquals(true, page.evaluate("() => !!window['gotFocus']"));
@@ -310,32 +309,4 @@ public class TestPageBasic extends TestBase {
page.dragAndDrop("#source", "#target");
assertEquals(true, page.evalOnSelector("#target", "target => target.contains(document.querySelector('#source'))"));
}
@Test
void shouldWaitForCondition() {
List<String> messages = new ArrayList<>();
page.onConsoleMessage(m -> messages.add(m.text()));
page.evaluate("setTimeout(() => {\n" +
" console.log('foo');\n" +
" console.log('bar');\n" +
"}, 100);");
page.waitForCondition(() -> messages.size() > 1);
assertEquals(asList("foo", "bar"), messages);
}
@Test
void waitForConditionTimeout() {
PlaywrightException e = assertThrows(PlaywrightException.class,
() -> page.waitForCondition(() -> false, new Page.WaitForConditionOptions().setTimeout(100)));
assertTrue(e.getMessage().contains("Timeout"), e.getMessage());
}
@Test
void waitForConditionPageClosed() {
PlaywrightException e = assertThrows(PlaywrightException.class,
() -> page.waitForCondition(() -> {
page.close();
return false;
}));
assertTrue(e.getMessage().contains("Page closed"), e.getMessage());
}
}
@@ -2,8 +2,6 @@ package com.microsoft.playwright;
import org.junit.jupiter.api.Test;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.util.HashMap;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
@@ -73,23 +71,6 @@ public class TestPageInterception extends TestBase {
assertTrue(response.headers().get("content-type").contains("text/html"));
}
@Test
void shouldSupportTimeoutOptionInRouteFetch() {
server.setRoute("/slow", exchange -> {
exchange.getResponseHeaders().set("Content-type", "text/plain");
exchange.sendResponseHeaders(200, 4096);
});
page.route("**/*", route -> {
PlaywrightException error = assertThrows(PlaywrightException.class,
() -> route.fetch(new Route.FetchOptions().setTimeout(1000)));
assertTrue(error.getMessage().contains("Request timed out after 1000ms"), error.getMessage());
});
PlaywrightException error = assertThrows(PlaywrightException.class,
() -> page.navigate(server.PREFIX + "/slow", new Page.NavigateOptions().setTimeout(2000)));
assertTrue(error.getMessage().contains("Timeout 2000ms exceeded"), error.getMessage());
}
@Test
void shouldInterceptWithUrlOverride() {
page.route("**/*.html", route -> {
@@ -140,21 +140,18 @@ public class TestPageLocatorQuery extends TestBase {
new Page.LocatorOptions().setHasText("Save & Continue")).textContent());
}
private static String removeHighlight(String markup) {
return markup.replaceAll("\\s__playwright_target__=\"[^\"]+\"", "");
}
@Test
void shouldSupportHasLocator() {
page.setContent("<div><span>hello</span></div><div><span>world</span></div>");
assertThat(page.locator("div", new Page.LocatorOptions().setHas(page.locator("text=world")))).hasCount(1);
assertEquals("<div><span>world</span></div>", removeHighlight((String) page.locator("div", new Page.LocatorOptions().setHas(page.locator("text=world"))).evaluate("e => e.outerHTML")));
assertEquals("<div><span>world</span></div>", page.locator("div", new Page.LocatorOptions().setHas(page.locator("text=world"))).evaluate("e => e.outerHTML"));
assertThat(page.locator("div", new Page.LocatorOptions().setHas(page.locator("text='hello'")))).hasCount(1);
assertEquals("<div><span>hello</span></div>", removeHighlight((String) page.locator("div", new Page.LocatorOptions().setHas(page.locator("text='hello'"))).evaluate("e => e.outerHTML")));
assertEquals("<div><span>hello</span></div>", page.locator("div", new Page.LocatorOptions().setHas(page.locator("text='hello'"))).evaluate("e => e.outerHTML"));
assertThat(page.locator("div", new Page.LocatorOptions().setHas(page.locator("xpath=./span")))).hasCount(2);
assertThat(page.locator("div", new Page.LocatorOptions().setHas(page.locator("span")))).hasCount(2);
assertThat(page.locator("div", new Page.LocatorOptions().setHas(page.locator("span", new Page.LocatorOptions().setHasText("wor"))))).hasCount(1);
assertEquals("<div><span>world</span></div>", removeHighlight((String) page.locator("div", new Page.LocatorOptions().setHas(
page.locator("span", new Page.LocatorOptions().setHasText("wor")))).evaluate("e => e.outerHTML")));
assertEquals("<div><span>world</span></div>", page.locator("div", new Page.LocatorOptions().setHas(
page.locator("span", new Page.LocatorOptions().setHasText("wor")))).evaluate("e => e.outerHTML"));
assertThat(page.locator("div", new Page.LocatorOptions()
.setHas(page.locator("span")).setHasText("wor"))).hasCount(1);
}
@@ -172,39 +169,5 @@ public class TestPageLocatorQuery extends TestBase {
assertThat(page.locator("div").filter(new Locator.FilterOptions()
.setHas(page.locator("span"))
.setHasText("world"))).hasCount(1);
assertThat(page.locator("div").filter(new Locator.FilterOptions()
.setHasNot(page.locator("span", new Page.LocatorOptions().setHasText("world"))))).hasCount(1);
assertThat(page.locator("div").filter(new Locator.FilterOptions()
.setHasNot(page.locator("section")))).hasCount(2);
assertThat(page.locator("div").filter(new Locator.FilterOptions()
.setHasNot(page.locator("span")))).hasCount(0);
assertThat(page.locator("div").filter(new Locator.FilterOptions().setHasNotText("hello"))).hasCount(1);
assertThat(page.locator("div").filter(new Locator.FilterOptions().setHasNotText("foo"))).hasCount(2);
}
@Test
void shouldSupportLocatorAnd() {
page.setContent("<div data-testid=foo>hello</div><div data-testid=bar>world</div>\n" +
" <span data-testid=foo>hello2</span><span data-testid=bar>world2</span>");
assertThat(page.locator("div").and(page.locator("div"))).hasCount(2);
assertThat(page.locator("div").and(page.getByTestId("foo"))).hasText(new String[] { "hello" });
assertThat(page.locator("div").and(page.getByTestId("bar"))).hasText(new String[] { "world" });
assertThat(page.getByTestId("foo").and(page.locator("div"))).hasText(new String[] { "hello" });
assertThat(page.getByTestId("bar").and(page.locator("span"))).hasText(new String[] { "world2" });
assertThat(page.locator("span").and(page.getByTestId(Pattern.compile("bar|foo")))).hasCount(2);
}
@Test
void shouldSupportLocatorOr() {
page.setContent("<div>hello</div><span>world</span>");
assertThat(page.locator("div").or(page.locator("span"))).hasCount(2);
assertThat(page.locator("div").or(page.locator("span"))).hasText(new String[]{"hello", "world"});
assertThat(page.locator("span").or(page.locator("article")).or(page.locator("div"))).hasText(new String[]{"hello", "world"});
assertThat(page.locator("article").or(page.locator("someting"))).hasCount(0);
assertThat(page.locator("article").or(page.locator("div"))).hasText("hello");
assertThat(page.locator("article").or(page.locator("span"))).hasText("world");
assertThat(page.locator("div").or(page.locator("article"))).hasText("hello");
assertThat(page.locator("span").or(page.locator("article"))).hasText("world");
}
}
@@ -56,7 +56,6 @@ public class TestPageNetworkResponse extends TestBase {
exchange.sendResponseHeaders(200, 0);
OutputStreamWriter writer = new OutputStreamWriter(exchange.getResponseBody());
writer.write("hello ");
writer.flush();
});
// send request and wait for server response
@@ -81,7 +80,6 @@ public class TestPageNetworkResponse extends TestBase {
exchange.sendResponseHeaders(200, 0);
OutputStreamWriter writer = new OutputStreamWriter(exchange.getResponseBody());
writer.write("hello ");
writer.flush();
});
// send request and wait for server response
@@ -82,12 +82,12 @@ public class TestPageRoute extends TestBase {
intercepted.add(4);
route.fallback();
};
page.route(Pattern.compile("empty.html"), handler4);
page.route("**/empty.html", handler4);
page.navigate(server.EMPTY_PAGE);
assertEquals(asList(4, 3, 2, 1), intercepted);
intercepted.clear();
page.unroute(Pattern.compile("empty.html"), handler4);
page.unroute("**/empty.html", handler4);
page.navigate(server.EMPTY_PAGE);
assertEquals(asList(3, 2, 1), intercepted);
@@ -58,21 +58,19 @@ public class TestPageWaitForNavigation extends TestBase {
@Test
void shouldWorkWithCommit() {
server.setRoute("/script.js", exchange -> {});
server.setRoute("/empty.html", exchange -> {
exchange.getResponseHeaders().add("Content-Type", "text/html");
exchange.sendResponseHeaders(200, 0);
try (OutputStreamWriter writer = new OutputStreamWriter(exchange.getResponseBody())) {
writer.write("<title>Hello</title><script src=\"script.js\"></script>");
}
exchange.sendResponseHeaders(200, 8192);
OutputStreamWriter writer = new OutputStreamWriter(exchange.getResponseBody());
writer.write("<title>" + String.join("", nCopies(4100, "A")));
writer.flush();
});
page.waitForNavigation(new Page.WaitForNavigationOptions().setWaitUntil(WaitUntilState.COMMIT), () -> {
try {
page.navigate(server.EMPTY_PAGE, new Page.NavigateOptions().setTimeout(1000));
page.navigate(server.EMPTY_PAGE, new Page.NavigateOptions().setTimeout(100));
} catch (TimeoutError e) {
}
});
assertEquals("Hello", page.title());
}
@Test
@@ -241,18 +239,16 @@ public class TestPageWaitForNavigation extends TestBase {
page.navigate(server.PREFIX + "/frames/one-frame.html");
Frame frame = page.frames().get(1);
server.setRoute("/empty.html", exchange -> {});
server.setRoute("/one-style.css", exchange -> {});
PlaywrightException ex = assertThrows(PlaywrightException.class, () -> {
frame.waitForNavigation(() -> {
Future<Server.Request> req = server.futureRequest("/one-style.css");
page.evalOnSelector("iframe", "frame => { frame.contentWindow.location.href = '/one-style.html'; }");
Future<Server.Request> req = server.futureRequest("/empty.html");
page.evalOnSelector("iframe", "frame => { frame.contentWindow.location.href = '/empty.html'; }");
try {
// Make sure policy checks pass and navigation actually begins before removing the frame to avoid other errors
req.get();
} catch (InterruptedException | ExecutionException e) {
throw new RuntimeException(e);
}
page.evalOnSelector("iframe", "frame => setTimeout(() => frame.remove(), 0)");
page.evaluate("setTimeout(() => document.querySelector('iframe').remove());");
});
});
assertTrue(ex.getMessage().contains("frame was detached"), ex.getMessage());
@@ -52,20 +52,18 @@ public class TestPageWaitForUrl extends TestBase {
@Test
void shouldWorkWithCommit() {
server.setRoute("/script.js", exchange -> {});
server.setRoute("/empty.html", exchange -> {
exchange.getResponseHeaders().add("Content-Type", "text/html");
exchange.sendResponseHeaders(200, 0);
try (OutputStreamWriter writer = new OutputStreamWriter(exchange.getResponseBody())) {
writer.write("<title>Hello</title><script src=\"script.js\"></script>");
}
exchange.sendResponseHeaders(200, 8192);
OutputStreamWriter writer = new OutputStreamWriter(exchange.getResponseBody());
writer.write("<title>" + String.join("", nCopies(4100, "A")));
writer.flush();
});
try {
page.navigate(server.EMPTY_PAGE, new Page.NavigateOptions().setTimeout(100));
} catch (TimeoutError e) {
}
page.waitForURL("**/empty.html", new Page.WaitForURLOptions().setWaitUntil(WaitUntilState.COMMIT));
assertEquals("Hello", page.title());
}
@Test
@@ -2,7 +2,6 @@ package com.microsoft.playwright;
import org.junit.jupiter.api.Test;
import static java.util.Arrays.asList;
import static org.junit.jupiter.api.Assertions.*;
public class TestSelectorsMisc extends TestBase {
@@ -195,39 +194,4 @@ public class TestSelectorsMisc extends TestBase {
e = assertThrows(PlaywrightException.class, () -> page.querySelector("div >> left-of='span',3,4"));
assertTrue(e.getMessage().contains("Malformed selector: left-of='span',3,4"));
}
@Test
void shouldWorkWithInternalHasNot() {
page.setContent("<section><span></span><div></div></section><section><br></section>");
assertEquals(1, page.evalOnSelectorAll("section >> internal:has-not=\"span\"", "els => els.length"));
assertEquals(0, page.evalOnSelectorAll("section >> internal:has-not=\"span, div, br\"", "els => els.length"));
assertEquals(1, page.evalOnSelectorAll("section >> internal:has-not=\"br\"", "els => els.length"));
assertEquals(1, page.evalOnSelectorAll("section >> internal:has-not=\"span, div\"", "els => els.length"));
assertEquals(2, page.evalOnSelectorAll("section >> internal:has-not=\"article\"", "els => els.length"));
}
@Test
void shouldWorkWithInternalAnd() {
page.setContent("<div class=foo>hello</div><div class=bar>world</div>\n" +
" <span class=foo>hello2</span><span class=bar>world2</span>");
assertEquals(asList(), page.evalOnSelectorAll("div >> internal:and=\"span\"", "els => els.map(e => e.textContent)"));
assertEquals(asList("hello"), page.evalOnSelectorAll("div >> internal:and=\".foo\"", "els => els.map(e => e.textContent)"));
assertEquals(asList("world"), page.evalOnSelectorAll("div >> internal:and=\".bar\"", "els => els.map(e => e.textContent)"));
assertEquals(asList("hello2", "world2"), page.evalOnSelectorAll("span >> internal:and=\"span\"", "els => els.map(e => e.textContent)"));
assertEquals(asList("hello"), page.evalOnSelectorAll(".foo >> internal:and=\"div\"", "els => els.map(e => e.textContent)"));
assertEquals(asList("world2"), page.evalOnSelectorAll(".bar >> internal:and=\"span\"", "els => els.map(e => e.textContent)"));
}
@Test
void shouldWorkWithInternalOr() {
page.setContent("<div>hello</div>\n" +
" <span>world</span>");
assertEquals(asList("hello", "world"), page.evalOnSelectorAll("div >> internal:or=\"span\"", "els => els.map(e => e.textContent)"));
assertEquals(asList("hello", "world"), page.evalOnSelectorAll("span >> internal:or=\"div\"", "els => els.map(e => e.textContent)"));
assertEquals(0, page.evalOnSelectorAll("article >> internal:or=\"something\"", "els => els.length"));
assertEquals("hello", page.locator("article >> internal:or=\"div\"").textContent());
assertEquals("world", page.locator("article >> internal:or=\"span\"").textContent());
assertEquals("hello", page.locator("div >> internal:or=\"article\"").textContent());
assertEquals("world", page.locator("span >> internal:or=\"article\"").textContent());
}
}
@@ -131,27 +131,4 @@ public class TestTracing extends TestBase {
context.tracing().start(new Tracing.StartOptions().setSources(false));
}
@Test
void shouldRespectTracesDirAndName(@TempDir Path tempDir) {
Path tracesDir = tempDir.resolve("trace-dir");
BrowserType.LaunchOptions options = createLaunchOptions();
options.setTracesDir(tracesDir);
try (Browser browser = browserType.launch(options)) {
BrowserContext context = browser.newContext();
Page page = context.newPage();
context.tracing().start(new Tracing.StartOptions().setName("name1").setSnapshots(true));
page.navigate(server.PREFIX + "/one-style.html");
context.tracing().stopChunk(new Tracing.StopChunkOptions().setPath(tempDir.resolve("trace1.zip")));
assertTrue(Files.exists(tracesDir.resolve("name1.trace")));
assertTrue(Files.exists(tracesDir.resolve("name1.network")));
context.tracing().startChunk(new Tracing.StartChunkOptions().setName("name2"));
page.navigate(server.PREFIX + "/har.html");
context.tracing().stop(new Tracing.StopOptions().setPath(tempDir.resolve("trace2.zip")));
assertTrue(Files.exists(tracesDir.resolve("name2.trace")));
assertTrue(Files.exists(tracesDir.resolve("name2.network")));
}
}
}
@@ -185,7 +185,7 @@ public class TestWebSocket extends TestBase {
PlaywrightException e = assertThrows(PlaywrightException.class, () -> {
ws.waitForFrameSent(() -> page.evaluate("window.ws.close()"));
});
assertTrue(e.getMessage().matches("Socket closed|Socket error"), e.getMessage());
assertTrue(e.getMessage().contains("Socket closed"));
}
@Test
@@ -144,10 +144,6 @@ class Utils {
return OS.UNKNOWN;
}
static int osVersion() {
return Integer.parseInt(System.getProperty("os.version").split("\\.")[0]);
}
static List<String> expectedSSLError(String browserName) {
switch (browserName) {
case "chromium":
@@ -200,18 +196,4 @@ class Utils {
assertEquals(width, page.evaluate("window.innerWidth"));
assertEquals(height, page.evaluate("window.innerHeight"));
}
static String generateDifferentOriginScheme(final Server server){
return server.PREFIX.startsWith("http://") ?
server.PREFIX.replace("http://", "https://") :
server.PREFIX.replace("https://", "http://");
}
static String generateDifferentOriginHostname(final Server server){
return server.PREFIX.replace("localhost", "mismatching-hostname");
}
static String generateDifferentOriginPort(final Server server){
return server.PREFIX.replace(String.valueOf(server.PORT), String.valueOf(server.PORT+1));
}
}
+1 -1
View File
@@ -6,7 +6,7 @@
<groupId>com.microsoft.playwright</groupId>
<artifactId>parent-pom</artifactId>
<version>1.34.0</version>
<version>1.31.0</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.34.2
1.31.1
+1 -1
View File
@@ -33,7 +33,7 @@ fi
mkdir -p driver
cd driver
for PLATFORM in mac mac-arm64 linux linux-arm64 win32_x64
for PLATFORM in mac linux linux-arm64 win32_x64
do
FILE_NAME=$FILE_PREFIX-$PLATFORM.zip
if [[ -d $PLATFORM ]]; then
+1 -1
View File
@@ -6,7 +6,7 @@
<groupId>com.microsoft.playwright</groupId>
<artifactId>api-generator</artifactId>
<version>1.34.0</version>
<version>1.31.0</version>
<name>Playwright - API Generator</name>
<description>
This is an internal module used to generate Java API from the upstream Playwright
@@ -967,10 +967,6 @@ class Interface extends TypeDefinition {
if (asList("Page", "Browser", "BrowserContext", "WebSocket", "Worker").contains(jsonName)) {
output.add("import java.util.function.Consumer;");
}
if (asList("Page", "BrowserContext").contains(jsonName)) {
output.add("import java.util.function.BooleanSupplier;");
}
if (asList("Page", "Frame", "BrowserContext", "WebSocket").contains(jsonName)) {
output.add("import java.util.function.Predicate;");
}
+1 -1
View File
@@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.microsoft.playwright</groupId>
<artifactId>test-cli-fatjar</artifactId>
<version>1.34.0</version>
<version>1.31.0</version>
<name>Test Playwright Command Line FatJar</name>
<properties>
<compiler.version>1.8</compiler.version>
+1 -1
View File
@@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.microsoft.playwright</groupId>
<artifactId>test-cli-version</artifactId>
<version>1.34.0</version>
<version>1.31.0</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.34.0</version>
<version>1.31.0</version>
<name>Test local installation</name>
<description>Runs Playwright test suite (copied from playwright module) against locally cached Playwright</description>
<properties>
+1 -1
View File
@@ -9,7 +9,7 @@
</parent>
<groupId>com.microsoft.playwright</groupId>
<artifactId>test-spring-boot-starter</artifactId>
<version>1.34.0</version>
<version>1.31.0</version>
<name>Test Playwright With Spring Boot</name>
<properties>
<spring.version>2.4.3</spring.version>
+1 -1
View File
@@ -6,7 +6,7 @@
<groupId>com.microsoft.playwright</groupId>
<artifactId>update-version</artifactId>
<version>1.34.0</version>
<version>1.31.0</version>
<name>Playwright - Update Version in Documentation</name>
<description>
This is an internal module used to update versions in the documentation based on
+2 -2
View File
@@ -24,8 +24,8 @@ RUN apt-get update && \
# Create the pwuser
adduser pwuser
RUN VERSION=3.8.8 && \
curl -o - https://archive.apache.org/dist/maven/maven-3/$VERSION/binaries/apache-maven-$VERSION-bin.tar.gz | tar zxfv - -C /opt/ && \
RUN VERSION=3.8.7 && \
curl -o - https://dlcdn.apache.org/maven/maven-3/$VERSION/binaries/apache-maven-$VERSION-bin.tar.gz | tar zxfv - -C /opt/ && \
ln -s /opt/apache-maven-$VERSION/bin/mvn /usr/local/bin/
ARG PW_TARGET_ARCH
-57
View File
@@ -1,57 +0,0 @@
FROM ubuntu:jammy
ARG DEBIAN_FRONTEND=noninteractive
ARG TZ=America/Los_Angeles
ARG DOCKER_IMAGE_NAME_TEMPLATE="mcr.microsoft.com/playwright/java:v%version%-jammy"
# === INSTALL JDK and Maven ===
RUN apt-get update && \
# Install install jdk 17 in a separate apt-get command so that
# installing maven doesn't bring in jdk 11
apt-get install -y --no-install-recommends openjdk-17-jdk && \
apt-get install -y --no-install-recommends \
# Ubuntu 22.04 and earlier come with Maven 3.6.3 which fails with
# Java 17, so we install latest Maven from Apache instead.
# maven \
# Install utilities required for downloading browsers
curl \
# Install utilities required for downloading driver
unzip \
# For the MSEdge install script
gpg && \
rm -rf /var/lib/apt/lists/* && \
# Create the pwuser
adduser pwuser
RUN VERSION=3.8.8 && \
curl -o - https://archive.apache.org/dist/maven/maven-3/$VERSION/binaries/apache-maven-$VERSION-bin.tar.gz | tar zxfv - -C /opt/ && \
ln -s /opt/apache-maven-$VERSION/bin/mvn /usr/local/bin/
ARG PW_TARGET_ARCH
ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk-${PW_TARGET_ARCH}
# === 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 && \
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 && \
DEBIAN_FRONTEND=noninteractive mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI \
-D exec.args="install-deps" -f playwright/pom.xml --no-transfer-progress && \
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI \
-D exec.args="install" -f playwright/pom.xml --no-transfer-progress && \
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI \
-D exec.args="mark-docker-image '${DOCKER_IMAGE_NAME_TEMPLATE}'" -f playwright/pom.xml --no-transfer-progress && \
rm -rf /tmp/pw-java && \
chmod -R 777 $PLAYWRIGHT_BROWSERS_PATH
+1 -1
View File
@@ -3,7 +3,7 @@ set -e
set +x
if [[ ($1 == '--help') || ($1 == '-h') || ($1 == '') || ($2 == '') ]]; then
echo "usage: $(basename $0) {--arm64,--amd64} {focal,jammy} playwright:localbuild-focal"
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"
+20 -25
View File
@@ -34,26 +34,25 @@ if [[ -z "${GITHUB_SHA}" ]]; then
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")
fi
JAMMY_TAGS=(
"next"
"next-jammy"
"sha-${GITHUB_SHA}"
)
if [[ "$RELEASE_CHANNEL" == "stable" ]]; then
JAMMY_TAGS+=("jammy")
JAMMY_TAGS+=("latest")
JAMMY_TAGS+=("v${PW_VERSION}")
JAMMY_TAGS+=("v${PW_VERSION}-jammy")
FOCAL_TAGS+=("v${PW_VERSION}")
fi
tag_and_push() {
@@ -67,12 +66,12 @@ tag_and_push() {
publish_docker_images_with_arch_suffix() {
local FLAVOR="$1"
local TAGS=()
if [[ "$FLAVOR" == "focal" ]]; then
if [[ "$FLAVOR" == "bionic" ]]; then
TAGS=("${BIONIC_TAGS[@]}")
elif [[ "$FLAVOR" == "focal" ]]; then
TAGS=("${FOCAL_TAGS[@]}")
elif [[ "$FLAVOR" == "jammy" ]]; then
TAGS=("${JAMMY_TAGS[@]}")
else
echo "ERROR: unknown flavor - $FLAVOR. Must be either 'focal' or 'jammy'"
echo "ERROR: unknown flavor - $FLAVOR. Must be either 'bionic' or 'focal'"
exit 1
fi
local ARCH="$2"
@@ -93,12 +92,12 @@ publish_docker_images_with_arch_suffix() {
publish_docker_manifest () {
local FLAVOR="$1"
local TAGS=()
if [[ "$FLAVOR" == "focal" ]]; then
if [[ "$FLAVOR" == "bionic" ]]; then
TAGS=("${BIONIC_TAGS[@]}")
elif [[ "$FLAVOR" == "focal" ]]; then
TAGS=("${FOCAL_TAGS[@]}")
elif [[ "$FLAVOR" == "jammy" ]]; then
TAGS=("${JAMMY_TAGS[@]}")
else
echo "ERROR: unknown flavor - $FLAVOR. Must be either 'focal' or 'jammy'"
echo "ERROR: unknown flavor - $FLAVOR. Must be either 'bionic' or 'focal'"
exit 1
fi
@@ -120,7 +119,3 @@ publish_docker_manifest () {
publish_docker_images_with_arch_suffix focal amd64
publish_docker_images_with_arch_suffix focal arm64
publish_docker_manifest focal amd64 arm64
publish_docker_images_with_arch_suffix jammy amd64
publish_docker_images_with_arch_suffix jammy arm64
publish_docker_manifest jammy amd64 arm64