Skip to main content

Alert and Popup actions

I accept the <alert|confirmation> popup

Accepts and closes an alert or confirmation popup by clicking OK.

Where

  • <alert|confirmation> is either:

    • alert for an alert box with an OK button
    • confirmation for a confirmation box with OK and Cancel buttons

Example

  Given the alert link can be located by id "alert"
When I navigate to "https://www.selenium.dev/selenium/web/alerts.html"
And I click the alert link
And I accept the alert popup
I dismiss the confirmation popup

Dismisses and closes a confirmation popup by clicking Cancel.

Example

  Given the confirmation link can be located by id "prompt-with-default"
When I navigate to "https://www.selenium.dev/selenium/web/alerts.html"
And I click the confirmation link
And I dismiss the confirmation popup
I capture the <alert|confirmation> popup message

Captures the alert or confirmation popup message and binds it to the <alert|confirmation> popup message in the global scope.

Where

  • <alert|confirmation> is either:

    • alert for an alert box with an OK button
    • confirmation for a confirmation box with OK and Cancel buttons

Example

  Given the alert link can be located by id "alert"
When I navigate to "https://www.selenium.dev/selenium/web/alerts.html"
And I click the alert link
And I capture the alert popup message
I capture the <alert|confirmation> popup message as <name>

Captures the alert or confirmation popup message and binds it to the given name in the global scope.

Where

  • <alert|confirmation> is either:

    • alert for an alert box with an OK button
    • confirmation for a confirmation box with OK and Cancel buttons

Example

  Given the confirmation link can be located by id "prompt-with-default"
When I navigate to "https://www.selenium.dev/selenium/web/alerts.html"
And I click the confirmation link
And I capture the confirmation popup message as the alert message