Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 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 -->149.0.7827.55<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| Chromium <!-- GEN:chromium-version -->151.0.7922.34<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| WebKit <!-- GEN:webkit-version -->26.5<!-- GEN:stop --> | ✅ | ✅ | ✅ |
| Firefox <!-- GEN:firefox-version -->151.0<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| Firefox <!-- GEN:firefox-version -->152.0.4<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |

## Documentation

Expand Down
2 changes: 1 addition & 1 deletion examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<name>Playwright Client Examples</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<playwright.version>1.61.0</playwright.version>
<playwright.version>1.62.0</playwright.version>
</properties>
<dependencies>
<dependency>
Expand Down
10 changes: 10 additions & 0 deletions playwright/src/main/java/com/microsoft/playwright/APIResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,16 @@ public interface APIResponse {
* @since v1.16
*/
String text();
/**
* Returns resource timing information for given response. For redirected requests, returns the information for the last
* request in the redirect chain. When the response is served <a
* href="https://playwright.dev/java/docs/mock#replaying-from-har">from the HAR file</a>, timing information is not
* available and all the values are -1. Find more information at <a
* href="https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming">Resource Timing API</a>.
*
* @since v1.62
*/
Timing timing();
/**
* Contains the URL of the response.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,13 @@ public RouteOptions setTimes(int times) {
}
}
class RouteFromHAROptions {
/**
* If set to {@code true}, requests made via {@code APIRequestContext} (such as {@link
* com.microsoft.playwright.BrowserContext#request BrowserContext.request()} or {@link
* com.microsoft.playwright.Page#request Page.request()}) are also served from the HAR file. By default these requests are
* sent to the network, matching the behavior prior to v1.62. Defaults to {@code false} for backward compatibility.
*/
public Boolean interceptAPIRequests;
/**
* <ul>
* <li> If set to 'abort' any request not found in the HAR file will be aborted.</li>
Expand Down Expand Up @@ -394,6 +401,16 @@ class RouteFromHAROptions {
*/
public Object url;

/**
* If set to {@code true}, requests made via {@code APIRequestContext} (such as {@link
* com.microsoft.playwright.BrowserContext#request BrowserContext.request()} or {@link
* com.microsoft.playwright.Page#request Page.request()}) are also served from the HAR file. By default these requests are
* sent to the network, matching the behavior prior to v1.62. Defaults to {@code false} for backward compatibility.
*/
public RouteFromHAROptions setInterceptAPIRequests(boolean interceptAPIRequests) {
this.interceptAPIRequests = interceptAPIRequests;
return this;
}
/**
* <ul>
* <li> If set to 'abort' any request not found in the HAR file will be aborted.</li>
Expand Down Expand Up @@ -449,6 +466,16 @@ public RouteFromHAROptions setUrl(Pattern url) {
}
}
class StorageStateOptions {
/**
* Set to {@code true} to include the context's virtual WebAuthn {@link com.microsoft.playwright.BrowserContext#credentials
* BrowserContext.credentials()} (passkeys) in the storage state snapshot. The captured credentials carry their private
* keys, so they can be re-seeded into a later context via the {@code storageState} option or {@link
* com.microsoft.playwright.BrowserContext#setStorageState BrowserContext.setStorageState()}. Note that restoring the
* storage state that contains credentials will automatically install the virtual WebAuthn authenticator (see {@link
* com.microsoft.playwright.Credentials#install Credentials.install()}), and prevent all real authenticators from working
* in this context.
*/
public Boolean credentials;
/**
* Set to {@code true} to include <a href="https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API">IndexedDB</a> in
* the storage state snapshot. If your application uses IndexedDB to store authentication tokens, like Firebase
Expand All @@ -461,6 +488,19 @@ class StorageStateOptions {
*/
public Path path;

/**
* Set to {@code true} to include the context's virtual WebAuthn {@link com.microsoft.playwright.BrowserContext#credentials
* BrowserContext.credentials()} (passkeys) in the storage state snapshot. The captured credentials carry their private
* keys, so they can be re-seeded into a later context via the {@code storageState} option or {@link
* com.microsoft.playwright.BrowserContext#setStorageState BrowserContext.setStorageState()}. Note that restoring the
* storage state that contains credentials will automatically install the virtual WebAuthn authenticator (see {@link
* com.microsoft.playwright.Credentials#install Credentials.install()}), and prevent all real authenticators from working
* in this context.
*/
public StorageStateOptions setCredentials(boolean credentials) {
this.credentials = credentials;
return this;
}
/**
* Set to {@code true} to include <a href="https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API">IndexedDB</a> in
* the storage state snapshot. If your application uses IndexedDB to store authentication tokens, like Firebase
Expand Down Expand Up @@ -1469,21 +1509,26 @@ default void routeFromHAR(Path har) {
*/
void setOffline(boolean offline);
/**
* Returns storage state for this browser context, contains current cookies, local storage snapshot and IndexedDB snapshot.
* Returns storage state for this browser context, contains current cookies, local storage snapshot, IndexedDB snapshot and
* virtual WebAuthn credentials.
*
* @since v1.8
*/
default String storageState() {
return storageState(null);
}
/**
* Returns storage state for this browser context, contains current cookies, local storage snapshot and IndexedDB snapshot.
* Returns storage state for this browser context, contains current cookies, local storage snapshot, IndexedDB snapshot and
* virtual WebAuthn credentials.
*
* @since v1.8
*/
String storageState(StorageStateOptions options);
/**
* Clears the existing cookies, local storage and IndexedDB entries for all origins and sets the new storage state.
* Clears the existing cookies, local storage, IndexedDB entries and virtual WebAuthn credentials, and sets the new storage
* state. When the storage state contains credentials, the virtual WebAuthn authenticator is installed (equivalent to
* {@link com.microsoft.playwright.Credentials#install Credentials.install()}), preventing all real authenticators from
* working in this context.
*
* <p> <strong>Usage</strong>
* <pre>{@code
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1314,6 +1314,9 @@ default Browser connect(String endpoint) {
* advanced functionality, you probably want to use {@link com.microsoft.playwright.BrowserType#connect
* BrowserType.connect()}.
*
* <p> <strong>NOTE:</strong> Playwright maintains a curated list of arguments for launching the browser. If you launch the browser without Playwright
* and do not pass the exact same arguments, some of Playwright functionality may be broken upon connecting to the browser.
*
* <p> <strong>Usage</strong>
* <pre>{@code
* Browser browser = playwright.chromium().connectOverCDP("http://localhost:9222");
Expand All @@ -1340,6 +1343,9 @@ default Browser connectOverCDP(String endpointURL) {
* advanced functionality, you probably want to use {@link com.microsoft.playwright.BrowserType#connect
* BrowserType.connect()}.
*
* <p> <strong>NOTE:</strong> Playwright maintains a curated list of arguments for launching the browser. If you launch the browser without Playwright
* and do not pass the exact same arguments, some of Playwright functionality may be broken upon connecting to the browser.
*
* <p> <strong>Usage</strong>
* <pre>{@code
* Browser browser = playwright.chromium().connectOverCDP("http://localhost:9222");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* passkeys and answer {@code navigator.credentials.create()} / {@code navigator.credentials.get()} ceremonies in the page,
* without a real authenticator or hardware security key.
*
* <p> There are two common ways to use it:
* <p> There are three common ways to use it:
*
* <p> <strong>Usage: seed a known credential</strong>
* <pre>{@code
Expand All @@ -43,7 +43,7 @@
* // The page's navigator.credentials.get() is answered with the seeded passkey.
* }</pre>
*
* <p> <strong>Usage: capture a passkey, then reuse it</strong>
* <p> <strong>Usage: capture a credential, then reuse it</strong>
* <pre>{@code
* // setup test: let the app register a passkey, then save it.
* BrowserContext context = browser.newContext();
Expand Down Expand Up @@ -75,6 +75,11 @@
* // navigator.credentials.get() resolves the captured passkey — already signed in.
* }</pre>
*
* <p> <strong>Usage: save credentials in the storage state, restore later</strong>
*
* <p> See <a href="https://playwright.dev/java/docs/auth">authentication guide</a> for examples of using saving and resotring
* the storage state.
*
* <p> <strong>Defaults</strong>
*/
public interface Credentials {
Expand Down
Loading
Loading