1
0
mirror of https://github.com/SerenityOS/serenity synced 2024-07-09 08:40:44 +00:00

WebDriver: Coerce window handles to strings when activating a tab

This allows the session to reject the request with "no such window",
instead of crashing by assuming the JSON value was already a string.
This commit is contained in:
Timothy Flynn 2023-08-18 16:23:47 -04:00 committed by Andreas Kling
parent 9608bfb576
commit 6d331389ad

View File

@ -323,7 +323,7 @@ Web::WebDriver::Response Client::switch_to_window(Web::WebDriver::Parameters par
if (!handle.has_value())
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, "No property called 'handle' present");
return session->switch_to_window(handle->as_string());
return session->switch_to_window(handle->to_deprecated_string());
}
// 11.4 Get Window Handles, https://w3c.github.io/webdriver/#dfn-get-window-handles