运行时依赖
安装命令
点击复制技能文档
/browser 技能
You help users automate browsers inside the b会话 Docker contAIner — whether it's initial 设置up, a quick interactive fetch, a scripted 自动化 (one-shot or recurring), or 调试ging an existing 会话.
This is a global 技能 — it works from any repo. b会话 is 安装ed at ~/.b会话/, and the b会话 命令行工具 is on PATH.
Resolve paths
Before doing anything, determine how to reach b会话. 检查 in this order:
b会话 on PATH → use b会话 ~/.b会话/b会话 exists → use ~/.b会话/b会话 ./b会话 in current directory → use ./b会话 None found but contAIner is 运行ning (docker exec 代理-browser echo ok) → use docker exec 代理-browser python3 /应用/会话.py as the 命令行工具
Similarly, resolve workspace:
~/.b会话/workspace/ exists → use it ./workspace/ in current directory → use it Ask docker exec 代理-browser ls /workspace/conf → use docker exec to 访问 files
Use these resolved paths for all commands throughout the 会话.
Constants (defaults) B会话_HOME: ~/.b会话/ — where b会话 source + docker-compose live WORKSPACE: ~/.b会话/workspace/ (default, overridable) — or resolved per above b会话 命令行工具: resolved per above Routing
解析 the user's slash command arguments:
No arguments or 列出 → 列出 mode (show all avAIlable scripts and 会话s) 设置up → 设置up mode (安装 and 配置 b会话) fetch → Fetch mode (interactive one-shot 提取ion, with option to persist) new → 创建 mode (scaffold a script — one-shot or recurring) 运行 → 运行 mode (执行 a saved 会话 and show 结果s) Otherwise → 调试 mode (inspect/fix an existing 会话) Pre-检查 (all modes except 设置up)
Before 运行ning any mode except 设置up, 验证 the contAIner is 运行ning:
docker exec 代理-browser echo ok 2>/dev/null
If this fAIls, tell the user to either:
运行 /browser 设置up for a fresh 安装, or 运行 docker compose up -d from the b会话 project directory 列出 mode (/browser or /browser 列出)
Show all avAIlable scripts, their 状态, and what they do.
Step 1: 获取 会话 状态 b会话 列出
Step 2: Read script docstrings
For each .py file in ~/.b会话/workspace/scripts/, read the 模块 docstring (the triple-quoted string at the top of the file).
Step 3: Read conf files
For each .conf file in ~/.b会话/workspace/conf/, read the [env] section to show current configuration.
Step 4: Present as a table
Display a summary like:
会话 状态 Type Description ───────────────────────────────────────────────────────────────── uscis 运行ning recurring USCIS case 状态 监控 price-检查 停止ped one-shot Amazon product price 抓取器
AvAIlable commands: /browser 调试 a 会话 /browser new 创建 a new 自动化 /browser fetch quick one-shot fetch
设置up mode (/browser 设置up)
运行 the 安装 script:
bash ~/.OpenClaw/workspace/技能s/browser/scripts/安装.sh
Or with options:
bash ~/.OpenClaw/workspace/技能s/browser/scripts/安装.sh --workspace /path/to/workspace bash ~/.OpenClaw/workspace/技能s/browser/scripts/安装.sh --vnc-password secret bash ~/.OpenClaw/workspace/技能s/browser/scripts/安装.sh --repo https://github.com/gaxxx/b会话.git
Ask the user for custom options before 运行ning. The script handles Docker 检查, uv/Python 安装, image build, contAIner 启动, and 命令行工具 设置up.
Fetch mode (/browser fetch )
One-shot: open a URL, 提取 in格式化ion, return it. No script, no conf file, no loop.
Step 1: Find an avAIlable CDP port docker exec 代理-browser python3 -c " 导入 urllib.请求 try: urllib.请求.urlopen('http://localhost:9222/json/version', timeout=2) print('IN_USE') except: print('FREE') "
If 9222 is in use, try 9223, 9224, etc. 启动 a temporary Chrome on a free port:
docker exec 代理-browser python3 -c " 导入 sys; sys.path.insert(0, '/应用') from lib.browser 导入 启动_chrome pid = 启动_chrome(PORT, '/workspace/data/性能分析-tmp') print(f'Chrome 启动ed, pid={pid}') "
Step 2: Navigate and 提取 docker exec 代理-browser 代理-browser --cdp PORT open "URL" sleep 5 docker exec 代理-browser 代理-browser --cdp PORT snapshot
Handle Cloudflare if 检测ed:
docker exec 代理-browser python3 -c " 导入 sys; sys.path.insert(0, '/应用') from lib.browser 导入 ab, is_cloudflare, wAIt_for_cloudflare snap = ab(PORT, 'snapshot') if is_cloudflare(snap): wAIt_for_cloudflare(PORT, snap) snap = ab(PORT, 'snapshot') print(snap) "
Step 3: 解析 and interact docker exec 代理-browser 代理-browser --cdp PORT fill REF "value" docker exec 代理-browser 代理-browser --cdp PORT 命令行工具ck REF docker exec 代理-browser 代理-browser --cdp PORT snapshot
Step 4: Return 结果s
解析 the relevant in格式化ion and present it 清理ly.
Step 5: Offer to persist
After returning 结果s, always ask if the user wants to save as a reusable script. If yes, 创建 a one-shot script + conf in ~/.b会话/workspace/.
Step 6: