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

WebDriver+Browser: Implement POST /session/{id}/window/minimize

This commit is contained in:
Timothy Flynn 2022-11-02 10:01:51 -04:00 committed by Linus Groh
parent 0d5209cee6
commit 11d0489fa3
7 changed files with 40 additions and 0 deletions

View file

@ -401,6 +401,24 @@ ErrorOr<JsonValue, WebDriverError> Session::maximize_window()
return serialize_window_rect(m_browser_connection->get_window_rect());
}
// 11.8.4 Minimize Window, https://w3c.github.io/webdriver/#minimize-window
ErrorOr<JsonValue, WebDriverError> Session::minimize_window()
{
// 1. If the remote end does not support the Minimize Window command for the current top-level browsing context for any reason, return error with error code unsupported operation.
// 2. If the current top-level browsing context is no longer open, return error with error code no such window.
TRY(check_for_open_top_level_browsing_context_or_return_error());
// FIXME: 3. Handle any user prompts and return its value if it is an error.
// FIXME: 4. Fully exit fullscreen.
// 5. Iconify the window.
m_browser_connection->async_minimize_window();
// 6. Return success with data set to the WindowRect object for the current top-level browsing context.
return serialize_window_rect(m_browser_connection->get_window_rect());
}
// https://w3c.github.io/webdriver/#dfn-get-or-create-a-web-element-reference
static String get_or_create_a_web_element_reference(Session::LocalElement const& element)
{