ckorhonen/claude-skills/agent-browser

Claude Code and agent skill by ckorhonen/claude-skills

Trust tier 2
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Automate headless browser interactions using agent-browser CLI. Use when scraping web pages, automating form submissions, testing web apps, or performing browser automation tasks. Works with element refs (@e1, @e2) optimized for AI agent reasoning.

Install

npx vskill@latest install ckorhonen/claude-skills/agent-browser

SKILL.md

agent-browser CLI

A headless browser automation CLI designed for AI agents, with fast Rust-based execution and element refs optimized for LLM reasoning.

Overview

agent-browser provides programmatic browser control through a CLI that's purpose-built for AI agent workflows. It uses deterministic element references (@e1, @e2, etc.) from accessibility trees, making it ideal for LLM-based automation where consistent element targeting is critical.

Key Features:

  • Fast Rust-based CLI with Node.js fallback
  • Element refs (@e1, @e2) for stable LLM reasoning
  • Session isolation for parallel browser instances
  • JSON output for programmatic parsing
  • Accessibility tree snapshots for element discovery
  • CDP connection support for existing browser instances

When to Use

  • Automating web interactions (form filling, clicking, navigation)
  • Scraping web content with accessibility tree parsing
  • Testing web applications programmatically
  • Multi-agent scenarios requiring isolated browser sessions
  • Screenshot capture and PDF generation
  • Monitoring web page state changes

Prerequisites

  • Node.js >= 18 or Bun runtime
  • Chromium (installed via agent-browser install)

Installation

bash
# Install globally
bun install -g agent-browser
# Download Chromium
agent-browser install
# Linux with system dependencies
agent-browser install --with-deps

Verify installation:

bash
agent-browser --version

Quick Start

bash
# Navigate to a page
agent-browser open https://example.com
# Get accessibility snapshot with element refs
agent-browser snapshot -i # -i = interactive elements only
# Click an element by ref
agent-browser click @e2
# Fill a form field
agent-browser fill @e3 "test@example.com"
# Take a screenshot
agent-browser screenshot output.png

Core Workflow

1. Open Page and Snapshot
bash
# Open URL
agent-browser open https://example.com
# Get interactive elements with refs
agent-browser snapshot -i --json

The snapshot returns elements like:

@e1 link "Home"
@e2 textbox "Email"
@e3 button "Submit"
2. Interact Using Refs
bash
# Click by ref
agent-browser click @e2
# Type into focused element
agent-browser type @e2 "hello@example.com"
# Fill (clears first, then types)
agent-browser fill @e2 "hello@example.com"
# Press keyboard key
agent-browser press Enter
3. Verify State
bash
# Check element visibility
agent-browser is visible @e3
# Get element text
agent-browser get text @e1
# Get page URL
agent-browser get url

Command Reference

Navigation
CommandDescription
open <url>Navigate to URL
backGo back in history
forwardGo forward in history
reloadReload current page
closeClose browser
Interactions
CommandDescription
click <ref>Click element
dblclick <ref>Double-click element
type <ref> <text>Type text into element
fill <ref> <text>Clear and fill element
press <key>Press keyboard key (Enter, Tab, Control+a)
hover <ref>Hover over element
focus <ref>Focus element
check <ref>Check checkbox
uncheck <ref>Uncheck checkbox
select <ref> <val>Select dropdown option
scroll <dir> [px]Scroll (up/down/left/right)
`wait <ref\ms>`Wait for element or milliseconds
Information
CommandDescription
snapshotGet accessibility tree with refs
snapshot -iInteractive elements only
snapshot -cCompact (remove empty elements)
snapshot -d <n>Limit tree depth
get text <ref>Get element text content
get html <ref>Get element HTML
get value <ref>Get input value
get urlGet current page URL
get titleGet page title
screenshot [path]Take screenshot
screenshot --fullFull page screenshot
pdf <path>Save page as PDF
State Checks
CommandDescription
is visible <ref>Check if element is visible
is enabled <ref>Check if element is enabled
is checked <ref>Check if checkbox is checked
Find Elements
bash
# Find by role and click
agent-browser find role button click --name Submit
# Find by text
agent-browser find text "Sign In" click
# Find by label
agent-browser find label "Email" fill "test@example.com"
# Find by placeholder
agent-browser find placeholder "Search..." type "query"

Session Management

Sessions provide isolated browser instances for parallel execution:

bash
# Use named session
agent-browser --session login-flow open https://app.com
# Different session for another task
agent-browser --session checkout open https://app.com/cart
# List active sessions
agent-browser session list
# Environment variable (persistent across commands)
export AGENT_BROWSER_SESSION=my-session
agent-browser open https://example.com

JSON Output

Use --json for machine-readable output:

bash
# Snapshot as JSON
agent-browser snapshot -i --json
# Get element info as JSON
agent-browser get text @e1 --json
# Parse in scripts
agent-browser get url --json | jq -r '.url'

Common Pitfalls

This section covers frequent failure modes and how to debug them. Each pitfall includes the symptom you'll see, the underlying cause, and the fix.

Browser not found

Symptom: Error: Browser executable not found at default path or agent-browser: command not found

Cause: Chromium isn't installed, or agent-browser CLI isn't on PATH

Fix:

bash
# Install Chromium
agent-browser install
# For Linux, install system dependencies
agent-browser install --with-deps
# Verify installation
agent-browser --version
Element ref becomes stale after page change

Symptom: Error: Element @e2 not found even though you just used it, or clicks fail silently

