1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 03:57:43 +00:00

LibWeb+WebContent+WebDriver: Implement Get Active Element

Unfortunately, nothing ever calls DOM::Document::set_active_element at
the moment, so this will always return ErrorCode::NoSuchElement.
This commit is contained in:
Timothy Flynn 2022-11-14 19:02:23 -05:00 committed by Linus Groh
parent 269a931414
commit cb91e6067c
7 changed files with 33 additions and 0 deletions

View file

@ -359,6 +359,15 @@ Web::WebDriver::Response Client::find_elements_from_element(Web::WebDriver::Para
return session->web_content_connection().find_elements_from_element(payload, parameters[1]);
}
// 12.3.8 Get Active Element, https://w3c.github.io/webdriver/#get-active-element
// GET /session/{session id}/element/active
Web::WebDriver::Response Client::get_active_element(Web::WebDriver::Parameters parameters, JsonValue)
{
dbgln_if(WEBDRIVER_DEBUG, "Handling GET /session/<session_id>/element/active");
auto* session = TRY(find_session_with_id(parameters[0]));
return session->web_content_connection().get_active_element();
}
// 12.4.1 Is Element Selected, https://w3c.github.io/webdriver/#dfn-is-element-selected
// GET /session/{session id}/element/{element id}/selected
Web::WebDriver::Response Client::is_element_selected(Web::WebDriver::Parameters parameters, JsonValue)