mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:17:36 +00:00
LibWeb+WebContent+WebDriver: Implement Accept Alert
This commit is contained in:
parent
7cf2feb047
commit
3e7d633954
9 changed files with 45 additions and 0 deletions
|
@ -1360,6 +1360,23 @@ Messages::WebDriverClient::DismissAlertResponse WebDriverConnection::dismiss_ale
|
|||
return JsonValue {};
|
||||
}
|
||||
|
||||
// 16.2 Accept Alert, https://w3c.github.io/webdriver/#accept-alert
|
||||
Messages::WebDriverClient::AcceptAlertResponse WebDriverConnection::accept_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. Accept the current user prompt.
|
||||
m_page_host.accept_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