1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 14:27:35 +00:00

WebDriver: Implement GET /session/{id}/element/{id}/attribute/{name}

This commit is contained in:
Tobias Christiansen 2022-10-19 16:58:14 +02:00 committed by Linus Groh
parent 3f5a620b5d
commit 249350a7a3
7 changed files with 65 additions and 0 deletions

View file

@ -144,4 +144,15 @@ Messages::WebDriverSessionClient::QuerySelectorAllResponse WebDriverConnection::
return { {} };
}
Messages::WebDriverSessionClient::GetElementAttributeResponse WebDriverConnection::get_element_attribute(i32 element_id, String const& name)
{
dbgln("WebDriverConnection: get_element_attribute");
if (auto browser_window = m_browser_window.strong_ref()) {
auto& tab = browser_window->active_tab();
if (tab.on_get_element_attribute)
return { tab.on_get_element_attribute(element_id, name) };
}
return { {} };
}
}

View file

@ -49,6 +49,7 @@ public:
virtual void update_cookie(Web::Cookie::Cookie const&) override;
virtual Messages::WebDriverSessionClient::GetDocumentElementResponse get_document_element() override;
virtual Messages::WebDriverSessionClient::QuerySelectorAllResponse query_selector_all(i32 start_node_id, String const& selector) override;
virtual Messages::WebDriverSessionClient::GetElementAttributeResponse get_element_attribute(i32 element_id, String const& name) override;
private:
WebDriverConnection(NonnullOwnPtr<Core::Stream::LocalSocket> socket, NonnullRefPtr<BrowserWindow> browser_window);

View file

@ -18,5 +18,6 @@ endpoint WebDriverSessionClient {
update_cookie(Web::Cookie::Cookie cookie) =|
get_document_element() => (Optional<i32> document_element_id)
query_selector_all(i32 start_node_id, String selector) => (Optional<Vector<i32>> elements_ids)
get_element_attribute(i32 element_id, String name) => (Optional<String> atttibute)
}