diff options
author | Timothy Flynn <trflynn89@pm.me> | 2022-11-10 09:25:53 -0500 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-11-10 17:02:11 +0000 |
commit | 3c00d0e92b070e8336ea5be97ee044e0a2fda443 (patch) | |
tree | 15a4ae7dea03bc4d827a0630aa77af8a666fa267 /Userland/Services/WebDriver | |
parent | 1bc94e135ff03cc8e949842c4b73442da9696164 (diff) | |
download | serenity-3c00d0e92b070e8336ea5be97ee044e0a2fda443.zip |
Browser+WebContent+WebDriver: Move Get Element Property to WebContent
Diffstat (limited to 'Userland/Services/WebDriver')
-rw-r--r-- | Userland/Services/WebDriver/Client.cpp | 5 | ||||
-rw-r--r-- | Userland/Services/WebDriver/Session.cpp | 22 | ||||
-rw-r--r-- | Userland/Services/WebDriver/Session.h | 1 |
3 files changed, 2 insertions, 26 deletions
diff --git a/Userland/Services/WebDriver/Client.cpp b/Userland/Services/WebDriver/Client.cpp index d0cebe18b2..8afa7c822a 100644 --- a/Userland/Services/WebDriver/Client.cpp +++ b/Userland/Services/WebDriver/Client.cpp @@ -668,12 +668,11 @@ Web::WebDriver::Response Client::handle_get_element_attribute(Vector<StringView> // 12.4.3 Get Element Property, https://w3c.github.io/webdriver/#dfn-get-element-property // GET /session/{session id}/element/{element id}/property/{name} -Web::WebDriver::Response Client::handle_get_element_property(Vector<StringView> const& parameters, JsonValue const& payload) +Web::WebDriver::Response Client::handle_get_element_property(Vector<StringView> const& parameters, JsonValue const&) { dbgln_if(WEBDRIVER_DEBUG, "Handling GET /session/<session_id>/element/<element_id>/property/<name>"); auto* session = TRY(find_session_with_id(parameters[0])); - auto result = TRY(session->get_element_property(payload, parameters[1], parameters[2])); - return make_json_value(result); + return session->web_content_connection().get_element_property(parameters[1], parameters[2]); } // 12.4.4 Get Element CSS Value, https://w3c.github.io/webdriver/#dfn-get-element-css-value diff --git a/Userland/Services/WebDriver/Session.cpp b/Userland/Services/WebDriver/Session.cpp index 9cab66be80..06030a8ff1 100644 --- a/Userland/Services/WebDriver/Session.cpp +++ b/Userland/Services/WebDriver/Session.cpp @@ -323,28 +323,6 @@ static ErrorOr<i32, Web::WebDriver::Error> get_known_connected_element(StringVie return maybe_element_id.release_value(); } -// 12.4.3 Get Element Property, https://w3c.github.io/webdriver/#dfn-get-element-property -Web::WebDriver::Response Session::get_element_property(JsonValue const&, StringView parameter_element_id, StringView name) -{ - // 1. If the current browsing context is no longer open, return error with error code no such window. - TRY(check_for_open_top_level_browsing_context_or_return_error()); - - // FIXME: 2. Handle any user prompts and return its value if it is an error. - - // 3. Let element be the result of trying to get a known connected element with url variable element id. - auto element_id = TRY(get_known_connected_element(parameter_element_id)); - - // 4. Let property be the result of calling the Object.[[GetProperty]](name) on element. - auto property = m_browser_connection->get_element_property(element_id, name); - - // 5. Let result be the value of property if not undefined, or null. - if (!property.has_value()) - return JsonValue(); - - // 6. Return success with data result. - return JsonValue(property.release_value()); -} - // 12.4.4 Get Element CSS Value, https://w3c.github.io/webdriver/#dfn-get-element-css-value Web::WebDriver::Response Session::get_element_css_value(JsonValue const&, StringView parameter_element_id, StringView property_name) { diff --git a/Userland/Services/WebDriver/Session.h b/Userland/Services/WebDriver/Session.h index d335c9baa3..8328fec20e 100644 --- a/Userland/Services/WebDriver/Session.h +++ b/Userland/Services/WebDriver/Session.h @@ -58,7 +58,6 @@ public: Web::WebDriver::Response get_window_handle(); ErrorOr<void, Variant<Web::WebDriver::Error, Error>> close_window(); Web::WebDriver::Response get_window_handles() const; - Web::WebDriver::Response get_element_property(JsonValue const& payload, StringView element_id, StringView name); Web::WebDriver::Response get_element_css_value(JsonValue const& payload, StringView element_id, StringView property_name); Web::WebDriver::Response get_element_text(JsonValue const& payload, StringView element_id); Web::WebDriver::Response get_element_tag_name(JsonValue const& payload, StringView element_id); |