






















@@ -0,0 +1,83 @@
1+---
2+name: browser-automation
3+description: Use when controlling web pages with the OpenClaw browser tool, especially multi-step flows, login checks, tab management, or recovery from stale refs/timeouts.
4+user-invocable: false
5+---
6+7+# Browser Automation
8+9+Use this skill when you need the `browser` tool for anything beyond a single page check.
10+11+## Operating Loop
12+13+1. Check browser state before acting:
14+- `action="status"` for availability.
15+- `action="profiles"` if login state or profile choice matters.
16+- `action="tabs"` before opening a new tab if retries/timeouts may have left windows behind.
17+2. Prefer stable tab handles:
18+- Open important tabs with `label`, for example `label="meet"`.
19+- Use `tabId` handles like `t1` or labels like `meet` as `targetId` in later calls.
20+- Avoid relying on raw DevTools `targetId` unless the tool just returned it.
21+3. Read before you click:
22+- Use `action="snapshot"` on the intended `targetId`.
23+- Use the same `targetId` for follow-up actions so refs stay on the same tab.
24+- For durable Playwright refs, request `refs="aria"` when supported.
25+4. Act narrowly:
26+- Prefer `action="act"` with a ref from the latest snapshot.
27+- After navigation, modal changes, or form submission, snapshot again before the next action.
28+- Avoid blind waits. Wait for visible UI state when possible.
29+5. Report real blockers:
30+- If the page needs login, permission, captcha, 2FA, camera/microphone approval, or another manual step, stop and tell the user exactly what is needed.
31+- Do not claim the browser is not logged in just because the current page shows a permission or onboarding dialog. Inspect the visible UI first.
32+33+## Tab Hygiene
34+35+Before creating a tab for a named task, list tabs and reuse an existing matching label or URL when it is still usable.
36+37+Example:
38+39+```json
40+{ "action": "tabs" }
41+```
42+43+If no suitable tab exists:
44+45+```json
46+{ "action": "open", "url": "https://example.com", "label": "task" }
47+```
48+49+Then target it by label:
50+51+```json
52+{ "action": "snapshot", "targetId": "task", "refs": "aria" }
53+```
54+55+If a retry creates duplicates, close the extras by `tabId`:
56+57+```json
58+{ "action": "close", "targetId": "t3" }
59+```
60+61+## Stale Ref Recovery
62+63+If an action fails with a missing or stale ref:
64+65+1. Snapshot the same `targetId` again.
66+2. Find the current visible control.
67+3. Retry once with the new ref.
68+4. If the UI moved to a blocker state, report the blocker instead of looping.
69+70+## Existing User Browser
71+72+Use `profile="user"` only when existing cookies/login matter. This attaches to the user's running Chromium-based browser.
73+74+For `profile="user"` and other existing-session profiles, omit `timeoutMs` on `act:type`, `evaluate`, `hover`, `scrollIntoView`, `drag`, `select`, and `fill`; that driver rejects per-call timeout overrides for those actions.
75+76+## Google Meet Notes
77+78+When creating or joining a Meet:
79+80+- Treat camera/microphone permission screens as progress, not login failure.
81+- If asked whether people can hear you, click the microphone option when voice is required.
82+- If Google asks for sign-in, 2FA, account chooser confirmation, or permission that needs user approval, report the exact manual action.
83+- Use one labeled tab per meeting flow, for example `label="meet"`, and reuse it during retries.
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。