Playwright

Handle an alert or confirm dialog

Medium70 pts~25 min
  • UI Widgets Lab
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/playwright-handle-an-alert-or-confirm-dialog

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

Objective

Handle an alert or confirm dialog. Practise it against the UI Widgets Lab practice application (Native alerts, confirm and prompt dialogs, a modal, a cookie banner, custom dropdown, autocomplete, date picker and tooltip.).

Your task

  1. 1Open the practice application at the test URL shown above and wait for it to finish loading.
  2. 2Inspect the page to find the elements you need — key elements include #alert-button, #confirm-button, #prompt-button.
  3. 3Write and run a test that demonstrates: handle an alert or confirm dialog.
  4. 4Finish with at least one assertion on a user-visible outcome, not an internal detail.

Acceptance criteria

  • The test runs to completion without errors.
  • The test contains at least one passing assertion on a user-visible outcome.

Playwright · Playwright · Actions & inputs