1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 13:47:45 +00:00

WebDriver+Browser: Implement GET /session/{id}/element/{id}/screenshot

This commit is contained in:
Timothy Flynn 2022-11-04 20:28:42 -04:00 committed by Linus Groh
parent 3c1c2994f1
commit b0eb45f7c7
9 changed files with 79 additions and 0 deletions

View file

@ -218,6 +218,16 @@ Messages::WebDriverSessionClient::QuerySelectorAllResponse WebDriverConnection::
return { {} };
}
void WebDriverConnection::scroll_element_into_view(i32 element_id)
{
dbgln("WebDriverConnection: scroll_element_into_view {}", element_id);
if (auto browser_window = m_browser_window.strong_ref()) {
auto& tab = browser_window->active_tab();
if (tab.webdriver_endpoints().on_scroll_element_into_view)
tab.webdriver_endpoints().on_scroll_element_into_view(element_id);
}
}
Messages::WebDriverSessionClient::IsElementSelectedResponse WebDriverConnection::is_element_selected(i32 element_id)
{
dbgln("WebDriverConnection: is_element_selected {}", element_id);
@ -329,4 +339,16 @@ Messages::WebDriverSessionClient::TakeScreenshotResponse WebDriverConnection::ta
return { {} };
}
Messages::WebDriverSessionClient::TakeElementScreenshotResponse WebDriverConnection::take_element_screenshot(i32 element_id)
{
dbgln_if(WEBDRIVER_DEBUG, "WebDriverConnection: take_element_screenshot {}", element_id);
if (auto browser_window = m_browser_window.strong_ref()) {
auto& tab = browser_window->active_tab();
if (tab.webdriver_endpoints().on_take_element_screenshot)
return { tab.webdriver_endpoints().on_take_element_screenshot(element_id) };
}
return { {} };
}
}