-
Notifications
You must be signed in to change notification settings - Fork 902
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Is your feature request related to a problem? Please describe.
I'm working on a web automation project using Chrome DevTools MCP and encountered a significant limitation when dealing with JavaScript alert dialogs. When my automation script encounters an alert() call in the target page, the entire automation process gets blocked because there's no way to detect or handle these dialogs programmatically.
This is particularly problematic when testing web applications that use alert dialogs for user notifications or error messages. The automation script hangs indefinitely waiting for user interaction that will never happen in an automated environment.
Describe the solution you'd like
I would like to see the Chrome DevTools MCP add the following capabilities:
- Dialog Detection API: A way to detect when JavaScript dialogs (alert, confirm, prompt) appear on the page
-
- Dialog Handling Methods: Functions to programmatically accept, dismiss, or interact with these dialogs
-
- Event-based Notification: An event system that notifies when dialogs appear, allowing for immediate response
Proposed API additions:
- Event-based Notification: An event system that notifies when dialogs appear, allowing for immediate response
handle_dialog(action, promptText?)- Handle the currently active dialog-
wait_for_dialog(timeout?)- Wait for a dialog to appear
-
-
- Dialog event listeners for real-time detection
This would enable robust automation workflows that can handle unexpected dialog interruptions gracefully.
- Dialog event listeners for real-time detection
-
Describe alternatives you've considered
Alternative approaches I've considered:
- Page-level JavaScript injection: Overriding
window.alert,window.confirm, andwindow.promptfunctions to intercept calls. However, this approach has limitations: -
- Doesn't work for dialogs triggered by browser extensions or system-level alerts
-
- May interfere with the application's intended behavior
-
- Requires careful implementation to avoid breaking existing functionality
- Polling-based detection: Periodically checking for dialog presence using JavaScript. This is unreliable and inefficient:
-
- High resource consumption due to constant polling
-
- May miss dialogs that appear and disappear quickly
-
- Not a real-time solution
- Using external automation tools: Integrating with other browser automation frameworks that have dialog handling capabilities. This adds complexity:
-
- Requires maintaining multiple tool integrations
-
- Increases the overall system complexity
-
- May introduce compatibility issues
The native Chrome DevTools MCP integration would be the most elegant and reliable solution.
- May introduce compatibility issues
Additional context
No response
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request