跳到正文
Skillpedia
通用编程30k · #9355

agent-browser

它能做什么

这项技能让你的智能体通过命令行控制基于 Chrome 的浏览器,在网站中导航并与之交互。适合测试网页应用、填写表单以及从页面中提取信息。

适用场景

  • ✓当你想让智能体打开网站并填写表单的时候。
  • ✓当你想从网页中截图或获取数据的时候。
  • ✓当你想通过逐页点击来测试网页应用时。

技能链接

https://github.com/sipeed/picoclaw/blob/main/workspace/skills/agent-browser/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/sipeed/picoclaw/blob/main/workspace/skills/agent-browser/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请打开我们的注册页面,用测试信息填写表单,并截取结果的截图。”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会打开页面,列出可点击和可填写的元素及其编号,然后根据这些编号进行操作。每次页面发生变化后,它都会重新读取页面,因为之前的编号会失效。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Agent Browser

CLI browser automation via Chrome/Chromium CDP. Install: npm i -g agent-browser && agent-browser install.

Before using this skill, verify the tool is available by running which agent-browser. If the command is not found, tell the user that browser automation requires the agent-browser CLI and Chromium, which are only available in the heavy container image. Do not attempt to install it at runtime.

Core Workflow

  1. agent-browser open <url> — navigate
  2. agent-browser snapshot -i — get interactive elements with refs (@e1, @e2, ...)
  3. Interact using refs — click @e1, fill @e2 "text"
  4. Re-snapshot after any navigation or DOM change — refs are invalidated
agent-browser open https://example.com/form
agent-browser snapshot -i
# @e1 [input] "Email", @e2 [input] "Password", @e3 [button] "Submit"
agent-browser fill @e1 "user@example.com"
agent-browser fill @e2 "secret"
agent-browser click @e3
agent-browser wait --load networkidle
agent-browser snapshot -i

Chain commands with && when you don't need intermediate output:

agent-browser open https://example.com && agent-browser wait --load networkidle && agent-browser snapshot -i

Commands

# Navigation
agent-browser open <url>
agent-browser close

# Snapshot
agent-browser snapshot -i                # Interactive elements with refs
agent-browser snapshot -s "#selector"    # Scope to CSS selector

# Interaction (use @refs from snapshot)
agent-browser click @e1
agent-browser fill @e2 "text"            # Clear + type
agent-browser type @e2 "text"            # Type without clearing
agent-browser select @e1 "option"
agent-browser check @e1
agent-browser press Enter
agent-browser scroll down 500

# Get info
agent-browser get text @e1
agent-browser get url
agent-browser get title

# Wait
agent-browser wait @e1                   # Wait for element
agent-browser wait --load networkidle    # Wait for network idle
agent-browser wait --url "**/dashboard"  # Wait for URL pattern
agent-browser wait --text "Welcome"      # Wait for text
agent-browser wait 2000                  # Wait ms

# Capture
agent-browser screenshot                 # Screenshot to temp dir
agent-browser screenshot --full          # Full page
agent-browser screenshot --annotate      # With numbered element labels ([N] -> @eN)
agent-browser pdf output.pdf

# Semantic locators (when refs unavailable)
agent-browser find text "Sign In" click
agent-browser find label "Email" fill "user@test.com"
agent-browser find role button click --name "Submit"

Authentication

# Option 1: Import from user's running Chrome
agent-browser --auto-connect state save ./auth.json
agent-browser --state ./auth.json open https://app.example.com

# Option 2: Persistent profile
agent-browser --profile ~/.myapp open https://app.example.com/login
# ... login once, all future runs are authenticated

# Option 3: Session name (auto-save/restore)
agent-browser --session-name myapp open https://app.example.com/login
# ... login, close, next run state is restored

# Option 4: State file
agent-browser state save auth.json
agent-browser state load auth.json

Iframes

Iframe content is inlined in snapshots. Interact with iframe refs directly — no frame switch needed.

Parallel Sessions

agent-browser --session s1 open https://site-a.com
agent-browser --session s2 open https://site-b.com
agent-browser session list

JavaScript Eval

agent-browser eval 'document.title'

# Complex JS — use --stdin to avoid shell quoting issues
agent-browser eval --stdin <<'EVALEOF'
JSON.stringify(Array.from(document.querySelectorAll("a")).map(a => a.href))
EVALEOF

Cleanup

Always close sessions when done:

agent-browser close
agent-browser --session s1 close
常见问题

我需要先安装什么?

需要 agent-browser 命令行工具和 Chromium。技能会在开始之前检查该工具是否可用。

智能体会替我安装这个工具吗?

不会。如果缺少该工具,智能体会告诉你需要安装,而不会在任务过程中自行安装。

为什么智能体总是重新查看页面?

点击或页面变化之后,元素编号就会失效,因此智能体会在下一步之前重新读取页面。

详情

作者的原始描述

Browser automation via agent-browser CLI. Use when the user needs to navigate websites, fill forms, click buttons, take screenshots, extract data, or test web apps.

repo: sipeed/picoclaw

热度

GitHub 星标
30k
排名
#9355
许可证
MIT
更新时间
2026/10/30

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能