From c04855fd432d0dbb2dde565fb9a76b1b42eee8b9 Mon Sep 17 00:00:00 2001 From: titusfortner Date: Mon, 9 Oct 2023 10:51:40 -0500 Subject: [PATCH] [cdp][java] add Chrome 118 and remove 115 --- Rakefile | 2 +- .../devtools/{v115 => v118}/BUILD.bazel | 2 +- .../v118CdpInfo.java} | 8 +++--- .../v118Domains.java} | 26 +++++++++--------- .../v115Events.java => v118/v118Events.java} | 18 ++++++------- .../v118Javascript.java} | 17 ++++++------ .../{v115/v115Log.java => v118/v118Log.java} | 10 +++---- .../v118Network.java} | 27 ++++++++----------- .../v115Target.java => v118/v118Target.java} | 24 ++++++++--------- .../org/openqa/selenium/devtools/versions.bzl | 2 +- 10 files changed, 66 insertions(+), 70 deletions(-) rename java/src/org/openqa/selenium/devtools/{v115 => v118}/BUILD.bazel (98%) rename java/src/org/openqa/selenium/devtools/{v115/v115CdpInfo.java => v118/v118CdpInfo.java} (86%) rename java/src/org/openqa/selenium/devtools/{v115/v115Domains.java => v118/v118Domains.java} (77%) rename java/src/org/openqa/selenium/devtools/{v115/v115Events.java => v118/v118Events.java} (86%) rename java/src/org/openqa/selenium/devtools/{v115/v115Javascript.java => v118/v118Javascript.java} (81%) rename java/src/org/openqa/selenium/devtools/{v115/v115Log.java => v118/v118Log.java} (89%) rename java/src/org/openqa/selenium/devtools/{v115/v115Network.java => v118/v118Network.java} (90%) rename java/src/org/openqa/selenium/devtools/{v115/v115Target.java => v118/v118Target.java} (83%) diff --git a/Rakefile b/Rakefile index da86a58f797a9..ef9bd40468100 100644 --- a/Rakefile +++ b/Rakefile @@ -98,9 +98,9 @@ task '//java/test/org/openqa/selenium/environment/webserver:webserver:uber' => [ JAVA_RELEASE_TARGETS = %w[ //java/src/org/openqa/selenium/chrome:chrome.publish //java/src/org/openqa/selenium/chromium:chromium.publish - //java/src/org/openqa/selenium/devtools/v115:v115.publish //java/src/org/openqa/selenium/devtools/v116:v116.publish //java/src/org/openqa/selenium/devtools/v117:v117.publish + //java/src/org/openqa/selenium/devtools/v118:v118.publish //java/src/org/openqa/selenium/devtools/v85:v85.publish //java/src/org/openqa/selenium/edge:edge.publish //java/src/org/openqa/selenium/firefox:firefox.publish diff --git a/java/src/org/openqa/selenium/devtools/v115/BUILD.bazel b/java/src/org/openqa/selenium/devtools/v118/BUILD.bazel similarity index 98% rename from java/src/org/openqa/selenium/devtools/v115/BUILD.bazel rename to java/src/org/openqa/selenium/devtools/v118/BUILD.bazel index 62fb997f9fd2c..1d57c53faf929 100644 --- a/java/src/org/openqa/selenium/devtools/v115/BUILD.bazel +++ b/java/src/org/openqa/selenium/devtools/v118/BUILD.bazel @@ -3,7 +3,7 @@ load("//common:defs.bzl", "copy_file") load("//java:defs.bzl", "java_export", "java_library") load("//java:version.bzl", "SE_VERSION") -cdp_version = "v115" +cdp_version = "v118" java_export( name = cdp_version, diff --git a/java/src/org/openqa/selenium/devtools/v115/v115CdpInfo.java b/java/src/org/openqa/selenium/devtools/v118/v118CdpInfo.java similarity index 86% rename from java/src/org/openqa/selenium/devtools/v115/v115CdpInfo.java rename to java/src/org/openqa/selenium/devtools/v118/v118CdpInfo.java index 4ed7b73d47efc..5266ef6626e21 100644 --- a/java/src/org/openqa/selenium/devtools/v115/v115CdpInfo.java +++ b/java/src/org/openqa/selenium/devtools/v118/v118CdpInfo.java @@ -15,15 +15,15 @@ // specific language governing permissions and limitations // under the License. -package org.openqa.selenium.devtools.v115; +package org.openqa.selenium.devtools.v118; import com.google.auto.service.AutoService; import org.openqa.selenium.devtools.CdpInfo; @AutoService(CdpInfo.class) -public class v115CdpInfo extends CdpInfo { +public class v118CdpInfo extends CdpInfo { - public v115CdpInfo() { - super(115, v115Domains::new); + public v118CdpInfo() { + super(118, v118Domains::new); } } diff --git a/java/src/org/openqa/selenium/devtools/v115/v115Domains.java b/java/src/org/openqa/selenium/devtools/v118/v118Domains.java similarity index 77% rename from java/src/org/openqa/selenium/devtools/v115/v115Domains.java rename to java/src/org/openqa/selenium/devtools/v118/v118Domains.java index 43525847eab61..0985ae1ce9860 100644 --- a/java/src/org/openqa/selenium/devtools/v115/v115Domains.java +++ b/java/src/org/openqa/selenium/devtools/v118/v118Domains.java @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -package org.openqa.selenium.devtools.v115; +package org.openqa.selenium.devtools.v118; import org.openqa.selenium.devtools.DevTools; import org.openqa.selenium.devtools.idealized.Domains; @@ -26,21 +26,21 @@ import org.openqa.selenium.devtools.idealized.target.Target; import org.openqa.selenium.internal.Require; -public class v115Domains implements Domains { +public class v118Domains implements Domains { - private final v115Javascript js; - private final v115Events events; - private final v115Log log; - private final v115Network network; - private final v115Target target; + private final v118Javascript js; + private final v118Events events; + private final v118Log log; + private final v118Network network; + private final v118Target target; - public v115Domains(DevTools devtools) { + public v118Domains(DevTools devtools) { Require.nonNull("DevTools", devtools); - events = new v115Events(devtools); - js = new v115Javascript(devtools); - log = new v115Log(); - network = new v115Network(devtools); - target = new v115Target(); + events = new v118Events(devtools); + js = new v118Javascript(devtools); + log = new v118Log(); + network = new v118Network(devtools); + target = new v118Target(); } @Override diff --git a/java/src/org/openqa/selenium/devtools/v115/v115Events.java b/java/src/org/openqa/selenium/devtools/v118/v118Events.java similarity index 86% rename from java/src/org/openqa/selenium/devtools/v115/v115Events.java rename to java/src/org/openqa/selenium/devtools/v118/v118Events.java index d9af58b1ccaca..d0793160edf10 100644 --- a/java/src/org/openqa/selenium/devtools/v115/v115Events.java +++ b/java/src/org/openqa/selenium/devtools/v118/v118Events.java @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -package org.openqa.selenium.devtools.v115; +package org.openqa.selenium.devtools.v118; import com.google.common.collect.ImmutableList; import java.time.Instant; @@ -28,15 +28,15 @@ import org.openqa.selenium.devtools.events.ConsoleEvent; import org.openqa.selenium.devtools.idealized.Events; import org.openqa.selenium.devtools.idealized.runtime.model.RemoteObject; -import org.openqa.selenium.devtools.v115.runtime.Runtime; -import org.openqa.selenium.devtools.v115.runtime.model.ConsoleAPICalled; -import org.openqa.selenium.devtools.v115.runtime.model.ExceptionDetails; -import org.openqa.selenium.devtools.v115.runtime.model.ExceptionThrown; -import org.openqa.selenium.devtools.v115.runtime.model.StackTrace; +import org.openqa.selenium.devtools.v118.runtime.Runtime; +import org.openqa.selenium.devtools.v118.runtime.model.ConsoleAPICalled; +import org.openqa.selenium.devtools.v118.runtime.model.ExceptionDetails; +import org.openqa.selenium.devtools.v118.runtime.model.ExceptionThrown; +import org.openqa.selenium.devtools.v118.runtime.model.StackTrace; -public class v115Events extends Events { +public class v118Events extends Events { - public v115Events(DevTools devtools) { + public v118Events(DevTools devtools) { super(devtools); } @@ -77,7 +77,7 @@ protected ConsoleEvent toConsoleEvent(ConsoleAPICalled event) { protected JavascriptException toJsException(ExceptionThrown event) { ExceptionDetails details = event.getExceptionDetails(); Optional maybeTrace = details.getStackTrace(); - Optional maybeException = + Optional maybeException = details.getException(); String message = diff --git a/java/src/org/openqa/selenium/devtools/v115/v115Javascript.java b/java/src/org/openqa/selenium/devtools/v118/v118Javascript.java similarity index 81% rename from java/src/org/openqa/selenium/devtools/v115/v115Javascript.java rename to java/src/org/openqa/selenium/devtools/v118/v118Javascript.java index 11cf74a0928b4..987e170321645 100644 --- a/java/src/org/openqa/selenium/devtools/v115/v115Javascript.java +++ b/java/src/org/openqa/selenium/devtools/v118/v118Javascript.java @@ -15,21 +15,21 @@ // specific language governing permissions and limitations // under the License. -package org.openqa.selenium.devtools.v115; +package org.openqa.selenium.devtools.v118; import java.util.Optional; import org.openqa.selenium.devtools.Command; import org.openqa.selenium.devtools.DevTools; import org.openqa.selenium.devtools.Event; import org.openqa.selenium.devtools.idealized.Javascript; -import org.openqa.selenium.devtools.v115.page.Page; -import org.openqa.selenium.devtools.v115.page.model.ScriptIdentifier; -import org.openqa.selenium.devtools.v115.runtime.Runtime; -import org.openqa.selenium.devtools.v115.runtime.model.BindingCalled; +import org.openqa.selenium.devtools.v118.page.Page; +import org.openqa.selenium.devtools.v118.page.model.ScriptIdentifier; +import org.openqa.selenium.devtools.v118.runtime.Runtime; +import org.openqa.selenium.devtools.v118.runtime.model.BindingCalled; -public class v115Javascript extends Javascript { +public class v118Javascript extends Javascript { - public v115Javascript(DevTools devtools) { + public v118Javascript(DevTools devtools) { super(devtools); } @@ -65,7 +65,8 @@ protected Command disablePage() { @Override protected Command addScriptToEvaluateOnNewDocument(String script) { - return Page.addScriptToEvaluateOnNewDocument(script, Optional.empty(), Optional.empty()); + return Page.addScriptToEvaluateOnNewDocument( + script, Optional.empty(), Optional.empty(), Optional.empty()); } @Override diff --git a/java/src/org/openqa/selenium/devtools/v115/v115Log.java b/java/src/org/openqa/selenium/devtools/v118/v118Log.java similarity index 89% rename from java/src/org/openqa/selenium/devtools/v115/v115Log.java rename to java/src/org/openqa/selenium/devtools/v118/v118Log.java index 0ae650a2288da..b7eb6a55e423f 100644 --- a/java/src/org/openqa/selenium/devtools/v115/v115Log.java +++ b/java/src/org/openqa/selenium/devtools/v118/v118Log.java @@ -15,19 +15,19 @@ // specific language governing permissions and limitations // under the License. -package org.openqa.selenium.devtools.v115; +package org.openqa.selenium.devtools.v118; import java.util.function.Function; import java.util.logging.Level; import org.openqa.selenium.devtools.Command; import org.openqa.selenium.devtools.ConverterFunctions; import org.openqa.selenium.devtools.Event; -import org.openqa.selenium.devtools.v115.log.Log; -import org.openqa.selenium.devtools.v115.log.model.LogEntry; -import org.openqa.selenium.devtools.v115.runtime.model.Timestamp; +import org.openqa.selenium.devtools.v118.log.Log; +import org.openqa.selenium.devtools.v118.log.model.LogEntry; +import org.openqa.selenium.devtools.v118.runtime.model.Timestamp; import org.openqa.selenium.json.JsonInput; -public class v115Log implements org.openqa.selenium.devtools.idealized.log.Log { +public class v118Log implements org.openqa.selenium.devtools.idealized.log.Log { @Override public Command enable() { diff --git a/java/src/org/openqa/selenium/devtools/v115/v115Network.java b/java/src/org/openqa/selenium/devtools/v118/v118Network.java similarity index 90% rename from java/src/org/openqa/selenium/devtools/v115/v115Network.java rename to java/src/org/openqa/selenium/devtools/v118/v118Network.java index d7b89012207f4..332335374402d 100644 --- a/java/src/org/openqa/selenium/devtools/v115/v115Network.java +++ b/java/src/org/openqa/selenium/devtools/v118/v118Network.java @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -package org.openqa.selenium.devtools.v115; +package org.openqa.selenium.devtools.v118; import static java.net.HttpURLConnection.HTTP_OK; @@ -24,12 +24,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; -import java.util.AbstractMap; -import java.util.ArrayList; -import java.util.Base64; -import java.util.List; -import java.util.Map; -import java.util.Optional; +import java.util.*; import java.util.logging.Logger; import org.openqa.selenium.UsernameAndPassword; import org.openqa.selenium.devtools.Command; @@ -37,35 +32,35 @@ import org.openqa.selenium.devtools.DevToolsException; import org.openqa.selenium.devtools.Event; import org.openqa.selenium.devtools.idealized.Network; -import org.openqa.selenium.devtools.v115.fetch.Fetch; -import org.openqa.selenium.devtools.v115.fetch.model.*; -import org.openqa.selenium.devtools.v115.network.model.Request; +import org.openqa.selenium.devtools.v118.fetch.Fetch; +import org.openqa.selenium.devtools.v118.fetch.model.*; +import org.openqa.selenium.devtools.v118.network.model.Request; import org.openqa.selenium.internal.Either; import org.openqa.selenium.remote.http.HttpRequest; import org.openqa.selenium.remote.http.HttpResponse; -public class v115Network extends Network { +public class v118Network extends Network { - private static final Logger LOG = Logger.getLogger(v115Network.class.getName()); + private static final Logger LOG = Logger.getLogger(v118Network.class.getName()); - public v115Network(DevTools devTools) { + public v118Network(DevTools devTools) { super(devTools); } @Override protected Command setUserAgentOverride(UserAgent userAgent) { - return org.openqa.selenium.devtools.v115.network.Network.setUserAgentOverride( + return org.openqa.selenium.devtools.v118.network.Network.setUserAgentOverride( userAgent.userAgent(), userAgent.acceptLanguage(), userAgent.platform(), Optional.empty()); } @Override protected Command enableNetworkCaching() { - return org.openqa.selenium.devtools.v115.network.Network.setCacheDisabled(false); + return org.openqa.selenium.devtools.v118.network.Network.setCacheDisabled(false); } @Override protected Command disableNetworkCaching() { - return org.openqa.selenium.devtools.v115.network.Network.setCacheDisabled(true); + return org.openqa.selenium.devtools.v118.network.Network.setCacheDisabled(true); } @Override diff --git a/java/src/org/openqa/selenium/devtools/v115/v115Target.java b/java/src/org/openqa/selenium/devtools/v118/v118Target.java similarity index 83% rename from java/src/org/openqa/selenium/devtools/v115/v115Target.java rename to java/src/org/openqa/selenium/devtools/v118/v118Target.java index e0b9592188431..df52150eb5533 100644 --- a/java/src/org/openqa/selenium/devtools/v115/v115Target.java +++ b/java/src/org/openqa/selenium/devtools/v118/v118Target.java @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -package org.openqa.selenium.devtools.v115; +package org.openqa.selenium.devtools.v118; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; @@ -28,21 +28,21 @@ import org.openqa.selenium.devtools.idealized.browser.model.BrowserContextID; import org.openqa.selenium.devtools.idealized.target.model.SessionID; import org.openqa.selenium.devtools.idealized.target.model.TargetID; -import org.openqa.selenium.devtools.v115.target.Target; -import org.openqa.selenium.devtools.v115.target.model.TargetInfo; +import org.openqa.selenium.devtools.v118.target.Target; +import org.openqa.selenium.devtools.v118.target.model.TargetInfo; import org.openqa.selenium.json.JsonInput; import org.openqa.selenium.json.TypeToken; -public class v115Target implements org.openqa.selenium.devtools.idealized.target.Target { +public class v118Target implements org.openqa.selenium.devtools.idealized.target.Target { @Override public Command detachFromTarget( Optional sessionId, Optional targetId) { return Target.detachFromTarget( sessionId.map( - id -> new org.openqa.selenium.devtools.v115.target.model.SessionID(id.toString())), + id -> new org.openqa.selenium.devtools.v118.target.model.SessionID(id.toString())), targetId.map( - id -> new org.openqa.selenium.devtools.v115.target.model.TargetID(id.toString()))); + id -> new org.openqa.selenium.devtools.v118.target.model.TargetID(id.toString()))); } @Override @@ -74,19 +74,19 @@ public Command detachFromTarget( @Override public Command attachToTarget(TargetID targetId) { - Function mapper = + Function mapper = ConverterFunctions.map( - "sessionId", org.openqa.selenium.devtools.v115.target.model.SessionID.class); + "sessionId", org.openqa.selenium.devtools.v118.target.model.SessionID.class); return new Command<>( "Target.attachToTarget", ImmutableMap.of( "targetId", - new org.openqa.selenium.devtools.v115.target.model.TargetID(targetId.toString()), + new org.openqa.selenium.devtools.v118.target.model.TargetID(targetId.toString()), "flatten", true), input -> { - org.openqa.selenium.devtools.v115.target.model.SessionID id = mapper.apply(input); + org.openqa.selenium.devtools.v118.target.model.SessionID id = mapper.apply(input); return new SessionID(id.toString()); }); } @@ -101,9 +101,9 @@ public Event detached() { return new Event<>( "Target.detachedFromTarget", input -> { - Function converter = + Function converter = ConverterFunctions.map( - "targetId", org.openqa.selenium.devtools.v115.target.model.TargetID.class); + "targetId", org.openqa.selenium.devtools.v118.target.model.TargetID.class); return new TargetID(converter.apply(input).toString()); }); } diff --git a/java/src/org/openqa/selenium/devtools/versions.bzl b/java/src/org/openqa/selenium/devtools/versions.bzl index 7749e728628fa..98dd41bc8fa74 100644 --- a/java/src/org/openqa/selenium/devtools/versions.bzl +++ b/java/src/org/openqa/selenium/devtools/versions.bzl @@ -1,8 +1,8 @@ CDP_VERSIONS = [ "v85", # Required by Firefox - "v115", "v116", "v117", + "v118", ] CDP_DEPS = ["//java/src/org/openqa/selenium/devtools/%s" % v for v in CDP_VERSIONS]