1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 20:28:11 +00:00

WebDriver+Friends: Add IPC and plumbing for Element-getting

This extends the IPC calls `get_document_element` and
`query_selector_all` to be usable by the WebDriver. For this the
`WebDriverConnection` provides the same interfaces and takes care of
routing the data through the Browser.
This commit is contained in:
Tobias Christiansen 2022-10-18 12:44:21 +02:00 committed by Linus Groh
parent 281991057c
commit 5d762bd448
7 changed files with 49 additions and 0 deletions

View file

@ -121,4 +121,26 @@ void WebDriverConnection::update_cookie(Web::Cookie::Cookie const& cookie)
}
}
Messages::WebDriverSessionClient::GetDocumentElementResponse WebDriverConnection::get_document_element()
{
dbgln("WebDriverConnection: get_document_element");
if (auto browser_window = m_browser_window.strong_ref()) {
auto& tab = browser_window->active_tab();
if (tab.on_get_document_element)
return { tab.on_get_document_element() };
}
return { {} };
}
Messages::WebDriverSessionClient::QuerySelectorAllResponse WebDriverConnection::query_selector_all(i32 start_node_id, String const& selector)
{
dbgln("WebDriverConnection: query_selector_all");
if (auto browser_window = m_browser_window.strong_ref()) {
auto& tab = browser_window->active_tab();
if (tab.on_query_selector_all)
return { tab.on_query_selector_all(start_node_id, selector) };
}
return { {} };
}
}