Skip to content

Commit

Permalink
[cdp][java] add Chrome 118 and remove 115
Browse files Browse the repository at this point in the history
  • Loading branch information
titusfortner committed Oct 9, 2023
1 parent d7d1b4e commit c04855f
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 70 deletions.
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<ConsoleAPICalled, ExceptionThrown> {
public class v118Events extends Events<ConsoleAPICalled, ExceptionThrown> {

public v115Events(DevTools devtools) {
public v118Events(DevTools devtools) {
super(devtools);
}

Expand Down Expand Up @@ -77,7 +77,7 @@ protected ConsoleEvent toConsoleEvent(ConsoleAPICalled event) {
protected JavascriptException toJsException(ExceptionThrown event) {
ExceptionDetails details = event.getExceptionDetails();
Optional<StackTrace> maybeTrace = details.getStackTrace();
Optional<org.openqa.selenium.devtools.v115.runtime.model.RemoteObject> maybeException =
Optional<org.openqa.selenium.devtools.v118.runtime.model.RemoteObject> maybeException =
details.getException();

String message =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<ScriptIdentifier, BindingCalled> {
public class v118Javascript extends Javascript<ScriptIdentifier, BindingCalled> {

public v115Javascript(DevTools devtools) {
public v118Javascript(DevTools devtools) {
super(devtools);
}

Expand Down Expand Up @@ -65,7 +65,8 @@ protected Command<Void> disablePage() {

@Override
protected Command<ScriptIdentifier> addScriptToEvaluateOnNewDocument(String script) {
return Page.addScriptToEvaluateOnNewDocument(script, Optional.empty(), Optional.empty());
return Page.addScriptToEvaluateOnNewDocument(
script, Optional.empty(), Optional.empty(), Optional.empty());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Void> enable() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -24,48 +24,43 @@
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;
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.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<AuthRequired, RequestPaused> {
public class v118Network extends Network<AuthRequired, RequestPaused> {

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<Void> 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<Void> enableNetworkCaching() {
return org.openqa.selenium.devtools.v115.network.Network.setCacheDisabled(false);
return org.openqa.selenium.devtools.v118.network.Network.setCacheDisabled(false);
}

@Override
protected Command<Void> disableNetworkCaching() {
return org.openqa.selenium.devtools.v115.network.Network.setCacheDisabled(true);
return org.openqa.selenium.devtools.v118.network.Network.setCacheDisabled(true);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<Void> detachFromTarget(
Optional<SessionID> sessionId, Optional<TargetID> 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
Expand Down Expand Up @@ -74,19 +74,19 @@ public Command<Void> detachFromTarget(

@Override
public Command<SessionID> attachToTarget(TargetID targetId) {
Function<JsonInput, org.openqa.selenium.devtools.v115.target.model.SessionID> mapper =
Function<JsonInput, org.openqa.selenium.devtools.v118.target.model.SessionID> 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());
});
}
Expand All @@ -101,9 +101,9 @@ public Event<TargetID> detached() {
return new Event<>(
"Target.detachedFromTarget",
input -> {
Function<JsonInput, org.openqa.selenium.devtools.v115.target.model.TargetID> converter =
Function<JsonInput, org.openqa.selenium.devtools.v118.target.model.TargetID> 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());
});
}
Expand Down
2 changes: 1 addition & 1 deletion java/src/org/openqa/selenium/devtools/versions.bzl
Original file line number Diff line number Diff line change
@@ -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]

0 comments on commit c04855f

Please sign in to comment.