Browser Control Skill
Goal
Finish the user’s real task reliably.
Prioritize successful completion and correct results over aggressive call minimization.
Operating Rules
- Start with the intended action directly (
navigate/open/act/evaluate). Do not run status as a pre-check.
- Use
snapshot only when refs are required for interaction (click/type/select/drag/scrollIntoView).
- Prefer
evaluate for extraction. Return structured data in one comprehensive call when possible.
- Use condition waits by default (
loadState/url → selector/text/textGone → fn). Avoid timeMs unless explicitly needed.
- Before clicking potentially off-screen elements, run
act.scrollIntoView on the ref first.
- Keep context stable: once
targetId is known, pass it in follow-up calls when supported.
- Avoid blind loops: every extra call must have a clear purpose.
Reliability and Recovery
- If
Ref not found, do not reuse stale refs. Take one fresh snapshot, retry once, then stop if still failing.
- For repeated failures with the same cause, stop and explain the blocker clearly instead of retrying endlessly.
- Connection recovery is built into the tool. Allow auto-recovery once; if still disconnected, instruct user to install/connect extension.
Screenshot Policy
- Default: no screenshot.
- Use screenshots only when user asks, or when visual proof is required.
- Prefer element screenshots (
ref or element) over full-page screenshots.
- Use full-page screenshots only for page-level evidence.
Recommended Flow
- Direct action first (
navigate/open or immediate act/evaluate).
- If interaction needs refs, run
snapshot (interactive: true preferred).
- Wait for readiness using
act.wait with explicit conditions.
- Interact (
scrollIntoView → click/type/select/drag as needed).
- Extract/verify with
evaluate (preferred) or snapshot.
- Provide screenshot evidence only when necessary.
Connection Handling
Connection recovery is built into the tool. On connection failure, let the tool auto-attach/launch/retry once. If still disconnected, stop and instruct the user to install/connect the extension.
Minimal CLI Usage
Use <BROWSER_TOOL_CMD> for commands:
- macOS/Linux:
~/.wegent-executor/bin/browser-tool
- Windows:
~/.wegent-executor/bin/browser-tool.cmd
<BROWSER_TOOL_CMD> '<json>'
Quick Examples
# Navigate directly
<BROWSER_TOOL_CMD> '{"action":"navigate","url":"https://example.com"}'
# Snapshot only when refs are needed
<BROWSER_TOOL_CMD> '{"action":"snapshot","interactive":true}'
# Act on ref
<BROWSER_TOOL_CMD> '{"action":"act","request":{"kind":"click","ref":"e1"}}'
# Ensure element is visible before click (recommended on long pages)
<BROWSER_TOOL_CMD> '{"action":"act","request":{"kind":"scrollIntoView","ref":"e1"}}'
# Condition wait (preferred over fixed sleep)
<BROWSER_TOOL_CMD> '{"action":"act","request":{"kind":"wait","loadState":"domcontentloaded","timeoutMs":15000}}'
# URL-based wait
<BROWSER_TOOL_CMD> '{"action":"act","request":{"kind":"wait","url":"checkout","timeoutMs":10000}}'
# Run JS in page context via act.evaluate (function or expression)
<BROWSER_TOOL_CMD> '{"action":"act","request":{"kind":"evaluate","fn":"() => ({title: document.title, href: location.href})"}}'
# Run JS against a target element ref via act.evaluate
<BROWSER_TOOL_CMD> '{"action":"act","request":{"kind":"evaluate","ref":"e1","fn":"(el) => ({text: el.textContent?.trim() || \"\"})"}}'
# Close current tab (or pass targetId)
<BROWSER_TOOL_CMD> '{"action":"act","request":{"kind":"close"}}'
# Element screenshot (prefer over full-page when only target proof is needed)
<BROWSER_TOOL_CMD> '{"action":"screenshot","ref":"e1","type":"jpeg"}'
# Comprehensive extraction in one evaluate
<BROWSER_TOOL_CMD> '{"action":"evaluate","expression":"(() => ({title:document.title,url:location.href}))()"}'
1---2name: browser3description: Complete real user web tasks end-to-end via browser-tool, navigate, interact, wait for page state, extract results, and provide evidence when needed.4---56# Browser Control Skill78## Goal910Finish the user’s real task reliably. 11Prioritize successful completion and correct results over aggressive call minimization.1213## Operating Rules14151. Start with the intended action directly (`navigate`/`open`/`act`/`evaluate`). Do not run `status` as a pre-check.162. Use `snapshot` only when refs are required for interaction (click/type/select/drag/scrollIntoView).173. Prefer `evaluate` for extraction. Return structured data in one comprehensive call when possible.184. Use condition waits by default (`loadState`/`url` → `selector`/`text`/`textGone` → `fn`). Avoid `timeMs` unless explicitly needed.195. Before clicking potentially off-screen elements, run `act.scrollIntoView` on the ref first.206. Keep context stable: once `targetId` is known, pass it in follow-up calls when supported.217. Avoid blind loops: every extra call must have a clear purpose.2223## Reliability and Recovery24251. If `Ref not found`, do not reuse stale refs. Take one fresh `snapshot`, retry once, then stop if still failing.262. For repeated failures with the same cause, stop and explain the blocker clearly instead of retrying endlessly.273. Connection recovery is built into the tool. Allow auto-recovery once; if still disconnected, instruct user to install/connect extension.2829## Screenshot Policy30311. Default: no screenshot.322. Use screenshots only when user asks, or when visual proof is required.333. Prefer element screenshots (`ref` or `element`) over full-page screenshots.344. Use full-page screenshots only for page-level evidence.3536## Recommended Flow37381. Direct action first (`navigate`/`open` or immediate `act`/`evaluate`).392. If interaction needs refs, run `snapshot` (`interactive: true` preferred).403. Wait for readiness using `act.wait` with explicit conditions.414. Interact (`scrollIntoView` → `click/type/select/drag` as needed).425. Extract/verify with `evaluate` (preferred) or `snapshot`.436. Provide screenshot evidence only when necessary.4445## Connection Handling4647Connection recovery is built into the tool. On connection failure, let the tool auto-attach/launch/retry once. If still disconnected, stop and instruct the user to install/connect the extension.4849## Minimal CLI Usage5051Use `<BROWSER_TOOL_CMD>` for commands:5253- macOS/Linux: `~/.wegent-executor/bin/browser-tool`54- Windows: `~/.wegent-executor/bin/browser-tool.cmd`5556```bash57<BROWSER_TOOL_CMD> '<json>'58```5960## Quick Examples6162```bash63# Navigate directly64<BROWSER_TOOL_CMD> '{"action":"navigate","url":"https://example.com"}'6566# Snapshot only when refs are needed67<BROWSER_TOOL_CMD> '{"action":"snapshot","interactive":true}'6869# Act on ref70<BROWSER_TOOL_CMD> '{"action":"act","request":{"kind":"click","ref":"e1"}}'7172# Ensure element is visible before click (recommended on long pages)73<BROWSER_TOOL_CMD> '{"action":"act","request":{"kind":"scrollIntoView","ref":"e1"}}'7475# Condition wait (preferred over fixed sleep)76<BROWSER_TOOL_CMD> '{"action":"act","request":{"kind":"wait","loadState":"domcontentloaded","timeoutMs":15000}}'7778# URL-based wait79<BROWSER_TOOL_CMD> '{"action":"act","request":{"kind":"wait","url":"checkout","timeoutMs":10000}}'8081# Run JS in page context via act.evaluate (function or expression)82<BROWSER_TOOL_CMD> '{"action":"act","request":{"kind":"evaluate","fn":"() => ({title: document.title, href: location.href})"}}'8384# Run JS against a target element ref via act.evaluate85<BROWSER_TOOL_CMD> '{"action":"act","request":{"kind":"evaluate","ref":"e1","fn":"(el) => ({text: el.textContent?.trim() || \"\"})"}}'8687# Close current tab (or pass targetId)88<BROWSER_TOOL_CMD> '{"action":"act","request":{"kind":"close"}}'8990# Element screenshot (prefer over full-page when only target proof is needed)91<BROWSER_TOOL_CMD> '{"action":"screenshot","ref":"e1","type":"jpeg"}'9293# Comprehensive extraction in one evaluate94<BROWSER_TOOL_CMD> '{"action":"evaluate","expression":"(() => ({title:document.title,url:location.href}))()"}'95```