diff --git a/playwright/src/main/java/com/microsoft/playwright/BrowserType.java b/playwright/src/main/java/com/microsoft/playwright/BrowserType.java index ea4111a9..69927ee0 100644 --- a/playwright/src/main/java/com/microsoft/playwright/BrowserType.java +++ b/playwright/src/main/java/com/microsoft/playwright/BrowserType.java @@ -605,10 +605,11 @@ public interface BrowserType { * *
NOTE: Connecting over the Chrome DevTools Protocol is only supported for Chromium-based browsers. * - * @param wsEndpoint A CDP websocket endpoint to connect to. + * @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}. */ - default Browser connectOverCDP(String wsEndpoint) { - return connectOverCDP(wsEndpoint, null); + default Browser connectOverCDP(String endpointURL) { + return connectOverCDP(endpointURL, null); } /** * This methods attaches Playwright to an existing browser instance using the Chrome DevTools Protocol. @@ -617,9 +618,10 @@ public interface BrowserType { * *
NOTE: Connecting over the Chrome DevTools Protocol is only supported for Chromium-based browsers. * - * @param wsEndpoint A CDP websocket endpoint to connect to. + * @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}. */ - Browser connectOverCDP(String wsEndpoint, ConnectOverCDPOptions options); + Browser connectOverCDP(String endpointURL, ConnectOverCDPOptions options); /** * A path where Playwright expects to find a bundled browser executable. */ diff --git a/playwright/src/main/java/com/microsoft/playwright/ElementHandle.java b/playwright/src/main/java/com/microsoft/playwright/ElementHandle.java index 740f6a86..f18c9381 100644 --- a/playwright/src/main/java/com/microsoft/playwright/ElementHandle.java +++ b/playwright/src/main/java/com/microsoft/playwright/ElementHandle.java @@ -623,20 +623,20 @@ public interface ElementHandle extends JSHandle { /** * This method checks the element by performing the following steps: *
If the element is detached from the DOM at any moment during the action, this method rejects. + *
If the element is detached from the DOM at any moment during the action, this method throws. * - *
When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}. - * Passing zero timeout disables this. + *
When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code TimeoutError}. Passing + * zero timeout disables this. */ default void check() { check(null); @@ -644,20 +644,20 @@ public interface ElementHandle extends JSHandle { /** * This method checks the element by performing the following steps: *
If the element is detached from the DOM at any moment during the action, this method rejects. + *
If the element is detached from the DOM at any moment during the action, this method throws. * - *
When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}. - * Passing zero timeout disables this. + *
When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code TimeoutError}. Passing + * zero timeout disables this. */ void check(CheckOptions options); /** @@ -670,10 +670,10 @@ public interface ElementHandle extends JSHandle { *
If the element is detached from the DOM at any moment during the action, this method rejects. + *
If the element is detached from the DOM at any moment during the action, this method throws. * - *
When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}. - * Passing zero timeout disables this. + *
When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code TimeoutError}. Passing + * zero timeout disables this. */ default void click() { click(null); @@ -688,10 +688,10 @@ public interface ElementHandle extends JSHandle { *
If the element is detached from the DOM at any moment during the action, this method rejects. + *
If the element is detached from the DOM at any moment during the action, this method throws. * - *
When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}. - * Passing zero timeout disables this. + *
When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code TimeoutError}. Passing + * zero timeout disables this. */ void click(ClickOptions options); /** @@ -706,13 +706,13 @@ public interface ElementHandle extends JSHandle { *
If the element is detached from the DOM at any moment during the action, this method rejects. + *
If the element is detached from the DOM at any moment during the action, this method throws. * - *
When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}. - * Passing zero timeout disables this. + *
When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code TimeoutError}. Passing + * zero timeout disables this. * *
NOTE: {@code elementHandle.dblclick()} dispatches two {@code click} events and a single {@code dblclick} event. */ @@ -727,13 +727,13 @@ public interface ElementHandle extends JSHandle { *
If the element is detached from the DOM at any moment during the action, this method rejects. + *
If the element is detached from the DOM at any moment during the action, this method throws. * - *
When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}. - * Passing zero timeout disables this. + *
When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code TimeoutError}. Passing + * zero timeout disables this. * *
NOTE: {@code elementHandle.dblclick()} dispatches two {@code click} events and a single {@code dblclick} event. */ @@ -953,10 +953,10 @@ public interface ElementHandle extends JSHandle { *
If the element is detached from the DOM at any moment during the action, this method rejects. + *
If the element is detached from the DOM at any moment during the action, this method throws. * - *
When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}. - * Passing zero timeout disables this. + *
When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code TimeoutError}. Passing + * zero timeout disables this. */ default void hover() { hover(null); @@ -971,10 +971,10 @@ public interface ElementHandle extends JSHandle { *
If the element is detached from the DOM at any moment during the action, this method rejects. + *
If the element is detached from the DOM at any moment during the action, this method throws. * - *
When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}. - * Passing zero timeout disables this. + *
When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code TimeoutError}. Passing + * zero timeout disables this. */ void hover(HoverOptions options); /** @@ -1477,10 +1477,10 @@ public interface ElementHandle extends JSHandle { *
If the element is detached from the DOM at any moment during the action, this method rejects. + *
If the element is detached from the DOM at any moment during the action, this method throws. * - *
When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}. - * Passing zero timeout disables this. + *
When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code TimeoutError}. Passing + * zero timeout disables this. * *
NOTE: {@code elementHandle.tap()} requires that the {@code hasTouch} option of the browser context be set to true. */ @@ -1497,10 +1497,10 @@ public interface ElementHandle extends JSHandle { *
If the element is detached from the DOM at any moment during the action, this method rejects. + *
If the element is detached from the DOM at any moment during the action, this method throws. * - *
When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}. - * Passing zero timeout disables this. + *
When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code TimeoutError}. Passing + * zero timeout disables this. * *
NOTE: {@code elementHandle.tap()} requires that the {@code hasTouch} option of the browser context be set to true. */ @@ -1552,20 +1552,20 @@ public interface ElementHandle extends JSHandle { /** * This method checks the element by performing the following steps: *
If the element is detached from the DOM at any moment during the action, this method rejects. + *
If the element is detached from the DOM at any moment during the action, this method throws. * - *
When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}. - * Passing zero timeout disables this. + *
When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code TimeoutError}. Passing + * zero timeout disables this. */ default void uncheck() { uncheck(null); @@ -1573,20 +1573,20 @@ public interface ElementHandle extends JSHandle { /** * This method checks the element by performing the following steps: *
If the element is detached from the DOM at any moment during the action, this method rejects. + *
If the element is detached from the DOM at any moment during the action, this method throws. * - *
When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}. - * Passing zero timeout disables this. + *
When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code TimeoutError}. Passing + * zero timeout disables this. */ void uncheck(UncheckOptions options); /** diff --git a/playwright/src/main/java/com/microsoft/playwright/Frame.java b/playwright/src/main/java/com/microsoft/playwright/Frame.java index 3f1a64a0..555367db 100644 --- a/playwright/src/main/java/com/microsoft/playwright/Frame.java +++ b/playwright/src/main/java/com/microsoft/playwright/Frame.java @@ -948,19 +948,19 @@ public interface Frame { /** * This method checks an element matching {@code selector} by performing the following steps: *
When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}. - * Passing zero timeout disables this. + *
When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code TimeoutError}. Passing + * zero timeout disables this. * * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See working with selectors for more details. @@ -971,19 +971,19 @@ public interface Frame { /** * This method checks an element matching {@code selector} by performing the following steps: *
When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}. - * Passing zero timeout disables this. + *
When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code TimeoutError}. Passing + * zero timeout disables this. * * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See working with selectors for more details. @@ -993,7 +993,7 @@ public interface Frame { /** * This method clicks an element matching {@code selector} by performing the following steps: *
When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}. - * Passing zero timeout disables this. + *
When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code TimeoutError}. Passing + * zero timeout disables this. * * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See working with selectors for more details. @@ -1013,7 +1013,7 @@ public interface Frame { /** * This method clicks an element matching {@code selector} by performing the following steps: *
When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}. - * Passing zero timeout disables this. + *
When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code TimeoutError}. Passing + * zero timeout disables this. * * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See working with selectors for more details. @@ -1035,17 +1035,17 @@ public interface Frame { /** * This method double clicks an element matching {@code selector} by performing the following steps: *
When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}. - * Passing zero timeout disables this. + *
When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code TimeoutError}. Passing + * zero timeout disables this. * *
NOTE: {@code frame.dblclick()} dispatches two {@code click} events and a single {@code dblclick} event. * @@ -1058,17 +1058,17 @@ public interface Frame { /** * This method double clicks an element matching {@code selector} by performing the following steps: *
When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}. - * Passing zero timeout disables this. + *
When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code TimeoutError}. Passing + * zero timeout disables this. * *
NOTE: {@code frame.dblclick()} dispatches two {@code click} events and a single {@code dblclick} event. * @@ -1561,7 +1561,7 @@ public interface Frame { /** * This method hovers over an element matching {@code selector} by performing the following steps: *
When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}. - * Passing zero timeout disables this. + *
When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code TimeoutError}. Passing + * zero timeout disables this. * * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See working with selectors for more details. @@ -1581,7 +1581,7 @@ public interface Frame { /** * This method hovers over an element matching {@code selector} by performing the following steps: *
When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}. - * Passing zero timeout disables this. + *
When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code TimeoutError}. Passing + * zero timeout disables this. * * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See working with selectors for more details. @@ -2225,7 +2225,7 @@ public interface Frame { /** * This method taps an element matching {@code selector} by performing the following steps: *
When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}. - * Passing zero timeout disables this. + *
When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code TimeoutError}. Passing + * zero timeout disables this. * *
NOTE: {@code frame.tap()} requires that the {@code hasTouch} option of the browser context be set to true. * @@ -2247,7 +2247,7 @@ public interface Frame { /** * This method taps an element matching {@code selector} by performing the following steps: *
When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}. - * Passing zero timeout disables this. + *
When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code TimeoutError}. Passing + * zero timeout disables this. * *
NOTE: {@code frame.tap()} requires that the {@code hasTouch} option of the browser context be set to true. * @@ -2323,19 +2323,19 @@ public interface Frame { /** * This method checks an element matching {@code selector} by performing the following steps: *
When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}. - * Passing zero timeout disables this. + *
When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code TimeoutError}. Passing + * zero timeout disables this. * * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See working with selectors for more details. @@ -2346,19 +2346,19 @@ public interface Frame { /** * This method checks an element matching {@code selector} by performing the following steps: *
When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}. - * Passing zero timeout disables this. + *
When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code TimeoutError}. Passing + * zero timeout disables this. * * @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See working with selectors for more details. diff --git a/playwright/src/main/java/com/microsoft/playwright/Page.java b/playwright/src/main/java/com/microsoft/playwright/Page.java index c80e27f1..d20e17ee 100644 --- a/playwright/src/main/java/com/microsoft/playwright/Page.java +++ b/playwright/src/main/java/com/microsoft/playwright/Page.java @@ -1713,19 +1713,19 @@ public interface Page extends AutoCloseable { /** * This method checks an element matching {@code selector} by performing the following steps: *
When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}. - * Passing zero timeout disables this. + *
When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code TimeoutError}. Passing + * zero timeout disables this. * *
Shortcut for main frame's {@link Frame#check Frame.check()}. * @@ -1738,19 +1738,19 @@ public interface Page extends AutoCloseable { /** * This method checks an element matching {@code selector} by performing the following steps: *
When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}. - * Passing zero timeout disables this. + *
When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code TimeoutError}. Passing + * zero timeout disables this. * *
Shortcut for main frame's {@link Frame#check Frame.check()}. * @@ -1761,7 +1761,7 @@ public interface Page extends AutoCloseable { /** * This method clicks an element matching {@code selector} by performing the following steps: *
When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}. - * Passing zero timeout disables this. + *
When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code TimeoutError}. Passing + * zero timeout disables this. * *
Shortcut for main frame's {@link Frame#click Frame.click()}. * @@ -1783,7 +1783,7 @@ public interface Page extends AutoCloseable { /** * This method clicks an element matching {@code selector} by performing the following steps: *
When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}. - * Passing zero timeout disables this. + *
When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code TimeoutError}. Passing + * zero timeout disables this. * *
Shortcut for main frame's {@link Frame#click Frame.click()}. * @@ -1833,17 +1833,17 @@ public interface Page extends AutoCloseable { /** * This method double clicks an element matching {@code selector} by performing the following steps: *
When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}. - * Passing zero timeout disables this. + *
When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code TimeoutError}. Passing + * zero timeout disables this. * *
NOTE: {@code page.dblclick()} dispatches two {@code click} events and a single {@code dblclick} event. * @@ -1858,17 +1858,17 @@ public interface Page extends AutoCloseable { /** * This method double clicks an element matching {@code selector} by performing the following steps: *
When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}. - * Passing zero timeout disables this. + *
When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code TimeoutError}. Passing + * zero timeout disables this. * *
NOTE: {@code page.dblclick()} dispatches two {@code click} events and a single {@code dblclick} event. * @@ -2666,7 +2666,7 @@ public interface Page extends AutoCloseable { /** * This method hovers over an element matching {@code selector} by performing the following steps: *
When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}. - * Passing zero timeout disables this. + *
When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code TimeoutError}. Passing + * zero timeout disables this. * *
Shortcut for main frame's {@link Frame#hover Frame.hover()}. * @@ -2688,7 +2688,7 @@ public interface Page extends AutoCloseable { /** * This method hovers over an element matching {@code selector} by performing the following steps: *
When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}. - * Passing zero timeout disables this. + *
When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code TimeoutError}. Passing + * zero timeout disables this. * *
Shortcut for main frame's {@link Frame#hover Frame.hover()}. * @@ -3668,7 +3668,7 @@ public interface Page extends AutoCloseable { /** * This method taps an element matching {@code selector} by performing the following steps: *
When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}. - * Passing zero timeout disables this. + *
When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code TimeoutError}. Passing + * zero timeout disables this. * *
NOTE: {@link Page#tap Page.tap()} requires that the {@code hasTouch} option of the browser context be set to true. * @@ -3692,7 +3692,7 @@ public interface Page extends AutoCloseable { /** * This method taps an element matching {@code selector} by performing the following steps: *
When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}. - * Passing zero timeout disables this. + *
When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code TimeoutError}. Passing + * zero timeout disables this. * *
NOTE: {@link Page#tap Page.tap()} requires that the {@code hasTouch} option of the browser context be set to true. * @@ -3775,19 +3775,19 @@ public interface Page extends AutoCloseable { /** * This method unchecks an element matching {@code selector} by performing the following steps: *
When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}. - * Passing zero timeout disables this. + *
When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code TimeoutError}. Passing + * zero timeout disables this. * *
Shortcut for main frame's {@link Frame#uncheck Frame.uncheck()}. * @@ -3800,19 +3800,19 @@ public interface Page extends AutoCloseable { /** * This method unchecks an element matching {@code selector} by performing the following steps: *
When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}. - * Passing zero timeout disables this. + *
When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code TimeoutError}. Passing + * zero timeout disables this. * *
Shortcut for main frame's {@link Frame#uncheck Frame.uncheck()}.
*
diff --git a/playwright/src/main/java/com/microsoft/playwright/impl/BrowserTypeImpl.java b/playwright/src/main/java/com/microsoft/playwright/impl/BrowserTypeImpl.java
index 0c88275c..b8d6da3f 100644
--- a/playwright/src/main/java/com/microsoft/playwright/impl/BrowserTypeImpl.java
+++ b/playwright/src/main/java/com/microsoft/playwright/impl/BrowserTypeImpl.java
@@ -88,21 +88,21 @@ class BrowserTypeImpl extends ChannelOwner implements BrowserType {
}
@Override
- public Browser connectOverCDP(String wsEndpoint, ConnectOverCDPOptions options) {
+ public Browser connectOverCDP(String endpointURL, ConnectOverCDPOptions options) {
if (!"chromium".equals(name())) {
throw new PlaywrightException("Connecting over CDP is only supported in Chromium.");
}
- return withLogging("BrowserType.connectOverCDP", () -> connectOverCDPImpl(wsEndpoint, options));
+ return withLogging("BrowserType.connectOverCDP", () -> connectOverCDPImpl(endpointURL, options));
}
- private Browser connectOverCDPImpl(String wsEndpoint, ConnectOverCDPOptions options) {
+ private Browser connectOverCDPImpl(String endpointURL, ConnectOverCDPOptions options) {
if (options == null) {
options = new ConnectOverCDPOptions();
}
JsonObject params = gson().toJsonTree(options).getAsJsonObject();
params.addProperty("sdkLanguage", "java");
- params.addProperty("wsEndpoint", wsEndpoint);
+ params.addProperty("endpointURL", endpointURL);
JsonObject json = sendMessage("connectOverCDP", params).getAsJsonObject();
BrowserImpl browser = connection.getExistingObject(json.getAsJsonObject("browser").get("guid").getAsString());
diff --git a/playwright/src/test/java/com/microsoft/playwright/TestChromium.java b/playwright/src/test/java/com/microsoft/playwright/TestChromium.java
index 4161216d..5136ba60 100644
--- a/playwright/src/test/java/com/microsoft/playwright/TestChromium.java
+++ b/playwright/src/test/java/com/microsoft/playwright/TestChromium.java
@@ -53,8 +53,7 @@ public class TestChromium extends TestBase {
int port = 9339;
try (Browser browserServer = browserType.launch(createLaunchOptions()
.setArgs(asList("--remote-debugging-port=" + port)))) {
- String wsEndpoint = wsEndpointFromUrl("http://localhost:" + port + "/json/version/");
- Browser cdpBrowser = browserType.connectOverCDP(wsEndpoint);
+ Browser cdpBrowser = browserType.connectOverCDP("http://localhost:" + port);
List