From 768cb3d700c6041723eaf5827b3481877a2ca8b6 Mon Sep 17 00:00:00 2001 From: Selenium CI Bot Date: Fri, 10 May 2024 10:44:46 +0200 Subject: [PATCH 01/10] [dotnet][rb][java][js][py] Automated Browser Version Update (#13924) Update pinned browser versions Co-authored-by: Selenium CI Bot --- common/repositories.bzl | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/common/repositories.bzl b/common/repositories.bzl index cb0fc09386f48..a0ee2a3b13b03 100644 --- a/common/repositories.bzl +++ b/common/repositories.bzl @@ -199,8 +199,8 @@ js_library( http_archive( name = "linux_chrome", - url = "https://storage.googleapis.com/chrome-for-testing-public/124.0.6367.155/linux64/chrome-linux64.zip", - sha256 = "0761489e320bb56a29f53c051abea0a26418afcef62af2fa9bf1d4768a78d005", + url = "https://storage.googleapis.com/chrome-for-testing-public/124.0.6367.201/linux64/chrome-linux64.zip", + sha256 = "867ea96ed4a92823b75952b1162985e406ace5d133ae97b72441eaf4e3a2d452", build_file_content = """ load("@aspect_rules_js//js:defs.bzl", "js_library") package(default_visibility = ["//visibility:public"]) @@ -221,8 +221,8 @@ js_library( http_archive( name = "mac_chrome", - url = "https://storage.googleapis.com/chrome-for-testing-public/124.0.6367.155/mac-x64/chrome-mac-x64.zip", - sha256 = "30456654c6699f2b8b6378a08d82caff439da1834213cb65e3536e669fc0e7ad", + url = "https://storage.googleapis.com/chrome-for-testing-public/124.0.6367.201/mac-x64/chrome-mac-x64.zip", + sha256 = "7248d83d4749eba968198fd97d2a213bd407ff4c0367f0bb7cd1eb9674ab3c99", strip_prefix = "chrome-mac-x64", patch_cmds = [ "mv 'Google Chrome for Testing.app' Chrome.app", @@ -243,8 +243,8 @@ js_library( http_archive( name = "linux_chromedriver", - url = "https://storage.googleapis.com/chrome-for-testing-public/124.0.6367.155/linux64/chromedriver-linux64.zip", - sha256 = "7ae76046edce32e4c14de5fcceb9ba4a18268dcb0d87368160400fff89f54899", + url = "https://storage.googleapis.com/chrome-for-testing-public/124.0.6367.201/linux64/chromedriver-linux64.zip", + sha256 = "de484f57e58f7181eb9463455e1991ae36b6fb05acafbec15601cb6d27b4205f", strip_prefix = "chromedriver-linux64", build_file_content = """ load("@aspect_rules_js//js:defs.bzl", "js_library") @@ -261,8 +261,8 @@ js_library( http_archive( name = "mac_chromedriver", - url = "https://storage.googleapis.com/chrome-for-testing-public/124.0.6367.155/mac-x64/chromedriver-mac-x64.zip", - sha256 = "e0c6700f68e08ceac14ed923c56d171fe9597cff308fb67a7a0ecbc05ce208f5", + url = "https://storage.googleapis.com/chrome-for-testing-public/124.0.6367.201/mac-x64/chromedriver-mac-x64.zip", + sha256 = "8e75a61fa333a99cf32006e5bc916fe632852762c82f21b2f9e3aa6fab169967", strip_prefix = "chromedriver-mac-x64", build_file_content = """ load("@aspect_rules_js//js:defs.bzl", "js_library") From 978a2d6afe614c697a840a1e7d61951e2c07187b Mon Sep 17 00:00:00 2001 From: joerg1985 <16140691+joerg1985@users.noreply.github.com> Date: Fri, 10 May 2024 11:33:50 +0200 Subject: [PATCH 02/10] [java] allow a DevTools listener to determinate the order of handler calls (#13921) Co-authored-by: Diego Molina --- .../openqa/selenium/devtools/Connection.java | 17 +++++++------ .../openqa/selenium/devtools/DevTools.java | 24 +++++++++++++++++++ 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/java/src/org/openqa/selenium/devtools/Connection.java b/java/src/org/openqa/selenium/devtools/Connection.java index 27f0105cf7dba..1ae1b5b48d595 100644 --- a/java/src/org/openqa/selenium/devtools/Connection.java +++ b/java/src/org/openqa/selenium/devtools/Connection.java @@ -43,6 +43,7 @@ import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock; +import java.util.function.BiConsumer; import java.util.function.Consumer; import java.util.logging.Level; import java.util.logging.Logger; @@ -70,11 +71,12 @@ public class Connection implements Closeable { return thread; }); private static final AtomicLong NEXT_ID = new AtomicLong(1L); + private static final AtomicLong NEXT_SEQUENCE = new AtomicLong(1L); private WebSocket socket; private final Map>> methodCallbacks = new ConcurrentHashMap<>(); private final ReadWriteLock callbacksLock = new ReentrantReadWriteLock(true); - private final Map, List>> eventCallbacks = new HashMap<>(); + private final Map, List>> eventCallbacks = new HashMap<>(); private HttpClient client; private final String url; private final AtomicBoolean isClosed; @@ -196,7 +198,7 @@ public X sendAndWait(SessionID sessionId, Command command, Duration timeo } } - public void addListener(Event event, Consumer handler) { + public void addListener(Event event, BiConsumer handler) { Require.nonNull("Event to listen for", event); Require.nonNull("Handler to call", handler); @@ -230,10 +232,11 @@ private class Listener implements WebSocket.Listener { @Override public void onText(CharSequence data) { + long sequence = NEXT_SEQUENCE.getAndIncrement(); EXECUTOR.execute( () -> { try { - handle(data); + handle(sequence, data); } catch (Throwable t) { LOG.log(Level.WARNING, "Unable to process: " + data, t); throw new DevToolsException(t); @@ -242,7 +245,7 @@ public void onText(CharSequence data) { } } - private void handle(CharSequence data) { + private void handle(long sequence, CharSequence data) { // It's kind of gross to decode the data twice, but this lets us get started on something // that feels nice to users. // TODO: decode once, and once only @@ -335,14 +338,14 @@ private void handle(CharSequence data) { return; } - for (Consumer action : event.getValue()) { + for (BiConsumer action : event.getValue()) { @SuppressWarnings("unchecked") - Consumer obj = (Consumer) action; + BiConsumer obj = (BiConsumer) action; LOG.log( getDebugLogLevel(), "Calling callback for {0} using {1} being passed {2}", new Object[] {event.getKey(), obj, params}); - obj.accept(params); + obj.accept(sequence, params); } } }); diff --git a/java/src/org/openqa/selenium/devtools/DevTools.java b/java/src/org/openqa/selenium/devtools/DevTools.java index f6cb7ad57edf3..b83e68f0fd8f0 100644 --- a/java/src/org/openqa/selenium/devtools/DevTools.java +++ b/java/src/org/openqa/selenium/devtools/DevTools.java @@ -26,6 +26,7 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; +import java.util.function.BiConsumer; import java.util.function.Consumer; import java.util.function.Function; import java.util.logging.Level; @@ -89,10 +90,33 @@ public X send(Command command) { return connection.sendAndWait(cdpSession, command, timeout); } + /** + * Register a handler to the given event. + * + * @param event the event to listen to + * @param handler the handler to register + * @param type of the data generated by the event + */ public void addListener(Event event, Consumer handler) { Require.nonNull("Event to listen for", event); Require.nonNull("Handler to call", handler); + connection.addListener(event, (sequence, x) -> handler.accept(x)); + } + + /** + * Register a handler to the given event, this handler will receive a sequence number to + * determinate the order of the data generated by the event. The sequence number might have gaps + * when other events are raised in between. + * + * @param event the event to listen to + * @param handler the handler to register + * @param type of the data generated by the event + */ + public void addListener(Event event, BiConsumer handler) { + Require.nonNull("Event to listen for", event); + Require.nonNull("Handler to call", handler); + connection.addListener(event, handler); } From 94f7247cb73cc62ddadb7593703c9ca14b9f507a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 10 May 2024 11:43:59 +0200 Subject: [PATCH 03/10] Bump jinja2 from 3.1.3 to 3.1.4 in /py/docs (#13911) Bumps [jinja2](https://github.com/pallets/jinja) from 3.1.3 to 3.1.4. - [Release notes](https://github.com/pallets/jinja/releases) - [Changelog](https://github.com/pallets/jinja/blob/main/CHANGES.rst) - [Commits](https://github.com/pallets/jinja/compare/3.1.3...3.1.4) --- updated-dependencies: - dependency-name: jinja2 dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Diego Molina --- py/docs/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/py/docs/requirements.txt b/py/docs/requirements.txt index 9bf9a82104a48..dc0847ca1129a 100644 --- a/py/docs/requirements.txt +++ b/py/docs/requirements.txt @@ -1,2 +1,2 @@ -Jinja2==3.1.3 +Jinja2==3.1.4 Sphinx==1.8.2 From 17ba2aa3f90946317079535cda9c20f700e28ae6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Sautter?= Date: Fri, 10 May 2024 21:04:47 +0200 Subject: [PATCH 04/10] [java] removed an unused testing dependency --- MODULE.bazel | 1 - java/maven_install.json | 16 ++-------------- java/test/org/openqa/selenium/remote/BUILD.bazel | 1 - 3 files changed, 2 insertions(+), 16 deletions(-) diff --git a/MODULE.bazel b/MODULE.bazel index 93578f833b573..da4d5903b7f23 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -204,7 +204,6 @@ maven.install( "org.junit.platform:junit-platform-commons:1.10.2", "org.junit.platform:junit-platform-engine:1.10.2", "org.mockito:mockito-core:5.11.0", - "org.mockito:mockito-inline:5.2.0", "org.redisson:redisson:3.29.0", "org.slf4j:slf4j-api:2.0.13", "org.slf4j:slf4j-jdk14:2.0.13", diff --git a/java/maven_install.json b/java/maven_install.json index 5149bc1486292..b920bafd56650 100644 --- a/java/maven_install.json +++ b/java/maven_install.json @@ -1,7 +1,7 @@ { "__AUTOGENERATED_FILE_DO_NOT_MODIFY_THIS_FILE_MANUALLY": "THERE_IS_NO_DATA_ONLY_ZUUL", - "__INPUT_ARTIFACTS_HASH": 1731569326, - "__RESOLVED_ARTIFACTS_HASH": -177292306, + "__INPUT_ARTIFACTS_HASH": 804245233, + "__RESOLVED_ARTIFACTS_HASH": 375527245, "conflict_resolution": { "com.google.code.gson:gson:2.8.9": "com.google.code.gson:gson:2.10.1", "com.google.errorprone:error_prone_annotations:2.3.2": "com.google.errorprone:error_prone_annotations:2.26.1", @@ -710,13 +710,6 @@ }, "version": "5.11.0" }, - "org.mockito:mockito-inline": { - "shasums": { - "jar": "ee52e1c299a632184fba274a9370993e09140429f5e516e6c5570fd6574b297f", - "sources": "ee52e1c299a632184fba274a9370993e09140429f5e516e6c5570fd6574b297f" - }, - "version": "5.2.0" - }, "org.objenesis:objenesis": { "shasums": { "jar": "02dfd0b0439a5591e35b708ed2f5474eb0948f53abf74637e959b8e4ef69bfeb", @@ -1114,9 +1107,6 @@ "net.bytebuddy:byte-buddy-agent", "org.objenesis:objenesis" ], - "org.mockito:mockito-inline": [ - "org.mockito:mockito-core" - ], "org.ow2.asm:asm-analysis": [ "org.ow2.asm:asm-tree" ], @@ -3153,8 +3143,6 @@ "org.junit.platform:junit-platform-reporting:jar:sources", "org.mockito:mockito-core", "org.mockito:mockito-core:jar:sources", - "org.mockito:mockito-inline", - "org.mockito:mockito-inline:jar:sources", "org.objenesis:objenesis", "org.objenesis:objenesis:jar:sources", "org.opentest4j:opentest4j", diff --git a/java/test/org/openqa/selenium/remote/BUILD.bazel b/java/test/org/openqa/selenium/remote/BUILD.bazel index 5f889931ed207..7f4f092333987 100644 --- a/java/test/org/openqa/selenium/remote/BUILD.bazel +++ b/java/test/org/openqa/selenium/remote/BUILD.bazel @@ -35,7 +35,6 @@ java_test_suite( artifact("com.google.guava:guava"), artifact("org.junit.jupiter:junit-jupiter-api"), artifact("org.mockito:mockito-core"), - artifact("org.mockito:mockito-inline"), ] + JUNIT5_DEPS, ) From 2aa0f5a65185391dd9dfd5503bc5434b483c44a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Sautter?= Date: Fri, 10 May 2024 21:21:01 +0200 Subject: [PATCH 05/10] [java] read selenium manager output as UTF-8 #13653 --- .../openqa/selenium/io/CircularOutputStream.java | 10 +++++++--- .../openqa/selenium/manager/SeleniumManager.java | 3 ++- .../org/openqa/selenium/os/ExternalProcess.java | 14 +++++++++++++- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/java/src/org/openqa/selenium/io/CircularOutputStream.java b/java/src/org/openqa/selenium/io/CircularOutputStream.java index 6bf9284baa725..fa492a5b63922 100644 --- a/java/src/org/openqa/selenium/io/CircularOutputStream.java +++ b/java/src/org/openqa/selenium/io/CircularOutputStream.java @@ -85,19 +85,23 @@ public void close() { } @Override - public synchronized String toString() { + public String toString() { + return toString(Charset.defaultCharset()); + } + + public synchronized String toString(Charset encoding) { int size = filled ? buffer.length : end; byte[] toReturn = new byte[size]; // Handle the partially filled array as a special case if (!filled) { System.arraycopy(buffer, 0, toReturn, 0, end); - return new String(toReturn, Charset.defaultCharset()); + return new String(toReturn, encoding); } int n = buffer.length - end; System.arraycopy(buffer, end, toReturn, 0, n); System.arraycopy(buffer, 0, toReturn, n, end); - return new String(toReturn, Charset.defaultCharset()); + return new String(toReturn, encoding); } } diff --git a/java/src/org/openqa/selenium/manager/SeleniumManager.java b/java/src/org/openqa/selenium/manager/SeleniumManager.java index 04daa88acb256..1723b7c769cfc 100644 --- a/java/src/org/openqa/selenium/manager/SeleniumManager.java +++ b/java/src/org/openqa/selenium/manager/SeleniumManager.java @@ -23,6 +23,7 @@ import java.io.IOException; import java.io.InputStream; +import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -141,7 +142,7 @@ private static Result runCommand(Path binary, List arguments) { process.shutdown(); } code = process.exitValue(); - output = process.getOutput(); + output = process.getOutput(StandardCharsets.UTF_8); } catch (Exception e) { throw new WebDriverException("Failed to run command: " + arguments, e); } diff --git a/java/src/org/openqa/selenium/os/ExternalProcess.java b/java/src/org/openqa/selenium/os/ExternalProcess.java index 2f6e53f591fc3..b9c05f441a347 100644 --- a/java/src/org/openqa/selenium/os/ExternalProcess.java +++ b/java/src/org/openqa/selenium/os/ExternalProcess.java @@ -24,6 +24,7 @@ import java.io.InputStream; import java.io.OutputStream; import java.io.UncheckedIOException; +import java.nio.charset.Charset; import java.time.Duration; import java.util.ArrayList; import java.util.Collections; @@ -254,7 +255,18 @@ public ExternalProcess(Process process, CircularOutputStream outputStream, Threa * @return stdout and stderr as String in Charset.defaultCharset() encoding */ public String getOutput() { - return outputStream.toString(); + return getOutput(Charset.defaultCharset()); + } + + /** + * The last N bytes of the combined stdout and stderr as String, the value of N is set while + * building the OsProcess. + * + * @param encoding the encoding to decode the stream + * @return stdout and stderr as String in the given encoding + */ + public String getOutput(Charset encoding) { + return outputStream.toString(encoding); } public boolean isAlive() { From e7324ef2960cd3c13f8f65513f91f0320a6454d2 Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 13 May 2024 16:24:17 +0700 Subject: [PATCH 06/10] [java] Reduce redundant toString() calls (#13932) * removed unnecessary semicolons * removed redundant access modifier for interface member * removed redundant toString() calls for id in RedisBackedSessionMap * removed redundant toString() call in DragAndDropTest * removed redundant toString() calls * applying formatting --- java/src/org/openqa/selenium/bidi/network/FetchError.java | 2 +- .../org/openqa/selenium/bidi/script/EvaluateResult.java | 2 +- .../openqa/selenium/bidi/script/SerializationOptions.java | 2 +- .../grid/sessionmap/redis/RedisBackedSessionMap.java | 8 ++++---- java/src/org/openqa/selenium/json/JsonInput.java | 2 +- java/src/org/openqa/selenium/remote/ErrorCodec.java | 4 ++-- .../pagefactory/internal/LocatingElementHandler.java | 2 +- java/test/org/openqa/selenium/ProxySettingTest.java | 4 ++-- .../org/openqa/selenium/interactions/DragAndDropTest.java | 2 +- .../org/openqa/selenium/javascript/TestFileLocator.java | 2 +- java/test/org/openqa/selenium/json/JsonTest.java | 2 +- 11 files changed, 16 insertions(+), 16 deletions(-) diff --git a/java/src/org/openqa/selenium/bidi/network/FetchError.java b/java/src/org/openqa/selenium/bidi/network/FetchError.java index 3f5361d4f5c99..e0010e0e24c7d 100644 --- a/java/src/org/openqa/selenium/bidi/network/FetchError.java +++ b/java/src/org/openqa/selenium/bidi/network/FetchError.java @@ -41,7 +41,7 @@ private FetchError(BaseParameters baseParameters, String errorText) { public static FetchError fromJsonMap(Map jsonMap) { try (StringReader baseParameterReader = new StringReader(JSON.toJson(jsonMap)); - JsonInput baseParamsInput = JSON.newInput(baseParameterReader); ) { + JsonInput baseParamsInput = JSON.newInput(baseParameterReader)) { String errorText = JSON.toJson(jsonMap.get("errorText")); return new FetchError(BaseParameters.fromJson(baseParamsInput), errorText); } diff --git a/java/src/org/openqa/selenium/bidi/script/EvaluateResult.java b/java/src/org/openqa/selenium/bidi/script/EvaluateResult.java index 6b06e0bfc60cc..c6c975a281d10 100644 --- a/java/src/org/openqa/selenium/bidi/script/EvaluateResult.java +++ b/java/src/org/openqa/selenium/bidi/script/EvaluateResult.java @@ -22,7 +22,7 @@ public interface EvaluateResult { String getRealmId(); - public enum Type { + enum Type { SUCCESS("success"), EXCEPTION("exception"); diff --git a/java/src/org/openqa/selenium/bidi/script/SerializationOptions.java b/java/src/org/openqa/selenium/bidi/script/SerializationOptions.java index e51131d7b537b..264ca37630af2 100644 --- a/java/src/org/openqa/selenium/bidi/script/SerializationOptions.java +++ b/java/src/org/openqa/selenium/bidi/script/SerializationOptions.java @@ -26,7 +26,7 @@ public class SerializationOptions { public enum IncludeShadowTree { NONE, OPEN, - ALL; + ALL } private Optional maxDomDepth = Optional.empty(); diff --git a/java/src/org/openqa/selenium/grid/sessionmap/redis/RedisBackedSessionMap.java b/java/src/org/openqa/selenium/grid/sessionmap/redis/RedisBackedSessionMap.java index 8fd841e3188bd..3e3278c4fcfec 100644 --- a/java/src/org/openqa/selenium/grid/sessionmap/redis/RedisBackedSessionMap.java +++ b/java/src/org/openqa/selenium/grid/sessionmap/redis/RedisBackedSessionMap.java @@ -316,25 +316,25 @@ public boolean isReady() { private String uriKey(SessionId id) { Require.nonNull("Session ID", id); - return "session:" + id.toString() + ":uri"; + return "session:" + id + ":uri"; } private String capabilitiesKey(SessionId id) { Require.nonNull("Session ID", id); - return "session:" + id.toString() + ":capabilities"; + return "session:" + id + ":capabilities"; } private String startKey(SessionId id) { Require.nonNull("Session ID", id); - return "session:" + id.toString() + ":start"; + return "session:" + id + ":start"; } private String stereotypeKey(SessionId id) { Require.nonNull("Session ID", id); - return "session:" + id.toString() + ":stereotype"; + return "session:" + id + ":stereotype"; } private void setCommonSpanAttributes(Span span) { diff --git a/java/src/org/openqa/selenium/json/JsonInput.java b/java/src/org/openqa/selenium/json/JsonInput.java index 2122410e4643d..5c8842851a3e0 100644 --- a/java/src/org/openqa/selenium/json/JsonInput.java +++ b/java/src/org/openqa/selenium/json/JsonInput.java @@ -246,7 +246,7 @@ public Number nextNumber() { } return number.longValue(); } catch (NumberFormatException e) { - throw new JsonException("Unable to parse to a number: " + builder.toString() + ". " + input); + throw new JsonException("Unable to parse to a number: " + builder + ". " + input); } } diff --git a/java/src/org/openqa/selenium/remote/ErrorCodec.java b/java/src/org/openqa/selenium/remote/ErrorCodec.java index 957c5a1f91eb3..e4fbbaddfbcaa 100644 --- a/java/src/org/openqa/selenium/remote/ErrorCodec.java +++ b/java/src/org/openqa/selenium/remote/ErrorCodec.java @@ -144,12 +144,12 @@ public int getHttpStatusCode(Throwable throwable) { public WebDriverException decode(Map response) { if (!(response.get("value") instanceof Map)) { - throw new IllegalArgumentException("Unable to find mapping for " + response.toString()); + throw new IllegalArgumentException("Unable to find mapping for " + response); } Map value = (Map) response.get("value"); if (!(value.get("error") instanceof String)) { - throw new IllegalArgumentException("Unable to find mapping for " + response.toString()); + throw new IllegalArgumentException("Unable to find mapping for " + response); } String error = (String) value.get("error"); diff --git a/java/src/org/openqa/selenium/support/pagefactory/internal/LocatingElementHandler.java b/java/src/org/openqa/selenium/support/pagefactory/internal/LocatingElementHandler.java index a4eea99d0dbeb..59375fc2fc0d5 100644 --- a/java/src/org/openqa/selenium/support/pagefactory/internal/LocatingElementHandler.java +++ b/java/src/org/openqa/selenium/support/pagefactory/internal/LocatingElementHandler.java @@ -38,7 +38,7 @@ public Object invoke(Object object, Method method, Object[] objects) throws Thro element = locator.findElement(); } catch (NoSuchElementException e) { if ("toString".equals(method.getName())) { - return "Proxy element for: " + locator.toString(); + return "Proxy element for: " + locator; } throw e; } diff --git a/java/test/org/openqa/selenium/ProxySettingTest.java b/java/test/org/openqa/selenium/ProxySettingTest.java index 3b3fb4b1ccb90..d3da50ec06243 100644 --- a/java/test/org/openqa/selenium/ProxySettingTest.java +++ b/java/test/org/openqa/selenium/ProxySettingTest.java @@ -94,7 +94,7 @@ public void canConfigureProxyThroughPACFile() throws URISyntaxException, Interru .join( "function FindProxyForURL(url, host) {", " return 'PROXY " + getHostAndPort(helloServer) + "';", - "}")); ) { + "}"))) { Proxy proxy = new Proxy(); proxy.setProxyAutoconfigUrl("http://" + getHostAndPort(pacFileServer) + "/proxy.pac"); @@ -132,7 +132,7 @@ public void canUsePACThatOnlyProxiesCertainHosts() " return 'PROXY " + getHostAndPort(goodbyeServer) + "';", " }", " return 'DIRECT';", - "}")); ) { + "}"))) { Proxy proxy = new Proxy(); proxy.setProxyAutoconfigUrl("http://" + getHostAndPort(pacFileServer) + "/proxy.pac"); diff --git a/java/test/org/openqa/selenium/interactions/DragAndDropTest.java b/java/test/org/openqa/selenium/interactions/DragAndDropTest.java index b61d4aa5ef3db..16579a729e0db 100644 --- a/java/test/org/openqa/selenium/interactions/DragAndDropTest.java +++ b/java/test/org/openqa/selenium/interactions/DragAndDropTest.java @@ -43,7 +43,7 @@ private static void sleep(int ms) { try { Thread.sleep(ms); } catch (InterruptedException e) { - throw new RuntimeException("Interrupted: " + e.toString()); + throw new RuntimeException("Interrupted: " + e); } } diff --git a/java/test/org/openqa/selenium/javascript/TestFileLocator.java b/java/test/org/openqa/selenium/javascript/TestFileLocator.java index fb50faf97f382..3d66472c52927 100644 --- a/java/test/org/openqa/selenium/javascript/TestFileLocator.java +++ b/java/test/org/openqa/selenium/javascript/TestFileLocator.java @@ -101,7 +101,7 @@ public static String getTestFilePath(Path baseDir, Path testFile) { testFile .toAbsolutePath() .toString() - .replace(baseDir.toAbsolutePath().toString() + File.separator, "") + .replace(baseDir.toAbsolutePath() + File.separator, "") .replace(File.separator, "/"); if (path.endsWith(".js")) { path = "common/generated/" + path; diff --git a/java/test/org/openqa/selenium/json/JsonTest.java b/java/test/org/openqa/selenium/json/JsonTest.java index ad5e0c0ef1007..3c9be8c689b12 100644 --- a/java/test/org/openqa/selenium/json/JsonTest.java +++ b/java/test/org/openqa/selenium/json/JsonTest.java @@ -376,7 +376,7 @@ void shouldBeAbleToConvertASelenium3CommandToASelenium2Command() { // In selenium 2, the sessionId is an object. In selenium 3, it's a straight string. String raw = "{\"sessionId\": \"" - + expectedId.toString() + + expectedId + "\", " + "\"name\": \"some command\"," + "\"parameters\": {}}"; From df54f9534cb9197e000562c72df24e408d8fb76c Mon Sep 17 00:00:00 2001 From: Selenium CI Bot Date: Mon, 13 May 2024 12:02:47 +0200 Subject: [PATCH 07/10] [dotnet][rb][java][js][py] Automated Browser Version Update (#13928) Update pinned browser versions Co-authored-by: Selenium CI Bot Co-authored-by: Diego Molina --- common/repositories.bzl | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/common/repositories.bzl b/common/repositories.bzl index a0ee2a3b13b03..476a67802f7aa 100644 --- a/common/repositories.bzl +++ b/common/repositories.bzl @@ -123,10 +123,10 @@ js_library( pkg_archive( name = "mac_edge", - url = "https://msedge.sf.dl.delivery.mp.microsoft.com/filestreamingservice/files/e6f7f9ba-499c-44cb-9c19-28daeaa82dc6/MicrosoftEdge-124.0.2478.80.pkg", - sha256 = "fc667b0401c05bbe0e4d337cc593641e2b653107fafd363b401cd32baa8a4f53", + url = "https://msedge.sf.dl.delivery.mp.microsoft.com/filestreamingservice/files/f12b802a-7a08-47df-b40e-04570cf4e133/MicrosoftEdge-124.0.2478.97.pkg", + sha256 = "a1c9df556e158a2564e3f8238082ea724ea4a2585b4b543376d0f0e4bc389749", move = { - "MicrosoftEdge-124.0.2478.80.pkg/Payload/Microsoft Edge.app": "Edge.app", + "MicrosoftEdge-124.0.2478.97.pkg/Payload/Microsoft Edge.app": "Edge.app", }, build_file_content = """ load("@aspect_rules_js//js:defs.bzl", "js_library") @@ -143,8 +143,8 @@ js_library( deb_archive( name = "linux_edge", - url = "https://packages.microsoft.com/repos/edge/pool/main/m/microsoft-edge-stable/microsoft-edge-stable_124.0.2478.80-1_amd64.deb", - sha256 = "a7eb75d95730c520eec998f755fcc427a9b4ac6a150bbb267b21e8383b6dc105", + url = "https://packages.microsoft.com/repos/edge/pool/main/m/microsoft-edge-stable/microsoft-edge-stable_124.0.2478.97-1_amd64.deb", + sha256 = "85d0ad1d63847b3dd54f0f214d18a2b54462bb43291536e773ad1b8b29bbf799", build_file_content = """ load("@aspect_rules_js//js:defs.bzl", "js_library") package(default_visibility = ["//visibility:public"]) @@ -165,8 +165,8 @@ js_library( http_archive( name = "linux_edgedriver", - url = "https://msedgedriver.azureedge.net/124.0.2478.80/edgedriver_linux64.zip", - sha256 = "4c9192c8e42ac1e1d779784ba95a0b28807cc75ae1be07be740f40bc20410670", + url = "https://msedgedriver.azureedge.net/124.0.2478.97/edgedriver_linux64.zip", + sha256 = "b8c2b6c20c1669240ef601939a3097f3b704d062215ee5bd98cb6415f5a7c907", build_file_content = """ load("@aspect_rules_js//js:defs.bzl", "js_library") package(default_visibility = ["//visibility:public"]) @@ -182,8 +182,8 @@ js_library( http_archive( name = "mac_edgedriver", - url = "https://msedgedriver.azureedge.net/124.0.2478.80/edgedriver_mac64.zip", - sha256 = "f8d8b0eaacb884196e5f368a64cad246a86e5a92941b0d37c5d7aa8ebb0fec1f", + url = "https://msedgedriver.azureedge.net/124.0.2478.97/edgedriver_mac64.zip", + sha256 = "8c70da916d7a040a90949a6dcb9c4bf9717d5d7daffeb7a4ca9304327c3ad199", build_file_content = """ load("@aspect_rules_js//js:defs.bzl", "js_library") package(default_visibility = ["//visibility:public"]) From 4e59ac82d660f5bbe06d2fa821d7dfdc9aaad297 Mon Sep 17 00:00:00 2001 From: Diego Molina Date: Mon, 13 May 2024 14:04:30 +0200 Subject: [PATCH 08/10] Moving ignore_local_proxy_environment_variables to BaseOptions (#13926) * Moving ignore_local_proxy_environment_variables to BaseOptions * Just moving instead of deprecating * Invoking method instead of property --- py/selenium/webdriver/common/options.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/py/selenium/webdriver/common/options.py b/py/selenium/webdriver/common/options.py index ea2bdde227e76..2f1579115dcce 100644 --- a/py/selenium/webdriver/common/options.py +++ b/py/selenium/webdriver/common/options.py @@ -367,6 +367,7 @@ def __init__(self) -> None: self._proxy = None self.set_capability("pageLoadStrategy", PageLoadStrategy.normal) self.mobile_options = None + self._ignore_local_proxy = False @property def capabilities(self): @@ -404,6 +405,11 @@ def to_capabilities(self): def default_capabilities(self): """Return minimal capabilities necessary as a dictionary.""" + def ignore_local_proxy_environment_variables(self) -> None: + """By calling this you will ignore HTTP_PROXY and HTTPS_PROXY from + being picked up and used.""" + self._ignore_local_proxy = True + class ArgOptions(BaseOptions): BINARY_LOCATION_ERROR = "Binary Location Must be a String" @@ -411,7 +417,6 @@ class ArgOptions(BaseOptions): def __init__(self) -> None: super().__init__() self._arguments = [] - self._ignore_local_proxy = False @property def arguments(self): @@ -432,7 +437,7 @@ def add_argument(self, argument) -> None: def ignore_local_proxy_environment_variables(self) -> None: """By calling this you will ignore HTTP_PROXY and HTTPS_PROXY from being picked up and used.""" - self._ignore_local_proxy = True + super().ignore_local_proxy_environment_variables() def to_capabilities(self): return self._caps From d1b84e4259c612788cadcb99a6d77db15ffca244 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Sautter?= Date: Mon, 13 May 2024 19:23:34 +0200 Subject: [PATCH 09/10] [java] fixed format of expires in Cookie.toString #13927 --- java/src/org/openqa/selenium/Cookie.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/java/src/org/openqa/selenium/Cookie.java b/java/src/org/openqa/selenium/Cookie.java index 89ca6cf5cb49e..ae9890ce25f23 100644 --- a/java/src/org/openqa/selenium/Cookie.java +++ b/java/src/org/openqa/selenium/Cookie.java @@ -22,6 +22,7 @@ import java.util.Date; import java.util.Map; import java.util.Objects; +import java.util.TimeZone; import java.util.TreeMap; public class Cookie implements Serializable { @@ -255,12 +256,12 @@ public Map toJson() { @Override public String toString() { + SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z"); + sdf.setTimeZone(TimeZone.getTimeZone("GMT")); return name + "=" + value - + (expiry == null - ? "" - : "; expires=" + new SimpleDateFormat("EEE, dd MMM yyyy hh:mm:ss z").format(expiry)) + + (expiry == null ? "" : "; expires=" + sdf.format(expiry)) + ("".equals(path) ? "" : "; path=" + path) + (domain == null ? "" : "; domain=" + domain) + (isSecure ? ";secure;" : "") From d556c8ea2e950bfb7ecaf7f6db65b689b555d672 Mon Sep 17 00:00:00 2001 From: Selenium CI Bot Date: Tue, 14 May 2024 11:04:40 +0200 Subject: [PATCH 10/10] [dotnet][rb][java][js][py] Automated Browser Version Update (#13935) Update pinned browser versions Co-authored-by: Selenium CI Bot --- common/repositories.bzl | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/common/repositories.bzl b/common/repositories.bzl index 476a67802f7aa..2fcaf067d0b5b 100644 --- a/common/repositories.bzl +++ b/common/repositories.bzl @@ -199,8 +199,8 @@ js_library( http_archive( name = "linux_chrome", - url = "https://storage.googleapis.com/chrome-for-testing-public/124.0.6367.201/linux64/chrome-linux64.zip", - sha256 = "867ea96ed4a92823b75952b1162985e406ace5d133ae97b72441eaf4e3a2d452", + url = "https://storage.googleapis.com/chrome-for-testing-public/124.0.6367.207/linux64/chrome-linux64.zip", + sha256 = "22ac5d13b0bcbe1e7a454714421ab2448f8f8568ad3954cb4a87750bd70336c2", build_file_content = """ load("@aspect_rules_js//js:defs.bzl", "js_library") package(default_visibility = ["//visibility:public"]) @@ -221,8 +221,8 @@ js_library( http_archive( name = "mac_chrome", - url = "https://storage.googleapis.com/chrome-for-testing-public/124.0.6367.201/mac-x64/chrome-mac-x64.zip", - sha256 = "7248d83d4749eba968198fd97d2a213bd407ff4c0367f0bb7cd1eb9674ab3c99", + url = "https://storage.googleapis.com/chrome-for-testing-public/124.0.6367.207/mac-x64/chrome-mac-x64.zip", + sha256 = "67d8b832c49c0afc96f2b3f3480acae270293f097c162ef2805cead51694b870", strip_prefix = "chrome-mac-x64", patch_cmds = [ "mv 'Google Chrome for Testing.app' Chrome.app", @@ -243,8 +243,8 @@ js_library( http_archive( name = "linux_chromedriver", - url = "https://storage.googleapis.com/chrome-for-testing-public/124.0.6367.201/linux64/chromedriver-linux64.zip", - sha256 = "de484f57e58f7181eb9463455e1991ae36b6fb05acafbec15601cb6d27b4205f", + url = "https://storage.googleapis.com/chrome-for-testing-public/124.0.6367.207/linux64/chromedriver-linux64.zip", + sha256 = "c428b34691e071e9eddc3fed3012be0ad5e2c2d4dd1fad5f8dad6ef10c840820", strip_prefix = "chromedriver-linux64", build_file_content = """ load("@aspect_rules_js//js:defs.bzl", "js_library") @@ -261,8 +261,8 @@ js_library( http_archive( name = "mac_chromedriver", - url = "https://storage.googleapis.com/chrome-for-testing-public/124.0.6367.201/mac-x64/chromedriver-mac-x64.zip", - sha256 = "8e75a61fa333a99cf32006e5bc916fe632852762c82f21b2f9e3aa6fab169967", + url = "https://storage.googleapis.com/chrome-for-testing-public/124.0.6367.207/mac-x64/chromedriver-mac-x64.zip", + sha256 = "d34e7cda39e5024564a85b329599d359f1e1e53264cfe9bd5bc4025d829eadfa", strip_prefix = "chromedriver-mac-x64", build_file_content = """ load("@aspect_rules_js//js:defs.bzl", "js_library")