360 Secure SkillHub
360 安全技能中心

Playwright Headless Browser (Chromium)

为 Clawdbot 配置 Playwright Chromium 无头浏览器:运行 npx playwright install chromium,安装 libnss3 等系统依赖,定位 Chromium 路径并通过 clawdbot config patch 写入 executablePath、headless、noSandbox,适用于 WSL/Linux。

maverick-software
maverick-software
热度 93.00
最近更新 2026-05-17 12:05:28
分类:自动化依赖:代码执行 / 联网浏览搜索应用场景:自动化脚本 / DevOps

安装技能

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

执行命令安装此 skill: npx secure-skills-cli add playwright-headless-browser
Metadata
name
playwright-browser
description
Set up headless browser automation in Clawdbot using Playwright Chromium. Use when configuring browser tools for WSL/Linux environments, installing browser dependencies, or enabling headless web automation. Handles Chromium installation, system library dependencies, and Clawdbot browser configuration.

Playwright Browser Setup

Configure Clawdbot's browser tool to use Playwright-managed Chromium for headless automation in WSL/Linux environments.

Quick Setup

Run the setup script to install everything:

./scripts/setup.sh

This will:

  1. Install Playwright and Chromium
  2. Install required system libraries (requires sudo)
  3. Patch Clawdbot config to use the Playwright browser

Manual Setup

1. Install Playwright Chromium

npx playwright install chromium

2. Install System Dependencies

Chromium requires NSS and ALSA libraries:

# Ubuntu/Debian
sudo apt-get install -y libnss3 libasound2t64

# If libasound2t64 doesn't exist (older Ubuntu):
sudo apt-get install -y libnss3 libasound2

3. Find Chromium Path

find ~/.cache/ms-playwright -name "chrome" -path "*/chrome-linux64/*" 2>/dev/null | head -1

4. Configure Clawdbot

Patch the gateway config:

clawdbot config patch '{"browser": {"executablePath": "<path-from-step-3>", "headless": true, "noSandbox": true}}'

Or use the provided script:

./scripts/configure-clawdbot.sh

Verification

Test the browser works:

~/.cache/ms-playwright/chromium-*/chrome-linux64/chrome --headless --no-sandbox --disable-gpu --dump-dom https://example.com

Notes

  • noSandbox: true is required for WSL/container environments
  • headless: true runs without a visible window (faster, no display needed)
  • For visible browser, set headless: false and ensure WSLg or X11 is configured