browser
Web browser automation with AI-optimized snapshots for claude-flow agents
What this skill does
# Browser Automation Skill Web browser automation using agent-browser with AI-optimized snapshots. Reduces context by 93% using element refs (@e1, @e2) instead of full DOM. ## Core Workflow ```bash # 1. Navigate to page agent-browser open <url> # 2. Get accessibility tree with element refs agent-browser snapshot -i # -i = interactive elements only # 3. Interact using refs from snapshot agent-browser click @e2 agent-browser fill @e3 "text" # 4. Re-snapshot after page changes agent-browser snapshot -i ``` ## Quick Reference ### Navigation | Command | Description | |---------|-------------| | `open <url>` | Navigate to URL | | `back` | Go back | | `forward` | Go forward | | `reload` | Reload page | | `close` | Close browser | ### Snapshots (AI-Optimized) | Command | Description | |---------|-------------| | `snapshot` | Full accessibility tree | | `snapshot -i` | Interactive elements only (buttons, links, inputs) | | `snapshot -c` | Compact (remove empty elements) | | `snapshot -d 3` | Limit depth to 3 levels | | `screenshot [path]` | Capture screenshot (base64 if no path) | ### Interaction | Command | Description | |---------|-------------| | `click <sel>` | Click element | | `fill <sel> <text>` | Clear and fill input | | `type <sel> <text>` | Type with key events | | `press <key>` | Press key (Enter, Tab, etc.) | | `hover <sel>` | Hover element | | `select <sel> <val>` | Select dropdown option | | `check/uncheck <sel>` | Toggle checkbox | | `scroll <dir> [px]` | Scroll page | ### Get Info | Command | Description | |---------|-------------| | `get text <sel>` | Get text content | | `get html <sel>` | Get innerHTML | | `get value <sel>` | Get input value | | `get attr <sel> <attr>` | Get attribute | | `get title` | Get page title | | `get url` | Get current URL | ### Wait | Command | Description | |---------|-------------| | `wait <selector>` | Wait for element | | `wait <ms>` | Wait milliseconds | | `wait --text "text"` | Wait for text | | `wait --url "pattern"` | Wait for URL | | `wait --load networkidle` | Wait for load state | ### Sessions | Command | Description | |---------|-------------| | `--session <name>` | Use isolated session | | `session list` | List active sessions | ## Selectors ### Element Refs (Recommended) ```bash # Get refs from snapshot agent-browser snapshot -i # Output: button "Submit" [ref=e2] # Use ref to interact agent-browser click @e2 ``` ### CSS Selectors ```bash agent-browser click "#submit" agent-browser fill ".email-input" "[email protected]" ``` ### Semantic Locators ```bash agent-browser find role button click --name "Submit" agent-browser find label "Email" fill "[email protected]" agent-browser find testid "login-btn" click ``` ## Examples ### Login Flow ```bash agent-browser open https://example.com/login agent-browser snapshot -i agent-browser fill @e2 "[email protected]" agent-browser fill @e3 "password123" agent-browser click @e4 agent-browser wait --url "**/dashboard" ``` ### Form Submission ```bash agent-browser open https://example.com/contact agent-browser snapshot -i agent-browser fill @e1 "John Doe" agent-browser fill @e2 "[email protected]" agent-browser fill @e3 "Hello, this is my message" agent-browser click @e4 agent-browser wait --text "Thank you" ``` ### Data Extraction ```bash agent-browser open https://example.com/products agent-browser snapshot -i # Iterate through product refs agent-browser get text @e1 # Product name agent-browser get text @e2 # Price agent-browser get attr @e3 href # Link ``` ### Multi-Session (Swarm) ```bash # Session 1: Navigator agent-browser --session nav open https://example.com agent-browser --session nav state save auth.json # Session 2: Scraper (uses same auth) agent-browser --session scrape state load auth.json agent-browser --session scrape open https://example.com/data agent-browser --session scrape snapshot -i ``` ## Integration with Claude Flow ### MCP Tools All browser operations are available as MCP tools with `browser/` prefix: - `browser/open` - `browser/snapshot` - `browser/click` - `browser/fill` - `browser/screenshot` - etc. ### Memory Integration ```bash # Store successful patterns npx @claude-flow/cli memory store --namespace browser-patterns --key "login-flow" --value "snapshot->fill->click->wait" # Retrieve before similar task npx @claude-flow/cli memory search --query "login automation" ``` ### Hooks ```bash # Pre-browse hook (get context) npx @claude-flow/cli hooks pre-edit --file "browser-task.ts" # Post-browse hook (record success) npx @claude-flow/cli hooks post-task --task-id "browse-1" --success true ``` ## Tips 1. **Always use snapshots** - They're optimized for AI with refs 2. **Prefer `-i` flag** - Gets only interactive elements, smaller output 3. **Use refs, not selectors** - More reliable, deterministic 4. **Re-snapshot after navigation** - Page state changes 5. **Use sessions for parallel work** - Each session is isolated
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.