360 Secure SkillHub
360 安全技能中心

Testagent Browser Setup

面向全新 openclaw 环境的一次性初始化 Skill:运行 setup.sh 检测或安装 Chromium、生成 ~/.local/bin/chrome-cdp 启动脚本、下载中文字体;可选手工配置内置浏览器与 SSRF 白名单、安装 browser-use;最后通过 CDP /json 与截图冒烟验证。需联网下载依赖,无需 root 权限。

wangyin717
wangyin717
热度 46.33
最近更新 2026-07-23 18:02:11
分类:自动化依赖:代码执行 / 读写文件 / 第三方 API / 联网浏览搜索 / MCP 服务应用场景:自动化脚本 / DevOps / 工作流

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add testagent-browser-setup
Metadata
name
testagent-browser-setup
version
2.2.0
description
One-time installation and initialization of Chromium, system dependencies, Chinese fonts, and the CDP launcher script in a fresh openclaw environment — no root required. Triggered when the user says "initialize test environment", "install browser tools", "setup browser", or when deploying a test agent to a new machine for the first time.

Browser Setup

One-time environment initialization, run on a fresh openclaw container. No root required.

Notes

The openclaw environment ships with Chromium pre-installed by default; setup.sh prefers it and only falls back to downloading via Playwright if it's not found.

The primary path for screenshots and browser actions is: Chrome + direct CDP. setup.sh creates a ~/.local/bin/chrome-cdp launcher script.

mcp doctor --probe gives false positives. It returning ok only means the MCP server process started — not that Chromium can actually run. The only reliable check is: playwright__browser_navigate actually returning page content.

Execution order

Step 1: Run the core setup script

bash scripts/setup.sh

The script does three things:

  1. Chromium detection: prefers the system-preinstalled Chromium, falling back to a Playwright download if not found
  2. chrome-cdp launcher script: ~/.local/bin/chrome-cdp, wrapping the --headless=new --no-sandbox --remote-allow-origins=* flags
  3. Chinese fonts: downloads WenQuanYi Micro Hei from GitHub into ~/.local/share/fonts/

Step 2: Try configuring the built-in browser (optional, often ineffective)

Edit ~/.openclaw/openclaw.json (config.patch refuses to modify protected paths, so the file must be written by hand):

{
  "browser": {
    "noSandbox": true,
    "ssrfPolicy": {
      "allowedHostnames": [
        "your target product domain (e.g. app.example.com)",
        "the corresponding login domain (e.g. xxx.us.auth0.com)"
      ]
    }
  }
}

After editing: browser stop → gateway restart → wait 15s → browser start

⚠️ The SSRF allowlist often doesn't take effect (the gateway has a runtime cache and doesn't always pick up the file). If browser navigate still reports blocked by policy, immediately abandon the built-in browser and switch to direct CDP (see TOOLS.md) rather than continuing to restart-and-retry.

Step 4: Initialize TOOLS.md

cp "$(dirname "$0")/../TOOLS.md" ./TOOLS.md

Step 6 (optional): Install browser-use

bash scripts/setup-optional.sh

Step 7: Smoke test

# Start Chrome CDP
chrome-cdp &
sleep 2

# Verify CDP is reachable
curl -s http://localhost:9223/json | python3 -m json.tool | head -20

# Verify with a screenshot (see the CDP screenshot flow in REFERENCE.md)

Acceptance criteria: CDP /json returns a target list, and Chinese text in screenshots renders cleanly with no mojibake.