Skip to content

browser_click: accept param aliases and resolve natural-language descriptions#631

Open
esslamali15 wants to merge 1 commit into
open-jarvis:mainfrom
esslamali15:feat/browser-click-resolution
Open

browser_click: accept param aliases and resolve natural-language descriptions#631
esslamali15 wants to merge 1 commit into
open-jarvis:mainfrom
esslamali15:feat/browser-click-resolution

Conversation

@esslamali15

Copy link
Copy Markdown

Problem

Local models (qwen3, llama, etc.) driving the orchestrator call browser_click with target=/text=/element= instead of selector=, and pass descriptions like 'first video result' rather than CSS. Both dead-end today (No selector provided / Playwright invalid-selector error), which in practice breaks most browse-and-click workflows — the model gets an unhelpful error, retries the same thing, and eventually apologizes to the user.

Fix

  • Param aliases: selector | target | text | element | query all accepted.
  • Strategy ladder: CSS → exact text → fuzzy text → YouTube video-title special-case → role-based keyword match (with ordinal support: first/second/last). Existence is probed with count() so non-matching rungs cost milliseconds; only a matching strategy gets a click timeout.
  • Iframe search: after the main frame, child frames are searched (cookie-consent dialogs and ad overlays live there).
  • Self-correcting errors: on failure the error lists the visible clickable elements, so the model's next attempt has real candidates to choose from.

Testing

On a live install (qwen3:8b orchestrator): the previously-failing flow navigate to YouTube search → click 'first video result' now resolves in ~0.1s via the ladder and lands on the correct watch page; a nonsense selector returns the candidate list instead of a bare error.

🤖 Generated with Claude Code

…rategy ladder

Small local models call browser_click with target=/text=/element= instead
of selector=, and pass natural descriptions like 'first video result'.
Both previously dead-ended ('No selector provided' / invalid CSS), which
in practice broke every browse-and-click workflow driven by a local model.

- Accept the common param aliases
- Resolve through a ladder: CSS -> exact text -> fuzzy text -> YouTube
  video-title special case -> role-based keyword match, using count() so
  non-matching strategies fail in milliseconds
- Search child iframes after the main frame (consent dialogs, ad frames)
- On failure, include the visible clickable elements in the error so the
  model can self-correct on the next turn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant