Browser dialogs (alerts, confirms, and prompts) are dispatched by a Page via the page::Event::Dialog event.
CRITICAL: Dialogs are dismissed automatically by default. If you attach a listener to the dialog event, you must manually call either accept() or dismiss() on the Dialog object. Failure to do so will cause the page to freeze, preventing subsequent actions like clicks from completing.
Common dialog types include:
alertbeforeunloadconfirmprompt
// Conceptual usage pattern based on the provided JS example
// Note: The exact Rust syntax for event registration follows the Playwright-Rust pattern
page.on(Event::Dialog, |dialog| {
println!("{}", dialog.message()?);
dialog.dismiss()?;
});