Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4095ef4159 | |||
| f6bc9a8b3d | |||
| 35e3c3653e | |||
| ed63ba4dcf | |||
| 48a92d1a62 | |||
| d219fddc8b | |||
| 7a1bbe23b1 | |||
| 2a047bff9a | |||
| 4e5285950d | |||
| b8a9d888be | |||
| 5a4640fe2a |
@@ -11,9 +11,9 @@ Playwright is a Java library to automate [Chromium](https://www.chromium.org/Hom
|
||||
|
||||
| | Linux | macOS | Windows |
|
||||
| :--- | :---: | :---: | :---: |
|
||||
| Chromium <!-- GEN:chromium-version -->114.0.5735.35<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||
| WebKit <!-- GEN:webkit-version -->16.4<!-- GEN:stop --> | ✅ | ✅ | ✅ |
|
||||
| Firefox <!-- GEN:firefox-version -->113.0<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||
| Chromium <!-- GEN:chromium-version -->115.0.5790.75<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||
| WebKit <!-- GEN:webkit-version -->17.0<!-- GEN:stop --> | ✅ | ✅ | ✅ |
|
||||
| Firefox <!-- GEN:firefox-version -->115.0<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||
|
||||
Headless execution is supported for all the browsers on all platforms. Check out [system requirements](https://playwright.dev/java/docs/next/intro/#system-requirements) for details.
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.microsoft.playwright</groupId>
|
||||
<artifactId>parent-pom</artifactId>
|
||||
<version>1.34.0-SNAPSHOT</version>
|
||||
<version>1.36.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>driver-bundle</artifactId>
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.microsoft.playwright</groupId>
|
||||
<artifactId>parent-pom</artifactId>
|
||||
<version>1.34.0-SNAPSHOT</version>
|
||||
<version>1.36.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>driver</artifactId>
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>org.example</groupId>
|
||||
<artifactId>examples</artifactId>
|
||||
<version>1.34.0-SNAPSHOT</version>
|
||||
<version>1.36.0</version>
|
||||
<name>Playwright Client Examples</name>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>com.microsoft.playwright</groupId>
|
||||
<artifactId>parent-pom</artifactId>
|
||||
<version>1.34.0-SNAPSHOT</version>
|
||||
<version>1.36.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>playwright</artifactId>
|
||||
|
||||
@@ -42,7 +42,7 @@ public interface APIRequest {
|
||||
*/
|
||||
public String baseURL;
|
||||
/**
|
||||
* An object containing additional HTTP headers to be sent with every request.
|
||||
* An object containing additional HTTP headers to be sent with every request. Defaults to none.
|
||||
*/
|
||||
public Map<String, String> extraHTTPHeaders;
|
||||
/**
|
||||
@@ -100,7 +100,7 @@ public interface APIRequest {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* An object containing additional HTTP headers to be sent with every request.
|
||||
* An object containing additional HTTP headers to be sent with every request. Defaults to none.
|
||||
*/
|
||||
public NewContextOptions setExtraHTTPHeaders(Map<String, String> extraHTTPHeaders) {
|
||||
this.extraHTTPHeaders = extraHTTPHeaders;
|
||||
|
||||
@@ -66,7 +66,7 @@ public interface Browser extends AutoCloseable {
|
||||
* Page.waitForURL()}, {@link Page#waitForRequest Page.waitForRequest()}, or {@link Page#waitForResponse
|
||||
* Page.waitForResponse()} it takes the base URL in consideration by using the <a
|
||||
* href="https://developer.mozilla.org/en-US/docs/Web/API/URL/URL">{@code URL()}</a> constructor for building the
|
||||
* corresponding URL. Examples:
|
||||
* corresponding URL. Unset by default. Examples:
|
||||
* <ul>
|
||||
* <li> baseURL: {@code http://localhost:3000} and navigating to {@code /bar.html} results in {@code
|
||||
* http://localhost:3000/bar.html}</li>
|
||||
@@ -78,7 +78,7 @@ public interface Browser extends AutoCloseable {
|
||||
*/
|
||||
public String baseURL;
|
||||
/**
|
||||
* Toggles bypassing page's Content-Security-Policy.
|
||||
* Toggles bypassing page's Content-Security-Policy. Defaults to {@code false}.
|
||||
*/
|
||||
public Boolean bypassCSP;
|
||||
/**
|
||||
@@ -93,7 +93,7 @@ public interface Browser extends AutoCloseable {
|
||||
*/
|
||||
public Double deviceScaleFactor;
|
||||
/**
|
||||
* An object containing additional HTTP headers to be sent with every request.
|
||||
* An object containing additional HTTP headers to be sent with every request. Defaults to none.
|
||||
*/
|
||||
public Map<String, String> extraHTTPHeaders;
|
||||
/**
|
||||
@@ -130,8 +130,9 @@ public interface Browser extends AutoCloseable {
|
||||
public Boolean javaScriptEnabled;
|
||||
/**
|
||||
* Specify user locale, for example {@code en-GB}, {@code de-DE}, etc. Locale will affect {@code navigator.language} value,
|
||||
* {@code Accept-Language} request header value as well as number and date formatting rules. Learn more about emulation in
|
||||
* our <a href="https://playwright.dev/java/docs/emulation#locale--timezone">emulation guide</a>.
|
||||
* {@code Accept-Language} request header value as well as number and date formatting rules. Defaults to the system default
|
||||
* locale. Learn more about emulation in our <a
|
||||
* href="https://playwright.dev/java/docs/emulation#locale--timezone">emulation guide</a>.
|
||||
*/
|
||||
public String locale;
|
||||
/**
|
||||
@@ -141,11 +142,11 @@ public interface Browser extends AutoCloseable {
|
||||
public Boolean offline;
|
||||
/**
|
||||
* A list of permissions to grant to all pages in this context. See {@link BrowserContext#grantPermissions
|
||||
* BrowserContext.grantPermissions()} for more details.
|
||||
* BrowserContext.grantPermissions()} for more details. Defaults to none.
|
||||
*/
|
||||
public List<String> permissions;
|
||||
/**
|
||||
* Network proxy settings to use with this context.
|
||||
* Network proxy settings to use with this context. Defaults to none.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> For Chromium on Windows the browser needs to be launched with the global proxy for this option to work. If all contexts
|
||||
* override the proxy, global proxy will be never used and can be any string, for example {@code launch({ proxy: { server:
|
||||
@@ -220,13 +221,14 @@ public interface Browser extends AutoCloseable {
|
||||
/**
|
||||
* If set to true, enables strict selectors mode for this context. In the strict selectors mode all operations on selectors
|
||||
* that imply single target DOM element will throw when more than one element matches the selector. This option does not
|
||||
* affect any Locator APIs (Locators are always strict). See {@code Locator} to learn more about the strict mode.
|
||||
* affect any Locator APIs (Locators are always strict). Defaults to {@code false}. See {@code Locator} to learn more about
|
||||
* the strict mode.
|
||||
*/
|
||||
public Boolean strictSelectors;
|
||||
/**
|
||||
* Changes the timezone of the context. See <a
|
||||
* href="https://cs.chromium.org/chromium/src/third_party/icu/source/data/misc/metaZones.txt?rcl=faee8bc70570192d82d2978a71e2a615788597d1">ICU's
|
||||
* metaZones.txt</a> for a list of supported timezone IDs.
|
||||
* metaZones.txt</a> for a list of supported timezone IDs. Defaults to the system timezone.
|
||||
*/
|
||||
public String timezoneId;
|
||||
/**
|
||||
@@ -255,7 +257,7 @@ public interface Browser extends AutoCloseable {
|
||||
* Page.waitForURL()}, {@link Page#waitForRequest Page.waitForRequest()}, or {@link Page#waitForResponse
|
||||
* Page.waitForResponse()} it takes the base URL in consideration by using the <a
|
||||
* href="https://developer.mozilla.org/en-US/docs/Web/API/URL/URL">{@code URL()}</a> constructor for building the
|
||||
* corresponding URL. Examples:
|
||||
* corresponding URL. Unset by default. Examples:
|
||||
* <ul>
|
||||
* <li> baseURL: {@code http://localhost:3000} and navigating to {@code /bar.html} results in {@code
|
||||
* http://localhost:3000/bar.html}</li>
|
||||
@@ -270,7 +272,7 @@ public interface Browser extends AutoCloseable {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Toggles bypassing page's Content-Security-Policy.
|
||||
* Toggles bypassing page's Content-Security-Policy. Defaults to {@code false}.
|
||||
*/
|
||||
public NewContextOptions setBypassCSP(boolean bypassCSP) {
|
||||
this.bypassCSP = bypassCSP;
|
||||
@@ -294,7 +296,7 @@ public interface Browser extends AutoCloseable {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* An object containing additional HTTP headers to be sent with every request.
|
||||
* An object containing additional HTTP headers to be sent with every request. Defaults to none.
|
||||
*/
|
||||
public NewContextOptions setExtraHTTPHeaders(Map<String, String> extraHTTPHeaders) {
|
||||
this.extraHTTPHeaders = extraHTTPHeaders;
|
||||
@@ -365,8 +367,9 @@ public interface Browser extends AutoCloseable {
|
||||
}
|
||||
/**
|
||||
* Specify user locale, for example {@code en-GB}, {@code de-DE}, etc. Locale will affect {@code navigator.language} value,
|
||||
* {@code Accept-Language} request header value as well as number and date formatting rules. Learn more about emulation in
|
||||
* our <a href="https://playwright.dev/java/docs/emulation#locale--timezone">emulation guide</a>.
|
||||
* {@code Accept-Language} request header value as well as number and date formatting rules. Defaults to the system default
|
||||
* locale. Learn more about emulation in our <a
|
||||
* href="https://playwright.dev/java/docs/emulation#locale--timezone">emulation guide</a>.
|
||||
*/
|
||||
public NewContextOptions setLocale(String locale) {
|
||||
this.locale = locale;
|
||||
@@ -382,14 +385,14 @@ public interface Browser extends AutoCloseable {
|
||||
}
|
||||
/**
|
||||
* A list of permissions to grant to all pages in this context. See {@link BrowserContext#grantPermissions
|
||||
* BrowserContext.grantPermissions()} for more details.
|
||||
* BrowserContext.grantPermissions()} for more details. Defaults to none.
|
||||
*/
|
||||
public NewContextOptions setPermissions(List<String> permissions) {
|
||||
this.permissions = permissions;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Network proxy settings to use with this context.
|
||||
* Network proxy settings to use with this context. Defaults to none.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> For Chromium on Windows the browser needs to be launched with the global proxy for this option to work. If all contexts
|
||||
* override the proxy, global proxy will be never used and can be any string, for example {@code launch({ proxy: { server:
|
||||
@@ -399,7 +402,7 @@ public interface Browser extends AutoCloseable {
|
||||
return setProxy(new Proxy(server));
|
||||
}
|
||||
/**
|
||||
* Network proxy settings to use with this context.
|
||||
* Network proxy settings to use with this context. Defaults to none.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> For Chromium on Windows the browser needs to be launched with the global proxy for this option to work. If all contexts
|
||||
* override the proxy, global proxy will be never used and can be any string, for example {@code launch({ proxy: { server:
|
||||
@@ -532,7 +535,8 @@ public interface Browser extends AutoCloseable {
|
||||
/**
|
||||
* If set to true, enables strict selectors mode for this context. In the strict selectors mode all operations on selectors
|
||||
* that imply single target DOM element will throw when more than one element matches the selector. This option does not
|
||||
* affect any Locator APIs (Locators are always strict). See {@code Locator} to learn more about the strict mode.
|
||||
* affect any Locator APIs (Locators are always strict). Defaults to {@code false}. See {@code Locator} to learn more about
|
||||
* the strict mode.
|
||||
*/
|
||||
public NewContextOptions setStrictSelectors(boolean strictSelectors) {
|
||||
this.strictSelectors = strictSelectors;
|
||||
@@ -541,7 +545,7 @@ public interface Browser extends AutoCloseable {
|
||||
/**
|
||||
* Changes the timezone of the context. See <a
|
||||
* href="https://cs.chromium.org/chromium/src/third_party/icu/source/data/misc/metaZones.txt?rcl=faee8bc70570192d82d2978a71e2a615788597d1">ICU's
|
||||
* metaZones.txt</a> for a list of supported timezone IDs.
|
||||
* metaZones.txt</a> for a list of supported timezone IDs. Defaults to the system timezone.
|
||||
*/
|
||||
public NewContextOptions setTimezoneId(String timezoneId) {
|
||||
this.timezoneId = timezoneId;
|
||||
@@ -588,7 +592,7 @@ public interface Browser extends AutoCloseable {
|
||||
* Page.waitForURL()}, {@link Page#waitForRequest Page.waitForRequest()}, or {@link Page#waitForResponse
|
||||
* Page.waitForResponse()} it takes the base URL in consideration by using the <a
|
||||
* href="https://developer.mozilla.org/en-US/docs/Web/API/URL/URL">{@code URL()}</a> constructor for building the
|
||||
* corresponding URL. Examples:
|
||||
* corresponding URL. Unset by default. Examples:
|
||||
* <ul>
|
||||
* <li> baseURL: {@code http://localhost:3000} and navigating to {@code /bar.html} results in {@code
|
||||
* http://localhost:3000/bar.html}</li>
|
||||
@@ -600,7 +604,7 @@ public interface Browser extends AutoCloseable {
|
||||
*/
|
||||
public String baseURL;
|
||||
/**
|
||||
* Toggles bypassing page's Content-Security-Policy.
|
||||
* Toggles bypassing page's Content-Security-Policy. Defaults to {@code false}.
|
||||
*/
|
||||
public Boolean bypassCSP;
|
||||
/**
|
||||
@@ -615,7 +619,7 @@ public interface Browser extends AutoCloseable {
|
||||
*/
|
||||
public Double deviceScaleFactor;
|
||||
/**
|
||||
* An object containing additional HTTP headers to be sent with every request.
|
||||
* An object containing additional HTTP headers to be sent with every request. Defaults to none.
|
||||
*/
|
||||
public Map<String, String> extraHTTPHeaders;
|
||||
/**
|
||||
@@ -652,8 +656,9 @@ public interface Browser extends AutoCloseable {
|
||||
public Boolean javaScriptEnabled;
|
||||
/**
|
||||
* Specify user locale, for example {@code en-GB}, {@code de-DE}, etc. Locale will affect {@code navigator.language} value,
|
||||
* {@code Accept-Language} request header value as well as number and date formatting rules. Learn more about emulation in
|
||||
* our <a href="https://playwright.dev/java/docs/emulation#locale--timezone">emulation guide</a>.
|
||||
* {@code Accept-Language} request header value as well as number and date formatting rules. Defaults to the system default
|
||||
* locale. Learn more about emulation in our <a
|
||||
* href="https://playwright.dev/java/docs/emulation#locale--timezone">emulation guide</a>.
|
||||
*/
|
||||
public String locale;
|
||||
/**
|
||||
@@ -663,11 +668,11 @@ public interface Browser extends AutoCloseable {
|
||||
public Boolean offline;
|
||||
/**
|
||||
* A list of permissions to grant to all pages in this context. See {@link BrowserContext#grantPermissions
|
||||
* BrowserContext.grantPermissions()} for more details.
|
||||
* BrowserContext.grantPermissions()} for more details. Defaults to none.
|
||||
*/
|
||||
public List<String> permissions;
|
||||
/**
|
||||
* Network proxy settings to use with this context.
|
||||
* Network proxy settings to use with this context. Defaults to none.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> For Chromium on Windows the browser needs to be launched with the global proxy for this option to work. If all contexts
|
||||
* override the proxy, global proxy will be never used and can be any string, for example {@code launch({ proxy: { server:
|
||||
@@ -742,13 +747,14 @@ public interface Browser extends AutoCloseable {
|
||||
/**
|
||||
* If set to true, enables strict selectors mode for this context. In the strict selectors mode all operations on selectors
|
||||
* that imply single target DOM element will throw when more than one element matches the selector. This option does not
|
||||
* affect any Locator APIs (Locators are always strict). See {@code Locator} to learn more about the strict mode.
|
||||
* affect any Locator APIs (Locators are always strict). Defaults to {@code false}. See {@code Locator} to learn more about
|
||||
* the strict mode.
|
||||
*/
|
||||
public Boolean strictSelectors;
|
||||
/**
|
||||
* Changes the timezone of the context. See <a
|
||||
* href="https://cs.chromium.org/chromium/src/third_party/icu/source/data/misc/metaZones.txt?rcl=faee8bc70570192d82d2978a71e2a615788597d1">ICU's
|
||||
* metaZones.txt</a> for a list of supported timezone IDs.
|
||||
* metaZones.txt</a> for a list of supported timezone IDs. Defaults to the system timezone.
|
||||
*/
|
||||
public String timezoneId;
|
||||
/**
|
||||
@@ -777,7 +783,7 @@ public interface Browser extends AutoCloseable {
|
||||
* Page.waitForURL()}, {@link Page#waitForRequest Page.waitForRequest()}, or {@link Page#waitForResponse
|
||||
* Page.waitForResponse()} it takes the base URL in consideration by using the <a
|
||||
* href="https://developer.mozilla.org/en-US/docs/Web/API/URL/URL">{@code URL()}</a> constructor for building the
|
||||
* corresponding URL. Examples:
|
||||
* corresponding URL. Unset by default. Examples:
|
||||
* <ul>
|
||||
* <li> baseURL: {@code http://localhost:3000} and navigating to {@code /bar.html} results in {@code
|
||||
* http://localhost:3000/bar.html}</li>
|
||||
@@ -792,7 +798,7 @@ public interface Browser extends AutoCloseable {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Toggles bypassing page's Content-Security-Policy.
|
||||
* Toggles bypassing page's Content-Security-Policy. Defaults to {@code false}.
|
||||
*/
|
||||
public NewPageOptions setBypassCSP(boolean bypassCSP) {
|
||||
this.bypassCSP = bypassCSP;
|
||||
@@ -816,7 +822,7 @@ public interface Browser extends AutoCloseable {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* An object containing additional HTTP headers to be sent with every request.
|
||||
* An object containing additional HTTP headers to be sent with every request. Defaults to none.
|
||||
*/
|
||||
public NewPageOptions setExtraHTTPHeaders(Map<String, String> extraHTTPHeaders) {
|
||||
this.extraHTTPHeaders = extraHTTPHeaders;
|
||||
@@ -887,8 +893,9 @@ public interface Browser extends AutoCloseable {
|
||||
}
|
||||
/**
|
||||
* Specify user locale, for example {@code en-GB}, {@code de-DE}, etc. Locale will affect {@code navigator.language} value,
|
||||
* {@code Accept-Language} request header value as well as number and date formatting rules. Learn more about emulation in
|
||||
* our <a href="https://playwright.dev/java/docs/emulation#locale--timezone">emulation guide</a>.
|
||||
* {@code Accept-Language} request header value as well as number and date formatting rules. Defaults to the system default
|
||||
* locale. Learn more about emulation in our <a
|
||||
* href="https://playwright.dev/java/docs/emulation#locale--timezone">emulation guide</a>.
|
||||
*/
|
||||
public NewPageOptions setLocale(String locale) {
|
||||
this.locale = locale;
|
||||
@@ -904,14 +911,14 @@ public interface Browser extends AutoCloseable {
|
||||
}
|
||||
/**
|
||||
* A list of permissions to grant to all pages in this context. See {@link BrowserContext#grantPermissions
|
||||
* BrowserContext.grantPermissions()} for more details.
|
||||
* BrowserContext.grantPermissions()} for more details. Defaults to none.
|
||||
*/
|
||||
public NewPageOptions setPermissions(List<String> permissions) {
|
||||
this.permissions = permissions;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Network proxy settings to use with this context.
|
||||
* Network proxy settings to use with this context. Defaults to none.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> For Chromium on Windows the browser needs to be launched with the global proxy for this option to work. If all contexts
|
||||
* override the proxy, global proxy will be never used and can be any string, for example {@code launch({ proxy: { server:
|
||||
@@ -921,7 +928,7 @@ public interface Browser extends AutoCloseable {
|
||||
return setProxy(new Proxy(server));
|
||||
}
|
||||
/**
|
||||
* Network proxy settings to use with this context.
|
||||
* Network proxy settings to use with this context. Defaults to none.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> For Chromium on Windows the browser needs to be launched with the global proxy for this option to work. If all contexts
|
||||
* override the proxy, global proxy will be never used and can be any string, for example {@code launch({ proxy: { server:
|
||||
@@ -1054,7 +1061,8 @@ public interface Browser extends AutoCloseable {
|
||||
/**
|
||||
* If set to true, enables strict selectors mode for this context. In the strict selectors mode all operations on selectors
|
||||
* that imply single target DOM element will throw when more than one element matches the selector. This option does not
|
||||
* affect any Locator APIs (Locators are always strict). See {@code Locator} to learn more about the strict mode.
|
||||
* affect any Locator APIs (Locators are always strict). Defaults to {@code false}. See {@code Locator} to learn more about
|
||||
* the strict mode.
|
||||
*/
|
||||
public NewPageOptions setStrictSelectors(boolean strictSelectors) {
|
||||
this.strictSelectors = strictSelectors;
|
||||
@@ -1063,7 +1071,7 @@ public interface Browser extends AutoCloseable {
|
||||
/**
|
||||
* Changes the timezone of the context. See <a
|
||||
* href="https://cs.chromium.org/chromium/src/third_party/icu/source/data/misc/metaZones.txt?rcl=faee8bc70570192d82d2978a71e2a615788597d1">ICU's
|
||||
* metaZones.txt</a> for a list of supported timezone IDs.
|
||||
* metaZones.txt</a> for a list of supported timezone IDs. Defaults to the system timezone.
|
||||
*/
|
||||
public NewPageOptions setTimezoneId(String timezoneId) {
|
||||
this.timezoneId = timezoneId;
|
||||
|
||||
@@ -382,7 +382,7 @@ public interface BrowserType {
|
||||
* Page.waitForURL()}, {@link Page#waitForRequest Page.waitForRequest()}, or {@link Page#waitForResponse
|
||||
* Page.waitForResponse()} it takes the base URL in consideration by using the <a
|
||||
* href="https://developer.mozilla.org/en-US/docs/Web/API/URL/URL">{@code URL()}</a> constructor for building the
|
||||
* corresponding URL. Examples:
|
||||
* corresponding URL. Unset by default. Examples:
|
||||
* <ul>
|
||||
* <li> baseURL: {@code http://localhost:3000} and navigating to {@code /bar.html} results in {@code
|
||||
* http://localhost:3000/bar.html}</li>
|
||||
@@ -394,7 +394,7 @@ public interface BrowserType {
|
||||
*/
|
||||
public String baseURL;
|
||||
/**
|
||||
* Toggles bypassing page's Content-Security-Policy.
|
||||
* Toggles bypassing page's Content-Security-Policy. Defaults to {@code false}.
|
||||
*/
|
||||
public Boolean bypassCSP;
|
||||
/**
|
||||
@@ -440,7 +440,7 @@ public interface BrowserType {
|
||||
*/
|
||||
public Path executablePath;
|
||||
/**
|
||||
* An object containing additional HTTP headers to be sent with every request.
|
||||
* An object containing additional HTTP headers to be sent with every request. Defaults to none.
|
||||
*/
|
||||
public Map<String, String> extraHTTPHeaders;
|
||||
/**
|
||||
@@ -506,8 +506,9 @@ public interface BrowserType {
|
||||
public Boolean javaScriptEnabled;
|
||||
/**
|
||||
* Specify user locale, for example {@code en-GB}, {@code de-DE}, etc. Locale will affect {@code navigator.language} value,
|
||||
* {@code Accept-Language} request header value as well as number and date formatting rules. Learn more about emulation in
|
||||
* our <a href="https://playwright.dev/java/docs/emulation#locale--timezone">emulation guide</a>.
|
||||
* {@code Accept-Language} request header value as well as number and date formatting rules. Defaults to the system default
|
||||
* locale. Learn more about emulation in our <a
|
||||
* href="https://playwright.dev/java/docs/emulation#locale--timezone">emulation guide</a>.
|
||||
*/
|
||||
public String locale;
|
||||
/**
|
||||
@@ -517,7 +518,7 @@ public interface BrowserType {
|
||||
public Boolean offline;
|
||||
/**
|
||||
* A list of permissions to grant to all pages in this context. See {@link BrowserContext#grantPermissions
|
||||
* BrowserContext.grantPermissions()} for more details.
|
||||
* BrowserContext.grantPermissions()} for more details. Defaults to none.
|
||||
*/
|
||||
public List<String> permissions;
|
||||
/**
|
||||
@@ -585,7 +586,8 @@ public interface BrowserType {
|
||||
/**
|
||||
* If set to true, enables strict selectors mode for this context. In the strict selectors mode all operations on selectors
|
||||
* that imply single target DOM element will throw when more than one element matches the selector. This option does not
|
||||
* affect any Locator APIs (Locators are always strict). See {@code Locator} to learn more about the strict mode.
|
||||
* affect any Locator APIs (Locators are always strict). Defaults to {@code false}. See {@code Locator} to learn more about
|
||||
* the strict mode.
|
||||
*/
|
||||
public Boolean strictSelectors;
|
||||
/**
|
||||
@@ -596,7 +598,7 @@ public interface BrowserType {
|
||||
/**
|
||||
* Changes the timezone of the context. See <a
|
||||
* href="https://cs.chromium.org/chromium/src/third_party/icu/source/data/misc/metaZones.txt?rcl=faee8bc70570192d82d2978a71e2a615788597d1">ICU's
|
||||
* metaZones.txt</a> for a list of supported timezone IDs.
|
||||
* metaZones.txt</a> for a list of supported timezone IDs. Defaults to the system timezone.
|
||||
*/
|
||||
public String timezoneId;
|
||||
/**
|
||||
@@ -637,7 +639,7 @@ public interface BrowserType {
|
||||
* Page.waitForURL()}, {@link Page#waitForRequest Page.waitForRequest()}, or {@link Page#waitForResponse
|
||||
* Page.waitForResponse()} it takes the base URL in consideration by using the <a
|
||||
* href="https://developer.mozilla.org/en-US/docs/Web/API/URL/URL">{@code URL()}</a> constructor for building the
|
||||
* corresponding URL. Examples:
|
||||
* corresponding URL. Unset by default. Examples:
|
||||
* <ul>
|
||||
* <li> baseURL: {@code http://localhost:3000} and navigating to {@code /bar.html} results in {@code
|
||||
* http://localhost:3000/bar.html}</li>
|
||||
@@ -652,7 +654,7 @@ public interface BrowserType {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Toggles bypassing page's Content-Security-Policy.
|
||||
* Toggles bypassing page's Content-Security-Policy. Defaults to {@code false}.
|
||||
*/
|
||||
public LaunchPersistentContextOptions setBypassCSP(boolean bypassCSP) {
|
||||
this.bypassCSP = bypassCSP;
|
||||
@@ -735,7 +737,7 @@ public interface BrowserType {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* An object containing additional HTTP headers to be sent with every request.
|
||||
* An object containing additional HTTP headers to be sent with every request. Defaults to none.
|
||||
*/
|
||||
public LaunchPersistentContextOptions setExtraHTTPHeaders(Map<String, String> extraHTTPHeaders) {
|
||||
this.extraHTTPHeaders = extraHTTPHeaders;
|
||||
@@ -853,8 +855,9 @@ public interface BrowserType {
|
||||
}
|
||||
/**
|
||||
* Specify user locale, for example {@code en-GB}, {@code de-DE}, etc. Locale will affect {@code navigator.language} value,
|
||||
* {@code Accept-Language} request header value as well as number and date formatting rules. Learn more about emulation in
|
||||
* our <a href="https://playwright.dev/java/docs/emulation#locale--timezone">emulation guide</a>.
|
||||
* {@code Accept-Language} request header value as well as number and date formatting rules. Defaults to the system default
|
||||
* locale. Learn more about emulation in our <a
|
||||
* href="https://playwright.dev/java/docs/emulation#locale--timezone">emulation guide</a>.
|
||||
*/
|
||||
public LaunchPersistentContextOptions setLocale(String locale) {
|
||||
this.locale = locale;
|
||||
@@ -870,7 +873,7 @@ public interface BrowserType {
|
||||
}
|
||||
/**
|
||||
* A list of permissions to grant to all pages in this context. See {@link BrowserContext#grantPermissions
|
||||
* BrowserContext.grantPermissions()} for more details.
|
||||
* BrowserContext.grantPermissions()} for more details. Defaults to none.
|
||||
*/
|
||||
public LaunchPersistentContextOptions setPermissions(List<String> permissions) {
|
||||
this.permissions = permissions;
|
||||
@@ -1002,7 +1005,8 @@ public interface BrowserType {
|
||||
/**
|
||||
* If set to true, enables strict selectors mode for this context. In the strict selectors mode all operations on selectors
|
||||
* that imply single target DOM element will throw when more than one element matches the selector. This option does not
|
||||
* affect any Locator APIs (Locators are always strict). See {@code Locator} to learn more about the strict mode.
|
||||
* affect any Locator APIs (Locators are always strict). Defaults to {@code false}. See {@code Locator} to learn more about
|
||||
* the strict mode.
|
||||
*/
|
||||
public LaunchPersistentContextOptions setStrictSelectors(boolean strictSelectors) {
|
||||
this.strictSelectors = strictSelectors;
|
||||
@@ -1019,7 +1023,7 @@ public interface BrowserType {
|
||||
/**
|
||||
* Changes the timezone of the context. See <a
|
||||
* href="https://cs.chromium.org/chromium/src/third_party/icu/source/data/misc/metaZones.txt?rcl=faee8bc70570192d82d2978a71e2a615788597d1">ICU's
|
||||
* metaZones.txt</a> for a list of supported timezone IDs.
|
||||
* metaZones.txt</a> for a list of supported timezone IDs. Defaults to the system timezone.
|
||||
*/
|
||||
public LaunchPersistentContextOptions setTimezoneId(String timezoneId) {
|
||||
this.timezoneId = timezoneId;
|
||||
|
||||
@@ -59,7 +59,7 @@ public interface ConsoleMessage {
|
||||
/**
|
||||
* The page that produced this console message, if any.
|
||||
*
|
||||
* @since v1.33
|
||||
* @since v1.34
|
||||
*/
|
||||
Page page();
|
||||
/**
|
||||
|
||||
@@ -84,7 +84,7 @@ public interface Dialog {
|
||||
/**
|
||||
* The page that initiated this dialog, if available.
|
||||
*
|
||||
* @since v1.33
|
||||
* @since v1.34
|
||||
*/
|
||||
Page page();
|
||||
/**
|
||||
|
||||
@@ -602,9 +602,15 @@ public interface ElementHandle extends JSHandle {
|
||||
public ScreenshotCaret caret;
|
||||
/**
|
||||
* Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with a pink box
|
||||
* {@code #FF00FF} that completely covers its bounding box.
|
||||
* {@code #FF00FF} (customized by {@code maskColor}) that completely covers its bounding box.
|
||||
*/
|
||||
public List<Locator> mask;
|
||||
/**
|
||||
* Specify the color of the overlay box for masked elements, in <a
|
||||
* href="https://developer.mozilla.org/en-US/docs/Web/CSS/color_value">CSS color format</a>. Default color is pink {@code
|
||||
* #FF00FF}.
|
||||
*/
|
||||
public String maskColor;
|
||||
/**
|
||||
* Hides default white background and allows capturing screenshots with transparency. Not applicable to {@code jpeg}
|
||||
* images. Defaults to {@code false}.
|
||||
@@ -663,12 +669,21 @@ public interface ElementHandle extends JSHandle {
|
||||
}
|
||||
/**
|
||||
* Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with a pink box
|
||||
* {@code #FF00FF} that completely covers its bounding box.
|
||||
* {@code #FF00FF} (customized by {@code maskColor}) that completely covers its bounding box.
|
||||
*/
|
||||
public ScreenshotOptions setMask(List<Locator> mask) {
|
||||
this.mask = mask;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Specify the color of the overlay box for masked elements, in <a
|
||||
* href="https://developer.mozilla.org/en-US/docs/Web/CSS/color_value">CSS color format</a>. Default color is pink {@code
|
||||
* #FF00FF}.
|
||||
*/
|
||||
public ScreenshotOptions setMaskColor(String maskColor) {
|
||||
this.maskColor = maskColor;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Hides default white background and allows capturing screenshots with transparency. Not applicable to {@code jpeg}
|
||||
* images. Defaults to {@code false}.
|
||||
|
||||
@@ -135,7 +135,7 @@ public interface JSHandle {
|
||||
*
|
||||
* <p> **Usage**
|
||||
* <pre>{@code
|
||||
* JSHandle handle = page.evaluateHandle("() => ({window, document})");
|
||||
* JSHandle handle = page.evaluateHandle("() => ({ window, document })");
|
||||
* Map<String, JSHandle> properties = handle.getProperties();
|
||||
* JSHandle windowHandle = properties.get("window");
|
||||
* JSHandle documentHandle = properties.get("document");
|
||||
|
||||
@@ -1407,9 +1407,15 @@ public interface Locator {
|
||||
public ScreenshotCaret caret;
|
||||
/**
|
||||
* Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with a pink box
|
||||
* {@code #FF00FF} that completely covers its bounding box.
|
||||
* {@code #FF00FF} (customized by {@code maskColor}) that completely covers its bounding box.
|
||||
*/
|
||||
public List<Locator> mask;
|
||||
/**
|
||||
* Specify the color of the overlay box for masked elements, in <a
|
||||
* href="https://developer.mozilla.org/en-US/docs/Web/CSS/color_value">CSS color format</a>. Default color is pink {@code
|
||||
* #FF00FF}.
|
||||
*/
|
||||
public String maskColor;
|
||||
/**
|
||||
* Hides default white background and allows capturing screenshots with transparency. Not applicable to {@code jpeg}
|
||||
* images. Defaults to {@code false}.
|
||||
@@ -1468,12 +1474,21 @@ public interface Locator {
|
||||
}
|
||||
/**
|
||||
* Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with a pink box
|
||||
* {@code #FF00FF} that completely covers its bounding box.
|
||||
* {@code #FF00FF} (customized by {@code maskColor}) that completely covers its bounding box.
|
||||
*/
|
||||
public ScreenshotOptions setMask(List<Locator> mask) {
|
||||
this.mask = mask;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Specify the color of the overlay box for masked elements, in <a
|
||||
* href="https://developer.mozilla.org/en-US/docs/Web/CSS/color_value">CSS color format</a>. Default color is pink {@code
|
||||
* #FF00FF}.
|
||||
*/
|
||||
public ScreenshotOptions setMaskColor(String maskColor) {
|
||||
this.maskColor = maskColor;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Hides default white background and allows capturing screenshots with transparency. Not applicable to {@code jpeg}
|
||||
* images. Defaults to {@code false}.
|
||||
@@ -2067,7 +2082,7 @@ public interface Locator {
|
||||
* }</pre>
|
||||
*
|
||||
* @param locator Additional locator to match.
|
||||
* @since v1.33
|
||||
* @since v1.34
|
||||
*/
|
||||
Locator and(Locator locator);
|
||||
/**
|
||||
|
||||
@@ -2407,9 +2407,15 @@ public interface Page extends AutoCloseable {
|
||||
public Boolean fullPage;
|
||||
/**
|
||||
* Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with a pink box
|
||||
* {@code #FF00FF} that completely covers its bounding box.
|
||||
* {@code #FF00FF} (customized by {@code maskColor}) that completely covers its bounding box.
|
||||
*/
|
||||
public List<Locator> mask;
|
||||
/**
|
||||
* Specify the color of the overlay box for masked elements, in <a
|
||||
* href="https://developer.mozilla.org/en-US/docs/Web/CSS/color_value">CSS color format</a>. Default color is pink {@code
|
||||
* #FF00FF}.
|
||||
*/
|
||||
public String maskColor;
|
||||
/**
|
||||
* Hides default white background and allows capturing screenshots with transparency. Not applicable to {@code jpeg}
|
||||
* images. Defaults to {@code false}.
|
||||
@@ -2489,12 +2495,21 @@ public interface Page extends AutoCloseable {
|
||||
}
|
||||
/**
|
||||
* Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with a pink box
|
||||
* {@code #FF00FF} that completely covers its bounding box.
|
||||
* {@code #FF00FF} (customized by {@code maskColor}) that completely covers its bounding box.
|
||||
*/
|
||||
public ScreenshotOptions setMask(List<Locator> mask) {
|
||||
this.mask = mask;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Specify the color of the overlay box for masked elements, in <a
|
||||
* href="https://developer.mozilla.org/en-US/docs/Web/CSS/color_value">CSS color format</a>. Default color is pink {@code
|
||||
* #FF00FF}.
|
||||
*/
|
||||
public ScreenshotOptions setMaskColor(String maskColor) {
|
||||
this.maskColor = maskColor;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Hides default white background and allows capturing screenshots with transparency. Not applicable to {@code jpeg}
|
||||
* images. Defaults to {@code false}.
|
||||
|
||||
+40
-40
@@ -40,7 +40,7 @@ public interface LocatorAssertions {
|
||||
class IsAttachedOptions {
|
||||
public Boolean attached;
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
* Time to retry the assertion for in milliseconds. Defaults to {@code 5000}.
|
||||
*/
|
||||
public Double timeout;
|
||||
|
||||
@@ -49,7 +49,7 @@ public interface LocatorAssertions {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
* Time to retry the assertion for in milliseconds. Defaults to {@code 5000}.
|
||||
*/
|
||||
public IsAttachedOptions setTimeout(double timeout) {
|
||||
this.timeout = timeout;
|
||||
@@ -59,7 +59,7 @@ public interface LocatorAssertions {
|
||||
class IsCheckedOptions {
|
||||
public Boolean checked;
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
* Time to retry the assertion for in milliseconds. Defaults to {@code 5000}.
|
||||
*/
|
||||
public Double timeout;
|
||||
|
||||
@@ -68,7 +68,7 @@ public interface LocatorAssertions {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
* Time to retry the assertion for in milliseconds. Defaults to {@code 5000}.
|
||||
*/
|
||||
public IsCheckedOptions setTimeout(double timeout) {
|
||||
this.timeout = timeout;
|
||||
@@ -77,12 +77,12 @@ public interface LocatorAssertions {
|
||||
}
|
||||
class IsDisabledOptions {
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
* Time to retry the assertion for in milliseconds. Defaults to {@code 5000}.
|
||||
*/
|
||||
public Double timeout;
|
||||
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
* Time to retry the assertion for in milliseconds. Defaults to {@code 5000}.
|
||||
*/
|
||||
public IsDisabledOptions setTimeout(double timeout) {
|
||||
this.timeout = timeout;
|
||||
@@ -92,7 +92,7 @@ public interface LocatorAssertions {
|
||||
class IsEditableOptions {
|
||||
public Boolean editable;
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
* Time to retry the assertion for in milliseconds. Defaults to {@code 5000}.
|
||||
*/
|
||||
public Double timeout;
|
||||
|
||||
@@ -101,7 +101,7 @@ public interface LocatorAssertions {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
* Time to retry the assertion for in milliseconds. Defaults to {@code 5000}.
|
||||
*/
|
||||
public IsEditableOptions setTimeout(double timeout) {
|
||||
this.timeout = timeout;
|
||||
@@ -110,12 +110,12 @@ public interface LocatorAssertions {
|
||||
}
|
||||
class IsEmptyOptions {
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
* Time to retry the assertion for in milliseconds. Defaults to {@code 5000}.
|
||||
*/
|
||||
public Double timeout;
|
||||
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
* Time to retry the assertion for in milliseconds. Defaults to {@code 5000}.
|
||||
*/
|
||||
public IsEmptyOptions setTimeout(double timeout) {
|
||||
this.timeout = timeout;
|
||||
@@ -125,7 +125,7 @@ public interface LocatorAssertions {
|
||||
class IsEnabledOptions {
|
||||
public Boolean enabled;
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
* Time to retry the assertion for in milliseconds. Defaults to {@code 5000}.
|
||||
*/
|
||||
public Double timeout;
|
||||
|
||||
@@ -134,7 +134,7 @@ public interface LocatorAssertions {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
* Time to retry the assertion for in milliseconds. Defaults to {@code 5000}.
|
||||
*/
|
||||
public IsEnabledOptions setTimeout(double timeout) {
|
||||
this.timeout = timeout;
|
||||
@@ -143,12 +143,12 @@ public interface LocatorAssertions {
|
||||
}
|
||||
class IsFocusedOptions {
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
* Time to retry the assertion for in milliseconds. Defaults to {@code 5000}.
|
||||
*/
|
||||
public Double timeout;
|
||||
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
* Time to retry the assertion for in milliseconds. Defaults to {@code 5000}.
|
||||
*/
|
||||
public IsFocusedOptions setTimeout(double timeout) {
|
||||
this.timeout = timeout;
|
||||
@@ -157,12 +157,12 @@ public interface LocatorAssertions {
|
||||
}
|
||||
class IsHiddenOptions {
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
* Time to retry the assertion for in milliseconds. Defaults to {@code 5000}.
|
||||
*/
|
||||
public Double timeout;
|
||||
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
* Time to retry the assertion for in milliseconds. Defaults to {@code 5000}.
|
||||
*/
|
||||
public IsHiddenOptions setTimeout(double timeout) {
|
||||
this.timeout = timeout;
|
||||
@@ -176,7 +176,7 @@ public interface LocatorAssertions {
|
||||
*/
|
||||
public Double ratio;
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
* Time to retry the assertion for in milliseconds. Defaults to {@code 5000}.
|
||||
*/
|
||||
public Double timeout;
|
||||
|
||||
@@ -189,7 +189,7 @@ public interface LocatorAssertions {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
* Time to retry the assertion for in milliseconds. Defaults to {@code 5000}.
|
||||
*/
|
||||
public IsInViewportOptions setTimeout(double timeout) {
|
||||
this.timeout = timeout;
|
||||
@@ -198,13 +198,13 @@ public interface LocatorAssertions {
|
||||
}
|
||||
class IsVisibleOptions {
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
* Time to retry the assertion for in milliseconds. Defaults to {@code 5000}.
|
||||
*/
|
||||
public Double timeout;
|
||||
public Boolean visible;
|
||||
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
* Time to retry the assertion for in milliseconds. Defaults to {@code 5000}.
|
||||
*/
|
||||
public IsVisibleOptions setTimeout(double timeout) {
|
||||
this.timeout = timeout;
|
||||
@@ -222,7 +222,7 @@ public interface LocatorAssertions {
|
||||
*/
|
||||
public Boolean ignoreCase;
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
* Time to retry the assertion for in milliseconds. Defaults to {@code 5000}.
|
||||
*/
|
||||
public Double timeout;
|
||||
/**
|
||||
@@ -239,7 +239,7 @@ public interface LocatorAssertions {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
* Time to retry the assertion for in milliseconds. Defaults to {@code 5000}.
|
||||
*/
|
||||
public ContainsTextOptions setTimeout(double timeout) {
|
||||
this.timeout = timeout;
|
||||
@@ -255,12 +255,12 @@ public interface LocatorAssertions {
|
||||
}
|
||||
class HasAttributeOptions {
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
* Time to retry the assertion for in milliseconds. Defaults to {@code 5000}.
|
||||
*/
|
||||
public Double timeout;
|
||||
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
* Time to retry the assertion for in milliseconds. Defaults to {@code 5000}.
|
||||
*/
|
||||
public HasAttributeOptions setTimeout(double timeout) {
|
||||
this.timeout = timeout;
|
||||
@@ -269,12 +269,12 @@ public interface LocatorAssertions {
|
||||
}
|
||||
class HasClassOptions {
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
* Time to retry the assertion for in milliseconds. Defaults to {@code 5000}.
|
||||
*/
|
||||
public Double timeout;
|
||||
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
* Time to retry the assertion for in milliseconds. Defaults to {@code 5000}.
|
||||
*/
|
||||
public HasClassOptions setTimeout(double timeout) {
|
||||
this.timeout = timeout;
|
||||
@@ -283,12 +283,12 @@ public interface LocatorAssertions {
|
||||
}
|
||||
class HasCountOptions {
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
* Time to retry the assertion for in milliseconds. Defaults to {@code 5000}.
|
||||
*/
|
||||
public Double timeout;
|
||||
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
* Time to retry the assertion for in milliseconds. Defaults to {@code 5000}.
|
||||
*/
|
||||
public HasCountOptions setTimeout(double timeout) {
|
||||
this.timeout = timeout;
|
||||
@@ -297,12 +297,12 @@ public interface LocatorAssertions {
|
||||
}
|
||||
class HasCSSOptions {
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
* Time to retry the assertion for in milliseconds. Defaults to {@code 5000}.
|
||||
*/
|
||||
public Double timeout;
|
||||
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
* Time to retry the assertion for in milliseconds. Defaults to {@code 5000}.
|
||||
*/
|
||||
public HasCSSOptions setTimeout(double timeout) {
|
||||
this.timeout = timeout;
|
||||
@@ -311,12 +311,12 @@ public interface LocatorAssertions {
|
||||
}
|
||||
class HasIdOptions {
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
* Time to retry the assertion for in milliseconds. Defaults to {@code 5000}.
|
||||
*/
|
||||
public Double timeout;
|
||||
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
* Time to retry the assertion for in milliseconds. Defaults to {@code 5000}.
|
||||
*/
|
||||
public HasIdOptions setTimeout(double timeout) {
|
||||
this.timeout = timeout;
|
||||
@@ -325,12 +325,12 @@ public interface LocatorAssertions {
|
||||
}
|
||||
class HasJSPropertyOptions {
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
* Time to retry the assertion for in milliseconds. Defaults to {@code 5000}.
|
||||
*/
|
||||
public Double timeout;
|
||||
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
* Time to retry the assertion for in milliseconds. Defaults to {@code 5000}.
|
||||
*/
|
||||
public HasJSPropertyOptions setTimeout(double timeout) {
|
||||
this.timeout = timeout;
|
||||
@@ -344,7 +344,7 @@ public interface LocatorAssertions {
|
||||
*/
|
||||
public Boolean ignoreCase;
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
* Time to retry the assertion for in milliseconds. Defaults to {@code 5000}.
|
||||
*/
|
||||
public Double timeout;
|
||||
/**
|
||||
@@ -361,7 +361,7 @@ public interface LocatorAssertions {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
* Time to retry the assertion for in milliseconds. Defaults to {@code 5000}.
|
||||
*/
|
||||
public HasTextOptions setTimeout(double timeout) {
|
||||
this.timeout = timeout;
|
||||
@@ -377,12 +377,12 @@ public interface LocatorAssertions {
|
||||
}
|
||||
class HasValueOptions {
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
* Time to retry the assertion for in milliseconds. Defaults to {@code 5000}.
|
||||
*/
|
||||
public Double timeout;
|
||||
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
* Time to retry the assertion for in milliseconds. Defaults to {@code 5000}.
|
||||
*/
|
||||
public HasValueOptions setTimeout(double timeout) {
|
||||
this.timeout = timeout;
|
||||
@@ -391,12 +391,12 @@ public interface LocatorAssertions {
|
||||
}
|
||||
class HasValuesOptions {
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
* Time to retry the assertion for in milliseconds. Defaults to {@code 5000}.
|
||||
*/
|
||||
public Double timeout;
|
||||
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
* Time to retry the assertion for in milliseconds. Defaults to {@code 5000}.
|
||||
*/
|
||||
public HasValuesOptions setTimeout(double timeout) {
|
||||
this.timeout = timeout;
|
||||
|
||||
@@ -39,12 +39,12 @@ import java.util.regex.Pattern;
|
||||
public interface PageAssertions {
|
||||
class HasTitleOptions {
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
* Time to retry the assertion for in milliseconds. Defaults to {@code 5000}.
|
||||
*/
|
||||
public Double timeout;
|
||||
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
* Time to retry the assertion for in milliseconds. Defaults to {@code 5000}.
|
||||
*/
|
||||
public HasTitleOptions setTimeout(double timeout) {
|
||||
this.timeout = timeout;
|
||||
@@ -53,12 +53,12 @@ public interface PageAssertions {
|
||||
}
|
||||
class HasURLOptions {
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
* Time to retry the assertion for in milliseconds. Defaults to {@code 5000}.
|
||||
*/
|
||||
public Double timeout;
|
||||
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
* Time to retry the assertion for in milliseconds. Defaults to {@code 5000}.
|
||||
*/
|
||||
public HasURLOptions setTimeout(double timeout) {
|
||||
this.timeout = timeout;
|
||||
|
||||
@@ -445,6 +445,10 @@ class BrowserContextImpl extends ChannelOwner implements BrowserContext {
|
||||
|
||||
@Override
|
||||
public void setDefaultNavigationTimeout(double timeout) {
|
||||
setDefaultNavigationTimeoutImpl(timeout);
|
||||
}
|
||||
|
||||
void setDefaultNavigationTimeoutImpl(Double timeout) {
|
||||
withLogging("BrowserContext.setDefaultNavigationTimeout", () -> {
|
||||
timeoutSettings.setDefaultNavigationTimeout(timeout);
|
||||
JsonObject params = new JsonObject();
|
||||
@@ -455,6 +459,10 @@ class BrowserContextImpl extends ChannelOwner implements BrowserContext {
|
||||
|
||||
@Override
|
||||
public void setDefaultTimeout(double timeout) {
|
||||
setDefaultTimeoutImpl(timeout);
|
||||
}
|
||||
|
||||
void setDefaultTimeoutImpl(Double timeout) {
|
||||
withLogging("BrowserContext.setDefaultTimeout", () -> {
|
||||
timeoutSettings.setDefaultTimeout(timeout);
|
||||
JsonObject params = new JsonObject();
|
||||
@@ -580,7 +588,7 @@ class BrowserContextImpl extends ChannelOwner implements BrowserContext {
|
||||
updateInterceptionPatterns();
|
||||
}
|
||||
if (handled == Router.HandleResult.NoMatchingHandler || handled == Router.HandleResult.Fallback) {
|
||||
route.resume();
|
||||
route.resume(null, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -936,7 +936,16 @@ public class PageImpl extends ChannelOwner implements Page {
|
||||
@Override
|
||||
public void pause() {
|
||||
withLogging("Page.pause", () -> {
|
||||
runUntil(() -> {}, new WaitableRace<>(asList(context().pause(), (Waitable<JsonElement>) waitableClosedOrCrashed)));
|
||||
Double defaultNavigationTimeout = browserContext.timeoutSettings.defaultNavigationTimeout();
|
||||
Double defaultTimeout = browserContext.timeoutSettings.defaultTimeout();
|
||||
browserContext.setDefaultNavigationTimeoutImpl(0.0);
|
||||
browserContext.setDefaultTimeoutImpl(0.0);
|
||||
try {
|
||||
runUntil(() -> {}, new WaitableRace<>(asList(context().pause(), (Waitable<JsonElement>) waitableClosedOrCrashed)));
|
||||
} finally {
|
||||
browserContext.setDefaultNavigationTimeoutImpl(defaultNavigationTimeout);
|
||||
browserContext.setDefaultTimeoutImpl(defaultTimeout);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -946,9 +955,6 @@ public class PageImpl extends ChannelOwner implements Page {
|
||||
}
|
||||
|
||||
private byte[] pdfImpl(PdfOptions options) {
|
||||
if (!browserContext.browser().isChromium()) {
|
||||
throw new PlaywrightException("Page.pdf only supported in headless Chromium");
|
||||
}
|
||||
if (options == null) {
|
||||
options = new PdfOptions();
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ class SerializedValue{
|
||||
String v;
|
||||
String d;
|
||||
String u;
|
||||
String bi;
|
||||
public static class R {
|
||||
String p;
|
||||
String f;
|
||||
|
||||
@@ -58,9 +58,13 @@ public class RouteImpl extends ChannelOwner implements Route {
|
||||
|
||||
@Override
|
||||
public void resume(ResumeOptions options) {
|
||||
resume(options, false);
|
||||
}
|
||||
|
||||
void resume(ResumeOptions options, boolean isFallback) {
|
||||
startHandling();
|
||||
applyOverrides(convertType(options, FallbackOptions.class));
|
||||
withLogging("Route.resume", () -> resumeImpl(request().fallbackOverridesForResume()));
|
||||
withLogging("Route.resume", () -> resumeImpl(request().fallbackOverridesForResume(), isFallback));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -71,7 +75,7 @@ public class RouteImpl extends ChannelOwner implements Route {
|
||||
}
|
||||
applyOverrides(options);
|
||||
if (shouldResumeIfFallbackIsCalled) {
|
||||
resume();
|
||||
resume(null, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,7 +118,7 @@ public class RouteImpl extends ChannelOwner implements Route {
|
||||
request().applyFallbackOverrides(overrides);
|
||||
}
|
||||
|
||||
private void resumeImpl(RequestImpl.FallbackOverrides options) {
|
||||
private void resumeImpl(RequestImpl.FallbackOverrides options, boolean isFallback) {
|
||||
JsonObject params = new JsonObject();
|
||||
if (options != null) {
|
||||
if (options.url != null) {
|
||||
@@ -132,6 +136,7 @@ public class RouteImpl extends ChannelOwner implements Route {
|
||||
}
|
||||
}
|
||||
params.addProperty("requestUrl", request.initializer.get("url").getAsString());
|
||||
params.addProperty("isFallback", isFallback);
|
||||
sendMessageAsync("continue", params);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintStream;
|
||||
import java.lang.reflect.Type;
|
||||
import java.math.BigInteger;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
@@ -162,6 +163,8 @@ class Serialization {
|
||||
result.d = ((LocalDateTime)value).atZone(ZoneId.systemDefault()).toInstant().toString();
|
||||
} else if (value instanceof URL) {
|
||||
result.u = ((URL)value).toString();
|
||||
} else if (value instanceof BigInteger) {
|
||||
result.bi = ((BigInteger)value).toString();
|
||||
} else if (value instanceof Pattern) {
|
||||
result.r = new SerializedValue.R();
|
||||
result.r.p = ((Pattern)value).pattern();
|
||||
@@ -236,6 +239,9 @@ class Serialization {
|
||||
throw new PlaywrightException("Unexpected value: " + value.u, e);
|
||||
}
|
||||
}
|
||||
if (value.bi != null) {
|
||||
return (T) new BigInteger(value.bi);
|
||||
}
|
||||
if (value.d != null)
|
||||
return (T)(Date.from(Instant.parse(value.d)));
|
||||
if (value.r != null)
|
||||
@@ -330,6 +336,11 @@ class Serialization {
|
||||
}
|
||||
|
||||
static JsonArray toProtocol(Map<String, String> map) {
|
||||
for (String value : map.values()) {
|
||||
if (value == null) {
|
||||
throw new PlaywrightException("Value cannot be null");
|
||||
}
|
||||
}
|
||||
return toNameValueArray(map);
|
||||
}
|
||||
|
||||
@@ -348,7 +359,11 @@ class Serialization {
|
||||
for (Map.Entry<String, ?> e : map.entrySet()) {
|
||||
JsonObject item = new JsonObject();
|
||||
item.addProperty("name", e.getKey());
|
||||
item.add("value", gson().toJsonTree(e.getValue()));
|
||||
if (e.getValue() instanceof FilePayload) {
|
||||
item.add("value", gson().toJsonTree(e.getValue()));
|
||||
} else {
|
||||
item.addProperty("value", "" + e.getValue());
|
||||
}
|
||||
array.add(item);
|
||||
}
|
||||
return array;
|
||||
|
||||
@@ -30,11 +30,18 @@ class TimeoutSettings {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
void setDefaultTimeout(double timeout) {
|
||||
Double defaultTimeout() {
|
||||
return defaultTimeout;
|
||||
}
|
||||
Double defaultNavigationTimeout() {
|
||||
return defaultNavigationTimeout;
|
||||
}
|
||||
|
||||
void setDefaultTimeout(Double timeout) {
|
||||
defaultTimeout = timeout;
|
||||
}
|
||||
|
||||
void setDefaultNavigationTimeout(double timeout) {
|
||||
void setDefaultNavigationTimeout(Double timeout) {
|
||||
defaultNavigationTimeout = timeout;
|
||||
}
|
||||
|
||||
@@ -73,5 +80,4 @@ class TimeoutSettings {
|
||||
}
|
||||
return new WaitableTimeout<>(timeout(timeout));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -89,7 +89,8 @@ class Utils {
|
||||
}
|
||||
|
||||
|
||||
static Set<Character> escapeGlobChars = new HashSet<>(Arrays.asList('/', '$', '^', '+', '.', '(', ')', '=', '!', '|'));
|
||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions#escaping
|
||||
static Set<Character> escapeGlobChars = new HashSet<>(Arrays.asList('$', '^', '+', '.', '*', '(', ')', '|', '\\', '?', '{', '}', '[', ']'));
|
||||
|
||||
static String globToRegex(String glob) {
|
||||
StringBuilder tokens = new StringBuilder();
|
||||
@@ -97,8 +98,12 @@ class Utils {
|
||||
boolean inGroup = false;
|
||||
for (int i = 0; i < glob.length(); ++i) {
|
||||
char c = glob.charAt(i);
|
||||
if (escapeGlobChars.contains(c)) {
|
||||
tokens.append("\\").append(c);
|
||||
if (c == '\\' && i + 1 < glob.length()) {
|
||||
char nextChar = glob.charAt(++i);
|
||||
if (escapeGlobChars.contains(nextChar)) {
|
||||
tokens.append('\\');
|
||||
}
|
||||
tokens.append(nextChar);
|
||||
continue;
|
||||
}
|
||||
if (c == '*') {
|
||||
@@ -139,7 +144,11 @@ class Utils {
|
||||
tokens.append("\\").append(c);
|
||||
break;
|
||||
default:
|
||||
if (escapeGlobChars.contains(c)) {
|
||||
tokens.append('\\');
|
||||
}
|
||||
tokens.append(c);
|
||||
break;
|
||||
}
|
||||
}
|
||||
tokens.append('$');
|
||||
@@ -162,16 +171,15 @@ class Utils {
|
||||
static final int maxUplodBufferSize = 50 * 1024 * 1024;
|
||||
|
||||
static boolean hasLargeFile(Path[] files) {
|
||||
int totalSize = 0;
|
||||
for (Path file: files) {
|
||||
try {
|
||||
if (Files.size(file)> maxUplodBufferSize) {
|
||||
return true;
|
||||
}
|
||||
totalSize += Files.size(file);
|
||||
} catch (IOException e) {
|
||||
throw new PlaywrightException("Cannot get file size.", e);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return totalSize > maxUplodBufferSize;
|
||||
}
|
||||
|
||||
static void addLargeFileUploadParams(Path[] files, JsonObject params, BrowserContextImpl context) {
|
||||
@@ -202,10 +210,12 @@ class Utils {
|
||||
}
|
||||
|
||||
static void checkFilePayloadSize(FilePayload[] files) {
|
||||
int totalSize = 0;
|
||||
for (FilePayload file: files) {
|
||||
if (file.buffer.length > maxUplodBufferSize) {
|
||||
throw new PlaywrightException("Cannot set buffer larger than 50Mb, please write it to a file and pass its path instead.");
|
||||
}
|
||||
totalSize += file.buffer.length;
|
||||
}
|
||||
if (totalSize > maxUplodBufferSize) {
|
||||
throw new PlaywrightException("Cannot set buffer larger than 50Mb, please write it to a file and pass its path instead.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -511,14 +511,18 @@ public class TestBrowserContextFetch extends TestBase {
|
||||
FormData.create()
|
||||
.set("firstName", "John")
|
||||
.set("lastName", "Doe")
|
||||
.set("age", 30)
|
||||
.set("isMale", true)
|
||||
.set("file", "f.js")));
|
||||
|
||||
assertEquals("POST", req.get().method);
|
||||
assertEquals(asList("application/x-www-form-urlencoded"), req.get().headers.get("content-type"));
|
||||
String body = new String(req.get().postBody);
|
||||
assertTrue(body.contains("firstName=John"));
|
||||
assertTrue(body.contains("lastName=Doe"));
|
||||
assertTrue(body.contains("file=f.js"));
|
||||
assertTrue(body.contains("firstName=John"), body);
|
||||
assertTrue(body.contains("lastName=Doe"), body);
|
||||
assertTrue(body.contains("age=30"), body);
|
||||
assertTrue(body.contains("isMale=true"), body);
|
||||
assertTrue(body.contains("file=f.js"), body);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -526,6 +530,8 @@ public class TestBrowserContextFetch extends TestBase {
|
||||
Map<String, Object> data = mapOf(
|
||||
"firstName", "John",
|
||||
"lastName", "Doe",
|
||||
"age", 30,
|
||||
"isMale", true,
|
||||
"file", mapOf("name", "f.js")
|
||||
);
|
||||
Future<Server.Request> req = server.futureRequest("/empty.html");
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.microsoft.playwright;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.condition.DisabledIf;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.time.*;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
@@ -115,6 +116,12 @@ public class TestPageEvaluate extends TestBase {
|
||||
assertEquals(true, result);
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldTransferBigint() {
|
||||
assertEquals(new BigInteger("42", 10), page.evaluate("() => 42n"));
|
||||
assertEquals(new BigInteger("17", 10), page.evaluate("a => a", new BigInteger("17", 10)));
|
||||
}
|
||||
|
||||
// @Test
|
||||
void shouldTransferMapsAsEmptyObjects() {
|
||||
// Not applicable.
|
||||
|
||||
@@ -97,6 +97,42 @@ public class TestPageRoute extends TestBase {
|
||||
assertEquals(asList(1), intercepted);
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldSupportQuestionMarkInGlobPattern() {
|
||||
server.setRoute("/index", exchange -> {
|
||||
exchange.sendResponseHeaders(200, 0);
|
||||
try (OutputStreamWriter writer = new OutputStreamWriter(exchange.getResponseBody())) {
|
||||
writer.write("index-no-hello");
|
||||
}
|
||||
});
|
||||
server.setRoute("/index123hello", exchange -> {
|
||||
exchange.sendResponseHeaders(200, 0);
|
||||
try (OutputStreamWriter writer = new OutputStreamWriter(exchange.getResponseBody())) {
|
||||
writer.write("index123hello");
|
||||
}
|
||||
});
|
||||
|
||||
page.route("**/index?hello", route -> {
|
||||
route.fulfill(new Route.FulfillOptions().setBody("intercepted any character"));
|
||||
});
|
||||
|
||||
page.route("**/index\\?hello", route -> {
|
||||
route.fulfill(new Route.FulfillOptions().setBody("intercepted question mark"));
|
||||
});
|
||||
|
||||
page.navigate(server.PREFIX + "/index?hello");
|
||||
assertTrue(page.content().contains("intercepted question mark"), page.content());
|
||||
|
||||
page.navigate(server.PREFIX + "/index");
|
||||
assertTrue(page.content().contains("index-no-hello"), page.content());
|
||||
|
||||
page.navigate(server.PREFIX + "/index1hello");
|
||||
assertTrue(page.content().contains("intercepted any character"), page.content());
|
||||
|
||||
page.navigate(server.PREFIX + "/index123hello");
|
||||
assertTrue(page.content().contains("index123hello"), page.content());
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldUnroutePredicate() {
|
||||
List<Integer> intercepted = new ArrayList<>();
|
||||
|
||||
@@ -35,6 +35,7 @@ import java.util.Arrays;
|
||||
import static com.microsoft.playwright.options.ScreenshotAnimations.DISABLED;
|
||||
import static java.util.Arrays.asList;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
|
||||
|
||||
// TODO: suite.skip(browserName === "firefox" && headful");
|
||||
public class TestPageScreenshot extends TestBase {
|
||||
@@ -233,4 +234,19 @@ public class TestPageScreenshot extends TestBase {
|
||||
}
|
||||
assertTrue(hasDifferentScreenshots);
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldWorkWhenMaskColorIsNotPinkF0F() {
|
||||
page.setViewportSize(500, 500);
|
||||
page.navigate(server.PREFIX + "/grid.html");
|
||||
byte[] screenshot1 = page.screenshot(
|
||||
new Page.ScreenshotOptions()
|
||||
.setMask(asList(page.locator("div").nth(5)))
|
||||
.setMaskColor("#00FF00"));
|
||||
byte[] screenshot2 = page.screenshot(
|
||||
new Page.ScreenshotOptions()
|
||||
.setMask(asList(page.locator("div").nth(5))));
|
||||
assertThrows(AssertionError.class, () -> assertArrayEquals(screenshot1, screenshot2));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -73,6 +73,6 @@ public class TestPageSetExtraHttpHeaders extends TestBase {
|
||||
PlaywrightException e = assertThrows(PlaywrightException.class, () -> {
|
||||
browser.newContext(new Browser.NewContextOptions().setExtraHTTPHeaders(mapOf("foo", null)));
|
||||
});
|
||||
assertTrue(e.getMessage().contains("expected string, got undefined"));
|
||||
assertTrue(e.getMessage().contains("Value cannot be null"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.microsoft.playwright;
|
||||
|
||||
import com.microsoft.playwright.options.AriaRole;
|
||||
import com.microsoft.playwright.options.FilePayload;
|
||||
import org.junit.jupiter.api.Assumptions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -96,6 +97,34 @@ public class TestPageSetInputFiles extends TestBase {
|
||||
assertEquals(200 * 1024 * 1024, fields.get(0).content.length());
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldUploadMultipleLargeFiles(@TempDir Path tmpDir) throws IOException, ExecutionException, InterruptedException {
|
||||
Assumptions.assumeTrue(3 <= (Runtime.getRuntime().maxMemory() >> 30), "Fails if max heap size is < 3Gb");
|
||||
int filesCount = 10;
|
||||
page.navigate(server.PREFIX + "/input/fileupload-multi.html");
|
||||
Path uploadFile = tmpDir.resolve("50MB_1.zip");
|
||||
String str = String.join("", Collections.nCopies(1024, "A"));
|
||||
|
||||
try (Writer stream = new OutputStreamWriter(Files.newOutputStream(uploadFile))) {
|
||||
for (int i = 0; i < 49 * 1024; i++) {
|
||||
stream.write(str);
|
||||
}
|
||||
}
|
||||
Locator input = page.locator("input[type='file']");
|
||||
List<Path> uploadFiles = new ArrayList<>();
|
||||
uploadFiles.add(uploadFile);
|
||||
for (int i = 1; i < filesCount; i++) {
|
||||
Path dstFile = tmpDir.resolve("50MB_" + i + ".zip");
|
||||
Files.copy(uploadFile, dstFile);
|
||||
uploadFiles.add(dstFile);
|
||||
}
|
||||
FileChooser fileChooser = page.waitForFileChooser(() -> input.click());
|
||||
fileChooser.setFiles(uploadFiles.toArray(new Path[0]));
|
||||
Object filesLen = page.getByRole(AriaRole.TEXTBOX).evaluate("e => e.files.length");
|
||||
assertTrue(fileChooser.isMultiple());
|
||||
assertEquals(filesCount, filesLen);
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldUploadLargeFileWithRelativePath(@TempDir Path tmpDir) throws IOException, ExecutionException, InterruptedException {
|
||||
Assumptions.assumeTrue(3 <= (Runtime.getRuntime().maxMemory() >> 30), "Fails if max heap size is < 3Gb");
|
||||
|
||||
@@ -52,6 +52,18 @@ public class TestPdf extends TestBase {
|
||||
@DisabledIf(value="com.microsoft.playwright.TestBase#isChromium", disabledReason="skip")
|
||||
void shouldThrowInNonChromium() {
|
||||
PlaywrightException e = assertThrows(PlaywrightException.class, () -> page.pdf());
|
||||
assertTrue(e.getMessage().contains("Page.pdf only supported in headless Chromium"));
|
||||
assertTrue(e.getMessage().contains("PDF generation is only supported for Headless Chromium"), e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@DisabledIf(value="com.microsoft.playwright.TestBase#isChromium", disabledReason="skip")
|
||||
void correctExceptionWithPersistentContext(@TempDir Path tempDir) {
|
||||
Path profile = tempDir.resolve("profile");
|
||||
try (BrowserContext context = browserType.launchPersistentContext(profile)) {
|
||||
Page page = context.newPage();
|
||||
PlaywrightException e = assertThrows(PlaywrightException.class, () -> page.pdf());
|
||||
assertTrue(e.getMessage().contains("PDF generation is only supported for Headless Chromium"), e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.microsoft.playwright;
|
||||
|
||||
import org.junit.jupiter.api.Assumptions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.condition.DisabledIf;
|
||||
import org.junit.jupiter.api.condition.EnabledIf;
|
||||
@@ -28,6 +29,11 @@ import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
public class TestWorkers extends TestBase {
|
||||
|
||||
private int browserMajorVersion() {
|
||||
String version = browser.version();
|
||||
return Integer.parseInt(version.split("\\.")[0]);
|
||||
}
|
||||
|
||||
@Test
|
||||
void pageWorkers() {
|
||||
Worker worker = page.waitForWorker(() -> page.navigate(server.PREFIX + "/worker/worker.html"));
|
||||
@@ -145,6 +151,7 @@ public class TestWorkers extends TestBase {
|
||||
|
||||
@Test
|
||||
void shouldReportNetworkActivity() {
|
||||
Assumptions.assumeFalse(isFirefox() && browserMajorVersion() < 114);
|
||||
Worker worker = page.waitForWorker(() -> page.navigate(server.PREFIX + "/worker/worker.html"));
|
||||
String url = server.PREFIX + "/one-style.css";
|
||||
Request[] request = {null};
|
||||
@@ -160,6 +167,7 @@ public class TestWorkers extends TestBase {
|
||||
|
||||
@Test
|
||||
void shouldReportNetworkActivityOnWorkerCreation() {
|
||||
Assumptions.assumeFalse(isFirefox() && browserMajorVersion() < 114);
|
||||
// Chromium needs waitForDebugger enabled for this one.
|
||||
page.navigate(server.EMPTY_PAGE);
|
||||
String url = server.PREFIX + "/one-style.css";
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>File upload test</title>
|
||||
</head>
|
||||
<body>
|
||||
<form action="/upload" method="post" enctype="multipart/form-data">
|
||||
<input type="file" multiple name="file1">
|
||||
<input type="submit">
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>com.microsoft.playwright</groupId>
|
||||
<artifactId>parent-pom</artifactId>
|
||||
<version>1.34.0-SNAPSHOT</version>
|
||||
<version>1.36.0</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>Playwright Parent Project</name>
|
||||
<description>Java library to automate Chromium, Firefox and WebKit with a single API.
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
1.34.2
|
||||
1.36.1
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>com.microsoft.playwright</groupId>
|
||||
<artifactId>api-generator</artifactId>
|
||||
<version>1.34.0-SNAPSHOT</version>
|
||||
<version>1.36.0</version>
|
||||
<name>Playwright - API Generator</name>
|
||||
<description>
|
||||
This is an internal module used to generate Java API from the upstream Playwright
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.microsoft.playwright</groupId>
|
||||
<artifactId>test-cli-fatjar</artifactId>
|
||||
<version>1.34.0-SNAPSHOT</version>
|
||||
<version>1.36.0</version>
|
||||
<name>Test Playwright Command Line FatJar</name>
|
||||
<properties>
|
||||
<compiler.version>1.8</compiler.version>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.microsoft.playwright</groupId>
|
||||
<artifactId>test-cli-version</artifactId>
|
||||
<version>1.34.0-SNAPSHOT</version>
|
||||
<version>1.36.0</version>
|
||||
<name>Test Playwright Command Line Version</name>
|
||||
<properties>
|
||||
<compiler.version>1.8</compiler.version>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.microsoft.playwright</groupId>
|
||||
<artifactId>test-local-installation</artifactId>
|
||||
<version>1.34.0-SNAPSHOT</version>
|
||||
<version>1.36.0</version>
|
||||
<name>Test local installation</name>
|
||||
<description>Runs Playwright test suite (copied from playwright module) against locally cached Playwright</description>
|
||||
<properties>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
</parent>
|
||||
<groupId>com.microsoft.playwright</groupId>
|
||||
<artifactId>test-spring-boot-starter</artifactId>
|
||||
<version>1.34.0-SNAPSHOT</version>
|
||||
<version>1.36.0</version>
|
||||
<name>Test Playwright With Spring Boot</name>
|
||||
<properties>
|
||||
<spring.version>2.4.3</spring.version>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>com.microsoft.playwright</groupId>
|
||||
<artifactId>update-version</artifactId>
|
||||
<version>1.34.0-SNAPSHOT</version>
|
||||
<version>1.36.0</version>
|
||||
<name>Playwright - Update Version in Documentation</name>
|
||||
<description>
|
||||
This is an internal module used to update versions in the documentation based on
|
||||
|
||||
Reference in New Issue
Block a user