跳到正文
cccskills
免费在 GitHub 公开

agent-browser

Automate real browser tasks to test websites, complete forms, and collect page information. The skill guides agents through identifying clickable elements, interacting with pages, comparing page states, and saving screenshots or PDFs.

中文简介正在准备中。当前显示英语简介。

原文查看原文说明

Browser automation CLI for AI agents. Use this when asked to test something in a real browser.

查看安装方法

适用场景

  • Testing form submissions and page navigation
  • Comparing page appearance before and after changes
  • Extracting page text and saving PDFs
  • Reusing saved login state

包含的文件(1)

  • SKILL.md6.8 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Browser Automation with agent-browser

Core Workflow

Every browser automation follows this pattern:

  1. Navigate: agent-browser open <url>
  2. Snapshot: agent-browser snapshot -i (get element refs like @e1, @e2)
  3. Interact: Use refs to click, fill, select
  4. Re-snapshot: After navigation or DOM changes, get fresh refs
agent-browser open https://example.com/form
agent-browser snapshot -i
# Output: @e1 [input type="email"], @e2 [input type="password"], @e3 [button] "Submit"

agent-browser fill @e1 "user@example.com"
agent-browser fill @e2 "password123"
agent-browser click @e3
agent-browser wait --load networkidle
agent-browser snapshot -i  # Check result

Command Chaining

Commands can be chained with && in a single shell invocation. The browser persists between commands via a background daemon, so chaining is safe and more efficient than separate calls.

# Chain open + wait + snapshot in one call
agent-browser open https://example.com && agent-browser wait --load networkidle && agent-browser snapshot -i

# Chain multiple interactions
agent-browser fill @e1 "user@example.com" && agent-browser fill @e2 "password123" && agent-browser click @e3

# Navigate and capture
agent-browser open https://example.com && agent-browser wait --load networkidle && agent-browser screenshot page.png

When to chain: Use && when you don't need to read the output of an intermediate command before proceeding (e.g., open + wait + screenshot). Run commands separately when you need to parse the output first (e.g., snapshot to discover refs, then interact using those refs).

Essential Commands

# Navigation
agent-browser open <url>              # Navigate (aliases: goto, navigate)
agent-browser close                   # Close browser

# Snapshot
agent-browser snapshot -i             # Interactive elements with refs (recommended)
agent-browser snapshot -i -C          # Include cursor-interactive elements (divs with onclick, cursor:pointer)
agent-browser snapshot -s "#selector" # Scope to CSS selector

# Interaction (use @refs from snapshot)
agent-browser click @e1               # Click element
agent-browser click @e1 --new-tab     # Click and open in new tab
agent-browser fill @e2 "text"         # Clear and type text
agent-browser type @e2 "text"         # Type without clearing
agent-browser select @e1 "option"     # Select dropdown option
agent-browser check @e1               # Check checkbox
agent-browser press Enter             # Press key
agent-browser keyboard type "text"    # Type at current focus (no selector)
agent-browser keyboard inserttext "text"  # Insert without key events
agent-browser scroll down 500         # Scroll page
agent-browser scroll down 500 --selector "div.content"  # Scroll within a specific container

# Get information
agent-browser get text @e1            # Get element text
agent-browser get url                 # Get current URL
agent-browser get title               # Get page title

# Wait
agent-browser wait @e1                # Wait for element
agent-browser wait --load networkidle # Wait for network idle
agent-browser wait --url "**/page"    # Wait for URL pattern
agent-browser wait 2000               # Wait milliseconds

# Downloads
agent-browser download @e1 ./file.pdf          # Click element to trigger download
agent-browser wait --download ./output.zip     # Wait for any download to complete
agent-browser --download-path ./downloads open <url>  # Set default download directory

# Capture
agent-browser screenshot              # Screenshot to temp dir
agent-browser screenshot --full       # Full page screenshot
agent-browser screenshot --annotate   # Annotated screenshot with numbered element labels
agent-browser pdf output.pdf          # Save as PDF

# Diff (compare page states)
agent-browser diff snapshot                          # Compare current vs last snapshot
agent-browser diff snapshot --baseline before.txt    # Compare current vs saved file
agent-browser diff screenshot --baseline before.png  # Visual pixel diff
agent-browser diff url <url1> <url2>                 # Compare two pages
agent-browser diff url <url1> <url2> --wait-until networkidle  # Custom wait strategy
agent-browser diff url <url1> <url2> --selector "#main"  # Scope to element

Common Patterns

Form Submission

