Files
camoufox-rs/tests/fixtures/dialogs.html
9prodhiandClaude Opus 5.5 6d24e3ca53 feat: handle JavaScript dialogs instead of freezing the page
A JS alert/confirm/prompt used to block the page silently: every command
timed out and nothing tracked the dialog. Each MainFrame now has a
DialogTracker listening for Page.dialogOpened/dialogClosed.

Default policy is manual: when a dialog opens, in-flight requests on that
page session fail at once with ProtocolErrorKind::DialogOpened (message
names the dialog), new page commands fail fast with a hint to run
`camoufox dialog <inst> <page> accept|dismiss [--text T]`, and `tabs` shows
the pending dialog. click/press that open a dialog return successfully with
the dialog info. `launch --dialogs accept|dismiss` auto-handles dialogs; the
Page.handleDialog call runs on a spawned thread, never the reader thread.

Measured: a pending `wait` fails 0.79 s after an alert opens (was: full
timeout).

Implemented by pi (openai/gpt-6.1-terra); reviewed by Claude.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YQU84X3UzxGaxqrADxbkoE
2026-11-21 06:09:48 -06:00

7 lines
355 B
HTML

<!doctype html>
<html><body>
<button id="alert" onclick="alert('Hello'); document.body.dataset.result='alert'">Alert</button>
<button id="confirm" onclick="document.body.dataset.result=String(confirm('Delete?'))">Confirm</button>
<button id="prompt" onclick="document.body.dataset.result=String(prompt('Name?', 'default'))">Prompt</button>
</body></html>