← Back to Skills Marketplace
wangyin717

Testagent Browser Setup

by wangyin717 · GitHub ↗ · v1.0.2 · MIT-0
cross-platform ⚠ suspicious
52
Downloads
0
Stars
0
Active Installs
3
Versions
Install in OpenClaw
/install testagent-browser-setup
Description
在新的 openclaw 环境中安装并初始化 Playwright MCP 和 browser-use CLI,含中文字体修复和自动验收。当用户说「初始化测试环境」「安装浏览器工具」「setup browser」或在新机器首次部署测试 agent 时触发。
README (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 执行一条简单命令,确认鉴权通过

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

Usage Guidance
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.
Capability Assessment
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.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install testagent-browser-setup
  3. After installation, invoke the skill by name or use /testagent-browser-setup
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
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.
Metadata
Slug testagent-browser-setup
Version 1.0.2
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 3
Frequently Asked Questions

What is Testagent Browser Setup?

在新的 openclaw 环境中安装并初始化 Playwright MCP 和 browser-use CLI,含中文字体修复和自动验收。当用户说「初始化测试环境」「安装浏览器工具」「setup browser」或在新机器首次部署测试 agent 时触发。 It is an AI Agent Skill for Claude Code / OpenClaw, with 52 downloads so far.

How do I install Testagent Browser Setup?

Run "/install testagent-browser-setup" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Testagent Browser Setup free?

Yes, Testagent Browser Setup is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Testagent Browser Setup support?

Testagent Browser Setup is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Testagent Browser Setup?

It is built and maintained by wangyin717 (@wangyin717); the current version is v1.0.2.

💬 Comments