← 返回 Skills 市场
wangyin717

Testagent Browser Setup

作者 wangyin717 · GitHub ↗ · v1.0.2 · MIT-0
cross-platform ⚠ suspicious
52
总下载
0
收藏
0
当前安装
3
版本数
在 OpenClaw 中安装
/install testagent-browser-setup
功能描述
在新的 openclaw 环境中安装并初始化 Playwright MCP 和 browser-use CLI,含中文字体修复和自动验收。当用户说「初始化测试环境」「安装浏览器工具」「setup browser」或在新机器首次部署测试 agent 时触发。
使用说明 (SKILL.md)

Browser Setup

一次性环境初始化,在新 openclaw 容器/机器上执行。需要 root 权限。

执行顺序

第一步:运行安装脚本

bash scripts/setup.sh

脚本按顺序完成:

  1. Playwright Chromium 安装 + 注册到 openclaw MCP(统一 --browser chromium,ARM64/x86 通用)
  2. 中文字体安装 + fontconfig 配置(截图无乱码)
  3. openclaw gateway restart(让字体生效,Chromium 重载 fontconfig 缓存)
  4. browser-use CLI 安装
  5. browser-use skill 安装

第二步:配置内置浏览器(容器必须)

重要:browser 相关配置必须直接编辑 ~/.openclaw/openclaw.jsonconfig.patch 无法修改 browser 配置(受保护路径)。

编辑 ~/.openclaw/openclaw.json,加入以下配置:

{
  "browser": {
    "noSandbox": true,
    "ssrfPolicy": {
      "allowedHostnames": [
        "你的目标产品域名(如 app.example.com)",
        "对应的 Auth0 / 登录域名(如 xxx.us.auth0.com)"
      ]
    }
  }
}
  • noSandbox: true:容器内 root 运行 Chromium 必须,否则报 Timeout waiting for browser
  • allowedHostnames:内置浏览器默认启用 SSRF 防护,未列入白名单的域名会报 blocked by policy;登录页(Auth0 等 SSO 域名)也需要单独加入,否则登录跳转被拦截

配置生效的完整重启序列(顺序不能错):

browser stop
openclaw gateway restart
# 等待约 15 秒
browser start

gateway restart 或仅 browser stop/start 都不够,必须三步完整执行。

第三步:初始化 TOOLS.md

将工具使用指南复制到项目根目录(与 SOUL.md、IDENTITY.md 同级),供 agent 在任意会话中随时查阅:

# 在 openclaw 项目根目录执行
cp "$(dirname "$0")/../TOOLS.md" ./TOOLS.md

若已存在则覆盖,确保版本与 skill 一致。

第四步:自动注册 browser-use API Key

脚本跑完后,agent 执行注册流程(无需人工介入):

  1. 检查 CLI 是否有内置注册命令:browser-use register
  2. 若无,参考 https://docs.browser-use.com 的 Self-Registration API,流程为:
    • 请求 challenge(返回一道数学题)
    • 计算答案并提交验证
    • 拿到 bu_ 开头的 API Key
  3. 写入环境变量:
    echo 'export BROWSER_USE_API_KEY=bu_xxx' >> ~/.bashrc
    export BROWSER_USE_API_KEY=bu_xxx
    

第五步:Smoke Test(自动验收)

验证 Playwright MCP

调用 playwright__browser_navigate → https://example.com
调用 playwright__browser_take_screenshot → filename="/root/.openclaw/workspace/smoke_test.png"
确认文件存在且大小 > 0

验证 browser-use

browser-use --version
# 用 BROWSER_USE_API_KEY 执行一条简单命令,确认鉴权通过

任一验收失败时,输出具体错误信息,提示修复方向,不要静默跳过。

安全使用建议
Install only in a disposable or trusted OpenClaw/container environment where root-level browser tooling changes are acceptable. Review the browser-use installer before running it, consider replacing the curl-to-bash step with a pinned verified install, and avoid storing the API key in ~/.bashrc unless you understand the exposure and know how to rotate or remove it.
能力评估
Purpose & Capability
The stated purpose matches the main behavior: installing Playwright MCP, browser-use CLI, fonts, browser configuration, and smoke tests for a new OpenClaw environment. The included browser-use guidance also covers cloud browsers, tunnels, proxies, and profile reuse, which are powerful but related to the advertised browser-testing workflow.
Instruction Scope
The skill says setup needs root and gives concrete configuration steps, but it also directs the agent to perform browser-use API key registration without human intervention and persist the result, which is sensitive enough to deserve explicit user control and clearer consent.
Install Mechanism
The setup script installs packages and MCP tooling in a purpose-aligned way, but it also runs a remote browser-use install script via curl piped directly to bash without pinning or verification. That is a material supply-chain risk, especially because the skill expects root/container setup authority.
Credentials
Root access, apt package installation, fontconfig changes, MCP registration, and OpenClaw gateway restart are proportionate for provisioning a fresh browser-testing environment, but they materially change the host/container environment.
Persistence & Privilege
The skill creates a setup-complete flag under ~/.openclaw and instructs appending BROWSER_USE_API_KEY to ~/.bashrc. The flag is low risk, but long-term credential persistence in a shell startup file is under-scoped and lacks removal, rotation, or file-permission guidance.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install testagent-browser-setup
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /testagent-browser-setup 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.2
Version 1.0.2 - Added TOOLS.md to provide a browser-use工具使用指南,供 agent 参考 - 安装脚本(setup.sh)新增:自动复制 TOOLS.md 到项目根目录,覆盖旧版本以保持一致 - SKILL.md 文档更新,详细说明 TOOLS.md 的初始化步骤
v1.0.1
Version 1.1.0 introduces improved browser configuration guidance and startup sequence. - 新增「配置内置浏览器」步骤,指导直接编辑 `~/.openclaw/openclaw.json` 配置 browser 及 SSRF 防护白名单 - 强调容器内 `noSandbox: true` 配置和 `allowedHostnames` 的必要性,避免 Chromium 超时和域名拦截问题 - 明确提出 browser 完整重启流程:`browser stop` → `openclaw gateway restart` → 等待 → `browser start` - 安装和注册流程结构化调整,分为四步,更易理解与操作 - 其他内容无重大变更
v1.0.0
Initial release of testagent-browser-setup. - Automates installation and initialization of Playwright MCP and browser-use CLI in new openclaw environments. - Adds Chinese font support and configures fontconfig to prevent text rendering issues in screenshots. - Supports both ARM64 and x86 architectures for Playwright Chromium setup. - Implements automated registration for browser-use using Self-Registration API; stores issued API Key in environment variables. - Runs smoke tests for both Playwright MCP and browser-use to ensure setup is successful and outputs error guidance if any validation fails.
元数据
Slug testagent-browser-setup
版本 1.0.2
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 3
常见问题

Testagent Browser Setup 是什么?

在新的 openclaw 环境中安装并初始化 Playwright MCP 和 browser-use CLI,含中文字体修复和自动验收。当用户说「初始化测试环境」「安装浏览器工具」「setup browser」或在新机器首次部署测试 agent 时触发。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 52 次。

如何安装 Testagent Browser Setup?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install testagent-browser-setup」即可一键安装,无需额外配置。

Testagent Browser Setup 是免费的吗?

是的,Testagent Browser Setup 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Testagent Browser Setup 支持哪些平台?

Testagent Browser Setup 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Testagent Browser Setup?

由 wangyin717(@wangyin717)开发并维护,当前版本 v1.0.2。

💬 留言讨论