diff --git a/Userland/Services/WebContent/WebDriverConnection.cpp b/Userland/Services/WebContent/WebDriverConnection.cpp index 416bb366f75..75ae21e0872 100644 --- a/Userland/Services/WebContent/WebDriverConnection.cpp +++ b/Userland/Services/WebContent/WebDriverConnection.cpp @@ -596,9 +596,10 @@ Messages::WebDriverClient::NewWindowResponse WebDriverConnection::new_window(Jso } // 11.6 Switch To Frame, https://w3c.github.io/webdriver/#dfn-switch-to-frame -Messages::WebDriverClient::SwitchToFrameResponse WebDriverConnection::switch_to_frame() +Messages::WebDriverClient::SwitchToFrameResponse WebDriverConnection::switch_to_frame(JsonValue const&) { dbgln("FIXME: WebDriverConnection::switch_to_frame()"); + // FIXME: 1. Let id be the result of getting the property "id" from parameters. // FIXME: 2. If id is not null, a Number object, or an Object that represents a web element, return error with error code invalid argument. @@ -650,10 +651,12 @@ Messages::WebDriverClient::SwitchToFrameResponse WebDriverConnection::switch_to_ // FIXME: 4. Update any implementation-specific state that would result from the user selecting session's current browsing context for interaction, without altering OS-level focus. // FIXME: 5. Return success with data null + + return JsonValue {}; } // 11.7 Switch To Parent Frame, https://w3c.github.io/webdriver/#dfn-switch-to-parent-frame -Messages::WebDriverClient::SwitchToParentFrameResponse WebDriverConnection::switch_to_parent_frame() +Messages::WebDriverClient::SwitchToParentFrameResponse WebDriverConnection::switch_to_parent_frame(JsonValue const&) { dbgln("FIXME: WebDriverConnection::switch_to_parent_frame()"); @@ -674,6 +677,8 @@ Messages::WebDriverClient::SwitchToParentFrameResponse WebDriverConnection::swit // FIXME: 5. Update any implementation-specific state that would result from the user selecting session's current browsing context for interaction, without altering OS-level focus. // FIXME: 6. Return success with data null. + + return JsonValue {}; } // 11.8.1 Get Window Rect, https://w3c.github.io/webdriver/#dfn-get-window-rect @@ -1509,10 +1514,9 @@ Messages::WebDriverClient::ElementClickResponse WebDriverConnection::element_cli } // 12.5.2 Element Clear, https://w3c.github.io/webdriver/#dfn-element-clear -Messages::WebDriverClient::ElementClearResponse WebDriverConnection::element_clear(String const& element_id) +Messages::WebDriverClient::ElementClearResponse WebDriverConnection::element_clear(String const&) { dbgln("FIXME: WebDriverConnection::element_clear()"); - // To clear a content editable element // FIXME: 1. If element's innerHTML IDL attribute is an empty string do nothing and return. @@ -1584,13 +1588,14 @@ Messages::WebDriverClient::ElementClearResponse WebDriverConnection::element_cle } // FIXME: 12. Return success with data null. + + return JsonValue {}; } // 12.5.3 Element Send Keys, https://w3c.github.io/webdriver/#dfn-element-send-keys -Messages::WebDriverClient::ElementSendKeysResponse WebDriverConnection::element_send_keys(String const& element_id) +Messages::WebDriverClient::ElementSendKeysResponse WebDriverConnection::element_send_keys(String const&) { dbgln("FIXME: WebDriverConnection::element_send_keys()"); - // To clear the modifier key state given input state, input id, source, undo actions, and browsing context: // FIXME: 1. If source is not a key input source return error with error code invalid argument. @@ -1809,6 +1814,8 @@ Messages::WebDriverClient::ElementSendKeysResponse WebDriverConnection::element_ // FIXME: 14. Remove an input source with input state and input id. // FIXME: 15. Return success with data null. + + return JsonValue {}; } // 13.1 Get Page Source, https://w3c.github.io/webdriver/#dfn-get-page-source diff --git a/Userland/Services/WebContent/WebDriverConnection.h b/Userland/Services/WebContent/WebDriverConnection.h index 35170edb83a..7d476aea65a 100644 --- a/Userland/Services/WebContent/WebDriverConnection.h +++ b/Userland/Services/WebContent/WebDriverConnection.h @@ -56,6 +56,8 @@ private: virtual Messages::WebDriverClient::CloseWindowResponse close_window() override; virtual Messages::WebDriverClient::SwitchToWindowResponse switch_to_window() override; virtual Messages::WebDriverClient::NewWindowResponse new_window(JsonValue const& payload) override; + virtual Messages::WebDriverClient::SwitchToFrameResponse switch_to_frame(JsonValue const& payload) override; + virtual Messages::WebDriverClient::SwitchToParentFrameResponse switch_to_parent_frame(JsonValue const& payload) override; virtual Messages::WebDriverClient::GetWindowRectResponse get_window_rect() override; virtual Messages::WebDriverClient::SetWindowRectResponse set_window_rect(JsonValue const& payload) override; virtual Messages::WebDriverClient::MaximizeWindowResponse maximize_window() override; @@ -81,6 +83,8 @@ private: virtual Messages::WebDriverClient::GetComputedRoleResponse get_computed_role(String const& element_id) override; virtual Messages::WebDriverClient::GetComputedLabelResponse get_computed_label(String const& element_id) override; virtual Messages::WebDriverClient::ElementClickResponse element_click(String const& element_id) override; + virtual Messages::WebDriverClient::ElementClearResponse element_clear(String const& element_id) override; + virtual Messages::WebDriverClient::ElementSendKeysResponse element_send_keys(String const& element_id) override; virtual Messages::WebDriverClient::GetSourceResponse get_source() override; virtual Messages::WebDriverClient::ExecuteScriptResponse execute_script(JsonValue const& payload) override; virtual Messages::WebDriverClient::ExecuteAsyncScriptResponse execute_async_script(JsonValue const& payload) override; diff --git a/Userland/Services/WebDriver/Client.cpp b/Userland/Services/WebDriver/Client.cpp index c977d8e2001..7e56fa6be1a 100644 --- a/Userland/Services/WebDriver/Client.cpp +++ b/Userland/Services/WebDriver/Client.cpp @@ -348,14 +348,18 @@ Web::WebDriver::Response Client::new_window(Web::WebDriver::Parameters parameter // POST /session/{session id}/frame Web::WebDriver::Response Client::switch_to_frame(Web::WebDriver::Parameters parameters, JsonValue payload) { - // FIXME + dbgln_if(WEBDRIVER_DEBUG, "Handling POST /session//frame"); + auto session = TRY(find_session_with_id(parameters[0])); + return session->web_content_connection().switch_to_frame(move(payload)); } // 11.7 Switch To Parent Frame, https://w3c.github.io/webdriver/#dfn-switch-to-parent-frame // POST /session/{session id}/frame/parent Web::WebDriver::Response Client::switch_to_parent_frame(Web::WebDriver::Parameters parameters, JsonValue payload) { - // FIXME + dbgln_if(WEBDRIVER_DEBUG, "Handling POST /session//frame/parent"); + auto session = TRY(find_session_with_id(parameters[0])); + return session->web_content_connection().switch_to_parent_frame(move(payload)); } // 11.8.1 Get Window Rect, https://w3c.github.io/webdriver/#dfn-get-window-rect @@ -587,14 +591,18 @@ Web::WebDriver::Response Client::element_click(Web::WebDriver::Parameters parame // POST /session/{session id}/element/{element id}/clear Web::WebDriver::Response Client::element_clear(Web::WebDriver::Parameters parameters, JsonValue) { - // FIXME + dbgln_if(WEBDRIVER_DEBUG, "Handling POST /session//element//clear"); + auto session = TRY(find_session_with_id(parameters[0])); + return session->web_content_connection().element_clear(move(parameters[1])); } // 12.5.3 Element Send Keys, https://w3c.github.io/webdriver/#dfn-element-send-keys // POST /session/{session id}/element/{element id}/value Web::WebDriver::Response Client::element_send_keys(Web::WebDriver::Parameters parameters, JsonValue) { - // FIXME + dbgln_if(WEBDRIVER_DEBUG, "Handling POST /session//element//value"); + auto session = TRY(find_session_with_id(parameters[0])); + return session->web_content_connection().element_send_keys(move(parameters[1])); } // 13.1 Get Page Source, https://w3c.github.io/webdriver/#dfn-get-page-source