mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:37:35 +00:00
LibWeb+WebContent+WebDriver: Implement Dismiss Alert
This commit is contained in:
parent
159dcb9507
commit
7cf2feb047
7 changed files with 33 additions and 0 deletions
|
@ -1343,6 +1343,23 @@ Messages::WebDriverClient::DeleteAllCookiesResponse WebDriverConnection::delete_
|
|||
return JsonValue {};
|
||||
}
|
||||
|
||||
// 16.1 Dismiss Alert, https://w3c.github.io/webdriver/#dismiss-alert
|
||||
Messages::WebDriverClient::DismissAlertResponse WebDriverConnection::dismiss_alert()
|
||||
{
|
||||
// 1. If the current top-level browsing context is no longer open, return error with error code no such window.
|
||||
TRY(ensure_open_top_level_browsing_context());
|
||||
|
||||
// 2. If there is no current user prompt, return error with error code no such alert.
|
||||
if (!m_page_host.has_pending_dialog())
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::NoSuchAlert, "No user dialog is currently open"sv);
|
||||
|
||||
// 3. Dismiss the current user prompt.
|
||||
m_page_host.dismiss_dialog();
|
||||
|
||||
// 4. Return success with data null.
|
||||
return JsonValue {};
|
||||
}
|
||||
|
||||
// 17.1 Take Screenshot, https://w3c.github.io/webdriver/#take-screenshot
|
||||
Messages::WebDriverClient::TakeScreenshotResponse WebDriverConnection::take_screenshot()
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue