Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ce430e375a | |||
| d76dc9c7c6 | |||
| 7de72a6432 | |||
| 24a70eff89 | |||
| 32cf6cd18e | |||
| e5135db82c | |||
| 6234e06280 |
@@ -75,7 +75,7 @@ extends:
|
|||||||
targetPath: $(Build.ArtifactStagingDirectory)/esrp-build
|
targetPath: $(Build.ArtifactStagingDirectory)/esrp-build
|
||||||
steps:
|
steps:
|
||||||
- checkout: none
|
- checkout: none
|
||||||
- task: EsrpRelease@9
|
- task: EsrpRelease@11
|
||||||
inputs:
|
inputs:
|
||||||
connectedservicename: 'Playwright-ESRP-PME'
|
connectedservicename: 'Playwright-ESRP-PME'
|
||||||
usemanagedidentity: true
|
usemanagedidentity: true
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ jobs:
|
|||||||
environment: Docker
|
environment: Docker
|
||||||
if: github.repository == 'microsoft/playwright-java'
|
if: github.repository == 'microsoft/playwright-java'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- name: Azure login
|
- name: Azure login
|
||||||
uses: azure/login@v3
|
uses: azure/login@v3
|
||||||
with:
|
with:
|
||||||
@@ -26,5 +26,5 @@ jobs:
|
|||||||
uses: docker/setup-qemu-action@v4
|
uses: docker/setup-qemu-action@v4
|
||||||
with:
|
with:
|
||||||
platforms: arm64
|
platforms: arm64
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- run: ./utils/docker/publish_docker.sh stable
|
- run: ./utils/docker/publish_docker.sh stable
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ jobs:
|
|||||||
browser: webkit
|
browser: webkit
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- name: Set up JDK 1.8
|
- name: Set up JDK 1.8
|
||||||
uses: actions/setup-java@v5
|
uses: actions/setup-java@v5
|
||||||
with:
|
with:
|
||||||
@@ -73,7 +73,7 @@ jobs:
|
|||||||
browser-channel: msedge
|
browser-channel: msedge
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- name: Install Media Pack
|
- name: Install Media Pack
|
||||||
if: matrix.os == 'windows-latest'
|
if: matrix.os == 'windows-latest'
|
||||||
shell: powershell
|
shell: powershell
|
||||||
@@ -108,7 +108,7 @@ jobs:
|
|||||||
browser: [chromium, firefox, webkit]
|
browser: [chromium, firefox, webkit]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- name: Set up JDK 21
|
- name: Set up JDK 21
|
||||||
uses: actions/setup-java@v5
|
uses: actions/setup-java@v5
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ jobs:
|
|||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- name: Cache Maven packages
|
- name: Cache Maven packages
|
||||||
uses: actions/cache@v5
|
uses: actions/cache@v6
|
||||||
with:
|
with:
|
||||||
path: ~/.m2
|
path: ~/.m2
|
||||||
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
|
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ jobs:
|
|||||||
- runs-on: ubuntu-24.04-arm
|
- runs-on: ubuntu-24.04-arm
|
||||||
arch: arm64
|
arch: arm64
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- name: Build Docker image
|
- name: Build Docker image
|
||||||
run: |
|
run: |
|
||||||
bash utils/docker/build.sh --${{ matrix.arch }} ${{ matrix.flavor }} playwright-java:localbuild-${{ matrix.flavor }}
|
bash utils/docker/build.sh --${{ matrix.arch }} ${{ matrix.flavor }} playwright-java:localbuild-${{ matrix.flavor }}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ jobs:
|
|||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- name: Download drivers
|
- name: Download drivers
|
||||||
run: scripts/download_driver.sh
|
run: scripts/download_driver.sh
|
||||||
- name: Regenerate APIs
|
- name: Regenerate APIs
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ Playwright is a Java library to automate [Chromium](https://www.chromium.org/Hom
|
|||||||
|
|
||||||
| | Linux | macOS | Windows |
|
| | Linux | macOS | Windows |
|
||||||
| :--- | :---: | :---: | :---: |
|
| :--- | :---: | :---: | :---: |
|
||||||
| Chromium <!-- GEN:chromium-version -->149.0.7827.55<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
| Chromium <!-- GEN:chromium-version -->151.0.7922.34<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||||
| WebKit <!-- GEN:webkit-version -->26.5<!-- GEN:stop --> | ✅ | ✅ | ✅ |
|
| WebKit <!-- GEN:webkit-version -->26.5<!-- GEN:stop --> | ✅ | ✅ | ✅ |
|
||||||
| Firefox <!-- GEN:firefox-version -->151.0<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
| Firefox <!-- GEN:firefox-version -->153.0<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.microsoft.playwright</groupId>
|
<groupId>com.microsoft.playwright</groupId>
|
||||||
<artifactId>parent-pom</artifactId>
|
<artifactId>parent-pom</artifactId>
|
||||||
<version>1.61.0</version>
|
<version>1.62.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>driver-bundle</artifactId>
|
<artifactId>driver-bundle</artifactId>
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.microsoft.playwright</groupId>
|
<groupId>com.microsoft.playwright</groupId>
|
||||||
<artifactId>parent-pom</artifactId>
|
<artifactId>parent-pom</artifactId>
|
||||||
<version>1.61.0</version>
|
<version>1.62.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>driver</artifactId>
|
<artifactId>driver</artifactId>
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import static com.microsoft.playwright.impl.driver.DriverLogging.logWithTimestam
|
|||||||
public abstract class Driver {
|
public abstract class Driver {
|
||||||
protected final Map<String, String> env = new LinkedHashMap<>(System.getenv());
|
protected final Map<String, String> env = new LinkedHashMap<>(System.getenv());
|
||||||
public static final String PLAYWRIGHT_NODEJS_PATH = "PLAYWRIGHT_NODEJS_PATH";
|
public static final String PLAYWRIGHT_NODEJS_PATH = "PLAYWRIGHT_NODEJS_PATH";
|
||||||
|
public static final String PLAYWRIGHT_DRIVER_DIR = "PLAYWRIGHT_DRIVER_DIR";
|
||||||
|
|
||||||
private static Driver instance;
|
private static Driver instance;
|
||||||
|
|
||||||
@@ -108,9 +109,12 @@ public abstract class Driver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static Driver newInstance() throws Exception {
|
private static Driver newInstance() throws Exception {
|
||||||
String pathFromProperty = System.getProperty("playwright.cli.dir");
|
String driverDir = System.getProperty("playwright.cli.dir");
|
||||||
if (pathFromProperty != null) {
|
if (driverDir == null) {
|
||||||
return new PreinstalledDriver(Paths.get(pathFromProperty));
|
driverDir = System.getenv(PLAYWRIGHT_DRIVER_DIR);
|
||||||
|
}
|
||||||
|
if (driverDir != null) {
|
||||||
|
return new PreinstalledDriver(Paths.get(driverDir));
|
||||||
}
|
}
|
||||||
|
|
||||||
String driverImpl =
|
String driverImpl =
|
||||||
|
|||||||
@@ -30,17 +30,11 @@ public class DriverJar extends Driver {
|
|||||||
private static final String PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD = "PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD";
|
private static final String PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD = "PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD";
|
||||||
private static final String SELENIUM_REMOTE_URL = "SELENIUM_REMOTE_URL";
|
private static final String SELENIUM_REMOTE_URL = "SELENIUM_REMOTE_URL";
|
||||||
private final Path driverTempDir;
|
private final Path driverTempDir;
|
||||||
|
private final boolean deleteOnExit;
|
||||||
private Path preinstalledNodePath;
|
private Path preinstalledNodePath;
|
||||||
|
|
||||||
public DriverJar() throws IOException {
|
public DriverJar() throws IOException {
|
||||||
// Allow specifying custom path for the driver installation
|
this(createTempDriverDir(), true);
|
||||||
// See https://github.com/microsoft/playwright-java/issues/728
|
|
||||||
String alternativeTmpdir = System.getProperty("playwright.driver.tmpdir");
|
|
||||||
String prefix = "playwright-java-";
|
|
||||||
driverTempDir = alternativeTmpdir == null
|
|
||||||
? Files.createTempDirectory(prefix)
|
|
||||||
: Files.createTempDirectory(Paths.get(alternativeTmpdir), prefix);
|
|
||||||
driverTempDir.toFile().deleteOnExit();
|
|
||||||
String nodePath = System.getProperty("playwright.nodejs.path");
|
String nodePath = System.getProperty("playwright.nodejs.path");
|
||||||
if (nodePath != null) {
|
if (nodePath != null) {
|
||||||
preinstalledNodePath = Paths.get(nodePath);
|
preinstalledNodePath = Paths.get(nodePath);
|
||||||
@@ -51,6 +45,32 @@ public class DriverJar extends Driver {
|
|||||||
logMessage("created DriverJar: " + driverTempDir);
|
logMessage("created DriverJar: " + driverTempDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private DriverJar(Path driverDir, boolean deleteOnExit) {
|
||||||
|
this.driverTempDir = driverDir;
|
||||||
|
this.deleteOnExit = deleteOnExit;
|
||||||
|
if (deleteOnExit) {
|
||||||
|
driverTempDir.toFile().deleteOnExit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Path createTempDriverDir() throws IOException {
|
||||||
|
// Allow specifying custom path for the driver installation
|
||||||
|
// See https://github.com/microsoft/playwright-java/issues/728
|
||||||
|
String alternativeTmpdir = System.getProperty("playwright.driver.tmpdir");
|
||||||
|
String prefix = "playwright-java-";
|
||||||
|
return alternativeTmpdir == null
|
||||||
|
? Files.createTempDirectory(prefix)
|
||||||
|
: Files.createTempDirectory(Paths.get(alternativeTmpdir), prefix);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Extracts the driver (playwright-core package and the Node.js binary for the current platform)
|
||||||
|
// into the given directory, persistently. Point playwright.cli.dir / PLAYWRIGHT_DRIVER_DIR at it
|
||||||
|
// to run without extracting to a temp directory on every launch. See issue #1268.
|
||||||
|
public static void installDriverTo(Path driverDir) throws IOException, URISyntaxException {
|
||||||
|
Files.createDirectories(driverDir);
|
||||||
|
new DriverJar(driverDir, false).extractDriverToTempDir();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initialize(Boolean installBrowsers) throws Exception {
|
protected void initialize(Boolean installBrowsers) throws Exception {
|
||||||
if (preinstalledNodePath == null && env.containsKey(PLAYWRIGHT_NODEJS_PATH)) {
|
if (preinstalledNodePath == null && env.containsKey(PLAYWRIGHT_NODEJS_PATH)) {
|
||||||
@@ -156,7 +176,9 @@ public class DriverJar extends Driver {
|
|||||||
toPath.toFile().setExecutable(true, true);
|
toPath.toFile().setExecutable(true, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
toPath.toFile().deleteOnExit();
|
if (deleteOnExit) {
|
||||||
|
toPath.toFile().deleteOnExit();
|
||||||
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException("Failed to extract driver from " + uri + ", full uri: " + originalUri, e);
|
throw new RuntimeException("Failed to extract driver from " + uri + ", full uri: " + originalUri, e);
|
||||||
}
|
}
|
||||||
@@ -179,7 +201,9 @@ public class DriverJar extends Driver {
|
|||||||
Path fromPath = Paths.get(jarUri);
|
Path fromPath = Paths.get(jarUri);
|
||||||
Path toPath = driverTempDir.resolve(fromPath.getFileName().toString());
|
Path toPath = driverTempDir.resolve(fromPath.getFileName().toString());
|
||||||
Files.copy(fromPath, toPath);
|
Files.copy(fromPath, toPath);
|
||||||
toPath.toFile().deleteOnExit();
|
if (deleteOnExit) {
|
||||||
|
toPath.toFile().deleteOnExit();
|
||||||
|
}
|
||||||
return new URI("jar:" + toPath.toUri() + JAR_URL_SEPARATOR + parts[2]);
|
return new URI("jar:" + toPath.toUri() + JAR_URL_SEPARATOR + parts[2]);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException("Failed to extract driver's nested .jar from " + jarUri + "; full uri: " + uri, e);
|
throw new RuntimeException("Failed to extract driver's nested .jar from " + jarUri + "; full uri: " + uri, e);
|
||||||
|
|||||||
+2
-2
@@ -6,11 +6,11 @@
|
|||||||
|
|
||||||
<groupId>org.example</groupId>
|
<groupId>org.example</groupId>
|
||||||
<artifactId>examples</artifactId>
|
<artifactId>examples</artifactId>
|
||||||
<version>1.61.0</version>
|
<version>1.62.0</version>
|
||||||
<name>Playwright Client Examples</name>
|
<name>Playwright Client Examples</name>
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<playwright.version>1.61.0</playwright.version>
|
<playwright.version>1.62.0</playwright.version>
|
||||||
</properties>
|
</properties>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.microsoft.playwright</groupId>
|
<groupId>com.microsoft.playwright</groupId>
|
||||||
<artifactId>parent-pom</artifactId>
|
<artifactId>parent-pom</artifactId>
|
||||||
<version>1.61.0</version>
|
<version>1.62.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>playwright</artifactId>
|
<artifactId>playwright</artifactId>
|
||||||
|
|||||||
@@ -87,6 +87,16 @@ public interface APIResponse {
|
|||||||
* @since v1.16
|
* @since v1.16
|
||||||
*/
|
*/
|
||||||
String text();
|
String text();
|
||||||
|
/**
|
||||||
|
* Returns resource timing information for given response. For redirected requests, returns the information for the last
|
||||||
|
* request in the redirect chain. When the response is served <a
|
||||||
|
* href="https://playwright.dev/java/docs/mock#replaying-from-har">from the HAR file</a>, timing information is not
|
||||||
|
* available and all the values are -1. Find more information at <a
|
||||||
|
* href="https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming">Resource Timing API</a>.
|
||||||
|
*
|
||||||
|
* @since v1.62
|
||||||
|
*/
|
||||||
|
Timing timing();
|
||||||
/**
|
/**
|
||||||
* Contains the URL of the response.
|
* Contains the URL of the response.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -449,6 +449,16 @@ public interface BrowserContext extends AutoCloseable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
class StorageStateOptions {
|
class StorageStateOptions {
|
||||||
|
/**
|
||||||
|
* Set to {@code true} to include the context's virtual WebAuthn {@link com.microsoft.playwright.BrowserContext#credentials
|
||||||
|
* BrowserContext.credentials()} (passkeys) in the storage state snapshot. The captured credentials carry their private
|
||||||
|
* keys, so they can be re-seeded into a later context via the {@code storageState} option or {@link
|
||||||
|
* com.microsoft.playwright.BrowserContext#setStorageState BrowserContext.setStorageState()}. Note that restoring the
|
||||||
|
* storage state that contains credentials will automatically install the virtual WebAuthn authenticator (see {@link
|
||||||
|
* com.microsoft.playwright.Credentials#install Credentials.install()}), and prevent all real authenticators from working
|
||||||
|
* in this context.
|
||||||
|
*/
|
||||||
|
public Boolean credentials;
|
||||||
/**
|
/**
|
||||||
* Set to {@code true} to include <a href="https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API">IndexedDB</a> in
|
* Set to {@code true} to include <a href="https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API">IndexedDB</a> in
|
||||||
* the storage state snapshot. If your application uses IndexedDB to store authentication tokens, like Firebase
|
* the storage state snapshot. If your application uses IndexedDB to store authentication tokens, like Firebase
|
||||||
@@ -461,6 +471,19 @@ public interface BrowserContext extends AutoCloseable {
|
|||||||
*/
|
*/
|
||||||
public Path path;
|
public Path path;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set to {@code true} to include the context's virtual WebAuthn {@link com.microsoft.playwright.BrowserContext#credentials
|
||||||
|
* BrowserContext.credentials()} (passkeys) in the storage state snapshot. The captured credentials carry their private
|
||||||
|
* keys, so they can be re-seeded into a later context via the {@code storageState} option or {@link
|
||||||
|
* com.microsoft.playwright.BrowserContext#setStorageState BrowserContext.setStorageState()}. Note that restoring the
|
||||||
|
* storage state that contains credentials will automatically install the virtual WebAuthn authenticator (see {@link
|
||||||
|
* com.microsoft.playwright.Credentials#install Credentials.install()}), and prevent all real authenticators from working
|
||||||
|
* in this context.
|
||||||
|
*/
|
||||||
|
public StorageStateOptions setCredentials(boolean credentials) {
|
||||||
|
this.credentials = credentials;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Set to {@code true} to include <a href="https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API">IndexedDB</a> in
|
* Set to {@code true} to include <a href="https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API">IndexedDB</a> in
|
||||||
* the storage state snapshot. If your application uses IndexedDB to store authentication tokens, like Firebase
|
* the storage state snapshot. If your application uses IndexedDB to store authentication tokens, like Firebase
|
||||||
@@ -1469,7 +1492,8 @@ public interface BrowserContext extends AutoCloseable {
|
|||||||
*/
|
*/
|
||||||
void setOffline(boolean offline);
|
void setOffline(boolean offline);
|
||||||
/**
|
/**
|
||||||
* Returns storage state for this browser context, contains current cookies, local storage snapshot and IndexedDB snapshot.
|
* Returns storage state for this browser context, contains current cookies, local storage snapshot, IndexedDB snapshot and
|
||||||
|
* virtual WebAuthn credentials.
|
||||||
*
|
*
|
||||||
* @since v1.8
|
* @since v1.8
|
||||||
*/
|
*/
|
||||||
@@ -1477,13 +1501,17 @@ public interface BrowserContext extends AutoCloseable {
|
|||||||
return storageState(null);
|
return storageState(null);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Returns storage state for this browser context, contains current cookies, local storage snapshot and IndexedDB snapshot.
|
* Returns storage state for this browser context, contains current cookies, local storage snapshot, IndexedDB snapshot and
|
||||||
|
* virtual WebAuthn credentials.
|
||||||
*
|
*
|
||||||
* @since v1.8
|
* @since v1.8
|
||||||
*/
|
*/
|
||||||
String storageState(StorageStateOptions options);
|
String storageState(StorageStateOptions options);
|
||||||
/**
|
/**
|
||||||
* Clears the existing cookies, local storage and IndexedDB entries for all origins and sets the new storage state.
|
* Clears the existing cookies, local storage, IndexedDB entries and virtual WebAuthn credentials, and sets the new storage
|
||||||
|
* state. When the storage state contains credentials, the virtual WebAuthn authenticator is installed (equivalent to
|
||||||
|
* {@link com.microsoft.playwright.Credentials#install Credentials.install()}), preventing all real authenticators from
|
||||||
|
* working in this context.
|
||||||
*
|
*
|
||||||
* <p> <strong>Usage</strong>
|
* <p> <strong>Usage</strong>
|
||||||
* <pre>{@code
|
* <pre>{@code
|
||||||
|
|||||||
@@ -1314,6 +1314,9 @@ public interface BrowserType {
|
|||||||
* advanced functionality, you probably want to use {@link com.microsoft.playwright.BrowserType#connect
|
* advanced functionality, you probably want to use {@link com.microsoft.playwright.BrowserType#connect
|
||||||
* BrowserType.connect()}.
|
* BrowserType.connect()}.
|
||||||
*
|
*
|
||||||
|
* <p> <strong>NOTE:</strong> Playwright maintains a curated list of arguments for launching the browser. If you launch the browser without Playwright
|
||||||
|
* and do not pass the exact same arguments, some of Playwright functionality may be broken upon connecting to the browser.
|
||||||
|
*
|
||||||
* <p> <strong>Usage</strong>
|
* <p> <strong>Usage</strong>
|
||||||
* <pre>{@code
|
* <pre>{@code
|
||||||
* Browser browser = playwright.chromium().connectOverCDP("http://localhost:9222");
|
* Browser browser = playwright.chromium().connectOverCDP("http://localhost:9222");
|
||||||
@@ -1340,6 +1343,9 @@ public interface BrowserType {
|
|||||||
* advanced functionality, you probably want to use {@link com.microsoft.playwright.BrowserType#connect
|
* advanced functionality, you probably want to use {@link com.microsoft.playwright.BrowserType#connect
|
||||||
* BrowserType.connect()}.
|
* BrowserType.connect()}.
|
||||||
*
|
*
|
||||||
|
* <p> <strong>NOTE:</strong> Playwright maintains a curated list of arguments for launching the browser. If you launch the browser without Playwright
|
||||||
|
* and do not pass the exact same arguments, some of Playwright functionality may be broken upon connecting to the browser.
|
||||||
|
*
|
||||||
* <p> <strong>Usage</strong>
|
* <p> <strong>Usage</strong>
|
||||||
* <pre>{@code
|
* <pre>{@code
|
||||||
* Browser browser = playwright.chromium().connectOverCDP("http://localhost:9222");
|
* Browser browser = playwright.chromium().connectOverCDP("http://localhost:9222");
|
||||||
|
|||||||
@@ -17,9 +17,12 @@
|
|||||||
package com.microsoft.playwright;
|
package com.microsoft.playwright;
|
||||||
|
|
||||||
import com.microsoft.playwright.impl.driver.Driver;
|
import com.microsoft.playwright.impl.driver.Driver;
|
||||||
|
import com.microsoft.playwright.impl.driver.jar.DriverJar;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
import static java.util.Arrays.asList;
|
import static java.util.Arrays.asList;
|
||||||
@@ -28,7 +31,13 @@ import static java.util.Arrays.asList;
|
|||||||
* Use this class to launch playwright cli.
|
* Use this class to launch playwright cli.
|
||||||
*/
|
*/
|
||||||
public class CLI {
|
public class CLI {
|
||||||
public static void main(String[] args) throws IOException, InterruptedException {
|
public static void main(String[] args) throws IOException, InterruptedException, URISyntaxException {
|
||||||
|
// Extract the driver into a fixed directory instead of running the playwright CLI. This is
|
||||||
|
// handled in Java because it must not require an already-extracted driver. See issue #1268.
|
||||||
|
if (args.length > 0 && "install-driver".equals(args[0])) {
|
||||||
|
installDriver(args);
|
||||||
|
return;
|
||||||
|
}
|
||||||
Driver driver = Driver.ensureDriverInstalled(Collections.emptyMap(), false);
|
Driver driver = Driver.ensureDriverInstalled(Collections.emptyMap(), false);
|
||||||
ProcessBuilder pb = driver.createProcessBuilder();
|
ProcessBuilder pb = driver.createProcessBuilder();
|
||||||
pb.command().addAll(asList(args));
|
pb.command().addAll(asList(args));
|
||||||
@@ -40,4 +49,17 @@ public class CLI {
|
|||||||
Process process = pb.start();
|
Process process = pb.start();
|
||||||
System.exit(process.waitFor());
|
System.exit(process.waitFor());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void installDriver(String[] args) throws IOException, URISyntaxException {
|
||||||
|
String dir = args.length > 1 ? args[1] : System.getenv(Driver.PLAYWRIGHT_DRIVER_DIR);
|
||||||
|
if (dir == null) {
|
||||||
|
System.err.println("Usage: install-driver <dir> (or set the " + Driver.PLAYWRIGHT_DRIVER_DIR
|
||||||
|
+ " environment variable)");
|
||||||
|
System.exit(1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Path driverDir = Paths.get(dir);
|
||||||
|
DriverJar.installDriverTo(driverDir);
|
||||||
|
System.out.println("Installed Playwright driver into " + driverDir.toAbsolutePath());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import java.util.*;
|
|||||||
* passkeys and answer {@code navigator.credentials.create()} / {@code navigator.credentials.get()} ceremonies in the page,
|
* passkeys and answer {@code navigator.credentials.create()} / {@code navigator.credentials.get()} ceremonies in the page,
|
||||||
* without a real authenticator or hardware security key.
|
* without a real authenticator or hardware security key.
|
||||||
*
|
*
|
||||||
* <p> There are two common ways to use it:
|
* <p> There are three common ways to use it:
|
||||||
*
|
*
|
||||||
* <p> <strong>Usage: seed a known credential</strong>
|
* <p> <strong>Usage: seed a known credential</strong>
|
||||||
* <pre>{@code
|
* <pre>{@code
|
||||||
@@ -43,7 +43,7 @@ import java.util.*;
|
|||||||
* // The page's navigator.credentials.get() is answered with the seeded passkey.
|
* // The page's navigator.credentials.get() is answered with the seeded passkey.
|
||||||
* }</pre>
|
* }</pre>
|
||||||
*
|
*
|
||||||
* <p> <strong>Usage: capture a passkey, then reuse it</strong>
|
* <p> <strong>Usage: capture a credential, then reuse it</strong>
|
||||||
* <pre>{@code
|
* <pre>{@code
|
||||||
* // setup test: let the app register a passkey, then save it.
|
* // setup test: let the app register a passkey, then save it.
|
||||||
* BrowserContext context = browser.newContext();
|
* BrowserContext context = browser.newContext();
|
||||||
@@ -75,6 +75,11 @@ import java.util.*;
|
|||||||
* // navigator.credentials.get() resolves the captured passkey — already signed in.
|
* // navigator.credentials.get() resolves the captured passkey — already signed in.
|
||||||
* }</pre>
|
* }</pre>
|
||||||
*
|
*
|
||||||
|
* <p> <strong>Usage: save credentials in the storage state, restore later</strong>
|
||||||
|
*
|
||||||
|
* <p> See <a href="https://playwright.dev/java/docs/auth">authentication guide</a> for examples of using saving and resotring
|
||||||
|
* the storage state.
|
||||||
|
*
|
||||||
* <p> <strong>Defaults</strong>
|
* <p> <strong>Defaults</strong>
|
||||||
*/
|
*/
|
||||||
public interface Credentials {
|
public interface Credentials {
|
||||||
|
|||||||
@@ -73,6 +73,13 @@ public interface ElementHandle extends JSHandle {
|
|||||||
* element.
|
* element.
|
||||||
*/
|
*/
|
||||||
public Position position;
|
public Position position;
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public ScrollMode scroll;
|
||||||
/**
|
/**
|
||||||
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
|
* 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 com.microsoft.playwright.BrowserContext#setDefaultTimeout
|
* value can be changed by using the {@link com.microsoft.playwright.BrowserContext#setDefaultTimeout
|
||||||
@@ -117,6 +124,16 @@ public interface ElementHandle extends JSHandle {
|
|||||||
this.position = position;
|
this.position = position;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public CheckOptions setScroll(ScrollMode scroll) {
|
||||||
|
this.scroll = scroll;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
|
* 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 com.microsoft.playwright.BrowserContext#setDefaultTimeout
|
* value can be changed by using the {@link com.microsoft.playwright.BrowserContext#setDefaultTimeout
|
||||||
@@ -170,6 +187,13 @@ public interface ElementHandle extends JSHandle {
|
|||||||
* element.
|
* element.
|
||||||
*/
|
*/
|
||||||
public Position position;
|
public Position position;
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public ScrollMode scroll;
|
||||||
/**
|
/**
|
||||||
* Defaults to 1. Sends {@code n} interpolated {@code mousemove} events to represent travel between Playwright's current
|
* Defaults to 1. Sends {@code n} interpolated {@code mousemove} events to represent travel between Playwright's current
|
||||||
* cursor position and the provided destination. When set to 1, emits a single {@code mousemove} event at the destination
|
* cursor position and the provided destination. When set to 1, emits a single {@code mousemove} event at the destination
|
||||||
@@ -250,6 +274,16 @@ public interface ElementHandle extends JSHandle {
|
|||||||
this.position = position;
|
this.position = position;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public ClickOptions setScroll(ScrollMode scroll) {
|
||||||
|
this.scroll = scroll;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Defaults to 1. Sends {@code n} interpolated {@code mousemove} events to represent travel between Playwright's current
|
* Defaults to 1. Sends {@code n} interpolated {@code mousemove} events to represent travel between Playwright's current
|
||||||
* cursor position and the provided destination. When set to 1, emits a single {@code mousemove} event at the destination
|
* cursor position and the provided destination. When set to 1, emits a single {@code mousemove} event at the destination
|
||||||
@@ -308,6 +342,13 @@ public interface ElementHandle extends JSHandle {
|
|||||||
* element.
|
* element.
|
||||||
*/
|
*/
|
||||||
public Position position;
|
public Position position;
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public ScrollMode scroll;
|
||||||
/**
|
/**
|
||||||
* Defaults to 1. Sends {@code n} interpolated {@code mousemove} events to represent travel between Playwright's current
|
* Defaults to 1. Sends {@code n} interpolated {@code mousemove} events to represent travel between Playwright's current
|
||||||
* cursor position and the provided destination. When set to 1, emits a single {@code mousemove} event at the destination
|
* cursor position and the provided destination. When set to 1, emits a single {@code mousemove} event at the destination
|
||||||
@@ -381,6 +422,16 @@ public interface ElementHandle extends JSHandle {
|
|||||||
this.position = position;
|
this.position = position;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public DblclickOptions setScroll(ScrollMode scroll) {
|
||||||
|
this.scroll = scroll;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Defaults to 1. Sends {@code n} interpolated {@code mousemove} events to represent travel between Playwright's current
|
* Defaults to 1. Sends {@code n} interpolated {@code mousemove} events to represent travel between Playwright's current
|
||||||
* cursor position and the provided destination. When set to 1, emits a single {@code mousemove} event at the destination
|
* cursor position and the provided destination. When set to 1, emits a single {@code mousemove} event at the destination
|
||||||
@@ -475,6 +526,13 @@ public interface ElementHandle extends JSHandle {
|
|||||||
* element.
|
* element.
|
||||||
*/
|
*/
|
||||||
public Position position;
|
public Position position;
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public ScrollMode scroll;
|
||||||
/**
|
/**
|
||||||
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
|
* 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 com.microsoft.playwright.BrowserContext#setDefaultTimeout
|
* value can be changed by using the {@link com.microsoft.playwright.BrowserContext#setDefaultTimeout
|
||||||
@@ -528,6 +586,16 @@ public interface ElementHandle extends JSHandle {
|
|||||||
this.position = position;
|
this.position = position;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public HoverOptions setScroll(ScrollMode scroll) {
|
||||||
|
this.scroll = scroll;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
|
* 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 com.microsoft.playwright.BrowserContext#setDefaultTimeout
|
* value can be changed by using the {@link com.microsoft.playwright.BrowserContext#setDefaultTimeout
|
||||||
@@ -550,18 +618,12 @@ public interface ElementHandle extends JSHandle {
|
|||||||
}
|
}
|
||||||
class InputValueOptions {
|
class InputValueOptions {
|
||||||
/**
|
/**
|
||||||
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
|
* @deprecated This option is ignored. The value is returned immediately.
|
||||||
* value can be changed by using the {@link com.microsoft.playwright.BrowserContext#setDefaultTimeout
|
|
||||||
* BrowserContext.setDefaultTimeout()} or {@link com.microsoft.playwright.Page#setDefaultTimeout Page.setDefaultTimeout()}
|
|
||||||
* methods.
|
|
||||||
*/
|
*/
|
||||||
public Double timeout;
|
public Double timeout;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
|
* @deprecated This option is ignored. The value is returned immediately.
|
||||||
* value can be changed by using the {@link com.microsoft.playwright.BrowserContext#setDefaultTimeout
|
|
||||||
* BrowserContext.setDefaultTimeout()} or {@link com.microsoft.playwright.Page#setDefaultTimeout Page.setDefaultTimeout()}
|
|
||||||
* methods.
|
|
||||||
*/
|
*/
|
||||||
public InputValueOptions setTimeout(double timeout) {
|
public InputValueOptions setTimeout(double timeout) {
|
||||||
this.timeout = timeout;
|
this.timeout = timeout;
|
||||||
@@ -652,7 +714,9 @@ public interface ElementHandle extends JSHandle {
|
|||||||
*/
|
*/
|
||||||
public Path path;
|
public Path path;
|
||||||
/**
|
/**
|
||||||
* The quality of the image, between 0-100. Not applicable to {@code png} images.
|
* The quality of the image, between 0-100. Not applicable to {@code png} images. For {@code jpeg} the default is {@code
|
||||||
|
* 80}. For {@code webp}, a quality of {@code 100} (the default) produces a lossless image, while lower values use lossy
|
||||||
|
* compression.
|
||||||
*/
|
*/
|
||||||
public Integer quality;
|
public Integer quality;
|
||||||
/**
|
/**
|
||||||
@@ -740,7 +804,9 @@ public interface ElementHandle extends JSHandle {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* The quality of the image, between 0-100. Not applicable to {@code png} images.
|
* The quality of the image, between 0-100. Not applicable to {@code png} images. For {@code jpeg} the default is {@code
|
||||||
|
* 80}. For {@code webp}, a quality of {@code 100} (the default) produces a lossless image, while lower values use lossy
|
||||||
|
* compression.
|
||||||
*/
|
*/
|
||||||
public ScreenshotOptions setQuality(int quality) {
|
public ScreenshotOptions setQuality(int quality) {
|
||||||
this.quality = quality;
|
this.quality = quality;
|
||||||
@@ -896,6 +962,13 @@ public interface ElementHandle extends JSHandle {
|
|||||||
* element.
|
* element.
|
||||||
*/
|
*/
|
||||||
public Position position;
|
public Position position;
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public ScrollMode scroll;
|
||||||
/**
|
/**
|
||||||
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
|
* 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 com.microsoft.playwright.BrowserContext#setDefaultTimeout
|
* value can be changed by using the {@link com.microsoft.playwright.BrowserContext#setDefaultTimeout
|
||||||
@@ -940,6 +1013,16 @@ public interface ElementHandle extends JSHandle {
|
|||||||
this.position = position;
|
this.position = position;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public SetCheckedOptions setScroll(ScrollMode scroll) {
|
||||||
|
this.scroll = scroll;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
|
* 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 com.microsoft.playwright.BrowserContext#setDefaultTimeout
|
* value can be changed by using the {@link com.microsoft.playwright.BrowserContext#setDefaultTimeout
|
||||||
@@ -1012,6 +1095,13 @@ public interface ElementHandle extends JSHandle {
|
|||||||
* element.
|
* element.
|
||||||
*/
|
*/
|
||||||
public Position position;
|
public Position position;
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public ScrollMode scroll;
|
||||||
/**
|
/**
|
||||||
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
|
* 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 com.microsoft.playwright.BrowserContext#setDefaultTimeout
|
* value can be changed by using the {@link com.microsoft.playwright.BrowserContext#setDefaultTimeout
|
||||||
@@ -1065,6 +1155,16 @@ public interface ElementHandle extends JSHandle {
|
|||||||
this.position = position;
|
this.position = position;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public TapOptions setScroll(ScrollMode scroll) {
|
||||||
|
this.scroll = scroll;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
|
* 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 com.microsoft.playwright.BrowserContext#setDefaultTimeout
|
* value can be changed by using the {@link com.microsoft.playwright.BrowserContext#setDefaultTimeout
|
||||||
@@ -1142,6 +1242,13 @@ public interface ElementHandle extends JSHandle {
|
|||||||
* element.
|
* element.
|
||||||
*/
|
*/
|
||||||
public Position position;
|
public Position position;
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public ScrollMode scroll;
|
||||||
/**
|
/**
|
||||||
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
|
* 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 com.microsoft.playwright.BrowserContext#setDefaultTimeout
|
* value can be changed by using the {@link com.microsoft.playwright.BrowserContext#setDefaultTimeout
|
||||||
@@ -1186,6 +1293,16 @@ public interface ElementHandle extends JSHandle {
|
|||||||
this.position = position;
|
this.position = position;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public UncheckOptions setScroll(ScrollMode scroll) {
|
||||||
|
this.scroll = scroll;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
|
* 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 com.microsoft.playwright.BrowserContext#setDefaultTimeout
|
* value can be changed by using the {@link com.microsoft.playwright.BrowserContext#setDefaultTimeout
|
||||||
|
|||||||
@@ -165,6 +165,13 @@ public interface Frame {
|
|||||||
* element.
|
* element.
|
||||||
*/
|
*/
|
||||||
public Position position;
|
public Position position;
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public ScrollMode scroll;
|
||||||
/**
|
/**
|
||||||
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
||||||
* element, the call throws an exception.
|
* element, the call throws an exception.
|
||||||
@@ -214,6 +221,16 @@ public interface Frame {
|
|||||||
this.position = position;
|
this.position = position;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public CheckOptions setScroll(ScrollMode scroll) {
|
||||||
|
this.scroll = scroll;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
||||||
* element, the call throws an exception.
|
* element, the call throws an exception.
|
||||||
@@ -275,6 +292,13 @@ public interface Frame {
|
|||||||
* element.
|
* element.
|
||||||
*/
|
*/
|
||||||
public Position position;
|
public Position position;
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public ScrollMode scroll;
|
||||||
/**
|
/**
|
||||||
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
||||||
* element, the call throws an exception.
|
* element, the call throws an exception.
|
||||||
@@ -355,6 +379,16 @@ public interface Frame {
|
|||||||
this.position = position;
|
this.position = position;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public ClickOptions setScroll(ScrollMode scroll) {
|
||||||
|
this.scroll = scroll;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
||||||
* element, the call throws an exception.
|
* element, the call throws an exception.
|
||||||
@@ -413,6 +447,13 @@ public interface Frame {
|
|||||||
* element.
|
* element.
|
||||||
*/
|
*/
|
||||||
public Position position;
|
public Position position;
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public ScrollMode scroll;
|
||||||
/**
|
/**
|
||||||
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
||||||
* element, the call throws an exception.
|
* element, the call throws an exception.
|
||||||
@@ -486,6 +527,16 @@ public interface Frame {
|
|||||||
this.position = position;
|
this.position = position;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public DblclickOptions setScroll(ScrollMode scroll) {
|
||||||
|
this.scroll = scroll;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
||||||
* element, the call throws an exception.
|
* element, the call throws an exception.
|
||||||
@@ -558,6 +609,13 @@ public interface Frame {
|
|||||||
* @deprecated This option has no effect.
|
* @deprecated This option has no effect.
|
||||||
*/
|
*/
|
||||||
public Boolean noWaitAfter;
|
public Boolean noWaitAfter;
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public ScrollMode scroll;
|
||||||
/**
|
/**
|
||||||
* Clicks on the source element at this point relative to the top-left corner of the element's padding box. If not
|
* Clicks on the source element at this point relative to the top-left corner of the element's padding box. If not
|
||||||
* specified, some visible point of the element is used.
|
* specified, some visible point of the element is used.
|
||||||
@@ -607,6 +665,16 @@ public interface Frame {
|
|||||||
this.noWaitAfter = noWaitAfter;
|
this.noWaitAfter = noWaitAfter;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public DragAndDropOptions setScroll(ScrollMode scroll) {
|
||||||
|
this.scroll = scroll;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Clicks on the source element at this point relative to the top-left corner of the element's padding box. If not
|
* Clicks on the source element at this point relative to the top-left corner of the element's padding box. If not
|
||||||
* specified, some visible point of the element is used.
|
* specified, some visible point of the element is used.
|
||||||
@@ -1156,6 +1224,13 @@ public interface Frame {
|
|||||||
* element.
|
* element.
|
||||||
*/
|
*/
|
||||||
public Position position;
|
public Position position;
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public ScrollMode scroll;
|
||||||
/**
|
/**
|
||||||
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
||||||
* element, the call throws an exception.
|
* element, the call throws an exception.
|
||||||
@@ -1215,6 +1290,16 @@ public interface Frame {
|
|||||||
this.position = position;
|
this.position = position;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public HoverOptions setScroll(ScrollMode scroll) {
|
||||||
|
this.scroll = scroll;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
||||||
* element, the call throws an exception.
|
* element, the call throws an exception.
|
||||||
@@ -1772,6 +1857,13 @@ public interface Frame {
|
|||||||
* element.
|
* element.
|
||||||
*/
|
*/
|
||||||
public Position position;
|
public Position position;
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public ScrollMode scroll;
|
||||||
/**
|
/**
|
||||||
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
||||||
* element, the call throws an exception.
|
* element, the call throws an exception.
|
||||||
@@ -1821,6 +1913,16 @@ public interface Frame {
|
|||||||
this.position = position;
|
this.position = position;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public SetCheckedOptions setScroll(ScrollMode scroll) {
|
||||||
|
this.scroll = scroll;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
||||||
* element, the call throws an exception.
|
* element, the call throws an exception.
|
||||||
@@ -1963,6 +2065,13 @@ public interface Frame {
|
|||||||
* element.
|
* element.
|
||||||
*/
|
*/
|
||||||
public Position position;
|
public Position position;
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public ScrollMode scroll;
|
||||||
/**
|
/**
|
||||||
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
||||||
* element, the call throws an exception.
|
* element, the call throws an exception.
|
||||||
@@ -2022,6 +2131,16 @@ public interface Frame {
|
|||||||
this.position = position;
|
this.position = position;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public TapOptions setScroll(ScrollMode scroll) {
|
||||||
|
this.scroll = scroll;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
||||||
* element, the call throws an exception.
|
* element, the call throws an exception.
|
||||||
@@ -2154,6 +2273,13 @@ public interface Frame {
|
|||||||
* element.
|
* element.
|
||||||
*/
|
*/
|
||||||
public Position position;
|
public Position position;
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public ScrollMode scroll;
|
||||||
/**
|
/**
|
||||||
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
||||||
* element, the call throws an exception.
|
* element, the call throws an exception.
|
||||||
@@ -2203,6 +2329,16 @@ public interface Frame {
|
|||||||
this.position = position;
|
this.position = position;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public UncheckOptions setScroll(ScrollMode scroll) {
|
||||||
|
this.scroll = scroll;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
||||||
* element, the call throws an exception.
|
* element, the call throws an exception.
|
||||||
|
|||||||
@@ -145,6 +145,13 @@ public interface Locator {
|
|||||||
* element.
|
* element.
|
||||||
*/
|
*/
|
||||||
public Position position;
|
public Position position;
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public ScrollMode scroll;
|
||||||
/**
|
/**
|
||||||
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
|
* 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 com.microsoft.playwright.BrowserContext#setDefaultTimeout
|
* value can be changed by using the {@link com.microsoft.playwright.BrowserContext#setDefaultTimeout
|
||||||
@@ -189,6 +196,16 @@ public interface Locator {
|
|||||||
this.position = position;
|
this.position = position;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public CheckOptions setScroll(ScrollMode scroll) {
|
||||||
|
this.scroll = scroll;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
|
* 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 com.microsoft.playwright.BrowserContext#setDefaultTimeout
|
* value can be changed by using the {@link com.microsoft.playwright.BrowserContext#setDefaultTimeout
|
||||||
@@ -286,6 +303,13 @@ public interface Locator {
|
|||||||
* element.
|
* element.
|
||||||
*/
|
*/
|
||||||
public Position position;
|
public Position position;
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public ScrollMode scroll;
|
||||||
/**
|
/**
|
||||||
* Defaults to 1. Sends {@code n} interpolated {@code mousemove} events to represent travel between Playwright's current
|
* Defaults to 1. Sends {@code n} interpolated {@code mousemove} events to represent travel between Playwright's current
|
||||||
* cursor position and the provided destination. When set to 1, emits a single {@code mousemove} event at the destination
|
* cursor position and the provided destination. When set to 1, emits a single {@code mousemove} event at the destination
|
||||||
@@ -367,6 +391,16 @@ public interface Locator {
|
|||||||
this.position = position;
|
this.position = position;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public ClickOptions setScroll(ScrollMode scroll) {
|
||||||
|
this.scroll = scroll;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Defaults to 1. Sends {@code n} interpolated {@code mousemove} events to represent travel between Playwright's current
|
* Defaults to 1. Sends {@code n} interpolated {@code mousemove} events to represent travel between Playwright's current
|
||||||
* cursor position and the provided destination. When set to 1, emits a single {@code mousemove} event at the destination
|
* cursor position and the provided destination. When set to 1, emits a single {@code mousemove} event at the destination
|
||||||
@@ -426,6 +460,13 @@ public interface Locator {
|
|||||||
* element.
|
* element.
|
||||||
*/
|
*/
|
||||||
public Position position;
|
public Position position;
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public ScrollMode scroll;
|
||||||
/**
|
/**
|
||||||
* Defaults to 1. Sends {@code n} interpolated {@code mousemove} events to represent travel between Playwright's current
|
* Defaults to 1. Sends {@code n} interpolated {@code mousemove} events to represent travel between Playwright's current
|
||||||
* cursor position and the provided destination. When set to 1, emits a single {@code mousemove} event at the destination
|
* cursor position and the provided destination. When set to 1, emits a single {@code mousemove} event at the destination
|
||||||
@@ -500,6 +541,16 @@ public interface Locator {
|
|||||||
this.position = position;
|
this.position = position;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public DblclickOptions setScroll(ScrollMode scroll) {
|
||||||
|
this.scroll = scroll;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Defaults to 1. Sends {@code n} interpolated {@code mousemove} events to represent travel between Playwright's current
|
* Defaults to 1. Sends {@code n} interpolated {@code mousemove} events to represent travel between Playwright's current
|
||||||
* cursor position and the provided destination. When set to 1, emits a single {@code mousemove} event at the destination
|
* cursor position and the provided destination. When set to 1, emits a single {@code mousemove} event at the destination
|
||||||
@@ -560,6 +611,13 @@ public interface Locator {
|
|||||||
* @deprecated This option has no effect.
|
* @deprecated This option has no effect.
|
||||||
*/
|
*/
|
||||||
public Boolean noWaitAfter;
|
public Boolean noWaitAfter;
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public ScrollMode scroll;
|
||||||
/**
|
/**
|
||||||
* Clicks on the source element at this point relative to the top-left corner of the element's padding box. If not
|
* Clicks on the source element at this point relative to the top-left corner of the element's padding box. If not
|
||||||
* specified, some visible point of the element is used.
|
* specified, some visible point of the element is used.
|
||||||
@@ -604,6 +662,16 @@ public interface Locator {
|
|||||||
this.noWaitAfter = noWaitAfter;
|
this.noWaitAfter = noWaitAfter;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public DragToOptions setScroll(ScrollMode scroll) {
|
||||||
|
this.scroll = scroll;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Clicks on the source element at this point relative to the top-left corner of the element's padding box. If not
|
* Clicks on the source element at this point relative to the top-left corner of the element's padding box. If not
|
||||||
* specified, some visible point of the element is used.
|
* specified, some visible point of the element is used.
|
||||||
@@ -1241,6 +1309,13 @@ public interface Locator {
|
|||||||
* element.
|
* element.
|
||||||
*/
|
*/
|
||||||
public Position position;
|
public Position position;
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public ScrollMode scroll;
|
||||||
/**
|
/**
|
||||||
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
|
* 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 com.microsoft.playwright.BrowserContext#setDefaultTimeout
|
* value can be changed by using the {@link com.microsoft.playwright.BrowserContext#setDefaultTimeout
|
||||||
@@ -1295,6 +1370,16 @@ public interface Locator {
|
|||||||
this.position = position;
|
this.position = position;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public HoverOptions setScroll(ScrollMode scroll) {
|
||||||
|
this.scroll = scroll;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
|
* 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 com.microsoft.playwright.BrowserContext#setDefaultTimeout
|
* value can be changed by using the {@link com.microsoft.playwright.BrowserContext#setDefaultTimeout
|
||||||
@@ -1710,7 +1795,9 @@ public interface Locator {
|
|||||||
*/
|
*/
|
||||||
public Path path;
|
public Path path;
|
||||||
/**
|
/**
|
||||||
* The quality of the image, between 0-100. Not applicable to {@code png} images.
|
* The quality of the image, between 0-100. Not applicable to {@code png} images. For {@code jpeg} the default is {@code
|
||||||
|
* 80}. For {@code webp}, a quality of {@code 100} (the default) produces a lossless image, while lower values use lossy
|
||||||
|
* compression.
|
||||||
*/
|
*/
|
||||||
public Integer quality;
|
public Integer quality;
|
||||||
/**
|
/**
|
||||||
@@ -1798,7 +1885,9 @@ public interface Locator {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* The quality of the image, between 0-100. Not applicable to {@code png} images.
|
* The quality of the image, between 0-100. Not applicable to {@code png} images. For {@code jpeg} the default is {@code
|
||||||
|
* 80}. For {@code webp}, a quality of {@code 100} (the default) produces a lossless image, while lower values use lossy
|
||||||
|
* compression.
|
||||||
*/
|
*/
|
||||||
public ScreenshotOptions setQuality(int quality) {
|
public ScreenshotOptions setQuality(int quality) {
|
||||||
this.quality = quality;
|
this.quality = quality;
|
||||||
@@ -1954,6 +2043,13 @@ public interface Locator {
|
|||||||
* element.
|
* element.
|
||||||
*/
|
*/
|
||||||
public Position position;
|
public Position position;
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public ScrollMode scroll;
|
||||||
/**
|
/**
|
||||||
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
|
* 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 com.microsoft.playwright.BrowserContext#setDefaultTimeout
|
* value can be changed by using the {@link com.microsoft.playwright.BrowserContext#setDefaultTimeout
|
||||||
@@ -1998,6 +2094,16 @@ public interface Locator {
|
|||||||
this.position = position;
|
this.position = position;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public SetCheckedOptions setScroll(ScrollMode scroll) {
|
||||||
|
this.scroll = scroll;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
|
* 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 com.microsoft.playwright.BrowserContext#setDefaultTimeout
|
* value can be changed by using the {@link com.microsoft.playwright.BrowserContext#setDefaultTimeout
|
||||||
@@ -2070,6 +2176,13 @@ public interface Locator {
|
|||||||
* element.
|
* element.
|
||||||
*/
|
*/
|
||||||
public Position position;
|
public Position position;
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public ScrollMode scroll;
|
||||||
/**
|
/**
|
||||||
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
|
* 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 com.microsoft.playwright.BrowserContext#setDefaultTimeout
|
* value can be changed by using the {@link com.microsoft.playwright.BrowserContext#setDefaultTimeout
|
||||||
@@ -2124,6 +2237,16 @@ public interface Locator {
|
|||||||
this.position = position;
|
this.position = position;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public TapOptions setScroll(ScrollMode scroll) {
|
||||||
|
this.scroll = scroll;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
|
* 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 com.microsoft.playwright.BrowserContext#setDefaultTimeout
|
* value can be changed by using the {@link com.microsoft.playwright.BrowserContext#setDefaultTimeout
|
||||||
@@ -2222,6 +2345,13 @@ public interface Locator {
|
|||||||
* element.
|
* element.
|
||||||
*/
|
*/
|
||||||
public Position position;
|
public Position position;
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public ScrollMode scroll;
|
||||||
/**
|
/**
|
||||||
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
|
* 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 com.microsoft.playwright.BrowserContext#setDefaultTimeout
|
* value can be changed by using the {@link com.microsoft.playwright.BrowserContext#setDefaultTimeout
|
||||||
@@ -2266,6 +2396,16 @@ public interface Locator {
|
|||||||
this.position = position;
|
this.position = position;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public UncheckOptions setScroll(ScrollMode scroll) {
|
||||||
|
this.scroll = scroll;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
|
* 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 com.microsoft.playwright.BrowserContext#setDefaultTimeout
|
* value can be changed by using the {@link com.microsoft.playwright.BrowserContext#setDefaultTimeout
|
||||||
@@ -2333,6 +2473,26 @@ public interface Locator {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
class WaitForFunctionOptions {
|
||||||
|
/**
|
||||||
|
* 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 com.microsoft.playwright.BrowserContext#setDefaultTimeout
|
||||||
|
* BrowserContext.setDefaultTimeout()} or {@link com.microsoft.playwright.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 com.microsoft.playwright.BrowserContext#setDefaultTimeout
|
||||||
|
* BrowserContext.setDefaultTimeout()} or {@link com.microsoft.playwright.Page#setDefaultTimeout Page.setDefaultTimeout()}
|
||||||
|
* methods.
|
||||||
|
*/
|
||||||
|
public WaitForFunctionOptions setTimeout(double timeout) {
|
||||||
|
this.timeout = timeout;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* When the locator points to a list of elements, this returns an array of locators, pointing to their respective elements.
|
* When the locator points to a list of elements, this returns an array of locators, pointing to their respective elements.
|
||||||
*
|
*
|
||||||
@@ -5696,5 +5856,83 @@ public interface Locator {
|
|||||||
* @since v1.16
|
* @since v1.16
|
||||||
*/
|
*/
|
||||||
void waitFor(WaitForOptions options);
|
void waitFor(WaitForOptions options);
|
||||||
|
/**
|
||||||
|
* Returns when {@code expression} returns a truthy value, called with the matching element as a first argument, and {@code
|
||||||
|
* arg} as a second argument.
|
||||||
|
*
|
||||||
|
* <p> This is a generic way to wait for an element to reach a custom condition without asserting it. The locator is
|
||||||
|
* re-resolved on each retry, so it tolerates the element being re-rendered while waiting.
|
||||||
|
*
|
||||||
|
* <p> If {@code expression} returns a <a
|
||||||
|
* href='https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise'>Promise</a>, this method
|
||||||
|
* will wait for the promise to resolve before checking its value.
|
||||||
|
*
|
||||||
|
* <p> If {@code expression} throws or rejects, this method throws.
|
||||||
|
*
|
||||||
|
* <p> <strong>Usage</strong>
|
||||||
|
*
|
||||||
|
* <p> Wait for an attribute to appear:
|
||||||
|
*
|
||||||
|
* <p> Passing argument to {@code expression}:
|
||||||
|
*
|
||||||
|
* @param expression JavaScript expression to be evaluated in the browser context. If the expression evaluates to a function, the function is
|
||||||
|
* automatically invoked.
|
||||||
|
* @param arg Optional argument to pass to {@code expression}.
|
||||||
|
* @since v1.62
|
||||||
|
*/
|
||||||
|
default void waitForFunction(String expression, Object arg) {
|
||||||
|
waitForFunction(expression, arg, null);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Returns when {@code expression} returns a truthy value, called with the matching element as a first argument, and {@code
|
||||||
|
* arg} as a second argument.
|
||||||
|
*
|
||||||
|
* <p> This is a generic way to wait for an element to reach a custom condition without asserting it. The locator is
|
||||||
|
* re-resolved on each retry, so it tolerates the element being re-rendered while waiting.
|
||||||
|
*
|
||||||
|
* <p> If {@code expression} returns a <a
|
||||||
|
* href='https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise'>Promise</a>, this method
|
||||||
|
* will wait for the promise to resolve before checking its value.
|
||||||
|
*
|
||||||
|
* <p> If {@code expression} throws or rejects, this method throws.
|
||||||
|
*
|
||||||
|
* <p> <strong>Usage</strong>
|
||||||
|
*
|
||||||
|
* <p> Wait for an attribute to appear:
|
||||||
|
*
|
||||||
|
* <p> Passing argument to {@code expression}:
|
||||||
|
*
|
||||||
|
* @param expression JavaScript expression to be evaluated in the browser context. If the expression evaluates to a function, the function is
|
||||||
|
* automatically invoked.
|
||||||
|
* @since v1.62
|
||||||
|
*/
|
||||||
|
default void waitForFunction(String expression) {
|
||||||
|
waitForFunction(expression, null);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Returns when {@code expression} returns a truthy value, called with the matching element as a first argument, and {@code
|
||||||
|
* arg} as a second argument.
|
||||||
|
*
|
||||||
|
* <p> This is a generic way to wait for an element to reach a custom condition without asserting it. The locator is
|
||||||
|
* re-resolved on each retry, so it tolerates the element being re-rendered while waiting.
|
||||||
|
*
|
||||||
|
* <p> If {@code expression} returns a <a
|
||||||
|
* href='https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise'>Promise</a>, this method
|
||||||
|
* will wait for the promise to resolve before checking its value.
|
||||||
|
*
|
||||||
|
* <p> If {@code expression} throws or rejects, this method throws.
|
||||||
|
*
|
||||||
|
* <p> <strong>Usage</strong>
|
||||||
|
*
|
||||||
|
* <p> Wait for an attribute to appear:
|
||||||
|
*
|
||||||
|
* <p> Passing argument to {@code expression}:
|
||||||
|
*
|
||||||
|
* @param expression JavaScript expression to be evaluated in the browser context. If the expression evaluates to a function, the function is
|
||||||
|
* automatically invoked.
|
||||||
|
* @param arg Optional argument to pass to {@code expression}.
|
||||||
|
* @since v1.62
|
||||||
|
*/
|
||||||
|
void waitForFunction(String expression, Object arg, WaitForFunctionOptions options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -435,6 +435,13 @@ public interface Page extends AutoCloseable {
|
|||||||
* element.
|
* element.
|
||||||
*/
|
*/
|
||||||
public Position position;
|
public Position position;
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public ScrollMode scroll;
|
||||||
/**
|
/**
|
||||||
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
||||||
* element, the call throws an exception.
|
* element, the call throws an exception.
|
||||||
@@ -484,6 +491,16 @@ public interface Page extends AutoCloseable {
|
|||||||
this.position = position;
|
this.position = position;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public CheckOptions setScroll(ScrollMode scroll) {
|
||||||
|
this.scroll = scroll;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
||||||
* element, the call throws an exception.
|
* element, the call throws an exception.
|
||||||
@@ -545,6 +562,13 @@ public interface Page extends AutoCloseable {
|
|||||||
* element.
|
* element.
|
||||||
*/
|
*/
|
||||||
public Position position;
|
public Position position;
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public ScrollMode scroll;
|
||||||
/**
|
/**
|
||||||
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
||||||
* element, the call throws an exception.
|
* element, the call throws an exception.
|
||||||
@@ -625,6 +649,16 @@ public interface Page extends AutoCloseable {
|
|||||||
this.position = position;
|
this.position = position;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public ClickOptions setScroll(ScrollMode scroll) {
|
||||||
|
this.scroll = scroll;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
||||||
* element, the call throws an exception.
|
* element, the call throws an exception.
|
||||||
@@ -710,6 +744,13 @@ public interface Page extends AutoCloseable {
|
|||||||
* element.
|
* element.
|
||||||
*/
|
*/
|
||||||
public Position position;
|
public Position position;
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public ScrollMode scroll;
|
||||||
/**
|
/**
|
||||||
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
||||||
* element, the call throws an exception.
|
* element, the call throws an exception.
|
||||||
@@ -783,6 +824,16 @@ public interface Page extends AutoCloseable {
|
|||||||
this.position = position;
|
this.position = position;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public DblclickOptions setScroll(ScrollMode scroll) {
|
||||||
|
this.scroll = scroll;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
||||||
* element, the call throws an exception.
|
* element, the call throws an exception.
|
||||||
@@ -855,6 +906,13 @@ public interface Page extends AutoCloseable {
|
|||||||
* @deprecated This option has no effect.
|
* @deprecated This option has no effect.
|
||||||
*/
|
*/
|
||||||
public Boolean noWaitAfter;
|
public Boolean noWaitAfter;
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public ScrollMode scroll;
|
||||||
/**
|
/**
|
||||||
* Clicks on the source element at this point relative to the top-left corner of the element's padding box. If not
|
* Clicks on the source element at this point relative to the top-left corner of the element's padding box. If not
|
||||||
* specified, some visible point of the element is used.
|
* specified, some visible point of the element is used.
|
||||||
@@ -904,6 +962,16 @@ public interface Page extends AutoCloseable {
|
|||||||
this.noWaitAfter = noWaitAfter;
|
this.noWaitAfter = noWaitAfter;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public DragAndDropOptions setScroll(ScrollMode scroll) {
|
||||||
|
this.scroll = scroll;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Clicks on the source element at this point relative to the top-left corner of the element's padding box. If not
|
* Clicks on the source element at this point relative to the top-left corner of the element's padding box. If not
|
||||||
* specified, some visible point of the element is used.
|
* specified, some visible point of the element is used.
|
||||||
@@ -1623,6 +1691,13 @@ public interface Page extends AutoCloseable {
|
|||||||
* element.
|
* element.
|
||||||
*/
|
*/
|
||||||
public Position position;
|
public Position position;
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public ScrollMode scroll;
|
||||||
/**
|
/**
|
||||||
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
||||||
* element, the call throws an exception.
|
* element, the call throws an exception.
|
||||||
@@ -1682,6 +1757,16 @@ public interface Page extends AutoCloseable {
|
|||||||
this.position = position;
|
this.position = position;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public HoverOptions setScroll(ScrollMode scroll) {
|
||||||
|
this.scroll = scroll;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
||||||
* element, the call throws an exception.
|
* element, the call throws an exception.
|
||||||
@@ -2598,7 +2683,9 @@ public interface Page extends AutoCloseable {
|
|||||||
*/
|
*/
|
||||||
public Path path;
|
public Path path;
|
||||||
/**
|
/**
|
||||||
* The quality of the image, between 0-100. Not applicable to {@code png} images.
|
* The quality of the image, between 0-100. Not applicable to {@code png} images. For {@code jpeg} the default is {@code
|
||||||
|
* 80}. For {@code webp}, a quality of {@code 100} (the default) produces a lossless image, while lower values use lossy
|
||||||
|
* compression.
|
||||||
*/
|
*/
|
||||||
public Integer quality;
|
public Integer quality;
|
||||||
/**
|
/**
|
||||||
@@ -2707,7 +2794,9 @@ public interface Page extends AutoCloseable {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* The quality of the image, between 0-100. Not applicable to {@code png} images.
|
* The quality of the image, between 0-100. Not applicable to {@code png} images. For {@code jpeg} the default is {@code
|
||||||
|
* 80}. For {@code webp}, a quality of {@code 100} (the default) produces a lossless image, while lower values use lossy
|
||||||
|
* compression.
|
||||||
*/
|
*/
|
||||||
public ScreenshotOptions setQuality(int quality) {
|
public ScreenshotOptions setQuality(int quality) {
|
||||||
this.quality = quality;
|
this.quality = quality;
|
||||||
@@ -2823,6 +2912,13 @@ public interface Page extends AutoCloseable {
|
|||||||
* element.
|
* element.
|
||||||
*/
|
*/
|
||||||
public Position position;
|
public Position position;
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public ScrollMode scroll;
|
||||||
/**
|
/**
|
||||||
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
||||||
* element, the call throws an exception.
|
* element, the call throws an exception.
|
||||||
@@ -2872,6 +2968,16 @@ public interface Page extends AutoCloseable {
|
|||||||
this.position = position;
|
this.position = position;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public SetCheckedOptions setScroll(ScrollMode scroll) {
|
||||||
|
this.scroll = scroll;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
||||||
* element, the call throws an exception.
|
* element, the call throws an exception.
|
||||||
@@ -3075,6 +3181,13 @@ public interface Page extends AutoCloseable {
|
|||||||
* element.
|
* element.
|
||||||
*/
|
*/
|
||||||
public Position position;
|
public Position position;
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public ScrollMode scroll;
|
||||||
/**
|
/**
|
||||||
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
||||||
* element, the call throws an exception.
|
* element, the call throws an exception.
|
||||||
@@ -3134,6 +3247,16 @@ public interface Page extends AutoCloseable {
|
|||||||
this.position = position;
|
this.position = position;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public TapOptions setScroll(ScrollMode scroll) {
|
||||||
|
this.scroll = scroll;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
||||||
* element, the call throws an exception.
|
* element, the call throws an exception.
|
||||||
@@ -3266,6 +3389,13 @@ public interface Page extends AutoCloseable {
|
|||||||
* element.
|
* element.
|
||||||
*/
|
*/
|
||||||
public Position position;
|
public Position position;
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public ScrollMode scroll;
|
||||||
/**
|
/**
|
||||||
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
||||||
* element, the call throws an exception.
|
* element, the call throws an exception.
|
||||||
@@ -3315,6 +3445,16 @@ public interface Page extends AutoCloseable {
|
|||||||
this.position = position;
|
this.position = position;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"},
|
||||||
|
* which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code
|
||||||
|
* "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This
|
||||||
|
* is useful to assert that an element is reachable by the user without additional scrolling.
|
||||||
|
*/
|
||||||
|
public UncheckOptions setScroll(ScrollMode scroll) {
|
||||||
|
this.scroll = scroll;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
||||||
* element, the call throws an exception.
|
* element, the call throws an exception.
|
||||||
@@ -5464,6 +5604,11 @@ public interface Page extends AutoCloseable {
|
|||||||
*
|
*
|
||||||
* <p> Navigate to the previous page in history.
|
* <p> Navigate to the previous page in history.
|
||||||
*
|
*
|
||||||
|
* <p> <strong>NOTE:</strong> **Testing Back/Forward Cache (BFCache) is not supported.** By default, Playwright disables the Back/Forward Cache
|
||||||
|
* across all browsers. Even if explicitly enabled, Playwright's internal state relies on network-level navigation events.
|
||||||
|
* Because BFCache restores unfreeze the DOM without firing these events, using {@code page.goBack()} or {@code
|
||||||
|
* page.goForward()} to trigger a BFCache restore will result in timeouts and a desynchronized {@code Page} state.
|
||||||
|
*
|
||||||
* @since v1.8
|
* @since v1.8
|
||||||
*/
|
*/
|
||||||
default Response goBack() {
|
default Response goBack() {
|
||||||
@@ -5475,6 +5620,11 @@ public interface Page extends AutoCloseable {
|
|||||||
*
|
*
|
||||||
* <p> Navigate to the previous page in history.
|
* <p> Navigate to the previous page in history.
|
||||||
*
|
*
|
||||||
|
* <p> <strong>NOTE:</strong> **Testing Back/Forward Cache (BFCache) is not supported.** By default, Playwright disables the Back/Forward Cache
|
||||||
|
* across all browsers. Even if explicitly enabled, Playwright's internal state relies on network-level navigation events.
|
||||||
|
* Because BFCache restores unfreeze the DOM without firing these events, using {@code page.goBack()} or {@code
|
||||||
|
* page.goForward()} to trigger a BFCache restore will result in timeouts and a desynchronized {@code Page} state.
|
||||||
|
*
|
||||||
* @since v1.8
|
* @since v1.8
|
||||||
*/
|
*/
|
||||||
Response goBack(GoBackOptions options);
|
Response goBack(GoBackOptions options);
|
||||||
@@ -5484,6 +5634,11 @@ public interface Page extends AutoCloseable {
|
|||||||
*
|
*
|
||||||
* <p> Navigate to the next page in history.
|
* <p> Navigate to the next page in history.
|
||||||
*
|
*
|
||||||
|
* <p> <strong>NOTE:</strong> **Testing Back/Forward Cache (BFCache) is not supported.** By default, Playwright disables the Back/Forward Cache
|
||||||
|
* across all browsers. Even if explicitly enabled, Playwright's internal state relies on network-level navigation events.
|
||||||
|
* Because BFCache restores unfreeze the DOM without firing these events, using {@code page.goBack()} or {@code
|
||||||
|
* page.goForward()} to trigger a BFCache restore will result in timeouts and a desynchronized {@code Page} state.
|
||||||
|
*
|
||||||
* @since v1.8
|
* @since v1.8
|
||||||
*/
|
*/
|
||||||
default Response goForward() {
|
default Response goForward() {
|
||||||
@@ -5495,6 +5650,11 @@ public interface Page extends AutoCloseable {
|
|||||||
*
|
*
|
||||||
* <p> Navigate to the next page in history.
|
* <p> Navigate to the next page in history.
|
||||||
*
|
*
|
||||||
|
* <p> <strong>NOTE:</strong> **Testing Back/Forward Cache (BFCache) is not supported.** By default, Playwright disables the Back/Forward Cache
|
||||||
|
* across all browsers. Even if explicitly enabled, Playwright's internal state relies on network-level navigation events.
|
||||||
|
* Because BFCache restores unfreeze the DOM without firing these events, using {@code page.goBack()} or {@code
|
||||||
|
* page.goForward()} to trigger a BFCache restore will result in timeouts and a desynchronized {@code Page} state.
|
||||||
|
*
|
||||||
* @since v1.8
|
* @since v1.8
|
||||||
*/
|
*/
|
||||||
Response goForward(GoForwardOptions options);
|
Response goForward(GoForwardOptions options);
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import com.microsoft.playwright.PlaywrightException;
|
|||||||
import com.microsoft.playwright.options.HttpHeader;
|
import com.microsoft.playwright.options.HttpHeader;
|
||||||
import com.microsoft.playwright.options.SecurityDetails;
|
import com.microsoft.playwright.options.SecurityDetails;
|
||||||
import com.microsoft.playwright.options.ServerAddr;
|
import com.microsoft.playwright.options.ServerAddr;
|
||||||
|
import com.microsoft.playwright.options.Timing;
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.Base64;
|
import java.util.Base64;
|
||||||
@@ -118,6 +119,26 @@ class APIResponseImpl implements APIResponse {
|
|||||||
return new String(body(), StandardCharsets.UTF_8);
|
return new String(body(), StandardCharsets.UTF_8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Timing timing() {
|
||||||
|
Timing timing;
|
||||||
|
if (initializer.has("timing")) {
|
||||||
|
timing = gson().fromJson(initializer.get("timing"), Timing.class);
|
||||||
|
} else {
|
||||||
|
timing = new Timing();
|
||||||
|
timing.startTime = -1;
|
||||||
|
timing.domainLookupStart = -1;
|
||||||
|
timing.domainLookupEnd = -1;
|
||||||
|
timing.connectStart = -1;
|
||||||
|
timing.secureConnectionStart = -1;
|
||||||
|
timing.connectEnd = -1;
|
||||||
|
timing.requestStart = -1;
|
||||||
|
timing.responseStart = -1;
|
||||||
|
}
|
||||||
|
timing.responseEnd = initializer.has("responseEndTiming") ? initializer.get("responseEndTiming").getAsDouble() : -1;
|
||||||
|
return timing;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String url() {
|
public String url() {
|
||||||
return initializer.get("url").getAsString();
|
return initializer.get("url").getAsString();
|
||||||
|
|||||||
@@ -125,11 +125,12 @@ class ChannelOwner extends LoggingSupport {
|
|||||||
JsonElement sendMessage(String method, JsonObject params, Double timeout) {
|
JsonElement sendMessage(String method, JsonObject params, Double timeout) {
|
||||||
checkNotCollected();
|
checkNotCollected();
|
||||||
if (timeout != null) {
|
if (timeout != null) {
|
||||||
params.addProperty("timeout", timeout);
|
// Timeout is passed in the message metadata, remove potential leftover from serialized options.
|
||||||
|
params.remove("timeout");
|
||||||
} else if (params.has("timeout")) {
|
} else if (params.has("timeout")) {
|
||||||
throw new PlaywrightException("Internal error: timeout must be passed explicitly.");
|
throw new PlaywrightException("Internal error: timeout must be passed explicitly.");
|
||||||
}
|
}
|
||||||
return connection.sendMessage(guid, method, params);
|
return connection.sendMessage(guid, method, params, timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkNotCollected() {
|
private void checkNotCollected() {
|
||||||
|
|||||||
@@ -129,19 +129,23 @@ public class Connection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public JsonElement sendMessage(String guid, String method, JsonObject params) {
|
public JsonElement sendMessage(String guid, String method, JsonObject params) {
|
||||||
return root.runUntil(() -> {}, sendMessageAsync(guid, method, params));
|
return sendMessage(guid, method, params, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public JsonElement sendMessage(String guid, String method, JsonObject params, Double timeout) {
|
||||||
|
return root.runUntil(() -> {}, internalSendMessage(guid, method, params, timeout, true, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
public WaitableResult<JsonElement> sendMessageAsync(String guid, String method, JsonObject params) {
|
public WaitableResult<JsonElement> sendMessageAsync(String guid, String method, JsonObject params) {
|
||||||
return internalSendMessage(guid, method, params, true, true);
|
return internalSendMessage(guid, method, params, null, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fire-and-forget: the server never replies.
|
// Fire-and-forget: the server never replies.
|
||||||
public void sendMessageNoReply(String guid, String method, JsonObject params) {
|
public void sendMessageNoReply(String guid, String method, JsonObject params) {
|
||||||
internalSendMessage(guid, method, params, false, false);
|
internalSendMessage(guid, method, params, null, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private WaitableResult<JsonElement> internalSendMessage(String guid, String method, JsonObject params, boolean sendStack, boolean expectsReply) {
|
private WaitableResult<JsonElement> internalSendMessage(String guid, String method, JsonObject params, Double timeout, boolean sendStack, boolean expectsReply) {
|
||||||
int id = ++lastId;
|
int id = ++lastId;
|
||||||
WaitableResult<JsonElement> result = new WaitableResult<>();
|
WaitableResult<JsonElement> result = new WaitableResult<>();
|
||||||
if (expectsReply) {
|
if (expectsReply) {
|
||||||
@@ -154,6 +158,9 @@ public class Connection {
|
|||||||
message.add("params", params);
|
message.add("params", params);
|
||||||
JsonObject metadata = new JsonObject();
|
JsonObject metadata = new JsonObject();
|
||||||
metadata.addProperty("wallTime", currentTimeMillis());
|
metadata.addProperty("wallTime", currentTimeMillis());
|
||||||
|
if (timeout != null) {
|
||||||
|
metadata.addProperty("timeout", timeout);
|
||||||
|
}
|
||||||
JsonArray stack = null;
|
JsonArray stack = null;
|
||||||
if (titleReported) {
|
if (titleReported) {
|
||||||
metadata.addProperty("internal", true);
|
metadata.addProperty("internal", true);
|
||||||
@@ -183,7 +190,7 @@ public class Connection {
|
|||||||
callData.add("stack", stack);
|
callData.add("stack", stack);
|
||||||
JsonObject stackParams = new JsonObject();
|
JsonObject stackParams = new JsonObject();
|
||||||
stackParams.add("callData", callData);
|
stackParams.add("callData", callData);
|
||||||
internalSendMessage(localUtils.guid,"addStackToTracingNoReply", stackParams, false, true);
|
internalSendMessage(localUtils.guid,"addStackToTracingNoReply", stackParams, null, false, true);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ import static com.microsoft.playwright.impl.Utils.*;
|
|||||||
import static com.microsoft.playwright.impl.Utils.addFilePathUploadParams;
|
import static com.microsoft.playwright.impl.Utils.addFilePathUploadParams;
|
||||||
import static com.microsoft.playwright.options.ScreenshotType.JPEG;
|
import static com.microsoft.playwright.options.ScreenshotType.JPEG;
|
||||||
import static com.microsoft.playwright.options.ScreenshotType.PNG;
|
import static com.microsoft.playwright.options.ScreenshotType.PNG;
|
||||||
|
import static com.microsoft.playwright.options.ScreenshotType.WEBP;
|
||||||
|
|
||||||
public class ElementHandleImpl extends JSHandleImpl implements ElementHandle {
|
public class ElementHandleImpl extends JSHandleImpl implements ElementHandle {
|
||||||
private final FrameImpl frame;
|
private final FrameImpl frame;
|
||||||
@@ -278,6 +279,8 @@ public class ElementHandleImpl extends JSHandleImpl implements ElementHandle {
|
|||||||
String extension = fileName.substring(extStart).toLowerCase();
|
String extension = fileName.substring(extStart).toLowerCase();
|
||||||
if (".jpeg".equals(extension) || ".jpg".equals(extension)) {
|
if (".jpeg".equals(extension) || ".jpg".equals(extension)) {
|
||||||
options.type = JPEG;
|
options.type = JPEG;
|
||||||
|
} else if (".webp".equals(extension)) {
|
||||||
|
options.type = WEBP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import java.util.regex.Pattern;
|
|||||||
|
|
||||||
import static com.microsoft.playwright.impl.LocatorUtils.*;
|
import static com.microsoft.playwright.impl.LocatorUtils.*;
|
||||||
import static com.microsoft.playwright.impl.Serialization.gson;
|
import static com.microsoft.playwright.impl.Serialization.gson;
|
||||||
|
import static com.microsoft.playwright.impl.Serialization.serializeArgument;
|
||||||
import static com.microsoft.playwright.impl.Utils.convertType;
|
import static com.microsoft.playwright.impl.Utils.convertType;
|
||||||
|
|
||||||
class LocatorImpl implements Locator {
|
class LocatorImpl implements Locator {
|
||||||
@@ -666,6 +667,16 @@ class LocatorImpl implements Locator {
|
|||||||
frame.waitForSelectorImpl(selector, convertType(options, Frame.WaitForSelectorOptions.class).setStrict(true), true);
|
frame.waitForSelectorImpl(selector, convertType(options, Frame.WaitForSelectorOptions.class).setStrict(true), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void waitForFunction(String expression, Object arg, WaitForFunctionOptions options) {
|
||||||
|
JsonObject params = new JsonObject();
|
||||||
|
params.addProperty("selector", selector);
|
||||||
|
params.addProperty("strict", true);
|
||||||
|
params.addProperty("expression", expression);
|
||||||
|
params.add("arg", gson().toJsonTree(serializeArgument(arg)));
|
||||||
|
frame.sendMessage("waitForFunction", params, frame.timeout(options == null ? null : options.timeout));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
String description = description();
|
String description = description();
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import static com.microsoft.playwright.impl.Serialization.parseError;
|
|||||||
import static com.microsoft.playwright.impl.Utils.*;
|
import static com.microsoft.playwright.impl.Utils.*;
|
||||||
import static com.microsoft.playwright.options.ScreenshotType.JPEG;
|
import static com.microsoft.playwright.options.ScreenshotType.JPEG;
|
||||||
import static com.microsoft.playwright.options.ScreenshotType.PNG;
|
import static com.microsoft.playwright.options.ScreenshotType.PNG;
|
||||||
|
import static com.microsoft.playwright.options.ScreenshotType.WEBP;
|
||||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||||
import static java.nio.file.Files.readAllBytes;
|
import static java.nio.file.Files.readAllBytes;
|
||||||
import static java.util.Arrays.asList;
|
import static java.util.Arrays.asList;
|
||||||
@@ -1259,6 +1260,8 @@ public class PageImpl extends ChannelOwner implements Page {
|
|||||||
String extension = fileName.substring(extStart).toLowerCase();
|
String extension = fileName.substring(extStart).toLowerCase();
|
||||||
if (".jpeg".equals(extension) || ".jpg".equals(extension)) {
|
if (".jpeg".equals(extension) || ".jpg".equals(extension)) {
|
||||||
options.type = JPEG;
|
options.type = JPEG;
|
||||||
|
} else if (".webp".equals(extension)) {
|
||||||
|
options.type = WEBP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,15 +39,21 @@ class ScreencastImpl implements Screencast {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void handleScreencastFrame(JsonObject params) {
|
void handleScreencastFrame(JsonObject params) {
|
||||||
if (onFrame == null) {
|
try {
|
||||||
return;
|
if (onFrame != null) {
|
||||||
|
String dataBase64 = params.get("data").getAsString();
|
||||||
|
byte[] data = java.util.Base64.getDecoder().decode(dataBase64);
|
||||||
|
double timestamp = params.get("timestamp").getAsDouble();
|
||||||
|
int viewportWidth = params.get("viewportWidth").getAsInt();
|
||||||
|
int viewportHeight = params.get("viewportHeight").getAsInt();
|
||||||
|
onFrame.accept(new ScreencastFrameImpl(data, timestamp, viewportWidth, viewportHeight));
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
// The server sends the next frame only after the previous one is acknowledged.
|
||||||
|
JsonObject ackParams = new JsonObject();
|
||||||
|
ackParams.add("frameId", params.get("frameId"));
|
||||||
|
page.sendMessageAsync("screencastFrameAck", ackParams);
|
||||||
}
|
}
|
||||||
String dataBase64 = params.get("data").getAsString();
|
|
||||||
byte[] data = java.util.Base64.getDecoder().decode(dataBase64);
|
|
||||||
double timestamp = params.get("timestamp").getAsDouble();
|
|
||||||
int viewportWidth = params.get("viewportWidth").getAsInt();
|
|
||||||
int viewportHeight = params.get("viewportHeight").getAsInt();
|
|
||||||
onFrame.accept(new ScreencastFrameImpl(data, timestamp, viewportWidth, viewportHeight));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ class Serialization {
|
|||||||
.registerTypeAdapter(ScreenshotCaret.class, new ToLowerCaseSerializer<ScreenshotCaret>())
|
.registerTypeAdapter(ScreenshotCaret.class, new ToLowerCaseSerializer<ScreenshotCaret>())
|
||||||
.registerTypeAdapter(ServiceWorkerPolicy.class, new ToLowerCaseAndDashSerializer<ServiceWorkerPolicy>())
|
.registerTypeAdapter(ServiceWorkerPolicy.class, new ToLowerCaseAndDashSerializer<ServiceWorkerPolicy>())
|
||||||
.registerTypeAdapter(MouseButton.class, new ToLowerCaseSerializer<MouseButton>())
|
.registerTypeAdapter(MouseButton.class, new ToLowerCaseSerializer<MouseButton>())
|
||||||
|
.registerTypeAdapter(ScrollMode.class, new ToLowerCaseSerializer<ScrollMode>())
|
||||||
.registerTypeAdapter(ConsoleMessagesFilter.class, new ConsoleMessagesFilterSerializer())
|
.registerTypeAdapter(ConsoleMessagesFilter.class, new ConsoleMessagesFilterSerializer())
|
||||||
.registerTypeAdapter(AriaSnapshotMode.class, new ToLowerCaseSerializer<AriaSnapshotMode>())
|
.registerTypeAdapter(AriaSnapshotMode.class, new ToLowerCaseSerializer<AriaSnapshotMode>())
|
||||||
.registerTypeAdapter(LoadState.class, new ToLowerCaseSerializer<LoadState>())
|
.registerTypeAdapter(LoadState.class, new ToLowerCaseSerializer<LoadState>())
|
||||||
|
|||||||
@@ -18,5 +18,6 @@ package com.microsoft.playwright.options;
|
|||||||
|
|
||||||
public enum ScreenshotType {
|
public enum ScreenshotType {
|
||||||
PNG,
|
PNG,
|
||||||
JPEG
|
JPEG,
|
||||||
|
WEBP
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) Microsoft Corporation.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.microsoft.playwright.options;
|
||||||
|
|
||||||
|
public enum ScrollMode {
|
||||||
|
AUTO,
|
||||||
|
NONE
|
||||||
|
}
|
||||||
@@ -22,42 +22,42 @@ public class Timing {
|
|||||||
*/
|
*/
|
||||||
public double startTime;
|
public double startTime;
|
||||||
/**
|
/**
|
||||||
* Time immediately before the browser starts the domain name lookup for the resource. The value is given in milliseconds
|
* Time immediately before the client starts the domain name lookup for the resource. The value is given in milliseconds
|
||||||
* relative to {@code startTime}, -1 if not available.
|
* relative to {@code startTime}, -1 if not available.
|
||||||
*/
|
*/
|
||||||
public double domainLookupStart;
|
public double domainLookupStart;
|
||||||
/**
|
/**
|
||||||
* Time immediately after the browser starts the domain name lookup for the resource. The value is given in milliseconds
|
* Time immediately after the client ends the domain name lookup for the resource. The value is given in milliseconds
|
||||||
* relative to {@code startTime}, -1 if not available.
|
* relative to {@code startTime}, -1 if not available.
|
||||||
*/
|
*/
|
||||||
public double domainLookupEnd;
|
public double domainLookupEnd;
|
||||||
/**
|
/**
|
||||||
* Time immediately before the user agent starts establishing the connection to the server to retrieve the resource. The
|
* Time immediately before the client starts establishing the connection to the server to retrieve the resource. The value
|
||||||
* value is given in milliseconds relative to {@code startTime}, -1 if not available.
|
* is given in milliseconds relative to {@code startTime}, -1 if not available.
|
||||||
*/
|
*/
|
||||||
public double connectStart;
|
public double connectStart;
|
||||||
/**
|
/**
|
||||||
* Time immediately before the browser starts the handshake process to secure the current connection. The value is given in
|
* Time immediately before the client starts the handshake process to secure the current connection. The value is given in
|
||||||
* milliseconds relative to {@code startTime}, -1 if not available.
|
* milliseconds relative to {@code startTime}, -1 if not available.
|
||||||
*/
|
*/
|
||||||
public double secureConnectionStart;
|
public double secureConnectionStart;
|
||||||
/**
|
/**
|
||||||
* Time immediately before the user agent starts establishing the connection to the server to retrieve the resource. The
|
* Time immediately after the client establishes the connection to the server to retrieve the resource. The value is given
|
||||||
* value is given in milliseconds relative to {@code startTime}, -1 if not available.
|
* in milliseconds relative to {@code startTime}, -1 if not available.
|
||||||
*/
|
*/
|
||||||
public double connectEnd;
|
public double connectEnd;
|
||||||
/**
|
/**
|
||||||
* Time immediately before the browser starts requesting the resource from the server, cache, or local resource. The value
|
* Time immediately before the client 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.
|
* is given in milliseconds relative to {@code startTime}, -1 if not available.
|
||||||
*/
|
*/
|
||||||
public double requestStart;
|
public double requestStart;
|
||||||
/**
|
/**
|
||||||
* Time immediately after the browser receives the first byte of the response from the server, cache, or local resource.
|
* Time immediately after the client receives the first byte of the response from the server, cache, or local resource. The
|
||||||
* The value is given in milliseconds relative to {@code startTime}, -1 if not available.
|
* value is given in milliseconds relative to {@code startTime}, -1 if not available.
|
||||||
*/
|
*/
|
||||||
public double responseStart;
|
public double responseStart;
|
||||||
/**
|
/**
|
||||||
* Time immediately after the browser receives the last byte of the resource or immediately before the transport connection
|
* Time immediately after the client receives the last byte of the resource or immediately before the transport connection
|
||||||
* is closed, whichever comes first. The value is given in milliseconds relative to {@code startTime}, -1 if not available.
|
* is closed, whichever comes first. The value is given in milliseconds relative to {@code startTime}, -1 if not available.
|
||||||
*/
|
*/
|
||||||
public double responseEnd;
|
public double responseEnd;
|
||||||
|
|||||||
@@ -56,6 +56,22 @@ public class TestBrowserContextFetch extends TestBase {
|
|||||||
assertEquals("{\"foo\": \"bar\"}\n", response.text());
|
assertEquals("{\"foo\": \"bar\"}\n", response.text());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void getShouldReturnTiming() {
|
||||||
|
APIResponse response = context.request().get(server.PREFIX + "/simple.json");
|
||||||
|
assertTrue(response.ok());
|
||||||
|
Timing timing = response.timing();
|
||||||
|
assertTrue(timing.startTime > 0, "startTime = " + timing.startTime);
|
||||||
|
assertTrue(timing.domainLookupEnd >= timing.domainLookupStart);
|
||||||
|
assertTrue(timing.connectStart >= timing.domainLookupEnd);
|
||||||
|
assertEquals(-1, timing.secureConnectionStart);
|
||||||
|
assertTrue(timing.connectEnd >= timing.connectStart);
|
||||||
|
assertTrue(timing.requestStart >= timing.connectEnd);
|
||||||
|
assertTrue(timing.responseStart >= timing.requestStart);
|
||||||
|
assertTrue(timing.responseEnd >= timing.responseStart);
|
||||||
|
assertTrue(timing.responseEnd < 60_000, "responseEnd = " + timing.responseEnd);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void fetchShouldWork() {
|
void fetchShouldWork() {
|
||||||
APIResponse response = context.request().fetch(server.PREFIX + "/simple.json");
|
APIResponse response = context.request().fetch(server.PREFIX + "/simple.json");
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package com.microsoft.playwright;
|
|||||||
import com.microsoft.playwright.options.HarMode;
|
import com.microsoft.playwright.options.HarMode;
|
||||||
import com.microsoft.playwright.options.HarNotFound;
|
import com.microsoft.playwright.options.HarNotFound;
|
||||||
import com.microsoft.playwright.options.RouteFromHarUpdateContentPolicy;
|
import com.microsoft.playwright.options.RouteFromHarUpdateContentPolicy;
|
||||||
|
import com.microsoft.playwright.options.Timing;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.jupiter.api.condition.DisabledIf;
|
import org.junit.jupiter.api.condition.DisabledIf;
|
||||||
import org.junit.jupiter.api.io.TempDir;
|
import org.junit.jupiter.api.io.TempDir;
|
||||||
@@ -501,4 +502,36 @@ public class TestBrowserContextHar extends TestBase {
|
|||||||
assertNull(page.evaluate("window.result"));
|
assertNull(page.evaluate("window.result"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setJsonRoute(String path, String json) {
|
||||||
|
server.setRoute(path, exchange -> {
|
||||||
|
exchange.getResponseHeaders().add("Content-Type", "application/json");
|
||||||
|
byte[] body = json.getBytes(StandardCharsets.UTF_8);
|
||||||
|
exchange.sendResponseHeaders(200, body.length);
|
||||||
|
try (OutputStream out = exchange.getResponseBody()) {
|
||||||
|
out.write(body);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void shouldNotInterceptAPIRequestContextRequestsByDefault(@TempDir Path tmpDir) {
|
||||||
|
setJsonRoute("/api/data", "{\"hello\": \"live\"}");
|
||||||
|
Path harPath = tmpDir.resolve("api.har");
|
||||||
|
try (BrowserContext context1 = browser.newContext()) {
|
||||||
|
context1.routeFromHAR(harPath, new BrowserContext.RouteFromHAROptions().setUpdate(true));
|
||||||
|
Page page1 = context1.newPage();
|
||||||
|
page1.navigate(server.EMPTY_PAGE);
|
||||||
|
page1.request().get(server.PREFIX + "/api/data");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Without the option, the live network is hit.
|
||||||
|
setJsonRoute("/api/data", "{\"hello\": \"fresh\"}");
|
||||||
|
try (BrowserContext context2 = browser.newContext()) {
|
||||||
|
context2.routeFromHAR(harPath, new BrowserContext.RouteFromHAROptions().setNotFound(HarNotFound.FALLBACK));
|
||||||
|
Page page2 = context2.newPage();
|
||||||
|
APIResponse replayed = page2.request().get(server.PREFIX + "/api/data");
|
||||||
|
assertEquals("{\"hello\": \"fresh\"}", replayed.text());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,12 +17,13 @@
|
|||||||
package com.microsoft.playwright;
|
package com.microsoft.playwright;
|
||||||
|
|
||||||
import com.microsoft.playwright.options.KeyboardModifier;
|
import com.microsoft.playwright.options.KeyboardModifier;
|
||||||
|
import com.microsoft.playwright.options.ScrollMode;
|
||||||
import org.junit.jupiter.api.Tag;
|
import org.junit.jupiter.api.Tag;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static com.microsoft.playwright.assertions.PlaywrightAssertions.assertThat;
|
import static com.microsoft.playwright.assertions.PlaywrightAssertions.assertThat;
|
||||||
import static java.util.Arrays.asList;
|
import static java.util.Arrays.asList;
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
@Tag("smoke")
|
@Tag("smoke")
|
||||||
public class TestLocatorClick extends TestBase {
|
public class TestLocatorClick extends TestBase {
|
||||||
@@ -104,4 +105,24 @@ public class TestLocatorClick extends TestBase {
|
|||||||
page.evaluate("result")
|
page.evaluate("result")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void shouldNotScrollWhenScrollIsNone() {
|
||||||
|
page.setContent("<div style='height: 2000px;'>filler</div>\n" +
|
||||||
|
"<button onclick='window._clicked=true'>click me</button>");
|
||||||
|
PlaywrightException e = assertThrows(PlaywrightException.class,
|
||||||
|
() -> page.locator("button").click(new Locator.ClickOptions().setScroll(ScrollMode.NONE).setTimeout(2000)));
|
||||||
|
assertTrue(e.getMessage().contains("element is outside of the viewport"), e.getMessage());
|
||||||
|
assertNull(page.evaluate("window._clicked"));
|
||||||
|
assertEquals(0, page.evaluate("() => window.scrollY"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void shouldClickInViewportElementWhenScrollIsNone() {
|
||||||
|
page.setContent("<button onclick='window._clicked=true'>click me</button>\n" +
|
||||||
|
"<div style='height: 2000px;'></div>");
|
||||||
|
page.locator("button").click(new Locator.ClickOptions().setScroll(ScrollMode.NONE).setTimeout(2000));
|
||||||
|
assertEquals(true, page.evaluate("window._clicked"));
|
||||||
|
assertEquals(0, page.evaluate("() => window.scrollY"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -140,4 +140,49 @@ public class TestLocatorMisc extends TestBase{
|
|||||||
assertThat(page.locator(".item").filter(new Locator.FilterOptions().setVisible(true)).getByText("data3")).hasText("visible data3");
|
assertThat(page.locator(".item").filter(new Locator.FilterOptions().setVisible(true)).getByText("data3")).hasText("visible data3");
|
||||||
assertThat(page.locator(".item").filter(new Locator.FilterOptions().setVisible(false)).getByText("data1")).hasText("Hidden data1");
|
assertThat(page.locator(".item").filter(new Locator.FilterOptions().setVisible(false)).getByText("data1")).hasText("Hidden data1");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void waitForFunctionShouldWaitForAnAttributeToAppear() {
|
||||||
|
page.setContent("<button id=toggle>Menu</button>");
|
||||||
|
page.evaluate("() => setTimeout(() => document.querySelector('#toggle').setAttribute('aria-expanded', 'true'), 500)");
|
||||||
|
page.locator("#toggle").waitForFunction("element => element.hasAttribute('aria-expanded')");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void waitForFunctionShouldReturnImmediatelyWhenAlreadyTruthy() {
|
||||||
|
page.setContent("<div id=target>yes</div>");
|
||||||
|
page.locator("#target").waitForFunction("element => element.textContent === 'yes'");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void waitForFunctionShouldAcceptElementHandleArguments() {
|
||||||
|
page.setContent("<div id=a></div><div id=b>value</div>");
|
||||||
|
ElementHandle handle = page.querySelector("#b");
|
||||||
|
page.locator("#a").waitForFunction("(element, other) => other.textContent === 'value'", handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void waitForFunctionShouldThrowWhenPredicateThrows() {
|
||||||
|
page.setContent("<div id=target>no</div>");
|
||||||
|
PlaywrightException e = assertThrows(PlaywrightException.class,
|
||||||
|
() -> page.locator("#target").waitForFunction("() => { throw new Error('oh my'); }"));
|
||||||
|
assertTrue(e.getMessage().contains("oh my"), e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void waitForFunctionShouldThrowOnStrictModeViolation() {
|
||||||
|
page.setContent("<div class=x>1</div><div class=x>2</div>");
|
||||||
|
PlaywrightException e = assertThrows(PlaywrightException.class,
|
||||||
|
() -> page.locator("div.x").waitForFunction("() => true"));
|
||||||
|
assertTrue(e.getMessage().contains("strict mode violation"), e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void waitForFunctionShouldRespectTimeout() {
|
||||||
|
page.setContent("<div id=target>no</div>");
|
||||||
|
PlaywrightException e = assertThrows(PlaywrightException.class,
|
||||||
|
() -> page.locator("#target").waitForFunction("element => element.textContent === 'yes'", null,
|
||||||
|
new Locator.WaitForFunctionOptions().setTimeout(500)));
|
||||||
|
assertTrue(e.getMessage().contains("Timeout 500ms exceeded"), e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,7 +82,10 @@ public class TestPageAriaSnapshotAI {
|
|||||||
"Link with a button <button style=\"cursor: pointer\">Button</button>" +
|
"Link with a button <button style=\"cursor: pointer\">Button</button>" +
|
||||||
"</a>");
|
"</a>");
|
||||||
String snapshot = aiSnapshot(page);
|
String snapshot = aiSnapshot(page);
|
||||||
assertTrue(snapshot.contains("link \"Link with a button Button\" [ref=e2] [cursor=pointer]"), snapshot);
|
// The link's name is redundant - "Link with a button" prints as text and "Button" as the button -
|
||||||
|
// so it is dropped even though the node is clickable.
|
||||||
|
assertTrue(snapshot.contains("link [ref=e2] [cursor=pointer]"), snapshot);
|
||||||
|
assertTrue(snapshot.contains("text: Link with a button"), snapshot);
|
||||||
// The button inside a cursor-pointer link should not get a redundant [cursor=pointer]
|
// The button inside a cursor-pointer link should not get a redundant [cursor=pointer]
|
||||||
assertTrue(snapshot.contains("button \"Button\" [ref=e3]"), snapshot);
|
assertTrue(snapshot.contains("button \"Button\" [ref=e3]"), snapshot);
|
||||||
assertFalse(snapshot.contains("button \"Button\" [ref=e3] [cursor=pointer]"), snapshot);
|
assertFalse(snapshot.contains("button \"Button\" [ref=e3] [cursor=pointer]"), snapshot);
|
||||||
|
|||||||
@@ -20,9 +20,11 @@ import com.microsoft.playwright.options.Clip;
|
|||||||
import com.microsoft.playwright.options.ScreenshotAnimations;
|
import com.microsoft.playwright.options.ScreenshotAnimations;
|
||||||
import com.microsoft.playwright.options.ScreenshotCaret;
|
import com.microsoft.playwright.options.ScreenshotCaret;
|
||||||
import com.microsoft.playwright.options.ScreenshotScale;
|
import com.microsoft.playwright.options.ScreenshotScale;
|
||||||
|
import com.microsoft.playwright.options.ScreenshotType;
|
||||||
import org.junit.jupiter.api.Disabled;
|
import org.junit.jupiter.api.Disabled;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.jupiter.api.condition.DisabledIf;
|
import org.junit.jupiter.api.condition.DisabledIf;
|
||||||
|
import org.junit.jupiter.api.io.TempDir;
|
||||||
import org.opentest4j.AssertionFailedError;
|
import org.opentest4j.AssertionFailedError;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
@@ -65,6 +67,39 @@ public class TestPageScreenshot extends TestBase {
|
|||||||
// expect(screenshot).toMatchSnapshot("screenshot-clip-rect.png");
|
// expect(screenshot).toMatchSnapshot("screenshot-clip-rect.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void assertWebp(byte[] screenshot) {
|
||||||
|
// WebP magic: "RIFF" at offset 0, "WEBP" at offset 8.
|
||||||
|
assertTrue(screenshot.length > 12);
|
||||||
|
assertEquals("RIFF", new String(screenshot, 0, 4, java.nio.charset.StandardCharsets.US_ASCII));
|
||||||
|
assertEquals("WEBP", new String(screenshot, 8, 4, java.nio.charset.StandardCharsets.US_ASCII));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void shouldProduceAValidWebpScreenshot() {
|
||||||
|
page.setViewportSize(300, 300);
|
||||||
|
page.navigate(server.EMPTY_PAGE);
|
||||||
|
byte[] screenshot = page.screenshot(new Page.ScreenshotOptions().setType(ScreenshotType.WEBP));
|
||||||
|
assertWebp(screenshot);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void pathOptionShouldDetectWebp(@TempDir Path tmpDir) throws IOException {
|
||||||
|
page.setViewportSize(300, 300);
|
||||||
|
page.navigate(server.EMPTY_PAGE);
|
||||||
|
Path outputPath = tmpDir.resolve("screenshot.webp");
|
||||||
|
byte[] screenshot = page.screenshot(new Page.ScreenshotOptions().setPath(outputPath));
|
||||||
|
assertWebp(screenshot);
|
||||||
|
assertWebp(Files.readAllBytes(outputPath));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void qualityOptionShouldWorkForWebp() {
|
||||||
|
page.navigate(server.PREFIX + "/grid.html");
|
||||||
|
byte[] lowQuality = page.screenshot(new Page.ScreenshotOptions().setType(ScreenshotType.WEBP).setQuality(0));
|
||||||
|
byte[] highQuality = page.screenshot(new Page.ScreenshotOptions().setType(ScreenshotType.WEBP).setQuality(100));
|
||||||
|
assertTrue(lowQuality.length < highQuality.length);
|
||||||
|
}
|
||||||
|
|
||||||
static private void rafraf(Page page) {
|
static private void rafraf(Page page) {
|
||||||
// Do a double raf since single raf does not
|
// Do a double raf since single raf does not
|
||||||
// actually guarantee a new animation frame.
|
// actually guarantee a new animation frame.
|
||||||
|
|||||||
@@ -193,9 +193,7 @@ public class TestWorkers extends TestBase {
|
|||||||
page.navigate(server.EMPTY_PAGE);
|
page.navigate(server.EMPTY_PAGE);
|
||||||
Worker worker = page.waitForWorker(() -> page.evaluate(
|
Worker worker = page.waitForWorker(() -> page.evaluate(
|
||||||
"() => new Worker(URL.createObjectURL(new Blob(['console.log(1)'], {type: 'application/javascript'})))"));
|
"() => new Worker(URL.createObjectURL(new Blob(['console.log(1)'], {type: 'application/javascript'})))"));
|
||||||
// https://github.com/microsoft/playwright/issues/38919
|
assertEquals("10\u00A0000,2", worker.evaluate("() => (10000.20).toLocaleString()"));
|
||||||
String expected = isFirefox() ? "10,000.2" : "10\u00A0000,2";
|
|
||||||
assertEquals(expected, worker.evaluate("() => (10000.20).toLocaleString()"));
|
|
||||||
context.close();
|
context.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -132,6 +132,30 @@ public class TestInstall {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void canInstallDriverToDirectoryAndReuseIt(@TempDir Path tmpDir) throws Exception {
|
||||||
|
Path driverDir = tmpDir.resolve("driver");
|
||||||
|
DriverJar.installDriverTo(driverDir);
|
||||||
|
// The directory is self-contained: the playwright-core package and the Node.js binary.
|
||||||
|
assertTrue(Files.exists(driverDir.resolve("package").resolve("cli.js")));
|
||||||
|
assertTrue(Files.exists(driverDir.resolve(isWindows() ? "node.exe" : "node")));
|
||||||
|
|
||||||
|
// Pointing playwright.cli.dir at it must reuse it as-is, without extracting to a temp directory.
|
||||||
|
System.setProperty("playwright.cli.dir", driverDir.toString());
|
||||||
|
Driver driver = Driver.createAndInstall(Collections.emptyMap(), false);
|
||||||
|
assertEquals(driverDir, driver.driverDir());
|
||||||
|
|
||||||
|
ProcessBuilder pb = driver.createProcessBuilder();
|
||||||
|
pb.command().add("--version");
|
||||||
|
pb.redirectError(ProcessBuilder.Redirect.INHERIT);
|
||||||
|
Path out = tmpDir.resolve("out.txt");
|
||||||
|
pb.redirectOutput(out.toFile());
|
||||||
|
Process p = pb.start();
|
||||||
|
assertTrue(p.waitFor(1, TimeUnit.MINUTES), "Timed out waiting for version to be printed");
|
||||||
|
String stdout = new String(Files.readAllBytes(out), StandardCharsets.UTF_8);
|
||||||
|
assertTrue(stdout.contains("Version "), stdout);
|
||||||
|
}
|
||||||
|
|
||||||
private static String extractNodeJsToTemp() throws URISyntaxException, IOException {
|
private static String extractNodeJsToTemp() throws URISyntaxException, IOException {
|
||||||
DriverJar auxDriver = new DriverJar();
|
DriverJar auxDriver = new DriverJar();
|
||||||
auxDriver.extractDriverToTempDir();
|
auxDriver.extractDriverToTempDir();
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>com.microsoft.playwright</groupId>
|
<groupId>com.microsoft.playwright</groupId>
|
||||||
<artifactId>parent-pom</artifactId>
|
<artifactId>parent-pom</artifactId>
|
||||||
<version>1.61.0</version>
|
<version>1.62.0</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<name>Playwright Parent Project</name>
|
<name>Playwright Parent Project</name>
|
||||||
<description>Java library to automate Chromium, Firefox and WebKit with a single API.
|
<description>Java library to automate Chromium, Firefox and WebKit with a single API.
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
1.61.1
|
1.62.1
|
||||||
|
|||||||
@@ -46,9 +46,15 @@ if [[ -z "$GIT_HEAD" ]]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# The Node.js version is kept in sync with the driver version in the upstream build script.
|
# The Node.js version used to be pinned in the upstream driver build script. The script was
|
||||||
NODE_VERSION=$(curl -fsSL "https://raw.githubusercontent.com/microsoft/playwright/$GIT_HEAD/utils/build/build-playwright-driver.sh" \
|
# removed in microsoft/playwright#41518, so for newer versions we follow the same policy it
|
||||||
|
# had: the latest Node.js LTS (see upstream utils/build/update-playwright-node.mjs).
|
||||||
|
NODE_VERSION=$(curl -fsSL "https://raw.githubusercontent.com/microsoft/playwright/$GIT_HEAD/utils/build/build-playwright-driver.sh" 2>/dev/null \
|
||||||
| sed -n 's/^NODE_VERSION="\([^"]*\)".*/\1/p')
|
| sed -n 's/^NODE_VERSION="\([^"]*\)".*/\1/p')
|
||||||
|
if [[ -z "$NODE_VERSION" ]]; then
|
||||||
|
NODE_VERSION=$(curl -fsSL "https://nodejs.org/dist/index.json" \
|
||||||
|
| node -e "let s='';process.stdin.on('data',d=>s+=d).on('end',()=>console.log(JSON.parse(s).find(r=>r.lts).version.slice(1)))")
|
||||||
|
fi
|
||||||
if [[ -z "$NODE_VERSION" ]]; then
|
if [[ -z "$NODE_VERSION" ]]; then
|
||||||
echo "Failed to determine Node.js version for playwright@$DRIVER_VERSION ($GIT_HEAD)"
|
echo "Failed to determine Node.js version for playwright@$DRIVER_VERSION ($GIT_HEAD)"
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>com.microsoft.playwright</groupId>
|
<groupId>com.microsoft.playwright</groupId>
|
||||||
<artifactId>api-generator</artifactId>
|
<artifactId>api-generator</artifactId>
|
||||||
<version>1.61.0</version>
|
<version>1.62.0</version>
|
||||||
<name>Playwright - API Generator</name>
|
<name>Playwright - API Generator</name>
|
||||||
<description>
|
<description>
|
||||||
This is an internal module used to generate Java API from the upstream Playwright
|
This is an internal module used to generate Java API from the upstream Playwright
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.microsoft.playwright</groupId>
|
<groupId>com.microsoft.playwright</groupId>
|
||||||
<artifactId>test-cli-fatjar</artifactId>
|
<artifactId>test-cli-fatjar</artifactId>
|
||||||
<version>1.61.0</version>
|
<version>1.62.0</version>
|
||||||
<name>Test Playwright Command Line FatJar</name>
|
<name>Test Playwright Command Line FatJar</name>
|
||||||
<properties>
|
<properties>
|
||||||
<compiler.version>1.8</compiler.version>
|
<compiler.version>1.8</compiler.version>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.microsoft.playwright</groupId>
|
<groupId>com.microsoft.playwright</groupId>
|
||||||
<artifactId>test-cli-version</artifactId>
|
<artifactId>test-cli-version</artifactId>
|
||||||
<version>1.61.0</version>
|
<version>1.62.0</version>
|
||||||
<name>Test Playwright Command Line Version</name>
|
<name>Test Playwright Command Line Version</name>
|
||||||
<properties>
|
<properties>
|
||||||
<compiler.version>1.8</compiler.version>
|
<compiler.version>1.8</compiler.version>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.microsoft.playwright</groupId>
|
<groupId>com.microsoft.playwright</groupId>
|
||||||
<artifactId>test-local-installation</artifactId>
|
<artifactId>test-local-installation</artifactId>
|
||||||
<version>1.61.0</version>
|
<version>1.62.0</version>
|
||||||
<name>Test local installation</name>
|
<name>Test local installation</name>
|
||||||
<description>Runs Playwright test suite (copied from playwright module) against locally cached Playwright</description>
|
<description>Runs Playwright test suite (copied from playwright module) against locally cached Playwright</description>
|
||||||
<properties>
|
<properties>
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
</parent>
|
</parent>
|
||||||
<groupId>com.microsoft.playwright</groupId>
|
<groupId>com.microsoft.playwright</groupId>
|
||||||
<artifactId>test-spring-boot-starter</artifactId>
|
<artifactId>test-spring-boot-starter</artifactId>
|
||||||
<version>1.61.0</version>
|
<version>1.62.0</version>
|
||||||
<name>Test Playwright With Spring Boot</name>
|
<name>Test Playwright With Spring Boot</name>
|
||||||
<properties>
|
<properties>
|
||||||
<spring.version>2.4.3</spring.version>
|
<spring.version>2.4.3</spring.version>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>com.microsoft.playwright</groupId>
|
<groupId>com.microsoft.playwright</groupId>
|
||||||
<artifactId>update-version</artifactId>
|
<artifactId>update-version</artifactId>
|
||||||
<version>1.61.0</version>
|
<version>1.62.0</version>
|
||||||
<name>Playwright - Update Version in Documentation</name>
|
<name>Playwright - Update Version in Documentation</name>
|
||||||
<description>
|
<description>
|
||||||
This is an internal module used to update versions in the documentation based on
|
This is an internal module used to update versions in the documentation based on
|
||||||
|
|||||||
@@ -38,6 +38,10 @@ ENV JAVA_HOME=/usr/lib/jvm/java-25-openjdk-${PW_TARGET_ARCH}
|
|||||||
|
|
||||||
ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
|
ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
|
||||||
|
|
||||||
|
# Extract the Playwright driver into the image once so the library reuses it instead of unpacking
|
||||||
|
# it into /tmp on every launch. See https://github.com/microsoft/playwright-java/issues/1268.
|
||||||
|
ENV PLAYWRIGHT_DRIVER_DIR=/ms-playwright-driver
|
||||||
|
|
||||||
RUN mkdir /ms-playwright && \
|
RUN mkdir /ms-playwright && \
|
||||||
mkdir /tmp/pw-java
|
mkdir /tmp/pw-java
|
||||||
|
|
||||||
@@ -45,6 +49,8 @@ COPY . /tmp/pw-java
|
|||||||
|
|
||||||
RUN cd /tmp/pw-java && \
|
RUN cd /tmp/pw-java && \
|
||||||
mvn install -D skipTests --no-transfer-progress && \
|
mvn install -D skipTests --no-transfer-progress && \
|
||||||
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI \
|
||||||
|
-D exec.args="install-driver" -f playwright/pom.xml --no-transfer-progress && \
|
||||||
DEBIAN_FRONTEND=noninteractive mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI \
|
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 && \
|
-D exec.args="install-deps" -f playwright/pom.xml --no-transfer-progress && \
|
||||||
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI \
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI \
|
||||||
@@ -61,4 +67,5 @@ RUN cd /tmp/pw-java && \
|
|||||||
else \
|
else \
|
||||||
rm /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstwebrtc.so; \
|
rm /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstwebrtc.so; \
|
||||||
fi && \
|
fi && \
|
||||||
chmod -R 777 $PLAYWRIGHT_BROWSERS_PATH
|
chmod -R 777 $PLAYWRIGHT_BROWSERS_PATH && \
|
||||||
|
chmod -R 777 $PLAYWRIGHT_DRIVER_DIR
|
||||||
|
|||||||
@@ -38,6 +38,10 @@ ENV JAVA_HOME=/usr/lib/jvm/java-25-openjdk-${PW_TARGET_ARCH}
|
|||||||
|
|
||||||
ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
|
ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
|
||||||
|
|
||||||
|
# Extract the Playwright driver into the image once so the library reuses it instead of unpacking
|
||||||
|
# it into /tmp on every launch. See https://github.com/microsoft/playwright-java/issues/1268.
|
||||||
|
ENV PLAYWRIGHT_DRIVER_DIR=/ms-playwright-driver
|
||||||
|
|
||||||
RUN mkdir /ms-playwright && \
|
RUN mkdir /ms-playwright && \
|
||||||
mkdir /tmp/pw-java
|
mkdir /tmp/pw-java
|
||||||
|
|
||||||
@@ -45,6 +49,8 @@ COPY . /tmp/pw-java
|
|||||||
|
|
||||||
RUN cd /tmp/pw-java && \
|
RUN cd /tmp/pw-java && \
|
||||||
mvn install -D skipTests --no-transfer-progress && \
|
mvn install -D skipTests --no-transfer-progress && \
|
||||||
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI \
|
||||||
|
-D exec.args="install-driver" -f playwright/pom.xml --no-transfer-progress && \
|
||||||
DEBIAN_FRONTEND=noninteractive mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI \
|
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 && \
|
-D exec.args="install-deps" -f playwright/pom.xml --no-transfer-progress && \
|
||||||
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI \
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI \
|
||||||
@@ -52,4 +58,5 @@ RUN cd /tmp/pw-java && \
|
|||||||
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI \
|
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 && \
|
-D exec.args="mark-docker-image '${DOCKER_IMAGE_NAME_TEMPLATE}'" -f playwright/pom.xml --no-transfer-progress && \
|
||||||
rm -rf /tmp/pw-java && \
|
rm -rf /tmp/pw-java && \
|
||||||
chmod -R 777 $PLAYWRIGHT_BROWSERS_PATH
|
chmod -R 777 $PLAYWRIGHT_BROWSERS_PATH && \
|
||||||
|
chmod -R 777 $PLAYWRIGHT_DRIVER_DIR
|
||||||
|
|||||||
@@ -38,6 +38,10 @@ ENV JAVA_HOME=/usr/lib/jvm/java-25-openjdk-${PW_TARGET_ARCH}
|
|||||||
|
|
||||||
ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
|
ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
|
||||||
|
|
||||||
|
# Extract the Playwright driver into the image once so the library reuses it instead of unpacking
|
||||||
|
# it into /tmp on every launch. See https://github.com/microsoft/playwright-java/issues/1268.
|
||||||
|
ENV PLAYWRIGHT_DRIVER_DIR=/ms-playwright-driver
|
||||||
|
|
||||||
RUN mkdir /ms-playwright && \
|
RUN mkdir /ms-playwright && \
|
||||||
mkdir /tmp/pw-java
|
mkdir /tmp/pw-java
|
||||||
|
|
||||||
@@ -45,6 +49,8 @@ COPY . /tmp/pw-java
|
|||||||
|
|
||||||
RUN cd /tmp/pw-java && \
|
RUN cd /tmp/pw-java && \
|
||||||
mvn install -D skipTests --no-transfer-progress && \
|
mvn install -D skipTests --no-transfer-progress && \
|
||||||
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI \
|
||||||
|
-D exec.args="install-driver" -f playwright/pom.xml --no-transfer-progress && \
|
||||||
DEBIAN_FRONTEND=noninteractive mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI \
|
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 && \
|
-D exec.args="install-deps" -f playwright/pom.xml --no-transfer-progress && \
|
||||||
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI \
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI \
|
||||||
@@ -52,4 +58,5 @@ RUN cd /tmp/pw-java && \
|
|||||||
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI \
|
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 && \
|
-D exec.args="mark-docker-image '${DOCKER_IMAGE_NAME_TEMPLATE}'" -f playwright/pom.xml --no-transfer-progress && \
|
||||||
rm -rf /tmp/pw-java && \
|
rm -rf /tmp/pw-java && \
|
||||||
chmod -R 777 $PLAYWRIGHT_BROWSERS_PATH
|
chmod -R 777 $PLAYWRIGHT_BROWSERS_PATH && \
|
||||||
|
chmod -R 777 $PLAYWRIGHT_DRIVER_DIR
|
||||||
|
|||||||
Reference in New Issue
Block a user