360 Secure SkillHub
360 安全技能中心

OpenClaw Browser WSL Attach

面向 WSL、无头 Linux 或 root 运行环境,脚本将 OpenClaw 浏览器配置为 attachOnly,手动启动带 CDP 的 Chromium,并通过状态与健康检查辅助修复连接,随后可执行网页自动化任务。

shenzheke
shenzheke
热度 41.05
最近更新 2026-05-11 17:40:19
分类:自动化依赖:代码执行 / 读写文件 / 联网浏览搜索应用场景:自动化脚本 / 工作流 / DevOps / 调试排错

安装技能

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

执行命令安装此 skill: npx secure-skills-cli add openclaw-browser-wsl-attach
Metadata
name
openclaw-browser-wsl-attach
description
Automatically prepare, repair, and attach an OpenClaw-controlled Chromium browser in WSL or Linux environments where OpenClaw runs as root or in a headless session. Use when the user asks to configure browser control, fix browser startup failures, enable OpenClaw browser automation, repair CDP/browser issues, or start a reusable attachOnly Chromium session for screenshots, web automation, login flows, clicking, typing, or page extraction.

OpenClaw Browser WSL Attach

Prepare a stable OpenClaw browser session by using Chromium in attachOnly mode with remote debugging enabled. Prefer this workflow in WSL, headless Linux, or root-run OpenClaw environments where direct browser launch is flaky.

Workflow

  1. Check browser readiness before changing anything.
  2. If OpenClaw browser is already attached and healthy, reuse it.
  3. If Chromium exists but OpenClaw launch is unstable, switch to attachOnly mode.
  4. Run python3 scripts/configure-browser.py and restart the gateway.
  5. Start Chromium manually with CDP on port 18800.
  6. Verify curl http://127.0.0.1:18800/json/version and openclaw browser status.
  7. Then use normal browser actions through OpenClaw.

Quick checks

Run these checks first:

openclaw browser status
command -v chromium || command -v chromium-browser || command -v google-chrome
curl -s http://127.0.0.1:18800/json/version

Interpretation:

  • If openclaw browser status shows running: true, the browser is ready.
  • If CDP JSON returns but OpenClaw still fails to launch browser itself, prefer attachOnly.
  • If Chromium is missing, install or point browser.executablePath to a valid Chromium-based browser.

Preferred configuration

Use this browser config in ~/.openclaw/openclaw.json for WSL/root/headless Linux:

"browser": {
  "enabled": true,
  "executablePath": "/usr/bin/chromium",
  "headless": true,
  "noSandbox": true,
  "attachOnly": true
}

Notes:

  • Use noSandbox: true when Chromium runs as root.
  • Use attachOnly: true when OpenClaw-managed launch times out or is unreliable.
  • browser: unknown and detectedBrowser: custom are acceptable if running: true and CDP works.

Start Chromium manually

Use the bundled scripts in this order:

python3 scripts/configure-browser.py
# restart gateway after config changes
bash scripts/start-browser.sh
bash scripts/healthcheck.sh

What each script does:

  • configure-browser.py: updates ~/.openclaw/openclaw.json for WSL/root/headless attachOnly mode and writes a timestamped backup
  • start-browser.sh: creates the OpenClaw browser profile directory, kills stale Chromium on port 18800 when needed, starts headless Chromium, and prints verification output
  • healthcheck.sh: shows binary, status, CDP, process, and environment diagnostics

Verify success

Healthy state usually looks like:

  • curl http://127.0.0.1:18800/json/version returns JSON
  • openclaw browser status shows running: true
  • openclaw browser tabs works

Once healthy, continue with OpenClaw browser tooling normally.

Repair workflow

If browser control breaks later:

  1. Re-run openclaw browser status
  2. Re-run bash scripts/start-browser.sh
  3. Run bash scripts/healthcheck.sh
  4. If needed, inspect /tmp/openclaw-browser.log
  5. Confirm port 18800 is not blocked by another process
  6. Restart gateway only after config changes

User-facing guidance

After setup, the user can simply ask for browser tasks in natural language, for example:

  • open a URL
  • search a phrase
  • log into a site
  • click a button
  • extract page content
  • take a screenshot

Read references/troubleshooting.md when browser attach still fails after the standard workflow.

Prefer this skill whenever the task is about making OpenClaw browser automation reliable on this machine, not just using the browser tool once.