mcpField
A
agent-browser

agent-browser

github.com/linuxlewisAgent workflows1130 installsUpdated 9w ago
Repository

About agent-browser

agent-browser is a headless browser automation skill for AI agents, using a CLI to navigate pages, inspect their structure, and interact with elements. It supports persistent sessions and can capture screenshots or save PDFs.

Key features

  1. 01Navigate with browser commands
  2. 02Inspect accessibility snapshots with element refs
  3. 03Interact using refs or selectors
  4. 04Maintain browser state across sessions
  5. 05Capture screenshots or export PDFs

Use cases

  1. 01Browse pages and inspect interactive elements
  2. 02Fill forms and verify actions
  3. 03Save page screenshots or PDFs

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/linuxlewis/agent-skills --skill agent-browser

After installing, type/agent-browserin Claude Code to confirm it loaded.

Bundled filesreferences/commands.md

Details

From the project README

Agent Browser

Browser automation using the agent-browser CLI - a fast, headless browser automation tool for AI agents.

Installation

npm install -g agent-browser
agent-browser install  # Install browser binaries

Quick Start

# Navigate to a URL
agent-browser open https://example.com

# Get accessibility snapshot (shows refs like @e1, @e2)
agent-browser snapshot -i

# Click using ref from snapshot
agent-browser click @e2

# Type into an element
agent-browser fill @e3 "hello world"

# Take screenshot
agent-browser screenshot output.png

Workflow Pattern

  1. Open - Navigate to the target URL
  2. Snapshot - Get the accessibility tree to see available elements
  3. Interact - Use refs (@e1, @e2, etc.) to interact with elements
  4. Verify - Take a snapshot or screenshot to verify state

Core Commands

See references/commands.md for the complete command reference.

Navigation
agent-browser open <url>           # Navigate to URL
agent-browser back                 # Go back
agent-browser forward              # Go forward
agent-browser reload               # Reload page
Interaction
agent-browser click <sel>          # Click element (or @ref)
agent-browser fill <sel> <text>    # Clear and fill
agent-browser press <key>          # Press key (Enter, Tab, etc.)
agent-browser select <sel> <val>   # Select dropdown option
Getting Information
agent-browser snapshot             # Accessibility tree with refs
agent-browser snapshot -i          # Interactive elements only
agent-browser get text <sel>       # Get element text
agent-browser get url              # Get current URL
Capture
agent-browser screenshot [path]    # Take screenshot
agent-browser screenshot --full    # Full page screenshot
agent-browser pdf <path>           # Save as PDF

Sessions

Use sessions to maintain browser state across commands:

agent-browser --session myproject open https://example.com
agent-browser --session myproject snapshot
agent-browser --session myproject click @e1

Selectors

  • Refs: @e1, @e2 (from snapshot output) - preferred
  • CSS: #id, .class, div > span
  • Text: text=Submit
  • Role: role=button[name="Submit"]

Best Practices

  1. Always snapshot first - Get the accessibility tree before interacting
  2. Use refs - Prefer @e1 refs from snapshot over CSS selectors
  3. Use sessions - Maintain state across multiple commands
  4. Wait appropriately - Use wait for dynamic content
  5. Verify actions - Snapshot or screenshot after interactions

Comments

Markdown supported