Skip to content

Commit

Permalink
[bidi][java] Update argument type to RemoteValue
Browse files Browse the repository at this point in the history
  • Loading branch information
pujagani committed Apr 23, 2024
1 parent 907b4f4 commit 5c5c68e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions java/src/org/openqa/selenium/bidi/log/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ java_library(
deps = [
"//java/src/org/openqa/selenium:core",
"//java/src/org/openqa/selenium/bidi",
"//java/src/org/openqa/selenium/bidi/script",
"//java/src/org/openqa/selenium/json",
"//java/src/org/openqa/selenium/remote/http",
],
Expand Down
11 changes: 6 additions & 5 deletions java/src/org/openqa/selenium/bidi/log/ConsoleLogEntry.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import org.openqa.selenium.bidi.script.RemoteValue;
import org.openqa.selenium.json.JsonInput;
import org.openqa.selenium.json.TypeToken;

Expand All @@ -31,7 +32,7 @@ public class ConsoleLogEntry extends GenericLogEntry {

private final String method;
private final String realm;
private final List<Object> args;
private final List<RemoteValue> args;

public ConsoleLogEntry(
LogLevel level,
Expand All @@ -40,7 +41,7 @@ public ConsoleLogEntry(
String type,
String method,
String realm,
List<Object> args,
List<RemoteValue> args,
StackTrace stackTrace) {
super(level, text, timestamp, type, stackTrace);
this.method = method;
Expand All @@ -56,7 +57,7 @@ public String getRealm() {
return realm;
}

public List<Object> getArgs() {
public List<RemoteValue> getArgs() {
return args;
}

Expand All @@ -67,7 +68,7 @@ public static ConsoleLogEntry fromJson(JsonInput input) {
String type = null;
String method = null;
String realm = null;
List<Object> args = null;
List<RemoteValue> args = null;
StackTrace stackTrace = null;

input.beginObject();
Expand Down Expand Up @@ -98,7 +99,7 @@ public static ConsoleLogEntry fromJson(JsonInput input) {
break;

case "args":
args = input.read(new TypeToken<List<Object>>() {}.getType());
args = input.read(new TypeToken<List<RemoteValue>>() {}.getType());
break;

case "stackTrace":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ void canListenToConsoleLog() throws ExecutionException, InterruptedException, Ti
assertThat(logEntry.getText()).isEqualTo("Hello, world!");
assertThat(logEntry.getRealm()).isNull();
assertThat(logEntry.getArgs().size()).isEqualTo(1);
assertThat(logEntry.getArgs().get(0).getType()).isEqualTo("string");
assertThat(logEntry.getType()).isEqualTo("console");
assertThat(logEntry.getLevel()).isEqualTo(LogLevel.INFO);
assertThat(logEntry.getMethod()).isEqualTo("log");
Expand Down

0 comments on commit 5c5c68e

Please sign in to comment.