agent-browser open https://example.com/signup
agent-browser snapshot -i
agent-browser fill @e1 "Jane Doe"
agent-browser fill @e2 "jane@example.com"
agent-browser select @e3 "California"
agent-browser check @e4
agent-browser click @e5
agent-browser wait --load networkidle

Authentication with State Persistence

# Login once and save state
agent-browser open https://app.example.com/login
agent-browser snapshot -i
agent-browser fill @e1 "$USERNAME"
agent-browser fill @e2 "$PASSWORD"
agent-browser click @e3
agent-browser wait --url "**/dashboard"
agent-browser state save auth.json

# Reuse in future sessions
agent-browser state load auth.json
agent-browser open https://app.example.com/dashboard

Data Extraction

agent-browser open https://example.com/products
agent-browser snapshot -i
agent-browser get text @e5           # Get specific element text
agent-browser get text body > page.txt  # Get all page text

# JSON output for parsing
agent-browser snapshot -i --json
agent-browser get text @e1 --json

Ref Lifecycle (Important)

Refs (@e1, @e2, etc.) are invalidated when the page changes. Always re-snapshot after:

  • Clicking links or buttons that navigate
  • Form submissions
  • Dynamic content loading (dropdowns, modals)
agent-browser click @e5              # Navigates to new page
agent-browser snapshot -i            # MUST re-snapshot
agent-browser click @e1              # Use new refs

Annotated Screenshots (Vision Mode)

Use --annotate to take a screenshot with numbered labels overlaid on interactive elements.

agent-browser screenshot --annotate
# Output includes the image path and a legend:
#   [1] @e1 button "Submit"
#   [2] @e2 link "Home"
#   [3] @e3 textbox "Email"
agent-browser click @e2              # Click using ref from annotated screenshot

JavaScript Evaluation

# Simple expressions
agent-browser eval 'document.title'

# Complex JS: use --stdin with heredoc (RECOMMENDED)
agent-browser eval --stdin <<'EVALEOF'
JSON.stringify(
  Array.from(document.querySelectorAll("img"))
    .filter(i => !i.alt)
    .map(i => ({ src: i.src.split("/").pop(), width: i.width }))
)
EVALEOF

Session Management and Cleanup

Always close your browser session when done:

agent-browser close                    # Close default session
agent-browser --session agent1 close   # Close specific session

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Trace application behavior and explain data structures using compact text tree diagrams. The diagrams connect user actions to real functions, data types, state changes, and the components that render again as a result.

中文简介正在准备中。当前显示英语简介。

  • Tracing what happens after a user action
  • Investigating why a component renders again
  • Mapping data structures and their consumers
slopus/happy2.4万2026年10月19日 更新

dev

免费

Set up and run Happy components locally, including its CLI, server, mobile app, and desktop app. The guide covers building, testing, checking logs, and separating development data using pnpm, the project's package management tool.

中文简介正在准备中。当前显示英语简介。

  • Setting up a local Happy development environment
  • Rebuilding the CLI and checking its daemon
  • Running the server and app locally
slopus/happy2.4万2026年10月19日 更新

maintain

免费

Organize Happy's GitHub issues, find duplicates, and check whether reported bugs are fixed on main, the primary development branch. Prepare replies and proposed actions for maintainer review, with explicit approval required before changes affecting contributors.

中文简介正在准备中。当前显示英语简介。

  • Grouping open issues and identifying duplicates
  • Checking whether reported bugs are fixed on main
  • Drafting replies and issue closure comments
slopus/happy2.4万2026年10月19日 更新

Query Prometheus metrics through Grafana and manage dashboards as JSON files. Use it to investigate current values and trends, add or adjust panels, and preview dashboard updates before applying them.

中文简介正在准备中。当前显示英语简介。

  • Investigating error rates and response times
  • Adding panels to a Grafana dashboard
  • Managing dashboard configuration as JSON
slopus/happy2.4万2026年10月19日 更新

Develop a product or side-project idea through guided questions and premise checks. Startup discussions examine evidence of demand, while builder discussions explore possibilities and scope, producing a design document before implementation begins.

中文简介正在准备中。当前显示英语简介。

  • Examining demand for a startup idea
  • Defining the smallest useful internal project
  • Shaping a hackathon or side-project idea
slopus/happy2.4万2026年10月19日 更新

release

免费

Guide releases of Happy's CLI, mobile app, web app, and server. Choose versions and release channels, follow build and test checks, publish through the designated services, and verify the resulting packages or app updates.

中文简介正在准备中。当前显示英语简介。

  • Publishing a stable or beta CLI release
  • Delivering preview or production mobile updates
  • Building native apps and submitting to stores
slopus/happy2.4万2026年10月19日 更新

查看 slopus 的全部技能

报告此技能的问题