1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 18:17:45 +00:00

WebDriver: Implement POST /session/{id}/window/fullscreen endpoint

This commit is contained in:
Tobias Christiansen 2022-11-09 19:09:17 +01:00 committed by Linus Groh
parent 6805cf00ad
commit 1aa16b4dd4
12 changed files with 57 additions and 0 deletions

View file

@ -43,6 +43,7 @@ Vector<Client::Route> Client::s_routes = {
{ HTTP::HttpRequest::Method::POST, { "session", ":session_id", "window", "rect" }, &Client::handle_set_window_rect },
{ HTTP::HttpRequest::Method::POST, { "session", ":session_id", "window", "maximize" }, &Client::handle_maximize_window },
{ HTTP::HttpRequest::Method::POST, { "session", ":session_id", "window", "minimize" }, &Client::handle_minimize_window },
{ HTTP::HttpRequest::Method::POST, { "session", ":session_id", "window", "fullscreen" }, &Client::handle_fullscreen_window },
{ HTTP::HttpRequest::Method::POST, { "session", ":session_id", "element" }, &Client::handle_find_element },
{ HTTP::HttpRequest::Method::POST, { "session", ":session_id", "elements" }, &Client::handle_find_elements },
{ HTTP::HttpRequest::Method::POST, { "session", ":session_id", "element", ":element_id", "element" }, &Client::handle_find_element_from_element },
@ -608,6 +609,15 @@ Web::WebDriver::Response Client::handle_minimize_window(Vector<StringView> const
return session->web_content_connection().minimize_window();
}
// 11.8.5 Fullscreen Window, https://w3c.github.io/webdriver/#dfn-fullscreen-window
// POST /session/{session id}/window/fullscreen
Web::WebDriver::Response Client::handle_fullscreen_window(Vector<StringView> const& parameters, JsonValue const&)
{
dbgln_if(WEBDRIVER_DEBUG, "Handling POST /session/<session_id>/window/fullscreen");
auto* session = TRY(find_session_with_id(parameters[0]));
return session->web_content_connection().fullscreen_window();
}
// 12.3.2 Find Element, https://w3c.github.io/webdriver/#dfn-find-element
// POST /session/{session id}/element
Web::WebDriver::Response Client::handle_find_element(Vector<StringView> const& parameters, JsonValue const& payload)

View file

@ -67,6 +67,7 @@ private:
Web::WebDriver::Response handle_set_window_rect(Vector<StringView> const&, JsonValue const& payload);
Web::WebDriver::Response handle_maximize_window(Vector<StringView> const&, JsonValue const& payload);
Web::WebDriver::Response handle_minimize_window(Vector<StringView> const&, JsonValue const& payload);
Web::WebDriver::Response handle_fullscreen_window(Vector<StringView> const&, JsonValue const& payload);
Web::WebDriver::Response handle_find_element(Vector<StringView> const&, JsonValue const& payload);
Web::WebDriver::Response handle_find_elements(Vector<StringView> const&, JsonValue const& payload);
Web::WebDriver::Response handle_find_element_from_element(Vector<StringView> const&, JsonValue const& payload);