1
0
mirror of synced 2026-05-22 18:53:15 +00:00

Compare commits

...

5 Commits

Author SHA1 Message Date
Yury Semikhatsky ef8656036f chore: set version to 1.35.0 (#1306) 2023-06-12 16:27:49 -07:00
Yury Semikhatsky 2a047bff9a chore: roll 1.35.0 (#1304) 2023-06-12 15:54:40 -07:00
Yury Semikhatsky 4e5285950d chore: roll to 1.35.0-beta (#1298) 2023-06-08 18:23:19 -07:00
Yury Semikhatsky b8a9d888be fix: NPE in Page.pdf for persistent context (#1292)
Fixes #1291
2023-05-26 12:00:07 -07:00
Yury Semikhatsky 5a4640fe2a chore: set dev version to 1.35 (#1288) 2023-05-24 16:45:39 -07:00
33 changed files with 291 additions and 139 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ Playwright is a Java library to automate [Chromium](https://www.chromium.org/Hom
| | Linux | macOS | Windows |
| :--- | :---: | :---: | :---: |
| Chromium <!-- GEN:chromium-version -->114.0.5735.35<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| Chromium <!-- GEN:chromium-version -->115.0.5790.24<!-- 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: |
+1 -1
View File
@@ -6,7 +6,7 @@
<parent>
<groupId>com.microsoft.playwright</groupId>
<artifactId>parent-pom</artifactId>
<version>1.34.0-SNAPSHOT</version>
<version>1.35.0</version>
</parent>
<artifactId>driver-bundle</artifactId>
+1 -1
View File
@@ -6,7 +6,7 @@
<parent>
<groupId>com.microsoft.playwright</groupId>
<artifactId>parent-pom</artifactId>
<version>1.34.0-SNAPSHOT</version>
<version>1.35.0</version>
</parent>
<artifactId>driver</artifactId>
+1 -1
View File
@@ -6,7 +6,7 @@
<groupId>org.example</groupId>
<artifactId>examples</artifactId>
<version>1.34.0-SNAPSHOT</version>
<version>1.35.0</version>
<name>Playwright Client Examples</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+1 -1
View File
@@ -7,7 +7,7 @@
<parent>
<groupId>com.microsoft.playwright</groupId>
<artifactId>parent-pom</artifactId>
<version>1.34.0-SNAPSHOT</version>
<version>1.35.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}.
@@ -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,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;
@@ -580,7 +580,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.setDefaultNavigationTimeout(0);
browserContext.setDefaultTimeout(0);
try {
runUntil(() -> {}, new WaitableRace<>(asList(context().pause(), (Waitable<JsonElement>) waitableClosedOrCrashed)));
} finally {
browserContext.setDefaultNavigationTimeout(defaultNavigationTimeout);
browserContext.setDefaultTimeout(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();
}
@@ -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);
}
@@ -30,6 +30,13 @@ class TimeoutSettings {
this.parent = parent;
}
Double defaultTimeout() {
return defaultTimeout;
}
Double defaultNavigationTimeout() {
return defaultNavigationTimeout;
}
void setDefaultTimeout(double timeout) {
defaultTimeout = timeout;
}
@@ -73,5 +80,4 @@ class TimeoutSettings {
}
return new WaitableTimeout<>(timeout(timeout));
}
}
@@ -162,16 +162,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 +201,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.");
}
}
@@ -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));
}
}
@@ -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>
+1 -1
View File
@@ -6,7 +6,7 @@
<groupId>com.microsoft.playwright</groupId>
<artifactId>parent-pom</artifactId>
<version>1.34.0-SNAPSHOT</version>
<version>1.35.0</version>
<packaging>pom</packaging>
<name>Playwright Parent Project</name>
<description>Java library to automate Chromium, Firefox and WebKit with a single API.
+1 -1
View File
@@ -1 +1 @@
1.34.2
1.35.0
+1 -1
View File
@@ -6,7 +6,7 @@
<groupId>com.microsoft.playwright</groupId>
<artifactId>api-generator</artifactId>
<version>1.34.0-SNAPSHOT</version>
<version>1.35.0</version>
<name>Playwright - API Generator</name>
<description>
This is an internal module used to generate Java API from the upstream Playwright
+1 -1
View File
@@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.microsoft.playwright</groupId>
<artifactId>test-cli-fatjar</artifactId>
<version>1.34.0-SNAPSHOT</version>
<version>1.35.0</version>
<name>Test Playwright Command Line FatJar</name>
<properties>
<compiler.version>1.8</compiler.version>
+1 -1
View File
@@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.microsoft.playwright</groupId>
<artifactId>test-cli-version</artifactId>
<version>1.34.0-SNAPSHOT</version>
<version>1.35.0</version>
<name>Test Playwright Command Line Version</name>
<properties>
<compiler.version>1.8</compiler.version>
+1 -1
View File
@@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.microsoft.playwright</groupId>
<artifactId>test-local-installation</artifactId>
<version>1.34.0-SNAPSHOT</version>
<version>1.35.0</version>
<name>Test local installation</name>
<description>Runs Playwright test suite (copied from playwright module) against locally cached Playwright</description>
<properties>
+1 -1
View File
@@ -9,7 +9,7 @@
</parent>
<groupId>com.microsoft.playwright</groupId>
<artifactId>test-spring-boot-starter</artifactId>
<version>1.34.0-SNAPSHOT</version>
<version>1.35.0</version>
<name>Test Playwright With Spring Boot</name>
<properties>
<spring.version>2.4.3</spring.version>
+1 -1
View File
@@ -6,7 +6,7 @@
<groupId>com.microsoft.playwright</groupId>
<artifactId>update-version</artifactId>
<version>1.34.0-SNAPSHOT</version>
<version>1.35.0</version>
<name>Playwright - Update Version in Documentation</name>
<description>
This is an internal module used to update versions in the documentation based on