diff --git a/README.md b/README.md index aa9ab07c3..5a4a7f0b1 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Playwright is a Java library to automate [Chromium](https://www.chromium.org/Hom | | Linux | macOS | Windows | | :--- | :---: | :---: | :---: | -| Chromium 158.0.8127.18 | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| Chromium 159.0.8154.13 | :white_check_mark: | :white_check_mark: | :white_check_mark: | | WebKit 27.2 | ✅ | ✅ | ✅ | | Firefox 159.0 | :white_check_mark: | :white_check_mark: | :white_check_mark: | diff --git a/playwright/src/main/java/com/microsoft/playwright/BrowserContext.java b/playwright/src/main/java/com/microsoft/playwright/BrowserContext.java index a8920e118..413ab4152 100644 --- a/playwright/src/main/java/com/microsoft/playwright/BrowserContext.java +++ b/playwright/src/main/java/com/microsoft/playwright/BrowserContext.java @@ -1520,10 +1520,13 @@ default void routeFromHAR(Path har) { * * @param offline Whether to emulate network being offline for the browser context. * - *

NOTE: Offline emulation only affects requests that go through the browser's regular network stack, such as page navigations, - * {@code fetch()}, {@code XMLHttpRequest} and WebSockets. It does not affect WebRTC traffic: established {@code - * RTCPeerConnection}s keep sending and receiving media over UDP. To test WebRTC connection loss, interrupt the connection - * outside the browser, for example by stopping the TURN server or using an OS-level firewall. + *

NOTE: Offline emulation affects HTTP requests, such as page navigations, {@code fetch()} and {@code XMLHttpRequest}.WebSocket behavior depends on the browser and whether the connection is already established. Chromium and Firefox fail + * new WebSocket connections while offline, but do not close already-open connections. Chromium can defer incoming messages + * until the context goes back online, rather than lose them; Firefox can continue delivering messages while offline. + * WebKit can allow both new WebSocket connections and traffic on established connections while offline. Do not rely on + * offline emulation to test WebSocket message loss or connection closure.Offline emulation does not affect WebRTC traffic: established {@code RTCPeerConnection}s keep sending and receiving + * media over UDP. To test WebRTC connection loss, interrupt the connection outside the browser, for example by stopping + * the TURN server or using an OS-level firewall. * @since v1.8 */ void setOffline(boolean offline); diff --git a/playwright/src/main/java/com/microsoft/playwright/BrowserType.java b/playwright/src/main/java/com/microsoft/playwright/BrowserType.java index 62b38ac26..90e854a4b 100644 --- a/playwright/src/main/java/com/microsoft/playwright/BrowserType.java +++ b/playwright/src/main/java/com/microsoft/playwright/BrowserType.java @@ -131,6 +131,20 @@ class ConnectOverCDPOptions { public @Nullable Path artifactsDir; /** * Additional HTTP headers to be sent with connect request. Optional. + * + *

When {@code endpointURL} is an extension URL such as {@code extension://chrome}, the headers are not sent. They are the + * options of the connection: + *

*/ public @Nullable Map headers; /** @@ -167,6 +181,20 @@ public ConnectOverCDPOptions setArtifactsDir(Path artifactsDir) { } /** * Additional HTTP headers to be sent with connect request. Optional. + * + *

When {@code endpointURL} is an extension URL such as {@code extension://chrome}, the headers are not sent. They are the + * options of the connection: + *

*/ public ConnectOverCDPOptions setHeaders(Map headers) { this.headers = headers; @@ -1361,10 +1389,27 @@ default Browser connect(String endpoint) { * @param endpointURL A CDP websocket endpoint or http url to connect to. For example {@code http://localhost:9222/} or {@code * ws://127.0.0.1:9222/devtools/browser/387adf4c-243f-4051-a181-46798f4a46f4}. * - *

Alternatively, a browser channel name such as {@code chrome} or {@code msedge} to connect to a browser with remote - * debugging enabled in its default user data directory. On Linux, Playwright uses {@code CHROME_USER_DATA_DIR} when set. - * Otherwise, it uses {@code CHROME_CONFIG_HOME}, then {@code XDG_CONFIG_HOME}, then {@code ~/.config} to locate that - * directory. + *

Alternatively, a URL that tells which running browser to connect to: + *

+ * + *

The values of {@code userDataDir} and {@code executablePath} must be URL-encoded, for example with {@code + * encodeURIComponent} or {@code URLSearchParams}. The channel is a browser channel name such as {@code chrome}, {@code + * chrome-beta} or {@code msedge}. The default user data directory of the channel is where the browser keeps its data. On + * Linux, Playwright uses {@code CHROME_USER_DATA_DIR} when set. Otherwise, it uses {@code CHROME_CONFIG_HOME}, then {@code + * XDG_CONFIG_HOME}, then {@code ~/.config} to locate that directory. * @since v1.9 */ default Browser connectOverCDP(String endpointURL) { @@ -1395,10 +1440,27 @@ default Browser connectOverCDP(String endpointURL) { * @param endpointURL A CDP websocket endpoint or http url to connect to. For example {@code http://localhost:9222/} or {@code * ws://127.0.0.1:9222/devtools/browser/387adf4c-243f-4051-a181-46798f4a46f4}. * - *

Alternatively, a browser channel name such as {@code chrome} or {@code msedge} to connect to a browser with remote - * debugging enabled in its default user data directory. On Linux, Playwright uses {@code CHROME_USER_DATA_DIR} when set. - * Otherwise, it uses {@code CHROME_CONFIG_HOME}, then {@code XDG_CONFIG_HOME}, then {@code ~/.config} to locate that - * directory. + *

Alternatively, a URL that tells which running browser to connect to: + *

+ * + *

The values of {@code userDataDir} and {@code executablePath} must be URL-encoded, for example with {@code + * encodeURIComponent} or {@code URLSearchParams}. The channel is a browser channel name such as {@code chrome}, {@code + * chrome-beta} or {@code msedge}. The default user data directory of the channel is where the browser keeps its data. On + * Linux, Playwright uses {@code CHROME_USER_DATA_DIR} when set. Otherwise, it uses {@code CHROME_CONFIG_HOME}, then {@code + * XDG_CONFIG_HOME}, then {@code ~/.config} to locate that directory. * @since v1.9 */ Browser connectOverCDP(String endpointURL, @Nullable ConnectOverCDPOptions options); diff --git a/playwright/src/main/java/com/microsoft/playwright/Frame.java b/playwright/src/main/java/com/microsoft/playwright/Frame.java index a8b5e7b1d..db86d78f3 100644 --- a/playwright/src/main/java/com/microsoft/playwright/Frame.java +++ b/playwright/src/main/java/com/microsoft/playwright/Frame.java @@ -3470,6 +3470,8 @@ default Locator getByAltText(Pattern text) { * Allows locating input elements by the text of the associated {@code

Associated {@code

Usage * *

For example, this method will find inputs by label "Username" and "Password" in the following DOM: @@ -3488,6 +3490,8 @@ default Locator getByLabel(String text) { * Allows locating input elements by the text of the associated {@code

Associated {@code

Usage * *

For example, this method will find inputs by label "Username" and "Password" in the following DOM: @@ -3504,6 +3508,8 @@ default Locator getByLabel(String text) { * Allows locating input elements by the text of the associated {@code

Associated {@code

Usage * *

For example, this method will find inputs by label "Username" and "Password" in the following DOM: @@ -3522,6 +3528,8 @@ default Locator getByLabel(Pattern text) { * Allows locating input elements by the text of the associated {@code

Associated {@code

Usage * *

For example, this method will find inputs by label "Username" and "Password" in the following DOM: diff --git a/playwright/src/main/java/com/microsoft/playwright/FrameLocator.java b/playwright/src/main/java/com/microsoft/playwright/FrameLocator.java index 2559fdb49..8deee87e6 100644 --- a/playwright/src/main/java/com/microsoft/playwright/FrameLocator.java +++ b/playwright/src/main/java/com/microsoft/playwright/FrameLocator.java @@ -510,6 +510,8 @@ default Locator getByAltText(Pattern text) { * Allows locating input elements by the text of the associated {@code

Associated {@code

Usage * *

For example, this method will find inputs by label "Username" and "Password" in the following DOM: @@ -528,6 +530,8 @@ default Locator getByLabel(String text) { * Allows locating input elements by the text of the associated {@code

Associated {@code

Usage * *

For example, this method will find inputs by label "Username" and "Password" in the following DOM: @@ -544,6 +548,8 @@ default Locator getByLabel(String text) { * Allows locating input elements by the text of the associated {@code

Associated {@code

Usage * *

For example, this method will find inputs by label "Username" and "Password" in the following DOM: @@ -562,6 +568,8 @@ default Locator getByLabel(Pattern text) { * Allows locating input elements by the text of the associated {@code

Associated {@code

Usage * *

For example, this method will find inputs by label "Username" and "Password" in the following DOM: diff --git a/playwright/src/main/java/com/microsoft/playwright/Keyboard.java b/playwright/src/main/java/com/microsoft/playwright/Keyboard.java index 8b6225b55..1053eb0b0 100644 --- a/playwright/src/main/java/com/microsoft/playwright/Keyboard.java +++ b/playwright/src/main/java/com/microsoft/playwright/Keyboard.java @@ -28,6 +28,11 @@ * com.microsoft.playwright.Keyboard#up Keyboard.up()}, and {@link com.microsoft.playwright.Keyboard#insertText * Keyboard.insertText()} to manually fire events as if they were generated from a real keyboard. * + *

NOTE: Caps Lock state emulation is not supported. Pressing {@code CapsLock} dispatches keyboard events, but does not make + * subsequent lowercase input uppercase. To type uppercase text, pass uppercase characters to {@link + * com.microsoft.playwright.Locator#pressSequentially Locator.pressSequentially()} or {@link + * com.microsoft.playwright.Keyboard#type Keyboard.type()}. + * *

An example of holding down {@code Shift} in order to select and delete some text: *

{@code
  * page.keyboard().type("Hello World!");
diff --git a/playwright/src/main/java/com/microsoft/playwright/Locator.java b/playwright/src/main/java/com/microsoft/playwright/Locator.java
index 6a3f129fc..2b3976301 100644
--- a/playwright/src/main/java/com/microsoft/playwright/Locator.java
+++ b/playwright/src/main/java/com/microsoft/playwright/Locator.java
@@ -3700,6 +3700,8 @@ default Locator getByAltText(Pattern text) {
    * Allows locating input elements by the text of the associated {@code