Requirements
- Target platform
- OpenClaw
- Install method
- Manual import
- Extraction
- Extract archive
- Prerequisites
- OpenClaw
- Primary doc
- SKILL.md
在Linux服务器上使用Chrome浏览器(无头/有头模式)配合xvfb运行,可连接chrome-devtools MCP进行浏览器自动化
在Linux服务器上使用Chrome浏览器(无头/有头模式)配合xvfb运行,可连接chrome-devtools MCP进行浏览器自动化
Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.
I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete.
I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run.
在无GUI的Linux服务器上运行Chrome浏览器的完整指南,支持配合 chrome-devtools MCP 使用。
场景推荐方式快速爬取、截图、自动化脚本--headless=new (无头)需要调试/连接DevTools MCPxvfb-run + 非无头 + --remote-debugging-port=9222需要看到浏览器窗口(VNC截图等)xvfb-run + 非无头
google-chrome --headless=new --no-sandbox --disable-gpu --user-data-dir=/tmp/chrome-data
xvfb-run -a google-chrome --no-sandbox \ --disable-gpu --remote-debugging-port=9222 \ --user-data-dir=/tmp/chrome-profile 关键点: -a = 自动分配 display 编号 去掉 --headless 就是有头模式 DevTools 监听 ws://127.0.0.1:9222/devtools/browser/xxx
pkill -f "chrome.*remote-debugging-port=9222" 2>/dev/null sleep 1 xvfb-run -a google-chrome --no-sandbox \ --disable-gpu --remote-debugging-port=9222 \ --user-data-dir=/tmp/chrome-profile &
MCP server chrome-devtools 已安装,连接 http://127.0.0.1:9222: mcporter list chrome-devtools --schema # 查看可用工具 mcporter call chrome-devtools.list_pages # 列出页面
工具功能new_page url:"https://xxx"打开新页面navigate_page type:"url" url:"https://xxx"导航take_screenshot filePath:"/path/xxx.png"截图take_snapshot获取页面元素快照click uid:"xxx"点击元素fill uid:"xxx" value:"xxx"填入表单type_text text:"xxx"输入文本list_network_requests查看网络请求evaluate_script function:"() => { return document.title }"执行JS
# 1. 启动浏览器 xvfb-run -a google-chrome --no-sandbox \ --disable-gpu --remote-debugging-port=9222 \ --user-data-dir=/tmp/chrome-profile & # 2. 检查是否就绪 curl -s http://127.0.0.1:9222/json/version # 3. 用 MCP 操作 mcporter call chrome-devtools.new_page url:"https://www.baidu.com" mcporter call chrome-devtools.take_screenshot filePath:"/root/screenshot.png"
参数作用--headless=new无头模式(不显示窗口)--remote-debugging-port=9222开启调试端口,供MCP连接--no-sandbox跳过沙箱(服务器必加)--disable-gpu禁用GPU(服务器必加)--user-data-dir=/tmp/xxx用户数据目录(避免冲突)-a (xvfb-run)自动分配 display 编号DISPLAY=:99指定使用某个 Xvfb 显示编号
ps aux | grep Xvfb | grep -v grep 输出示例: Xvfb :99 -screen 0 1280x720x24 Xvfb :100 -screen 0 640x480x24
# 1280x720 分辨率 Xvfb :99 -screen 0 1280x720x24 -nolisten tcp & # 1920x1080 分辨率 Xvfb :99 -screen 0 1920x1080x24 -nolisten tcp &
# 方式1:使用 xvfb-run 自动分配 xvfb-run -a google-chrome --no-sandbox ... # 方式2:手动指定 display 编号 DISPLAY=:99 google-chrome --no-sandbox ...
分辨率适用场景640x480轻量爬取、简单截图1280x720 (720p)常规浏览、推荐配置1920x1080 (1080p)高清截图、复杂页面
# 查看当前运行的 Xvfb ps aux | grep Xvfb | grep -v grep # 杀掉所有 Chrome 进程 killall chrome # 杀掉所有 Xvfb pkill Xvfb # 重启 Chrome(绑定到 :99) killall chrome 2>/dev/null sleep 1 DISPLAY=:99 google-chrome --no-sandbox \ --disable-gpu --remote-debugging-port=9222 \ --user-data-dir=/tmp/chrome-profile &
Code helpers, APIs, CLIs, browser automation, testing, and developer operations.
Largest current source with strong distribution and engagement signals.