Cause: Element refs change when the DOM updates (navigation, page reload, dynamic content). Refs are only valid for the current DOM snapshot.

Fix:

bash
# Always re-snapshot after major page changes
agent-browser click @e1 # Click submit
agent-browser wait 2000 # Wait for navigation
agent-browser snapshot -i --json # Get fresh refs
agent-browser click @e1 # Use new ref (was @e1 before? Verify!)

Prevention: In scripts, capture fresh refs after each navigation or dynamic load.

Session conflicts and port binding

Symptom: Error: Session "default" already in use or Port 9222 already in use

Cause: Browser session is still running from a previous command or crashed script, preventing a new session from starting

Fix:

bash
# List active sessions
agent-browser session list
# Kill a specific session
agent-browser session kill my-session
# Use unique session names to avoid conflicts
agent-browser --session upload-$(date +%s) open https://app.com
# Or set environment variable once
export AGENT_BROWSER_SESSION=task-$(date +%s)
agent-browser open https://example.com
agent-browser close
Clicks and interactions don't work on hidden elements

Symptom: agent-browser click @e5 succeeds but nothing happens, or element is invisible in screenshot

Cause: Element is outside viewport, hidden by CSS (display: none, visibility: hidden), or covered by another element. Accessibility tree may show it, but browser can't interact with it.

Fix:

bash
# Check visibility before interaction
agent-browser is visible @e5
# Scroll to make element visible
agent-browser scroll down 500
# Take screenshot to visually verify
agent-browser screenshot current-state.png
# Try parent element if child is deeply nested
agent-browser click @e4 # Click parent button instead

Prevention: Always take screenshots before and after critical interactions to verify visual state.

Timeout waiting for navigation or element

Symptom: Error: Timeout waiting for element or script hangs indefinitely after clicking a link

Cause:

  • Element doesn't exist or appears after longer than expected delay
  • Navigation is stuck (network error, page not loading)
  • Element selector is wrong

Fix:

bash
# Explicit wait before checking for element
agent-browser wait 2000 # Wait 2 seconds
agent-browser snapshot -i --json # Check if element exists
# Wait for specific element to appear
agent-browser wait @e3
# Increase timeout with explicit waits in script
agent-browser click @submit
sleep 3 # Shell script sleep
agent-browser snapshot -i
# Check page title to verify navigation worked
agent-browser get title

Prevention: Add explicit wait commands after form submissions or link clicks that cause navigation.

Snapshot is empty or missing expected elements

Symptom: agent-browser snapshot -i --json returns [] or very few elements, but you see them visually in screenshot

Cause:

  • Page content is rendered by JavaScript (React, Vue, etc.) that hasn't completed
  • Elements lack accessible labels or roles
  • -i flag filters too aggressively

Fix:

bash
# Wait for content to render
agent-browser wait 2000
agent-browser snapshot -i
# Remove interactive-only filter to see all elements
agent-browser snapshot -c # Compact but includes all elements
# Increase tree depth to find nested elements
agent-browser snapshot -d 5
# Use full snapshot to diagnose
agent-browser snapshot --json | jq . | less
# Check page title to verify page loaded
agent-browser get title

Prevention: Add wait delays after opening pages with heavy JavaScript rendering.

Form fill doesn't work or text is partial

Symptom: Text appears to be cut off, only first few characters typed, or field stays empty

Cause:

  • Field wasn't focused before typing (race condition)
  • Field has input validation or character limit
  • JavaScript event handlers expect specific typing speed or blur event

Fix:

bash
# Always focus explicitly before filling
agent-browser focus @e2
agent-browser wait 500 # Let field settle
agent-browser fill @e2 "complete@example.com"
# For fields with slow JS event handling
agent-browser type @e2 "first part"
agent-browser wait 500
agent-browser type @e2 "second part"
# Verify what was actually entered
agent-browser get value @e2

Prevention: After any form fill, immediately verify the value was entered correctly with get value.

Network requests fail or external API timeouts

Symptom: Page loads but data doesn't populate, or integration tests fail when hitting real APIs

Cause:

  • External API is slow or unreachable
  • CORS errors (browser blocks requests to different domain)
  • Missing authentication headers
  • Network is isolated (testing environment)

Fix:

bash
# Set custom headers for auth
agent-browser --headers '{"Authorization": "Bearer token123"}' open https://api.example.com
# Mock API responses instead
agent-browser network route "**/api/data" --body '{"result":"mocked"}'
# Add explicit wait for API response
agent-browser wait 3000 # Give API time to respond
agent-browser snapshot -i
# Fallback: Use `--headed` to see error messages
agent-browser --headed open https://app.com
agent-browser click @e1 # See browser console errors

Prevention: For testing, use network route to mock external APIs. For production, verify connectivity before running automation.

Browser crashes or becomes unresponsive

Symptom: agent-browser command hangs or process crashes with segmentation fault; Chrome window closes unexpectedly

Cause:

  • Out of memory (too many long-running sessions or screenshots)
  • Invalid CDP connection
  • Rare Chromium/Playwright crash
  • Insufficient system resources

Fix:

bash
# Restart with fresh session
agent-browser session kill all-sessions # Or specify a name
# Use lightweight mode with limited resources
agent-browser --session lite open https://minimal-site.com

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
1
7-day trend score
3

Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 17 Mar 2026, 8 months ago.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/ckorhonen/claude-skills/agent-browser/badge)](https://verified-skill.com/skills/ckorhonen/claude-skills/agent-browser)

Something wrong with this skill or its page? Tell us.