MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / entryAdded

Method entryAdded

java/src/org/openqa/selenium/bidi/log/Log.java:37–62  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

35 private static final Json JSON = new Json();
36
37 public static Event<LogEntry> entryAdded() {
38 return new Event<>(
39 "log.entryAdded",
40 params -> {
41 String type = (String) params.get("type");
42
43 Optional<GenericLogEntry> genericLogEntry = Optional.empty();
44 Optional<ConsoleLogEntry> consoleLogEntry = Optional.empty();
45 Optional<JavascriptLogEntry> javascriptLogEntry = Optional.empty();
46
47 if (type != null) {
48 try (StringReader reader = new StringReader(JSON.toJson(params));
49 JsonInput input = JSON.newInput(reader)) {
50 if ("console".equals(type)) {
51 consoleLogEntry = Optional.ofNullable(input.read(ConsoleLogEntry.class));
52 } else if ("javascript".equals(type)) {
53 javascriptLogEntry = Optional.ofNullable(input.read(JavascriptLogEntry.class));
54 } else {
55 genericLogEntry = Optional.ofNullable(input.read(GenericLogEntry.class));
56 }
57 }
58 }
59
60 return new LogEntry(genericLogEntry, consoleLogEntry, javascriptLogEntry);
61 });
62 }
63}

Callers 1

LogInspectorMethod · 0.95

Calls 6

getMethod · 0.65
toJsonMethod · 0.65
readMethod · 0.65
emptyMethod · 0.45
newInputMethod · 0.45
equalsMethod · 0.45

Tested by

no test coverage detected