Skip to content

Commit

Permalink
feat: Add /calibrate endpoint (#785)
Browse files Browse the repository at this point in the history
  • Loading branch information
mykola-mokhnach authored Oct 5, 2023
1 parent 570866e commit ae1603a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions WebDriverAgentLib/Routing/FBWebServer.m
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,16 @@ - (void)registerServerKeyRouteHandlers
[response respondWithString:@"I-AM-ALIVE"];
}];

NSString *calibrationPage = @"<html>"
"<title>{\"x\":null,\"y\":null}</title>"
"<header>"
"<script>document.addEventListener(\"click\",function(e){document.title=JSON.stringify({x:e.clientX,y:e.clientY})})</script>"
"</header>"
"</html>";
[self.server get:@"/calibrate" withBlock:^(RouteRequest *request, RouteResponse *response) {
[response respondWithString:calibrationPage];
}];

[self.server get:@"/wda/shutdown" withBlock:^(RouteRequest *request, RouteResponse *response) {
[response respondWithString:@"Shutting down"];
[self.delegate webServerDidRequestShutdown:self];
Expand Down

0 comments on commit ae1603a

Please sign in to comment.