Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ Playwright is a Java library to automate [Chromium](https://www.chromium.org/Hom

| | Linux | macOS | Windows |
| :--- | :---: | :---: | :---: |
| Chromium <!-- GEN:chromium-version -->151.0.7922.34<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| WebKit <!-- GEN:webkit-version -->26.5<!-- GEN:stop --> | ✅ | ✅ | ✅ |
| Firefox <!-- GEN:firefox-version -->153.0<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| Chromium <!-- GEN:chromium-version -->153.0.8010.12<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| WebKit <!-- GEN:webkit-version -->26.6<!-- GEN:stop --> | ✅ | ✅ | ✅ |
| Firefox <!-- GEN:firefox-version -->155.0<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |

## Documentation

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,11 @@
/**
* Credentials for <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication">HTTP authentication</a>. If
* no origin is specified, the username and password are sent to any servers upon unauthorized responses.
*
* <p> Pass an array to use different credentials for different origins. The first entry that matches the request origin is
* used, and entries with no origin match any request.
*/
public HttpCredentials httpCredentials;
public Object httpCredentials;
/**
* Whether to ignore HTTPS errors when sending network requests. Defaults to {@code false}.
*/
Expand Down Expand Up @@ -124,7 +127,7 @@
* {@code http://localhost:3000/bar.html}</li>
* </ul>
*/
public NewContextOptions setBaseURL(String baseURL) {

Check warning on line 130 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (macos-15-xlarge, webkit)

Check warning on line 130 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (macos-15-xlarge, webkit)

no @PARAM for baseURL

Check warning on line 130 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (ubuntu-latest, chromium)

Check warning on line 130 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (ubuntu-latest, chromium)

no @PARAM for baseURL

Check warning on line 130 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (macos-latest, chromium)

Check warning on line 130 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (macos-latest, chromium)

no @PARAM for baseURL

Check warning on line 130 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / stable (ubuntu-latest, chrome)

Check warning on line 130 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / stable (ubuntu-latest, chrome)

no @PARAM for baseURL

Check warning on line 130 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (ubuntu-latest, webkit)

Check warning on line 130 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (ubuntu-latest, webkit)

no @PARAM for baseURL

Check warning on line 130 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / stable (macos-latest, msedge)

Check warning on line 130 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / stable (macos-latest, msedge)

no @PARAM for baseURL

Check warning on line 130 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / stable (macos-latest, chrome)

Check warning on line 130 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / stable (macos-latest, chrome)

no @PARAM for baseURL

Check warning on line 130 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (ubuntu-latest, firefox)

Check warning on line 130 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (ubuntu-latest, firefox)

no @PARAM for baseURL

Check warning on line 130 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (macos-latest, firefox)

Check warning on line 130 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (macos-latest, firefox)

no @PARAM for baseURL
this.baseURL = baseURL;
return this;
}
Expand All @@ -145,39 +148,56 @@
* <p> <strong>NOTE:</strong> When using WebKit on macOS, accessing {@code localhost} will not pick up client certificates. You can make it work by
* replacing {@code localhost} with {@code local.playwright}.
*/
public NewContextOptions setClientCertificates(List<ClientCertificate> clientCertificates) {

Check warning on line 151 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (macos-15-xlarge, webkit)

Check warning on line 151 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (macos-15-xlarge, webkit)

no @PARAM for clientCertificates

Check warning on line 151 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (ubuntu-latest, chromium)

Check warning on line 151 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (ubuntu-latest, chromium)

no @PARAM for clientCertificates

Check warning on line 151 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (macos-latest, chromium)

Check warning on line 151 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (macos-latest, chromium)

no @PARAM for clientCertificates

Check warning on line 151 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / stable (ubuntu-latest, chrome)

Check warning on line 151 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / stable (ubuntu-latest, chrome)

no @PARAM for clientCertificates

Check warning on line 151 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (ubuntu-latest, webkit)

Check warning on line 151 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (ubuntu-latest, webkit)

no @PARAM for clientCertificates

Check warning on line 151 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / stable (macos-latest, msedge)

Check warning on line 151 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / stable (macos-latest, msedge)

no @PARAM for clientCertificates

Check warning on line 151 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / stable (macos-latest, chrome)

Check warning on line 151 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / stable (macos-latest, chrome)

no @PARAM for clientCertificates

Check warning on line 151 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (ubuntu-latest, firefox)

Check warning on line 151 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (ubuntu-latest, firefox)

no @PARAM for clientCertificates

Check warning on line 151 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (macos-latest, firefox)

Check warning on line 151 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (macos-latest, firefox)

no @PARAM for clientCertificates
this.clientCertificates = clientCertificates;
return this;
}
/**
* An object containing additional HTTP headers to be sent with every request. Defaults to none.
*/
public NewContextOptions setExtraHTTPHeaders(Map<String, String> extraHTTPHeaders) {

Check warning on line 158 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (macos-15-xlarge, webkit)

Check warning on line 158 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (macos-15-xlarge, webkit)

no @PARAM for extraHTTPHeaders

Check warning on line 158 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (ubuntu-latest, chromium)

Check warning on line 158 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (ubuntu-latest, chromium)

no @PARAM for extraHTTPHeaders

Check warning on line 158 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (macos-latest, chromium)

Check warning on line 158 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (macos-latest, chromium)

no @PARAM for extraHTTPHeaders

Check warning on line 158 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / stable (ubuntu-latest, chrome)

Check warning on line 158 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / stable (ubuntu-latest, chrome)

no @PARAM for extraHTTPHeaders

Check warning on line 158 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (ubuntu-latest, webkit)

Check warning on line 158 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (ubuntu-latest, webkit)

no @PARAM for extraHTTPHeaders

Check warning on line 158 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / stable (macos-latest, msedge)

Check warning on line 158 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / stable (macos-latest, msedge)

no @PARAM for extraHTTPHeaders

Check warning on line 158 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / stable (macos-latest, chrome)

Check warning on line 158 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / stable (macos-latest, chrome)

no @PARAM for extraHTTPHeaders

Check warning on line 158 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (ubuntu-latest, firefox)

Check warning on line 158 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (ubuntu-latest, firefox)

no @PARAM for extraHTTPHeaders

Check warning on line 158 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (macos-latest, firefox)

Check warning on line 158 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (macos-latest, firefox)

no @PARAM for extraHTTPHeaders
this.extraHTTPHeaders = extraHTTPHeaders;
return this;
}
/**
* Whether to throw on response codes other than 2xx and 3xx. By default response object is returned for all status codes.
*/
public NewContextOptions setFailOnStatusCode(boolean failOnStatusCode) {

Check warning on line 165 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (macos-15-xlarge, webkit)

no @PARAM for failOnStatusCode

Check warning on line 165 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (ubuntu-latest, chromium)

no @PARAM for failOnStatusCode

Check warning on line 165 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (macos-latest, chromium)

no @PARAM for failOnStatusCode

Check warning on line 165 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / stable (ubuntu-latest, chrome)

no @PARAM for failOnStatusCode

Check warning on line 165 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (ubuntu-latest, webkit)

no @PARAM for failOnStatusCode

Check warning on line 165 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / stable (macos-latest, msedge)

no @PARAM for failOnStatusCode

Check warning on line 165 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / stable (macos-latest, chrome)

no @PARAM for failOnStatusCode

Check warning on line 165 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (ubuntu-latest, firefox)

no @PARAM for failOnStatusCode

Check warning on line 165 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (macos-latest, firefox)

no @PARAM for failOnStatusCode
this.failOnStatusCode = failOnStatusCode;
return this;
}
/**
* Credentials for <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication">HTTP authentication</a>. If
* no origin is specified, the username and password are sent to any servers upon unauthorized responses.
*
* <p> Pass an array to use different credentials for different origins. The first entry that matches the request origin is
* used, and entries with no origin match any request.
*/
public NewContextOptions setHttpCredentials(String username, String password) {
return setHttpCredentials(new HttpCredentials(username, password));
}
/**
* Credentials for <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication">HTTP authentication</a>. If
* no origin is specified, the username and password are sent to any servers upon unauthorized responses.
*
* <p> Pass an array to use different credentials for different origins. The first entry that matches the request origin is
* used, and entries with no origin match any request.
*/
public NewContextOptions setHttpCredentials(HttpCredentials httpCredentials) {
this.httpCredentials = httpCredentials;
return this;
}
/**
* Credentials for <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication">HTTP authentication</a>. If
* no origin is specified, the username and password are sent to any servers upon unauthorized responses.
*
* <p> Pass an array to use different credentials for different origins. The first entry that matches the request origin is
* used, and entries with no origin match any request.
*/
public NewContextOptions setHttpCredentials(List<HttpCredentials> httpCredentials) {
this.httpCredentials = httpCredentials;
return this;
}
/**
* Whether to ignore HTTPS errors when sending network requests. Defaults to {@code false}.
*/
Expand Down Expand Up @@ -249,7 +269,7 @@
*
* @since v1.16
*/
default APIRequestContext newContext() {

Check warning on line 272 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (macos-15-xlarge, webkit)

Check warning on line 272 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (ubuntu-latest, chromium)

Check warning on line 272 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (macos-latest, chromium)

Check warning on line 272 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / stable (ubuntu-latest, chrome)

Check warning on line 272 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (ubuntu-latest, webkit)

Check warning on line 272 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / stable (macos-latest, msedge)

Check warning on line 272 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / stable (macos-latest, chrome)

Check warning on line 272 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (ubuntu-latest, firefox)

Check warning on line 272 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (macos-latest, firefox)

return newContext(null);
}
/**
Expand All @@ -257,6 +277,6 @@
*
* @since v1.16
*/
APIRequestContext newContext(NewContextOptions options);

Check warning on line 280 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (macos-15-xlarge, webkit)

Check warning on line 280 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (macos-15-xlarge, webkit)

no @PARAM for options

Check warning on line 280 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (ubuntu-latest, chromium)

Check warning on line 280 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (ubuntu-latest, chromium)

no @PARAM for options

Check warning on line 280 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (macos-latest, chromium)

Check warning on line 280 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (macos-latest, chromium)

no @PARAM for options

Check warning on line 280 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / stable (ubuntu-latest, chrome)

Check warning on line 280 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / stable (ubuntu-latest, chrome)

no @PARAM for options

Check warning on line 280 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (ubuntu-latest, webkit)

Check warning on line 280 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (ubuntu-latest, webkit)

no @PARAM for options

Check warning on line 280 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / stable (macos-latest, msedge)

Check warning on line 280 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / stable (macos-latest, msedge)

no @PARAM for options

Check warning on line 280 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / stable (macos-latest, chrome)

Check warning on line 280 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / stable (macos-latest, chrome)

no @PARAM for options

Check warning on line 280 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (ubuntu-latest, firefox)

Check warning on line 280 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (ubuntu-latest, firefox)

no @PARAM for options

Check warning on line 280 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (macos-latest, firefox)

Check warning on line 280 in playwright/src/main/java/com/microsoft/playwright/APIRequest.java

View workflow job for this annotation

GitHub Actions / dev (macos-latest, firefox)

no @PARAM for options
}

Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ class StorageStateOptions {
* Set to {@code true} to include IndexedDB in the storage state snapshot.
*/
public Boolean indexedDB;
/**
* Set to {@code true} to include the origin private file system in the storage state snapshot.
*/
public Boolean opfs;
/**
* The file path to save the storage state to. If {@code path} is a relative path, then it is resolved relative to current
* working directory. If no path is provided, storage state is still returned, but won't be saved to the disk.
Expand All @@ -74,6 +78,13 @@ public StorageStateOptions setIndexedDB(boolean indexedDB) {
this.indexedDB = indexedDB;
return this;
}
/**
* Set to {@code true} to include the origin private file system in the storage state snapshot.
*/
public StorageStateOptions setOpfs(boolean opfs) {
this.opfs = opfs;
return this;
}
/**
* The file path to save the storage state to. If {@code path} is a relative path, then it is resolved relative to current
* working directory. If no path is provided, storage state is still returned, but won't be saved to the disk.
Expand Down Expand Up @@ -484,7 +495,7 @@ default String storageState() {
*/
String storageState(StorageStateOptions options);
/**
*
* Tracing recorder for requests made through this API request context.
*
* @since v1.60
*/
Expand Down
44 changes: 42 additions & 2 deletions playwright/src/main/java/com/microsoft/playwright/Browser.java
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,11 @@ class NewContextOptions {
/**
* Credentials for <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication">HTTP authentication</a>. If
* no origin is specified, the username and password are sent to any servers upon unauthorized responses.
*
* <p> Pass an array to use different credentials for different origins. The first entry that matches the request origin is
* used, and entries with no origin match any request.
*/
public HttpCredentials httpCredentials;
public Object httpCredentials;
/**
* Whether to ignore HTTPS errors when sending network requests. Defaults to {@code false}.
*/
Expand Down Expand Up @@ -409,18 +412,35 @@ public NewContextOptions setHasTouch(boolean hasTouch) {
/**
* Credentials for <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication">HTTP authentication</a>. If
* no origin is specified, the username and password are sent to any servers upon unauthorized responses.
*
* <p> Pass an array to use different credentials for different origins. The first entry that matches the request origin is
* used, and entries with no origin match any request.
*/
public NewContextOptions setHttpCredentials(String username, String password) {
return setHttpCredentials(new HttpCredentials(username, password));
}
/**
* Credentials for <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication">HTTP authentication</a>. If
* no origin is specified, the username and password are sent to any servers upon unauthorized responses.
*
* <p> Pass an array to use different credentials for different origins. The first entry that matches the request origin is
* used, and entries with no origin match any request.
*/
public NewContextOptions setHttpCredentials(HttpCredentials httpCredentials) {
this.httpCredentials = httpCredentials;
return this;
}
/**
* Credentials for <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication">HTTP authentication</a>. If
* no origin is specified, the username and password are sent to any servers upon unauthorized responses.
*
* <p> Pass an array to use different credentials for different origins. The first entry that matches the request origin is
* used, and entries with no origin match any request.
*/
public NewContextOptions setHttpCredentials(List<HttpCredentials> httpCredentials) {
this.httpCredentials = httpCredentials;
return this;
}
/**
* Whether to ignore HTTPS errors when sending network requests. Defaults to {@code false}.
*/
Expand Down Expand Up @@ -737,8 +757,11 @@ class NewPageOptions {
/**
* Credentials for <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication">HTTP authentication</a>. If
* no origin is specified, the username and password are sent to any servers upon unauthorized responses.
*
* <p> Pass an array to use different credentials for different origins. The first entry that matches the request origin is
* used, and entries with no origin match any request.
*/
public HttpCredentials httpCredentials;
public Object httpCredentials;
/**
* Whether to ignore HTTPS errors when sending network requests. Defaults to {@code false}.
*/
Expand Down Expand Up @@ -985,18 +1008,35 @@ public NewPageOptions setHasTouch(boolean hasTouch) {
/**
* Credentials for <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication">HTTP authentication</a>. If
* no origin is specified, the username and password are sent to any servers upon unauthorized responses.
*
* <p> Pass an array to use different credentials for different origins. The first entry that matches the request origin is
* used, and entries with no origin match any request.
*/
public NewPageOptions setHttpCredentials(String username, String password) {
return setHttpCredentials(new HttpCredentials(username, password));
}
/**
* Credentials for <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication">HTTP authentication</a>. If
* no origin is specified, the username and password are sent to any servers upon unauthorized responses.
*
* <p> Pass an array to use different credentials for different origins. The first entry that matches the request origin is
* used, and entries with no origin match any request.
*/
public NewPageOptions setHttpCredentials(HttpCredentials httpCredentials) {
this.httpCredentials = httpCredentials;
return this;
}
/**
* Credentials for <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication">HTTP authentication</a>. If
* no origin is specified, the username and password are sent to any servers upon unauthorized responses.
*
* <p> Pass an array to use different credentials for different origins. The first entry that matches the request origin is
* used, and entries with no origin match any request.
*/
public NewPageOptions setHttpCredentials(List<HttpCredentials> httpCredentials) {
this.httpCredentials = httpCredentials;
return this;
}
/**
* Whether to ignore HTTPS errors when sending network requests. Defaults to {@code false}.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,17 @@ public interface BrowserContext extends AutoCloseable {
*/
void offDialog(Consumer<Dialog> handler);

/**
* Emitted when a JavaScript dialog in any page belonging to this context has been closed, either by {@link
* com.microsoft.playwright.Dialog#accept Dialog.accept()}, by {@link com.microsoft.playwright.Dialog#dismiss
* Dialog.dismiss()}, or manually by the user in the headed browser.
*/
void onDialogClosed(Consumer<Dialog> handler);
/**
* Removes handler that was previously added with {@link #onDialogClosed onDialogClosed(handler)}.
*/
void offDialogClosed(Consumer<Dialog> handler);

/**
* Emitted when attachment download started in any page belonging to this context. User can access basic file operations on
* downloaded content via the passed {@code Download} instance. See also {@link com.microsoft.playwright.Page#onDownload
Expand Down Expand Up @@ -465,6 +476,14 @@ class StorageStateOptions {
* Authentication, enable this.
*/
public Boolean indexedDB;
/**
* Set to {@code true} to include the <a
* href="https://developer.mozilla.org/en-US/docs/Web/API/File_System_API/Origin_private_file_system">origin private file
* system</a> in the storage state snapshot.
*
* <p> <strong>NOTE:</strong> OPFS is currently not supported in ephemeral WebKit contexts.
*/
public Boolean opfs;
/**
* The file path to save the storage state to. If {@code path} is a relative path, then it is resolved relative to current
* working directory. If no path is provided, storage state is still returned, but won't be saved to the disk.
Expand Down Expand Up @@ -493,6 +512,17 @@ public StorageStateOptions setIndexedDB(boolean indexedDB) {
this.indexedDB = indexedDB;
return this;
}
/**
* Set to {@code true} to include the <a
* href="https://developer.mozilla.org/en-US/docs/Web/API/File_System_API/Origin_private_file_system">origin private file
* system</a> in the storage state snapshot.
*
* <p> <strong>NOTE:</strong> OPFS is currently not supported in ephemeral WebKit contexts.
*/
public StorageStateOptions setOpfs(boolean opfs) {
this.opfs = opfs;
return this;
}
/**
* The file path to save the storage state to. If {@code path} is a relative path, then it is resolved relative to current
* working directory. If no path is provided, storage state is still returned, but won't be saved to the disk.
Expand Down Expand Up @@ -1492,26 +1522,26 @@ default void routeFromHAR(Path har) {
*/
void setOffline(boolean offline);
/**
* Returns storage state for this browser context, contains current cookies, local storage snapshot, IndexedDB snapshot and
* virtual WebAuthn credentials.
* Returns storage state for this browser context, contains current cookies, local storage snapshot, IndexedDB snapshot,
* origin private file system snapshot and virtual WebAuthn credentials.
*
* @since v1.8
*/
default String storageState() {
return storageState(null);
}
/**
* Returns storage state for this browser context, contains current cookies, local storage snapshot, IndexedDB snapshot and
* virtual WebAuthn credentials.
* Returns storage state for this browser context, contains current cookies, local storage snapshot, IndexedDB snapshot,
* origin private file system snapshot and virtual WebAuthn credentials.
*
* @since v1.8
*/
String storageState(StorageStateOptions options);
/**
* Clears the existing cookies, local storage, IndexedDB entries and virtual WebAuthn credentials, and sets the new storage
* state. When the storage state contains credentials, the virtual WebAuthn authenticator is installed (equivalent to
* {@link com.microsoft.playwright.Credentials#install Credentials.install()}), preventing all real authenticators from
* working in this context.
* Clears the existing cookies, local storage, IndexedDB entries, origin private file system entries and virtual WebAuthn
* credentials, and sets the new storage state. When the storage state contains credentials, the virtual WebAuthn
* authenticator is installed (equivalent to {@link com.microsoft.playwright.Credentials#install Credentials.install()}),
* preventing all real authenticators from working in this context.
*
* <p> <strong>Usage</strong>
* <pre>{@code
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -632,8 +632,11 @@ class LaunchPersistentContextOptions {
/**
* Credentials for <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication">HTTP authentication</a>. If
* no origin is specified, the username and password are sent to any servers upon unauthorized responses.
*
* <p> Pass an array to use different credentials for different origins. The first entry that matches the request origin is
* used, and entries with no origin match any request.
*/
public HttpCredentials httpCredentials;
public Object httpCredentials;
/**
* If {@code true}, Playwright does not pass its own configurations args and only uses the ones from {@code args}.
* Dangerous option; use with care. Defaults to {@code false}.
Expand Down Expand Up @@ -1013,18 +1016,35 @@ public LaunchPersistentContextOptions setHeadless(boolean headless) {
/**
* Credentials for <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication">HTTP authentication</a>. If
* no origin is specified, the username and password are sent to any servers upon unauthorized responses.
*
* <p> Pass an array to use different credentials for different origins. The first entry that matches the request origin is
* used, and entries with no origin match any request.
*/
public LaunchPersistentContextOptions setHttpCredentials(String username, String password) {
return setHttpCredentials(new HttpCredentials(username, password));
}
/**
* Credentials for <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication">HTTP authentication</a>. If
* no origin is specified, the username and password are sent to any servers upon unauthorized responses.
*
* <p> Pass an array to use different credentials for different origins. The first entry that matches the request origin is
* used, and entries with no origin match any request.
*/
public LaunchPersistentContextOptions setHttpCredentials(HttpCredentials httpCredentials) {
this.httpCredentials = httpCredentials;
return this;
}
/**
* Credentials for <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication">HTTP authentication</a>. If
* no origin is specified, the username and password are sent to any servers upon unauthorized responses.
*
* <p> Pass an array to use different credentials for different origins. The first entry that matches the request origin is
* used, and entries with no origin match any request.
*/
public LaunchPersistentContextOptions setHttpCredentials(List<HttpCredentials> httpCredentials) {
this.httpCredentials = httpCredentials;
return this;
}
/**
* If {@code true}, Playwright does not pass its own configurations args and only uses the ones from {@code args}.
* Dangerous option; use with care. Defaults to {@code false}.
Expand Down
Loading
Loading