-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Labels
agent-friendlyImproves agent workflowsImproves agent workflowsenhancementNew feature or requestNew feature or requesthigh-impactHigh value for agents/usersHigh value for agents/users
Description
Summary
Add automatic event listener detection to help agents identify interactive elements. Follows "just works" philosophy - validates at interaction time, not discovery.
Problem
Agents clicking non-interactive elements is a common failure mode:
bdg dom query "button" # Found 5 buttons
bdg dom click --index 2 # Nothing happens... why?
# Was it disabled? Wrong button? No handler attached?No visibility into whether elements actually have handlers.
Solution
1. Auto-warn on interaction commands (default behavior)
bdg dom click --index 0
# ⚠ No click handlers detected on element
# Clicked button.cancel- Validate at interaction time (single element = fast)
- Warn but don't fail - sometimes you need to click anyway
- Applies to:
click,fill,submit
2. Include listeners in dom get inspection
bdg dom get 0
# ... existing output ...
# events: ["click", "mouseenter"]Single element inspection = want full details.
3. Add --interactive filter for queries
bdg dom query "button" --interactive
# Only returns elements with handlersOpt-in filter when specifically looking for clickable elements.
Implementation Notes
- Use
DOM.resolveNodeto get objectId, thenDOMDebugger.getEventListeners - Keep
dom queryfast by default (no listener checks) - Consider checking immediate parent for delegated events
- New exit code not needed (warn only, still succeeds)
Design Principles
- Validate at interaction, not discovery - warning appears exactly when useful
- No extra flags needed for common case
- No performance hit on queries
- Warn, don't fail - agent can proceed if needed
References
- Roadmap:
docs/roadmap/ROADMAP.mdsection 1.5 - CDP method:
DOMDebugger.getEventListeners
Metadata
Metadata
Assignees
Labels
agent-friendlyImproves agent workflowsImproves agent workflowsenhancementNew feature or requestNew feature or requesthigh-impactHigh value for agents/usersHigh value for agents/users