$npx -y skills add jihe520/social-push --skill agent-browserBrowser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web apps, or automating any browser task. Triggers include requests to "open a websit
| 1 | # Browser Automation with agent-browser |
| 2 | |
| 3 | ## Core Workflow |
| 4 | |
| 5 | Every browser automation follows this pattern: |
| 6 | |
| 7 | 1. **Navigate**: `agent-browser open <url>` |
| 8 | 2. **Snapshot**: `agent-browser snapshot -i` (get element refs like `@e1`, `@e2`) |
| 9 | 3. **Interact**: Use refs to click, fill, select |
| 10 | 4. **Re-snapshot**: After navigation or DOM changes, get fresh refs |
| 11 | |
| 12 | ```bash |
| 13 | agent-browser open https://example.com/form |
| 14 | agent-browser snapshot -i |
| 15 | # Output: @e1 [input type="email"], @e2 [input type="password"], @e3 [button] "Submit" |
| 16 | |
| 17 | agent-browser fill @e1 "user@example.com" |
| 18 | agent-browser fill @e2 "password123" |
| 19 | agent-browser click @e3 |
| 20 | agent-browser wait --load networkidle |
| 21 | agent-browser snapshot -i # Check result |
| 22 | ``` |
| 23 | |
| 24 | ## Command Chaining |
| 25 | |
| 26 | Commands can be chained with `&&` in a single shell invocation. The browser persists between commands via a background daemon, so chaining is safe and more efficient than separate calls. |
| 27 | |
| 28 | ```bash |
| 29 | # Chain open + wait + snapshot in one call |
| 30 | agent-browser open https://example.com && agent-browser wait --load networkidle && agent-browser snapshot -i |
| 31 | |
| 32 | # Chain multiple interactions |
| 33 | agent-browser fill @e1 "user@example.com" && agent-browser fill @e2 "password123" && agent-browser click @e3 |
| 34 | |
| 35 | # Navigate and capture |
| 36 | agent-browser open https://example.com && agent-browser wait --load networkidle && agent-browser screenshot page.png |
| 37 | ``` |
| 38 | |
| 39 | **When to chain:** Use `&&` when you don't need to read the output of an intermediate command before proceeding (e.g., open + wait + screenshot). Run commands separately when you need to parse the output first (e.g., snapshot to discover refs, then interact using those refs). |
| 40 | |
| 41 | ## Essential Commands |
| 42 | |
| 43 | ```bash |
| 44 | # Navigation |
| 45 | agent-browser open <url> # Navigate (aliases: goto, navigate) |
| 46 | agent-browser close # Close browser |
| 47 | |
| 48 | # Snapshot |
| 49 | agent-browser snapshot -i # Interactive elements with refs (recommended) |
| 50 | agent-browser snapshot -i -C # Include cursor-interactive elements (divs with onclick, cursor:pointer) |
| 51 | agent-browser snapshot -s "#selector" # Scope to CSS selector |
| 52 | |
| 53 | # Interaction (use @refs from snapshot) |
| 54 | agent-browser click @e1 # Click element |
| 55 | agent-browser click @e1 --new-tab # Click and open in new tab |
| 56 | agent-browser fill @e2 "text" # Clear and type text |
| 57 | agent-browser type @e2 "text" # Type without clearing |
| 58 | agent-browser select @e1 "option" # Select dropdown option |
| 59 | agent-browser check @e1 # Check checkbox |
| 60 | agent-browser press Enter # Press key |
| 61 | agent-browser keyboard type "text" # Type at current focus (no selector) |
| 62 | agent-browser keyboard inserttext "text" # Insert without key events |
| 63 | agent-browser scroll down 500 # Scroll page |
| 64 | agent-browser scroll down 500 --selector "div.content" # Scroll within a specific container |
| 65 | |
| 66 | # Get information |
| 67 | agent-browser get text @e1 # Get element text |
| 68 | agent-browser get url # Get current URL |
| 69 | agent-browser get title # Get page title |
| 70 | |
| 71 | # Wait |
| 72 | agent-browser wait @e1 # Wait for element |
| 73 | agent-browser wait --load networkidle # Wait for network idle |
| 74 | agent-browser wait --url "**/page" # Wait for URL pattern |
| 75 | agent-browser wait 2000 # Wait milliseconds |
| 76 | |
| 77 | # Downloads |
| 78 | agent-browser download @e1 ./file.pdf # Click element to trigger download |
| 79 | agent-browser wait --download ./output.zip # Wait for any download to complete |
| 80 | agent-browser --download-path ./downloads open <url> # Set default download directory |
| 81 | |
| 82 | # Capture |
| 83 | agent-browser screenshot # Screenshot to temp dir |
| 84 | agent-browser screenshot --full # Full page screenshot |
| 85 | agent-browser screenshot --annotate # Annotated screenshot with numbered element labels |
| 86 | agent-browser pdf output.pdf # Save as PDF |
| 87 | |
| 88 | # Diff (compare page states) |
| 89 | agent-browser diff snapshot # Compare current vs last snapshot |
| 90 | agent-browser diff snapshot --baseline before.txt # Compare current vs saved file |
| 91 | agent-browser diff screenshot --baseline before.png # Visual pixel diff |
| 92 | agent-browser diff url <url1> <url2> # Compare two pages |
| 93 | agent-browser diff url <url1> <url2> --wait-until networkidle # Custom wait strategy |
| 94 | agent-browser diff url <url1> <url2> --selector "#main" # Scope to element |
| 95 | ``` |
| 96 | |
| 97 | ## Common Patterns |
| 98 | |
| 99 | ### Form Submission |
| 100 | |
| 101 | ```bash |
| 102 | agent-browser open https://example.com/s |