From db92e19e6b1cb1ec16d64b9fb7a70dd242e3e0e2 Mon Sep 17 00:00:00 2001 From: Puja Jagani Date: Tue, 22 Apr 2025 18:44:50 +0530 Subject: [PATCH 1/4] [java] Add header while creating websocket --- .../org/openqa/selenium/remote/http/jdk/JdkHttpClient.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/java/src/org/openqa/selenium/remote/http/jdk/JdkHttpClient.java b/java/src/org/openqa/selenium/remote/http/jdk/JdkHttpClient.java index e7d1d3569d7aa..f2d844a21b152 100644 --- a/java/src/org/openqa/selenium/remote/http/jdk/JdkHttpClient.java +++ b/java/src/org/openqa/selenium/remote/http/jdk/JdkHttpClient.java @@ -166,10 +166,13 @@ public WebSocket openSocket(HttpRequest request, WebSocket.Listener listener) { throw new ConnectionFailedException("JdkWebSocket initial request execution error", e); } + java.net.http.WebSocket.Builder builder = client.newWebSocketBuilder(); + + request.getHeaderNames().forEach(name -> builder.header(name, request.getHeader(name))); + CompletableFuture closed = new CompletableFuture<>(); CompletableFuture webSocketCompletableFuture = - client - .newWebSocketBuilder() + builder .connectTimeout(connectTimeout) .buildAsync( uri, From 972c746b6246081d4e5606c4e8e92e3224ac6532 Mon Sep 17 00:00:00 2001 From: Puja Jagani Date: Wed, 23 Apr 2025 12:53:31 +0530 Subject: [PATCH 2/4] [java] Adding a wait to the test to see if it passes --- .../org/openqa/selenium/bidi/input/DefaultWheelTest.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/java/test/org/openqa/selenium/bidi/input/DefaultWheelTest.java b/java/test/org/openqa/selenium/bidi/input/DefaultWheelTest.java index 4a56d011fef9b..f2b8dbfa34b41 100644 --- a/java/test/org/openqa/selenium/bidi/input/DefaultWheelTest.java +++ b/java/test/org/openqa/selenium/bidi/input/DefaultWheelTest.java @@ -34,6 +34,7 @@ import org.openqa.selenium.bidi.module.Input; import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.interactions.WheelInput; +import org.openqa.selenium.support.ui.ExpectedCondition; import org.openqa.selenium.testing.JupiterTestBase; import org.openqa.selenium.testing.NeedsFreshDriver; import org.openqa.selenium.testing.NotYetImplemented; @@ -137,7 +138,7 @@ void shouldScrollFromViewportByGivenAmount() { appServer.whereIs("scrolling_tests/frame_with_nested_scrolling_frame_out_of_view.html")); WebElement footer = driver.findElement(By.tagName("footer")); int deltaY = footer.getRect().y; - + input.perform( windowHandle, new Actions(driver) @@ -146,6 +147,8 @@ void shouldScrollFromViewportByGivenAmount() { .pause(3000) .getSequences()); + wait.until(driver -> driver.findElement(By.name("nested_scrolling_frame")).isDisplayed()); + assertTrue(inViewport(footer)); } From e765ff3742487597fed41b7ea88b7340f099a1d3 Mon Sep 17 00:00:00 2001 From: Puja Jagani Date: Wed, 23 Apr 2025 14:20:08 +0530 Subject: [PATCH 3/4] Remove unnecessary changes --- java/test/org/openqa/selenium/bidi/input/DefaultWheelTest.java | 1 - 1 file changed, 1 deletion(-) diff --git a/java/test/org/openqa/selenium/bidi/input/DefaultWheelTest.java b/java/test/org/openqa/selenium/bidi/input/DefaultWheelTest.java index f2b8dbfa34b41..73650b99a26f9 100644 --- a/java/test/org/openqa/selenium/bidi/input/DefaultWheelTest.java +++ b/java/test/org/openqa/selenium/bidi/input/DefaultWheelTest.java @@ -34,7 +34,6 @@ import org.openqa.selenium.bidi.module.Input; import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.interactions.WheelInput; -import org.openqa.selenium.support.ui.ExpectedCondition; import org.openqa.selenium.testing.JupiterTestBase; import org.openqa.selenium.testing.NeedsFreshDriver; import org.openqa.selenium.testing.NotYetImplemented; From 077d4a1a9890476270dcf94e968dd5a0695f6e7d Mon Sep 17 00:00:00 2001 From: Puja Jagani Date: Wed, 23 Apr 2025 14:24:42 +0530 Subject: [PATCH 4/4] Fix formatting --- java/test/org/openqa/selenium/bidi/input/DefaultWheelTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/test/org/openqa/selenium/bidi/input/DefaultWheelTest.java b/java/test/org/openqa/selenium/bidi/input/DefaultWheelTest.java index 73650b99a26f9..1ef198571e552 100644 --- a/java/test/org/openqa/selenium/bidi/input/DefaultWheelTest.java +++ b/java/test/org/openqa/selenium/bidi/input/DefaultWheelTest.java @@ -137,7 +137,7 @@ void shouldScrollFromViewportByGivenAmount() { appServer.whereIs("scrolling_tests/frame_with_nested_scrolling_frame_out_of_view.html")); WebElement footer = driver.findElement(By.tagName("footer")); int deltaY = footer.getRect().y; - + input.perform( windowHandle, new Actions(driver)