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

Method execute

java/src/org/openqa/selenium/remote/http/Route.java:54–88  ·  view source on GitHub ↗
(HttpRequest req)

Source from the content-addressed store, hash-verified

52 }
53
54 @Override
55 public final HttpResponse execute(HttpRequest req) {
56 if (!matches(req)) {
57 return new HttpResponse()
58 .setStatus(HTTP_NOT_FOUND)
59 .setContent(
60 asJson(
61 Map.of(
62 "value",
63 Map.of(
64 "error", "unknown command",
65 "message", "Unable to find handler for " + req,
66 "stacktrace", ""))));
67 }
68
69 HttpResponse res = handle(req);
70
71 if (res != null) {
72 return res;
73 }
74
75 return new HttpResponse()
76 .setStatus(HTTP_INTERNAL_ERROR)
77 .addHeader("WebDriver-Error", "unsupported operation")
78 .addHeader("Selenium-Route", "NULL_RES")
79 .setContent(
80 asJson(
81 Map.of(
82 "value",
83 Map.of(
84 "error", "unsupported operation",
85 "message",
86 String.format("Found handler for %s, but nothing was returned", req),
87 "stacktrace", ""))));
88 }
89
90 protected abstract HttpResponse handle(HttpRequest req);
91

Calls 8

handleMethod · 0.95
setContentMethod · 0.80
asJsonMethod · 0.80
addHeaderMethod · 0.80
matchesMethod · 0.65
setStatusMethod · 0.65
ofMethod · 0.45
formatMethod · 0.45