编写、调试与调优 Playwright 测试,涵盖定位器策略、追踪诊断与 CI 友好的超时配置。
浏览器
qqbrowser-use
试用在脚本里驱动真实 Chrome 完成网页交互:导航、填表、点击、截图、抽取数据。
它能做什么
QQBrowserUse 是面向 AI Agent 的命令行工具,可以驱动真实的 Chrome 浏览器打开网页、点击按钮、填写表单、截图、下载文件、读取页面状态。每个任务都跑在独立的 Chrome 标签页分组里,由 `browser_start_session` 开启、`browser_end_session` 关闭。需要重复执行的流程可以录制成参数化的 JSON playbook,后续通过 `browser_replay` 重放,不再依赖 AI 决策;一次性任务直接调用 `browser_*` 命令手动跑即可。
什么时候用它
- 在注册/登录页填写多字段表单并提交
- 把商品列表、条目列表抽取成结构化 JSON
- 把一次手动浏览器流程录制成可复用的 JSON playbook
- 不调用 AI,直接重放之前保存好的浏览器任务
技能文档
QQBrowserUse
Browser automation CLI for AI agents. Wraps every task in an isolated Chrome Tab Group, supports both live automation and reusable playbook replay.
Platform Support
Linux x86_64, Windows, macOS. Other Linux architectures (ARM, etc.) are not supported.
Installation
# Linux / macOS
pipx install qqbrowser-skill
qqbrowser-skill install # Download and install QQ Browser
# Windows
pip install qqbrowser-skill
qqbrowser-skill install
Reference Files (Load On Demand)
This main file is a decision guide. Load the following references only when they apply:
| Reference | Load when… |
|---|---|
| references/commands.md | You need the exact flag/argument shape of any browser_* command |
| references/session-lifecycle.md | You need full session rules, or the user's request is a composite (multi-domain) task |
| references/playbook.md | User asks to record/save/reuse, generate/edit a playbook JSON, or run a reusable browser task |
Key Concepts
- Element Index: Encoded string like
2_sfli_qp0u(highlightIndex_attrHash_xpathHash). Generated bybrowser_snapshot, used to target elements. Indices are regenerated on every snapshot — always re-snapshot before reusing indices; using a stale index will fail or target the wrong element. Never invent numeric indices like1or2; always copy the encoded index exactly from the latestbrowser_snapshotoutput. - Snapshot: Returns page content with indexed elements. Re-snapshot after any DOM change (navigation, form submit, modal, AJAX). Standalone
browser_snapshotcalls consume tokens — avoid unnecessary ones. - Session: AI tasks MUST be wrapped with
browser_start_session/browser_end_sessionfor tab group isolation. Details: references/session-lifecycle.md. - Task Recording: Manual browser tasks intended for replay MUST be wrapped with
task_begin/task_endfor playbook generation. Details: references/playbook.md. - Playbook: Parameterized JSON script that replays a recorded task without AI. Details: references/playbook.md.
⚠️ Core Workflow (MANDATORY)
Every automation MUST be wrapped in
browser_start_session/browser_end_session, and you MUST runplaybook_listbefore anytask_beginorbrowser_go_to_url. Never start manual automation without first checking for existing playbooks.
Decision Flow
Step 0: Composite request? ← Multi-domain / cross-site data flow?
├── YES → See references/session-lifecycle.md → Handling Composite Tasks.
│ Start ONE session for the whole composite task,
│ then run each sub-task through Step 2-3 independently,
│ and call browser_end_session once after all sub-tasks.
└── NO → Continue as a single task ↓
Step 1: browser_start_session ← REQUIRED, first command
Step 2: playbook_list ← REQUIRED, decide branch
Step 3: Match?
├── YES → browser_replay ← Branch A: Replay
└── NO → Manual automation
├── Recording mode ← Branch B: user explicitly asks to record
│ task_begin
│ browser_* operations...
│ task_end
│ → then continue with references/playbook.md
└── Non-recording mode ← Branch C: one-off task
browser_* operations...
Step 4: browser_end_session ← REQUIRED, always executed
Recording (Branch B) triggers only on explicit user request. Trigger words: "record this", "save this", "make reusable", "保存为脚本", "录一下", "下次还要用". Without an explicit request, use Branch C (non-recording) — do not wrap the operations in task_begin / task_end.
Step 1: Start Session (REQUIRED)
qqbrowser-skill browser_start_session --sessionId task--
sessionId must be unique per task (e.g. task-form-001). Full flags and idempotency rules: references/session-lifecycle.md.
Step 2: Check Playbooks (REQUIRED — DO NOT SKIP)
qqbrowser-skill playbook_list
Match returned playbooks against the user's task by name, description, keywords, and target URL. Even a partial match is enough to prefer replay over manual work.
Step 3: Branch by Match Result
Branch A — Playbook matched → Replay
⚠️
browser_replaymay run for up to 10 minutes. Wait for it to return — NEVER interrupt, retry, or fall back to manual mode while it is still running. Replayed operations are usually not idempotent (posting, submitting, messaging), so a premature retry will cause duplicate side effects.
qqbrowser-skill browser_replay --script --variables '{...}'
Output format and how to consume step_results: references/commands.md → browser_replay Output Format.
Branch B — No playbook + user asked to record → Manual with recording
Before calling
task_begin, MUST read references/playbook.md. These rules are required to make the recording reusable; do not start recording from the short example alone.
Wrap operations in task_begin / task_end so a playbook can be generated afterwards.
qqbrowser-skill task_begin --description "描述任务"
qqbrowser-skill browser_go_to_url --url
qqbrowser-skill browser_snapshot # Get element indices (AI use only; filtered on replay)
# ... interact using indices ...
qqbrowser-skill browser_snapshot # Re-snapshot after DOM changes
qqbrowser-skill task_end
Recording quality rules (mandatory inside task_begin/task_end): references/playbook.md.
After task_end, raw recordings are NOT replay-ready. Continue following references/playbook.md to load task_latest, generate the playbook JSON, save it, and verify it safely.
Branch C — No playbook + no recording request → Plain manual
Default fallback for one-off tasks. Do not call task_begin / task_end.
qqbrowser-skill browser_go_to_url --url
qqbrowser-skill browser_snapshot
# ... interact using indices ...
Step 4: End Session (REQUIRED — always executed)
Always call browser_end_session at the end, regardless of which branch was taken and regardless of success or failure:
qqbrowser-skill browser_end_session --sessionId task--
Common Patterns
Every example below is a complete task lifecycle template — it starts with
browser_start_session, checksplaybook_list, then ends withbrowser_end_session. AI agents must include all three calls in real runs; do not strip them when adapting these snippets. Replace placeholder URLs and indices with live values from the current task.
Form Submission (Branch C)
qqbrowser-skill browser_start_session --sessionId task-form-001
qqbrowser-skill playbook_list # REQUIRED before manual work
qqbrowser-skill browser_go_to_url --url https://example.com/signup
qqbrowser-skill browser_snapshot
# Copy encoded indices from the latest browser_snapshot, e.g. "2_sfli_qp0u". Never invent numeric indices.
qqbrowser-skill browser_input_text --index "" --text "Jane Doe"
qqbrowser-skill browser_input_text --index "" --text "jane@example.com"
qqbrowser-skill browser_select_dropdown_option --index "" --text "California"
qqbrowser-skill browser_check_op --index "" --value
qqbrowser-skill browser_click_element --index ""
qqbrowser-skill browser_wait --seconds 2
qqbrowser-skill browser_snapshot # Verify result
qqbrowser-skill browser_end_session --sessionId task-form-001
Data Extraction
Pick the right approach based on how the output will be consumed:
| Approach | When | Replayable? |
|---|---|---|
browser_snapshot --markdown | AI reads/summarizes a page once (Branch C only) | ❌ |
browser_snapshot + browser_get_info | Read one specific element's text/attribute | ❌ |
browser_eval_content_js | Structured JSON / multiple items / only safe option in Branch B | ✅ |
Full decision matrix: references/commands.md → browser_snapshot --markdown Usage Guide.
Structured extraction example (Branch C):
qqbrowser-skill browser_start_session --sessionId task-extract-001
qqbrowser-skill playbook_list
qqbrowser-skill browser_go_to_url --url https://example.com/products
qqbrowser-skill browser_eval_content_js --script "JSON.stringify(Array.from(document.querySelectorAll('.product-item')).slice(0,10).map(el=>({name:el.querySelector('.name')?.textContent?.trim(), price:el.querySelector('.price')?.textContent?.trim()})))"
qqbrowser-skill browser_end_session --sessionId task-extract-001
Infinite Scroll Pages
qqbrowser-skill browser_start_session --sessionId task-feed-001
qqbrowser-skill playbook_list
qqbrowser-skill browser_go_to_url --url https://example.com/feed
qqbrowser-skill browser_scroll_to_bottom # Trigger lazy loading
qqbrowser-skill browser_wait --seconds 2 # Wait for content
qqbrowser-skill browser_snapshot # Get updated content
qqbrowser-skill browser_end_session --sessionId task-feed-001
Evaluation Report
See the full skill evaluation report: QQBrowserSkillReport
相关技能
以 AI 机器人身份加入视频会议,提供语音、虚拟形象与屏幕共享四种模式。
按用户明确指令,在得到大脑(Get笔记)中保存、搜索并管理笔记与知识库。
把自然语言描述转为结构化 JSON,并由 mcp-diagram-generator MCP 服务生成 Draw.io、Mermaid 或 Excalidraw 图表文件。
在本地磁盘以分类纯 Markdown 文件保存需要长期留存的事实,与智能体内置记忆并存。
诊断生产力系统反复失效的根因,给出最小干预——容量测算、瓶颈定位、可靠的本地记录。