mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 23:17:45 +00:00
Browser+WebContent+WebDriver: Move Is Element Selected to WebContent
This commit is contained in:
parent
560da56a1d
commit
04ea3992e9
16 changed files with 40 additions and 76 deletions
|
@ -654,8 +654,7 @@ Web::WebDriver::Response Client::handle_is_element_selected(Vector<StringView> c
|
|||
{
|
||||
dbgln_if(WEBDRIVER_DEBUG, "Handling GET /session/<session_id>/element/<element_id>/selected");
|
||||
auto* session = TRY(find_session_with_id(parameters[0]));
|
||||
auto result = TRY(session->is_element_selected(parameters[1]));
|
||||
return make_json_value(result);
|
||||
return session->web_content_connection().is_element_selected(parameters[1]);
|
||||
}
|
||||
|
||||
// 12.4.2 Get Element Attribute, https://w3c.github.io/webdriver/#dfn-get-element-attribute
|
||||
|
|
|
@ -323,30 +323,6 @@ static ErrorOr<i32, Web::WebDriver::Error> get_known_connected_element(StringVie
|
|||
return maybe_element_id.release_value();
|
||||
}
|
||||
|
||||
// 12.4.1 Is Element Selected, https://w3c.github.io/webdriver/#dfn-is-element-selected
|
||||
Web::WebDriver::Response Session::is_element_selected(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 selected be the value corresponding to the first matching statement:
|
||||
// element is an input element with a type attribute in the Checkbox- or Radio Button state
|
||||
// -> The result of element’s checkedness.
|
||||
// element is an option element
|
||||
// -> The result of element’s selectedness.
|
||||
// Otherwise
|
||||
// -> False.
|
||||
auto selected = m_browser_connection->is_element_selected(element_id);
|
||||
|
||||
// 5. Return success with data selected.
|
||||
return JsonValue { selected };
|
||||
}
|
||||
|
||||
// 12.4.2 Get Element Attribute, https://w3c.github.io/webdriver/#dfn-get-element-attribute
|
||||
Web::WebDriver::Response Session::get_element_attribute(JsonValue const&, StringView parameter_element_id, StringView name)
|
||||
{
|
||||
|
|
|
@ -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 is_element_selected(StringView element_id);
|
||||
Web::WebDriver::Response get_element_attribute(JsonValue const& payload, StringView element_id, StringView name);
|
||||
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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue