| name | opencli-browser |
| description | Make websites accessible for AI agents. Navigate, click, type, extract, wait — using Chrome with existing login sessions. No LLM API key needed. |
| allowed-tools | Bash(opencli:*), Read, Edit, Write |
OpenCLI Browser — Browser Automation for AI Agents
Control Chrome step-by-step via CLI. Reuses existing login sessions — no passwords needed.
Prerequisites
opencli doctor
Requires: Chrome running + OpenCLI Browser Bridge extension installed.
Critical Rules
- ALWAYS use
state to inspect the page, NEVER use screenshot — state returns structured DOM with [N] element indices, is instant and costs zero tokens.
- ALWAYS use
click/type/select for interaction, NEVER use eval to click or type — eval "el.click()" bypasses scrollIntoView and CDP click pipeline.
- Verify inputs with
get value, not screenshots — after type, run get value <index> to confirm.
- Run
state after every page change — after open, click (on links), scroll, always run state.
- Chain commands aggressively with
&& — combine commands to reduce overhead.
eval is read-only — use eval ONLY for data extraction, never for clicking, typing, or navigating.
- Minimize total tool calls — plan your sequence before acting.
- Prefer
network to discover APIs — most sites have JSON APIs. API-based adapters are more reliable than DOM scraping.
Core Workflow
- Navigate:
opencli browser open <url>
- Inspect:
opencli browser state → elements with [N] indices
- Interact: use indices —
click, type, select, keys
- Wait (if needed):
opencli browser wait selector ".loaded" or wait text "Success"
- Verify:
opencli browser state or opencli browser get value <N>
- Repeat: browser stays open between commands
- Save: write a JS adapter to
~/.opencli/clis/<site>/<command>.js
Commands
Navigation
opencli browser open <url>
opencli browser back
opencli browser scroll down
Inspect (free & instant)
opencli browser state
opencli browser screenshot [path.png]
Get (free & instant)
opencli browser get title
opencli browser get url
opencli browser get text <index>
opencli browser get value <index>
opencli browser get html
opencli browser get html --selector "h1"
opencli browser get attributes <index>
Interact
opencli browser click <index>
opencli browser type <index> "text"
opencli browser select <index> "option"
opencli browser keys "Enter"
Wait
opencli browser wait time 3
opencli browser wait selector ".loaded"
opencli browser wait selector ".spinner" --timeout 5000
opencli browser wait text "Success"
Extract (free & instant, read-only)
opencli browser eval "document.title"
opencli browser eval "JSON.stringify([...document.querySelectorAll('h2')].map(e => e.textContent))"
Network (API Discovery)
opencli browser network
opencli browser network --detail 3
opencli browser network --all
Session
opencli browser close
Action Chaining
Always chain when possible — fewer tool calls = faster completion:
opencli browser open https://example.com && opencli browser state
opencli browser type 3 "hello" && opencli browser type 4 "world" && opencli browser click 7
opencli browser click 12 && opencli browser wait time 1 && opencli browser state
Tips
- Always
state first — never guess element indices
- Sessions persist — browser stays open between commands
- Use
eval for data extraction — eval "JSON.stringify(...)" is faster than multiple get calls
- Use
network to find APIs — JSON APIs are more reliable than DOM scraping
- Alias:
opencli op is shorthand for opencli browser
Troubleshooting
| Error | Fix |
|---|
| "Browser not connected" | Run opencli doctor |
| "attach failed: chrome-extension://" | Disable 1Password temporarily |
| Element not found | opencli browser scroll down && opencli browser state |
| Stale indices after page change | Run opencli browser state again |