Use when you need browser automation via the browser-use CLI or Python code in this OpenClaw container/host: open pages, click/type, take screenshots, extract HTML/links, or run an Agent with an OpenAI-compatible LLM (e.g. Moonshot/Kimi) using a custom base_url. Also use for debugging browser-use sessions (state empty, page readiness timeouts), and for extracting login QR codes from demo/login pages via screenshots or HTML data:image.
技能名称: browser-use-local
详细描述:
1) 打开
bash
browser-use --session demo open https://example.com
2) 检查 (有时在复杂/JS 网站上,state 返回 0 个元素)
bash
browser-use --session demo --json state | jq .data | {url,title,elements:(.elements|length)}
3) 截图 (始终有效;最佳调试原语)
bash
browser-use --session demo screenshot /home/node/.openclaw/workspace/page.png
4) 用于链接发现的 HTML (即使 state 为空也有效)
bash
browser-use --session demo --json get html > /tmp/page_html.json
python3 - <
html=json.load(open(/tmp/page_html.json)).get(data,{}).get(html,)
urls=set(re.findall(rhttps?://[^\s\<>]+, html))
for u in sorted([u for u in urls if any(k in u for k in [demo,login,console,qr,qrcode])])[:200]:
print(u)
PY
5) 通过 JS 进行轻量级 DOM 查询 (当 state 为空时有用)
bash
browser-use --session demo --json eval location.href
browser-use --session demo --json eval document.title
当 CLI 的 run 路径需要 Browser-Use 云密钥,或者需要严格控制 LLM 参数时,使用 Python 进行代理运行。
创建 .env (或导出环境变量),包含:
然后运行捆绑脚本:
bash
source /home/node/.openclaw/workspace/.venv-browser-use/bin/activate
python /home/node/.openclaw/workspace/skills/browser-use-local/scripts/runagentkimi.py
实践中观察到的 Kimi/Moonshot 特性 (修复方法):
如果遇到提及 responseformat.jsonschema ... keyword default is not allowed 或 min_items unsupported 的 400 错误,首先设置这两个标志。
1) 对页面截图 并裁剪候选区域 (快速、稳健)。
2) 如果 HTML 包含 data:image/png;base64,...,提取并解码。
使用 scripts/crop_candidates.py 从截图中生成多个可能的二维码裁剪区域。
bash
source /home/node/.openclaw/workspace/.venv-browser-use/bin/activate
python skills/browser-use-local/scripts/crop_candidates.py \
--in /home/node/.openclaw/workspace/login.png \
--outdir /home/node/.openclaw/workspace/qr_crops
bash
source /home/node/.openclaw/workspace/.venv-browser-use/bin/activate
browser-use --session demo --json get html > /tmp/page_html.json
python skills/browser-use-local/scripts/extractdataimages.py \
--in /tmp/page_html.json \
--outdir /home/node/.openclaw/workspace/data_imgs
该技能支持在以下平台通过对话安装:
帮我安装 SkillHub 和 browser-use-local-1776360877 技能
设置 SkillHub 为我的优先技能安装源,然后帮我安装 browser-use-local-1776360877 技能
skillhub install browser-use-local-1776360877
文件大小: 4.66 KB | 发布时间: 2026-4-17 14:24