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

WebDriver: Implement GET /session/{id}/cookie/{name} endpoint

This commit is contained in:
Tobias Christiansen 2022-10-15 19:22:20 +02:00 committed by Linus Groh
parent b6f101f1c0
commit a34f8c444b
7 changed files with 56 additions and 0 deletions

View file

@ -81,4 +81,18 @@ Messages::WebDriverSessionClient::GetAllCookiesResponse WebDriverConnection::get
return { {} };
}
Messages::WebDriverSessionClient::GetNamedCookieResponse WebDriverConnection::get_named_cookie(String const& name)
{
dbgln("WebDriverConnection: get_named_cookie");
if (auto browser_window = m_browser_window.strong_ref()) {
if (browser_window->active_tab().on_get_cookies_entries) {
for (auto cookie : browser_window->active_tab().on_get_cookies_entries()) {
if (cookie.name == name)
return { cookie };
}
}
}
return { {} };
}
}