From 2a05eb120b4a3bb941d49b8dcc3b697427311755 Mon Sep 17 00:00:00 2001 From: titusfortner Date: Tue, 27 Sep 2022 17:11:34 -0500 Subject: [PATCH] [java] add cdp v106 remove v103 --- Rakefile | 2 +- .../devtools/{v103 => v106}/BUILD.bazel | 2 +- .../V106CdpInfo.java} | 10 +++--- .../V106Domains.java} | 31 +++++++++++-------- .../V103Events.java => v106/V106Events.java} | 19 ++++++------ .../V106Javascript.java} | 14 ++++----- .../{v103/V103Log.java => v106/V106Log.java} | 10 +++--- .../V106Network.java} | 31 +++++++++---------- .../V103Target.java => v106/V106Target.java} | 30 +++++++++--------- .../org/openqa/selenium/devtools/versions.bzl | 4 +-- 10 files changed, 78 insertions(+), 75 deletions(-) rename java/src/org/openqa/selenium/devtools/{v103 => v106}/BUILD.bazel (98%) rename java/src/org/openqa/selenium/devtools/{v103/V103CdpInfo.java => v106/V106CdpInfo.java} (82%) rename java/src/org/openqa/selenium/devtools/{v103/V103Domains.java => v106/V106Domains.java} (68%) rename java/src/org/openqa/selenium/devtools/{v103/V103Events.java => v106/V106Events.java} (86%) rename java/src/org/openqa/selenium/devtools/{v103/V103Javascript.java => v106/V106Javascript.java} (85%) rename java/src/org/openqa/selenium/devtools/{v103/V103Log.java => v106/V106Log.java} (89%) rename java/src/org/openqa/selenium/devtools/{v103/V103Network.java => v106/V106Network.java} (89%) rename java/src/org/openqa/selenium/devtools/{v103/V103Target.java => v106/V106Target.java} (79%) diff --git a/Rakefile b/Rakefile index 32cc0c04e1d4e..b37be01f92028 100644 --- a/Rakefile +++ b/Rakefile @@ -99,9 +99,9 @@ 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/v85:v85.publish - //java/src/org/openqa/selenium/devtools/v103:v103.publish //java/src/org/openqa/selenium/devtools/v104:v104.publish //java/src/org/openqa/selenium/devtools/v105:v105.publish + //java/src/org/openqa/selenium/devtools/v106:v106.publish //java/src/org/openqa/selenium/edge:edge.publish //java/src/org/openqa/selenium/firefox:firefox.publish //java/src/org/openqa/selenium/grid/sessionmap/jdbc:jdbc.publish diff --git a/java/src/org/openqa/selenium/devtools/v103/BUILD.bazel b/java/src/org/openqa/selenium/devtools/v106/BUILD.bazel similarity index 98% rename from java/src/org/openqa/selenium/devtools/v103/BUILD.bazel rename to java/src/org/openqa/selenium/devtools/v106/BUILD.bazel index fa776cb4f898e..adda2e5ae41b1 100644 --- a/java/src/org/openqa/selenium/devtools/v103/BUILD.bazel +++ b/java/src/org/openqa/selenium/devtools/v106/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 = "v103" +cdp_version = "v106" java_export( name = cdp_version, diff --git a/java/src/org/openqa/selenium/devtools/v103/V103CdpInfo.java b/java/src/org/openqa/selenium/devtools/v106/V106CdpInfo.java similarity index 82% rename from java/src/org/openqa/selenium/devtools/v103/V103CdpInfo.java rename to java/src/org/openqa/selenium/devtools/v106/V106CdpInfo.java index 34e0e05945a25..caa6ba9b05ac1 100644 --- a/java/src/org/openqa/selenium/devtools/v103/V103CdpInfo.java +++ b/java/src/org/openqa/selenium/devtools/v106/V106CdpInfo.java @@ -15,16 +15,16 @@ // specific language governing permissions and limitations // under the License. -package org.openqa.selenium.devtools.v103; +package org.openqa.selenium.devtools.v106; import com.google.auto.service.AutoService; - import org.openqa.selenium.devtools.CdpInfo; +import org.openqa.selenium.devtools.v106.V106Domains; @AutoService(CdpInfo.class) -public class V103CdpInfo extends CdpInfo { +public class V106CdpInfo extends CdpInfo { - public V103CdpInfo() { - super(103, V103Domains::new); + public V106CdpInfo() { + super(106, V106Domains::new); } } diff --git a/java/src/org/openqa/selenium/devtools/v103/V103Domains.java b/java/src/org/openqa/selenium/devtools/v106/V106Domains.java similarity index 68% rename from java/src/org/openqa/selenium/devtools/v103/V103Domains.java rename to java/src/org/openqa/selenium/devtools/v106/V106Domains.java index 2feb6f6a19846..b2759cd87e386 100644 --- a/java/src/org/openqa/selenium/devtools/v103/V103Domains.java +++ b/java/src/org/openqa/selenium/devtools/v106/V106Domains.java @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -package org.openqa.selenium.devtools.v103; +package org.openqa.selenium.devtools.v106; import org.openqa.selenium.devtools.DevTools; import org.openqa.selenium.devtools.idealized.Domains; @@ -24,23 +24,28 @@ import org.openqa.selenium.devtools.idealized.Network; import org.openqa.selenium.devtools.idealized.log.Log; import org.openqa.selenium.devtools.idealized.target.Target; +import org.openqa.selenium.devtools.v106.V106Events; +import org.openqa.selenium.devtools.v106.V106Javascript; +import org.openqa.selenium.devtools.v106.V106Log; +import org.openqa.selenium.devtools.v106.V106Network; +import org.openqa.selenium.devtools.v106.V106Target; import org.openqa.selenium.internal.Require; -public class V103Domains implements Domains { +public class V106Domains implements Domains { - private final V103Javascript js; - private final V103Events events; - private final V103Log log; - private final V103Network network; - private final V103Target target; + private final V106Javascript js; + private final V106Events events; + private final V106Log log; + private final V106Network network; + private final V106Target target; - public V103Domains(DevTools devtools) { + public V106Domains(DevTools devtools) { Require.nonNull("DevTools", devtools); - events = new V103Events(devtools); - js = new V103Javascript(devtools); - log = new V103Log(); - network = new V103Network(devtools); - target = new V103Target(); + events = new V106Events(devtools); + js = new V106Javascript(devtools); + log = new V106Log(); + network = new V106Network(devtools); + target = new V106Target(); } @Override diff --git a/java/src/org/openqa/selenium/devtools/v103/V103Events.java b/java/src/org/openqa/selenium/devtools/v106/V106Events.java similarity index 86% rename from java/src/org/openqa/selenium/devtools/v103/V103Events.java rename to java/src/org/openqa/selenium/devtools/v106/V106Events.java index 9f6fcc357f27b..5927a2ea01070 100644 --- a/java/src/org/openqa/selenium/devtools/v103/V103Events.java +++ b/java/src/org/openqa/selenium/devtools/v106/V106Events.java @@ -15,10 +15,9 @@ // specific language governing permissions and limitations // under the License. -package org.openqa.selenium.devtools.v103; +package org.openqa.selenium.devtools.v106; import com.google.common.collect.ImmutableList; - import org.openqa.selenium.JavascriptException; import org.openqa.selenium.devtools.Command; import org.openqa.selenium.devtools.DevTools; @@ -26,19 +25,19 @@ 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.v103.runtime.Runtime; -import org.openqa.selenium.devtools.v103.runtime.model.ConsoleAPICalled; -import org.openqa.selenium.devtools.v103.runtime.model.ExceptionDetails; -import org.openqa.selenium.devtools.v103.runtime.model.ExceptionThrown; -import org.openqa.selenium.devtools.v103.runtime.model.StackTrace; +import org.openqa.selenium.devtools.v106.runtime.Runtime; +import org.openqa.selenium.devtools.v106.runtime.model.ConsoleAPICalled; +import org.openqa.selenium.devtools.v106.runtime.model.ExceptionDetails; +import org.openqa.selenium.devtools.v106.runtime.model.ExceptionThrown; +import org.openqa.selenium.devtools.v106.runtime.model.StackTrace; import java.time.Instant; import java.util.List; import java.util.Optional; -public class V103Events extends Events { +public class V106Events extends Events { - public V103Events(DevTools devtools) { + public V106Events(DevTools devtools) { super(devtools); } @@ -82,7 +81,7 @@ protected ConsoleEvent toConsoleEvent(ConsoleAPICalled event) { protected JavascriptException toJsException(ExceptionThrown event) { ExceptionDetails details = event.getExceptionDetails(); Optional maybeTrace = details.getStackTrace(); - Optional + Optional maybeException = details.getException(); String message = maybeException diff --git a/java/src/org/openqa/selenium/devtools/v103/V103Javascript.java b/java/src/org/openqa/selenium/devtools/v106/V106Javascript.java similarity index 85% rename from java/src/org/openqa/selenium/devtools/v103/V103Javascript.java rename to java/src/org/openqa/selenium/devtools/v106/V106Javascript.java index 218bc31f3f0ab..3e77b96907921 100644 --- a/java/src/org/openqa/selenium/devtools/v103/V103Javascript.java +++ b/java/src/org/openqa/selenium/devtools/v106/V106Javascript.java @@ -15,22 +15,22 @@ // specific language governing permissions and limitations // under the License. -package org.openqa.selenium.devtools.v103; +package org.openqa.selenium.devtools.v106; 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.v103.page.Page; -import org.openqa.selenium.devtools.v103.page.model.ScriptIdentifier; -import org.openqa.selenium.devtools.v103.runtime.Runtime; -import org.openqa.selenium.devtools.v103.runtime.model.BindingCalled; +import org.openqa.selenium.devtools.v106.page.Page; +import org.openqa.selenium.devtools.v106.page.model.ScriptIdentifier; +import org.openqa.selenium.devtools.v106.runtime.Runtime; +import org.openqa.selenium.devtools.v106.runtime.model.BindingCalled; import java.util.Optional; -public class V103Javascript extends Javascript { +public class V106Javascript extends Javascript { - public V103Javascript(DevTools devtools) { + public V106Javascript(DevTools devtools) { super(devtools); } diff --git a/java/src/org/openqa/selenium/devtools/v103/V103Log.java b/java/src/org/openqa/selenium/devtools/v106/V106Log.java similarity index 89% rename from java/src/org/openqa/selenium/devtools/v103/V103Log.java rename to java/src/org/openqa/selenium/devtools/v106/V106Log.java index 09e8336684833..e5e23643b09a0 100644 --- a/java/src/org/openqa/selenium/devtools/v103/V103Log.java +++ b/java/src/org/openqa/selenium/devtools/v106/V106Log.java @@ -15,20 +15,20 @@ // specific language governing permissions and limitations // under the License. -package org.openqa.selenium.devtools.v103; +package org.openqa.selenium.devtools.v106; import org.openqa.selenium.devtools.Command; import org.openqa.selenium.devtools.ConverterFunctions; import org.openqa.selenium.devtools.Event; -import org.openqa.selenium.devtools.v103.log.Log; -import org.openqa.selenium.devtools.v103.log.model.LogEntry; -import org.openqa.selenium.devtools.v103.runtime.model.Timestamp; +import org.openqa.selenium.devtools.v106.log.Log; +import org.openqa.selenium.devtools.v106.log.model.LogEntry; +import org.openqa.selenium.devtools.v106.runtime.model.Timestamp; import org.openqa.selenium.json.JsonInput; import java.util.function.Function; import java.util.logging.Level; -public class V103Log implements org.openqa.selenium.devtools.idealized.log.Log { +public class V106Log implements org.openqa.selenium.devtools.idealized.log.Log { @Override public Command enable() { diff --git a/java/src/org/openqa/selenium/devtools/v103/V103Network.java b/java/src/org/openqa/selenium/devtools/v106/V106Network.java similarity index 89% rename from java/src/org/openqa/selenium/devtools/v103/V103Network.java rename to java/src/org/openqa/selenium/devtools/v106/V106Network.java index b266e0f826444..244ecf2691b0e 100644 --- a/java/src/org/openqa/selenium/devtools/v103/V103Network.java +++ b/java/src/org/openqa/selenium/devtools/v106/V106Network.java @@ -15,25 +15,24 @@ // specific language governing permissions and limitations // under the License. -package org.openqa.selenium.devtools.v103; +package org.openqa.selenium.devtools.v106; import com.google.common.collect.ImmutableList; import com.google.common.io.ByteStreams; - import org.openqa.selenium.UsernameAndPassword; import org.openqa.selenium.devtools.Command; import org.openqa.selenium.devtools.DevTools; import org.openqa.selenium.devtools.DevToolsException; import org.openqa.selenium.devtools.Event; import org.openqa.selenium.devtools.idealized.Network; -import org.openqa.selenium.devtools.v103.fetch.Fetch; -import org.openqa.selenium.devtools.v103.fetch.model.AuthChallengeResponse; -import org.openqa.selenium.devtools.v103.fetch.model.AuthRequired; -import org.openqa.selenium.devtools.v103.fetch.model.HeaderEntry; -import org.openqa.selenium.devtools.v103.fetch.model.RequestPattern; -import org.openqa.selenium.devtools.v103.fetch.model.RequestPaused; -import org.openqa.selenium.devtools.v103.fetch.model.RequestStage; -import org.openqa.selenium.devtools.v103.network.model.Request; +import org.openqa.selenium.devtools.v106.fetch.Fetch; +import org.openqa.selenium.devtools.v106.fetch.model.AuthChallengeResponse; +import org.openqa.selenium.devtools.v106.fetch.model.AuthRequired; +import org.openqa.selenium.devtools.v106.fetch.model.HeaderEntry; +import org.openqa.selenium.devtools.v106.fetch.model.RequestPattern; +import org.openqa.selenium.devtools.v106.fetch.model.RequestPaused; +import org.openqa.selenium.devtools.v106.fetch.model.RequestStage; +import org.openqa.selenium.devtools.v106.network.model.Request; import org.openqa.selenium.internal.Either; import org.openqa.selenium.remote.http.HttpRequest; import org.openqa.selenium.remote.http.HttpResponse; @@ -51,28 +50,28 @@ import static java.net.HttpURLConnection.HTTP_OK; -public class V103Network extends Network { +public class V106Network extends Network { - private static final Logger LOG = Logger.getLogger(V103Network.class.getName()); + private static final Logger LOG = Logger.getLogger(V106Network.class.getName()); - public V103Network(DevTools devTools) { + public V106Network(DevTools devTools) { super(devTools); } @Override protected Command setUserAgentOverride(UserAgent userAgent) { - return org.openqa.selenium.devtools.v103.network.Network.setUserAgentOverride( + return org.openqa.selenium.devtools.v106.network.Network.setUserAgentOverride( userAgent.userAgent(), userAgent.acceptLanguage(), userAgent.platform(), Optional.empty()); } @Override protected Command enableNetworkCaching() { - return org.openqa.selenium.devtools.v103.network.Network.setCacheDisabled(false); + return org.openqa.selenium.devtools.v106.network.Network.setCacheDisabled(false); } @Override protected Command disableNetworkCaching() { - return org.openqa.selenium.devtools.v103.network.Network.setCacheDisabled(true); + return org.openqa.selenium.devtools.v106.network.Network.setCacheDisabled(true); } @Override diff --git a/java/src/org/openqa/selenium/devtools/v103/V103Target.java b/java/src/org/openqa/selenium/devtools/v106/V106Target.java similarity index 79% rename from java/src/org/openqa/selenium/devtools/v103/V103Target.java rename to java/src/org/openqa/selenium/devtools/v106/V106Target.java index d710c9de72271..594c57afe9af2 100644 --- a/java/src/org/openqa/selenium/devtools/v103/V103Target.java +++ b/java/src/org/openqa/selenium/devtools/v106/V106Target.java @@ -15,19 +15,19 @@ // specific language governing permissions and limitations // under the License. -package org.openqa.selenium.devtools.v103; +package org.openqa.selenium.devtools.v106; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; - import org.openqa.selenium.devtools.Command; import org.openqa.selenium.devtools.ConverterFunctions; import org.openqa.selenium.devtools.Event; 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.v103.target.Target; -import org.openqa.selenium.devtools.v103.target.model.TargetInfo; +import org.openqa.selenium.devtools.v106.target.Target; +import org.openqa.selenium.devtools.v106.target.model.TargetFilter; +import org.openqa.selenium.devtools.v106.target.model.TargetInfo; import org.openqa.selenium.json.JsonInput; import org.openqa.selenium.json.TypeToken; @@ -35,16 +35,16 @@ import java.util.Optional; import java.util.function.Function; -public class V103Target implements org.openqa.selenium.devtools.idealized.target.Target { +public class V106Target 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.v103.target.model.SessionID(id.toString())), + id -> new org.openqa.selenium.devtools.v106.target.model.SessionID(id.toString())), targetId.map( - id -> new org.openqa.selenium.devtools.v103.target.model.TargetID(id.toString()))); + id -> new org.openqa.selenium.devtools.v106.target.model.TargetID(id.toString()))); } @Override @@ -55,7 +55,7 @@ public Command( - Target.getTargets().getMethod(), + Target.getTargets(Optional.empty()).getMethod(), ImmutableMap.of(), input -> { List infos = mapper.apply(input); @@ -75,25 +75,25 @@ public Command attachToTarget(TargetID targetId) { - Function mapper = + Function mapper = ConverterFunctions.map("sessionId", - org.openqa.selenium.devtools.v103.target.model.SessionID.class); + org.openqa.selenium.devtools.v106.target.model.SessionID.class); return new Command<>( "Target.attachToTarget", ImmutableMap.of( "targetId", - new org.openqa.selenium.devtools.v103.target.model.TargetID(targetId.toString()), + new org.openqa.selenium.devtools.v106.target.model.TargetID(targetId.toString()), "flatten", true), input -> { - org.openqa.selenium.devtools.v103.target.model.SessionID id = mapper.apply(input); + org.openqa.selenium.devtools.v106.target.model.SessionID id = mapper.apply(input); return new SessionID(id.toString()); }); } @Override public Command setAutoAttach() { - return Target.setAutoAttach(true, false, Optional.of(true)); + return Target.setAutoAttach(true, false, Optional.of(true), Optional.empty()); } @Override @@ -101,9 +101,9 @@ public Event detached() { return new Event<>( "Target.detachedFromTarget", input -> { - Function converter = + Function converter = ConverterFunctions.map("targetId", - org.openqa.selenium.devtools.v103.target.model.TargetID.class); + org.openqa.selenium.devtools.v106.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 944aceea3ad08..727393f421da3 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 - "v103", "v104", - "v105" + "v105", + "v106" ] CDP_DEPS = ["//java/src/org/openqa/selenium/devtools/%s" % v for v in CDP_VERSIONS]