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

Method handle

java/src/org/openqa/selenium/bidi/Connection.java:299–316  ·  view source on GitHub ↗
(CharSequence data)

Source from the content-addressed store, hash-verified

297 }
298
299 private void handle(CharSequence data) {
300 // It's kind of gross to decode the data twice, but this lets us get started on something
301 // that feels nice to users.
302 // TODO: decode once, and once only
303
304 String asString = String.valueOf(data);
305 LOG.log(getDebugLogLevel(), "<- {0}", asString);
306
307 Map<String, Object> raw = JSON.toType(asString, MAP_TYPE);
308 if (raw.get("id") instanceof Number
309 && (raw.get("result") != null || raw.get("error") != null)) {
310 handleResponse(asString, raw);
311 } else if (raw.get("method") instanceof String && raw.get("params") instanceof Map) {
312 handleEventResponse(raw);
313 } else {
314 LOG.warning(() -> "Unhandled type BiDi response type: " + data);
315 }
316 }
317
318 private void handleResponse(String rawDataString, Map<String, Object> rawDataMap) {
319 Consumer<Either<Throwable, JsonInput>> consumer =

Callers

nothing calls this directly

Calls 7

handleResponseMethod · 0.95
handleEventResponseMethod · 0.95
getDebugLogLevelMethod · 0.80
toTypeMethod · 0.80
warningMethod · 0.80
logMethod · 0.65
getMethod · 0.65

Tested by

no test coverage detected