feat: add browser_click_at tool for coordinate-based mouse clicks#12
Open
grigoryosifov wants to merge 1 commit into
Open
feat: add browser_click_at tool for coordinate-based mouse clicks#12grigoryosifov wants to merge 1 commit into
grigoryosifov wants to merge 1 commit into
Conversation
Adds a last-resort click tool that takes absolute (x, y) coordinates and calls page.mouse.click/dblclick directly. Complements browser_click (ref-based) and browser_evaluate (JS-based) for cases where both fail: canvas-rendered UI, invisible overlays, pointer-events traps, or any element not surfaced in the accessibility snapshot. Coordinates come from browser_screenshot. Same cross-origin-iframe limitation as the other mouse-event paths applies - keyboard navigation via browser_press_key remains the iframe escape hatch. Verified end-to-end against a real Chrome Agents instance: button click fired at target coordinates and window event listener captured (160, 130).
18eae31 to
2ed255b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
browser_clickrequires an accessibility-snapshot ref;browser_evaluatewithelement.click()can hit synthetic-event blocks (notably cross-origin iframes and some pages where the submit button silently ignores JS-dispatched clicks). That leaves no fallback when a target is visible on screen but unreachable via refs or JS — canvas-rendered controls, invisible overlays stealing clicks, pointer-events traps, etc.Fix
New
browser_click_at(x, y)tool that calls Playwright'spage.mouse.click(x, y)(ordblclick) directly. Coordinates come frombrowser_screenshot. Supportsbutton(left/right/middle),doubleClick, andtargetIdlikebrowser_click. Validates thatxandyare finite numbers before dispatching.Tested
npx vitest run— 30/30 passing (3 new unit tests cover input validation for NaN, Infinity, undefined)browser_click_at({x: 160, y: 130})(160, 130)— confirming a real Playwright mouse event, not a synthetic DOM clickNotes
Cross-origin iframes still block mouse events at the CDP level (same as
browser_evaluatewith.click()). Keyboard navigation viabrowser_press_keyremains the escape hatch for those.