Skip to content

docs: clarify input.click param format in CLI help and skill#19

Closed
Eridanus117 wants to merge 5 commits into
koltyakov:mainfrom
Eridanus117:main
Closed

docs: clarify input.click param format in CLI help and skill#19
Eridanus117 wants to merge 5 commits into
koltyakov:mainfrom
Eridanus117:main

Conversation

@Eridanus117

Copy link
Copy Markdown
Contributor

Summary

  • Clarify that bbx call input.click requires {"target":{"elementRef":"..."}} format, not {"ref":"..."} or {"elementRef":"..."}
  • Add correct/wrong examples to CLI help, SKILL.md, and interaction reference
  • CLI shortcuts (bbx click el_xxx) handle wrapping automatically but bbx call does not — this was a common source of "Target not found" errors

Changes

  • packages/agent-client/src/command-registry.js — Added examples to Generic RPC help section
  • skills/browser-bridge/SKILL.md — Expanded target wrapper bullet with code block
  • skills/browser-bridge/references/interaction.md — New "Raw bbx call" section with correct/wrong examples

🤖 Generated with Claude Code

Eridanus117 and others added 5 commits May 28, 2026 18:07
bbx click / focus / type / hover / patch-style / patch-text / html
silently dropped --tab when called as shortcuts. The flag fell through
as a positional argument, the shortcut sent its request without tabId,
and the bridge routed the work to whatever tab the access route happened
to point at (typically the user's active tab).

Symptom: agents calling `bbx click --tab 124461098 'el_xxx' ` after the
user switched browser focus saw ELEMENT_STALE or "No element found",
because the click landed on the user's now-focused tab — not the one the
agent had been driving and resolved the elementRef against.

Fix: route shortcut commands through extractTabFlag the same way
`bbx call` and `bbx cdp-press-key` already do, and pass the resolved
tabId to both resolveRef (so the selector is resolved against the
target tab) and requestBridge (so the action runs on that tab).

Verified live against a running daemon: with the bridge routed to a
different tab, `bbx click --tab <other-tabId> 'selector'` now clicks the
element in the explicit tab regardless of which tab is focused.
When a shortcut command (click, type, focus, hover, etc.) is given a
CSS selector (not an el_xxx ref), and the action returns ELEMENT_STALE,
automatically re-resolve the selector and retry once.

This handles the common agent workflow:
1. Agent queries a selector → gets elementRef el_abc
2. Page re-renders (React reconciliation, user interaction, SPA nav)
3. Agent calls `bbx click el_abc` → ELEMENT_STALE
4. Agent must manually re-query → retry

With this change, `bbx click 'button[data-x=save]'` (selector form)
will auto-retry: re-resolve the selector against the current DOM, get
a fresh elementRef, and dispatch the action. The retry is at most once
and only fires for selector-based inputs (el_xxx refs skip retry since
there is no selector to re-resolve from).
input.type simulates individual keystrokes, which is slow and breaks
some framework-controlled inputs that expect programmatic value changes.
input.fill uses the native HTMLInputElement.prototype.value setter to
set the value in one shot, then dispatches input + change + blur events
to trigger framework state sync and field validation.

Three modes:
  - "setter" — prototype setter only (fast, works for React/Vue/Angular)
  - "keystrokes" — clear + type each char (slow but handles custom components)
  - "auto" (default) — try setter, verify value stuck, fallback to keystrokes

CLI: bbx fill <ref|selector> <value>
Protocol: input.fill (target, value, mode)
Content script: fillTarget in content-input.js
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Eridanus117 Eridanus117 closed this Jun 4, 2026
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