搜索

PythonReactSEOPDF
GitHub Skill

agent-browser

Headless browser automation via CLI for web scraping, UI testing, and automated workflows. Use when tasks require navigating websites, interacting with page elements (clicking, typing, form filling), taking screenshots, verifying page content, or performing end-to-end browser automation. Assumes agent-browser is installed globally.

wormholecowboy☆ 1 仓库 Stars0 仓库 Forks

安装与使用

请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。

查看来源 ↗使用指南

技能说明

Agent Browser

Control a headless browser via CLI. Use --json flag for machine-readable output.

Core Workflow

  1. Navigate to target URL
  2. Snapshot to get accessibility tree with element refs (@e1, @e2, etc.)
  3. Act using refs for deterministic element selection
  4. Re-snapshot after page changes
agent-browser open "https://example.com"
agent-browser snapshot -i -c    # interactive elements only, compact
agent-browser click @e3
agent-browser snapshot -i -c    # re-snapshot after interaction

Selectors

Prefer refs from snapshots for reliability:

  • @e1 - Ref from accessibility tree (most reliable)
  • text=Submit - By text content
  • #id / .class - CSS selectors
  • xpath=//button - XPath

Common Patterns

Form Interaction
agent-browser fill @e5 "user@example.com"
agent-browser fill @e6 "password123"
agent-browser click @e7
agent-browser wait --url "/dashboard"
UI Verification
agent-browser is visible "#success-message"
agent-browser get text ".error-message"
agent-browser get count ".list-item"
agent-browser get attr @e2 "disabled"
Screenshots & PDFs
agent-browser screenshot ./page.png
agent-browser screenshot --full ./fullpage.png
agent-browser pdf ./document.pdf
Wait Patterns
agent-browser wait "#loading"              # Wait for element
agent-browser wait 2000                    # Wait ms
agent-browser wait --text "Success"        # Wait for text
agent-browser wait --load networkidle     # Wait for network
Sessions (Parallel Isolation)
agent-browser --session test1 open "https://example.com"
agent-browser --session test2 open "https://other.com"
agent-browser session list
Authentication
# Set headers for API auth
agent-browser --headers '{"Authorization": "Bearer token"}' open "https://api.example.com"

# Save/restore auth state
agent-browser state save ./auth.json
agent-browser state load ./auth.json
Network Mocking
agent-browser network route "**/api/users" --body '{"users": []}'
agent-browser network route "**/ads/*" --abort

Snapshot Tips

Flag Purpose
-i Interactive elements only (buttons, inputs, links)
-c Compact output, removes empty containers
-d 3 Limit depth to 3 levels
-s "#main" Scope to specific container

Always use -i -c for cleaner output when interacting.

Reference

Full command reference: references/commands.md

使用示例

查看来源仓库中的使用示例与配置说明。

查看来源 ↗

来源历史

收录时间
2026-01-20
索引更新时间
2026-02-03
Branch
main

收录与同步日期属于本站记录。源码修改历史请查看来源仓库。

GitHub ↗

chat Comments (0)

chat_bubble_outline

No comments yet. Be the first to share your thoughts!