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

Browser+WebContent+WebDriver: Move Get Element Tag Name to WebContent

This commit is contained in:
Timothy Flynn 2022-11-10 10:24:49 -05:00 committed by Linus Groh
parent 5d32fd7026
commit 9dd62228c8
16 changed files with 22 additions and 57 deletions

View file

@ -695,12 +695,11 @@ Web::WebDriver::Response Client::handle_get_element_text(Vector<StringView> cons
// 12.4.6 Get Element Tag Name, https://w3c.github.io/webdriver/#dfn-get-element-tag-name
// GET /session/{session id}/element/{element id}/name
Web::WebDriver::Response Client::handle_get_element_tag_name(Vector<StringView> const& parameters, JsonValue const& payload)
Web::WebDriver::Response Client::handle_get_element_tag_name(Vector<StringView> const& parameters, JsonValue const&)
{
dbgln_if(WEBDRIVER_DEBUG, "Handling GET /session/<session_id>/element/<element_id>/name");
auto* session = TRY(find_session_with_id(parameters[0]));
auto result = TRY(session->get_element_tag_name(payload, parameters[1]));
return make_json_value(result);
return session->web_content_connection().get_element_tag_name(parameters[1]);
}
// 12.4.7 Get Element Rect, https://w3c.github.io/webdriver/#dfn-get-element-rect

View file

@ -323,24 +323,6 @@ static ErrorOr<i32, Web::WebDriver::Error> get_known_connected_element(StringVie
return maybe_element_id.release_value();
}
// 12.4.6 Get Element Tag Name, https://w3c.github.io/webdriver/#dfn-get-element-tag-name
Web::WebDriver::Response Session::get_element_tag_name(JsonValue const&, StringView parameter_element_id)
{
// 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 qualified name be the result of getting elements tagName IDL attribute.
auto qualified_name = m_browser_connection->get_element_tag_name(element_id);
// 5. Return success with data qualified name.
return JsonValue(qualified_name);
}
// 12.4.7 Get Element Rect, https://w3c.github.io/webdriver/#dfn-get-element-rect
Web::WebDriver::Response Session::get_element_rect(StringView parameter_element_id)
{

View file

@ -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_tag_name(JsonValue const& payload, StringView element_id);
Web::WebDriver::Response get_element_rect(StringView element_id);
Web::WebDriver::Response is_element_enabled(StringView element_id);
Web::WebDriver::Response get_source();