Skip to content

[BUG] Dialogs dismissed by user in headed mode are not considered dismissed #41837

Description

@jack5github

What's going on?

To reproduce this bug:

  1. Have an AI open a headed browser using the Playwright CLI, or run playwright-cli open --headed.
  2. Navigate to a page where a dialog is triggered and accept/dismiss it manually.
  3. Ask the AI to get a snapshot of the open page, or run playwright-cli snapshot. The output will indicate that there is an active dialog (which there shouldn't be). An AI or the user is forced to accept/dismiss the phantom dialog before retrieving a snapshot.
### Error
Error: Tool "browser_snapshot" does not handle the modal state.
### Page
- Page URL: ...
- Console: # errors, # warnings
### Modal state
- ["alert" dialog with message "..."]: can be handled by dialog-accept or dialog-dismiss

While this is not a critical bug, this leads to more consumed AI tokens, especially if multiple dialogs were triggered beforehand, as each must be dismissed one-by-one.

Version

CLI version 1.1.14-17

Metadata

Metadata

Assignees

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions