Native dialogs block the page until your test accepts or dismisses them. In Playwright, register a page.on('dialog') handler before clicking.

JavaScript dialogs

alert, confirm and prompt, each reporting what your test did.

#alertBtn#confirmBtn#promptBtn
No dialog handled yet.

HTML modals

These are regular DOM elements, so locate them like anything else. Close with the button, Escape or the backdrop.

#subscribeModal[role="dialog"]#modalCloseBtn
No modal action yet.