Repository navigation
Bug 2081620 - Keep page dialogs open until accept_dialog or dismiss_d… - #211
mattpmerrill wants to merge 1 commit into
Conversation
…ialog handles them The sessions never set unhandledPromptBehavior, so the WebDriver Classic default "dismiss and notify" applied and Firefox closed each alert, confirm and prompt as soon as it opened. confirm() always returned false and prompt() always returned null before the tools could act. All three session paths (launch, --connect-existing and Android) now request unhandledPromptBehavior "ignore". Marionette reports a missing dialog as NoSuchAlertError with an empty message, and acceptDialog and dismissDialog wrapped it in "Failed to accept dialog: ". The tools looked for "no such alert" in the message, so "No active dialog" never showed. PageManagement now keeps that error as it is and the tools check error.name.
juliandescottes
left a comment
There was a problem hiding this comment.
I tested a bit the PR, and I think before we can merge it we need to address the blocker bug: https://bugzilla.mozilla.org/show_bug.cgi?id=2080970, which will migrate the tools to handle dialogs to BiDi. Otherwise, it will put the mcp in a hard to use state when dialogs start appearing, especially if they are not in the current tab.
We also have Bug 2081600 - [firefox-devtools-mcp] Report open alert/confirm/prompt dialogs and the tools that handle them which is potentially a blocker here. At the moment the MCP is not great at exposing the state of the browser after a tool was called. So imagine you trigger some user input, which leads to showing a prompt: at the moment the agent will have no way to know about this and only the user can unblock the situation.
Finally, this is a bit tricky to enable until we have migrated most of the tools outside of webdriver classic (because classic commands throw if a dialog is opened - although that would be less of an issue if Bug 2081600 is handled first).
So my advice here would be table that, at least until Bug 2080970 is fixed. Would you be interested in picking this other bug up ?
|
@mattpmerrill Thanks for the PR, I have included the fix in #234. |
The sessions never set unhandledPromptBehavior, so the default "dismiss and notify" applied and every alert, confirm and prompt was closed as soon as it opened. confirm() always returned false and prompt() always returned null.
All three session paths (launch, --connect-existing and Android) now request unhandledPromptBehavior "ignore". Marionette sends NoSuchAlertError with an empty message, so accept_dialog and dismiss_dialog now check error.name and report "No active dialog" again.
How other tools behave while a dialog is open:
Unexpected confirm dialog detected. Performed handler "ignore"until the dialog is handled.Testing: