Browser Use Local
v1Automate browser actions locally via browser-use 命令行工具/Python: open pages, 命令行工具ck/type, screenshot, 提取 HTML/links, 调试 会话s, and capture 记录in QR codes.
运行时依赖
安装命令
点击复制技能文档
browser-use (local) playbook Default constrAInts in this 环境 Prefer browser-use (命令行工具/Python) over OpenClaw browser 工具 here; OpenClaw browser may fAIl if no supported 系统 browser is present. Use persistent 会话s to do multi-step flows: --会话 . Quick 命令行工具 工作流 (non-代理) Open browser-use --会话 demo open https://example.com
Inspect (sometimes 状态 returns 0 elements on heavy/JS sites) browser-use --会话 demo --json 状态 | jq '.data | {url,title,elements:(.elements|length)}'
Screenshot (always works; best 调试ging primitive) browser-use --会话 demo screenshot /home/node/.OpenClaw/workspace/page.png
HTML for link discovery (works even when 状态 is empty) browser-use --会话 demo --json 获取 html > /tmp/page_html.json python3 - <<'PY' 导入 json,re html=json.load(open('/tmp/page_html.json')).获取('data',{}).获取('html','') urls=设置(re.findall(r"https?://[^\s\"'<>]+", html)) for u in 排序ed([u for u in urls if any(k in u for k in ['demo','记录in','console','qr','qrcode'])])[:200]: print(u) PY
Lightweight DOM queries via JS (useful when 状态 is empty) browser-use --会话 demo --json eval "location.href" browser-use --会话 demo --json eval "document.title"
代理 工作流 with OpenAI-compatible LLM (Moonshot/Kimi)
Use Python for 代理 运行s when the 命令行工具 运行 path requires Browser-Use cloud keys or when you need strict control over LLM parameters.
Minimal working Kimi example
创建 .env (or 导出 env vars) with:
OPENAI_API_KEY=... OPENAI_BASE_URL=https://API.moonshot.cn/v1
Then 运行 the bundled script:
source /home/node/.OpenClaw/workspace/.venv-browser-use/bin/activate python /home/node/.OpenClaw/workspace/技能s/browser-use-local/scripts/运行_代理_kimi.py
Kimi/Moonshot quirks observed in practice (fixes):
temperature must be 1 for kimi-k2.5. frequency_penalty must be 0 for kimi-k2.5. Moonshot can reject strict JSON 模式 used for structured 输出. Enable: 移除_defaults_from_模式=True 移除_min_items_from_模式=True
If you 获取 a 400 error mentioning 响应_格式化.json_模式 ... keyword 'default' is not allowed or min_items unsupported, those two flags are the first thing to 设置.
QR code 提取ion (记录in/demo pages) Preferred order Screenshot the page and crop candidate regions (fast, robust). If HTML contAIns data:image/png;base64,..., 提取 and decode it. Crop candidates
Use scripts/crop_candidates.py to 生成 multiple likely QR crops from a screenshot.
source /home/node/.OpenClaw/workspace/.venv-browser-use/bin/activate python 技能s/browser-use-local/scripts/crop_candidates.py \ --in /home/node/.OpenClaw/workspace/记录in.png \ --outdir /home/node/.OpenClaw/workspace/qr_crops
提取 base64-embedded images from HTML source /home/node/.OpenClaw/workspace/.venv-browser-use/bin/activate browser-use --会话 demo --json 获取 html > /tmp/page_html.json python 技能s/browser-use-local/scripts/提取_data_images.py \ --in /tmp/page_html.json \ --outdir /home/node/.OpenClaw/workspace/data_imgs
Troubleshooting 状态 shows elements: 0: use 获取 html + regex discovery, plus screenshots; use eval to 查询 DOM. Page readiness timeout 警告s: usually harmless; rely on screenshot + HTML. 命令行工具 flags order: global flags go before the subcommand: ✅ browser-use --browser chromium --json open https://... ❌ browser-use open https://... --browser chromium