Selenium WebDriver 4

Dismiss a confirmation dialog

Medium70 pts~25 min
  • Confirm dialogs
  • Alerts
Practice app · UI Widgets Lab

Native alerts, confirm and prompt dialogs, a modal, a cookie banner, custom dropdown, autocomplete, date picker and tooltip.

Test URL
/lab/selenium-dismiss-a-confirmation-dialog

Your starter code already declares TEST_URL — never hardcode a host.

Objective

Cancel a native confirm dialog and verify the app registered the cancel.

Your task

  1. 1Open TEST_URL and click #confirm-button.
  2. 2Switch to the confirm and assert its text is “Delete this item?”.
  3. 3Dismiss it.
  4. 4Assert #confirm-result shows “You clicked Cancel”.

Acceptance criteria

  • The dialog is dismissed
  • #confirm-result shows “You clicked Cancel”
  • At least 2 assertions pass

Selenium WebDriver 4 · Selenium · Dropdowns, alerts & popups