mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:47:47 +00:00
WebDriver: Activate the browser tab during the Switch To Window command
This commit is contained in:
parent
f8b6369c23
commit
a96ba912b3
4 changed files with 15 additions and 2 deletions
|
@ -17,6 +17,7 @@ endpoint WebDriverClient {
|
||||||
get_title() => (Web::WebDriver::Response response)
|
get_title() => (Web::WebDriver::Response response)
|
||||||
get_window_handle() => (String handle)
|
get_window_handle() => (String handle)
|
||||||
close_window() => (Web::WebDriver::Response response)
|
close_window() => (Web::WebDriver::Response response)
|
||||||
|
switch_to_window() => (Web::WebDriver::Response response)
|
||||||
new_window(JsonValue payload) => (Web::WebDriver::Response response)
|
new_window(JsonValue payload) => (Web::WebDriver::Response response)
|
||||||
get_window_rect() => (Web::WebDriver::Response response)
|
get_window_rect() => (Web::WebDriver::Response response)
|
||||||
set_window_rect(JsonValue payload) => (Web::WebDriver::Response response)
|
set_window_rect(JsonValue payload) => (Web::WebDriver::Response response)
|
||||||
|
|
|
@ -545,6 +545,16 @@ Messages::WebDriverClient::CloseWindowResponse WebDriverConnection::close_window
|
||||||
return JsonValue {};
|
return JsonValue {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 11.3 Switch to Window, https://w3c.github.io/webdriver/#dfn-switch-to-window
|
||||||
|
Messages::WebDriverClient::SwitchToWindowResponse WebDriverConnection::switch_to_window()
|
||||||
|
{
|
||||||
|
// 5. Update any implementation-specific state that would result from the user selecting the current
|
||||||
|
// browsing context for interaction, without altering OS-level focus.
|
||||||
|
m_page_client.page_did_request_activate_tab();
|
||||||
|
|
||||||
|
return JsonValue {};
|
||||||
|
}
|
||||||
|
|
||||||
// 11.5 New Window, https://w3c.github.io/webdriver/#dfn-new-window
|
// 11.5 New Window, https://w3c.github.io/webdriver/#dfn-new-window
|
||||||
Messages::WebDriverClient::NewWindowResponse WebDriverConnection::new_window(JsonValue const&)
|
Messages::WebDriverClient::NewWindowResponse WebDriverConnection::new_window(JsonValue const&)
|
||||||
{
|
{
|
||||||
|
|
|
@ -54,6 +54,7 @@ private:
|
||||||
virtual Messages::WebDriverClient::GetTitleResponse get_title() override;
|
virtual Messages::WebDriverClient::GetTitleResponse get_title() override;
|
||||||
virtual Messages::WebDriverClient::GetWindowHandleResponse get_window_handle() override;
|
virtual Messages::WebDriverClient::GetWindowHandleResponse get_window_handle() override;
|
||||||
virtual Messages::WebDriverClient::CloseWindowResponse close_window() override;
|
virtual Messages::WebDriverClient::CloseWindowResponse close_window() override;
|
||||||
|
virtual Messages::WebDriverClient::SwitchToWindowResponse switch_to_window() override;
|
||||||
virtual Messages::WebDriverClient::NewWindowResponse new_window(JsonValue const& payload) override;
|
virtual Messages::WebDriverClient::NewWindowResponse new_window(JsonValue const& payload) override;
|
||||||
virtual Messages::WebDriverClient::GetWindowRectResponse get_window_rect() override;
|
virtual Messages::WebDriverClient::GetWindowRectResponse get_window_rect() override;
|
||||||
virtual Messages::WebDriverClient::SetWindowRectResponse set_window_rect(JsonValue const& payload) override;
|
virtual Messages::WebDriverClient::SetWindowRectResponse set_window_rect(JsonValue const& payload) override;
|
||||||
|
|
|
@ -144,8 +144,9 @@ Web::WebDriver::Response Session::switch_to_window(StringView handle)
|
||||||
else
|
else
|
||||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::NoSuchWindow, "Window not found");
|
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::NoSuchWindow, "Window not found");
|
||||||
|
|
||||||
// FIXME: 5. Update any implementation-specific state that would result from the user selecting the current
|
// 5. Update any implementation-specific state that would result from the user selecting the current
|
||||||
// browsing context for interaction, without altering OS-level focus.
|
// browsing context for interaction, without altering OS-level focus.
|
||||||
|
TRY(web_content_connection().switch_to_window());
|
||||||
|
|
||||||
// 6. Return success with data null.
|
// 6. Return success with data null.
|
||||||
return JsonValue {};
|
return JsonValue {};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue