$npx -y skills add molefrog/moi --skill agent-browserCore agent-browser usage guide. Read this before running any agent-browser commands. Covers the snapshot-and-ref workflow, navigating pages, interacting with elements (click, fill, type, select), extracting text and data, taking screenshots, managing tabs, handling forms and auth
| 1 | # agent-browser core |
| 2 | |
| 3 | > **moi note:** vendored from the `agent-browser` npm package (v0.27.0, |
| 4 | > `agent-browser skills get core --full` serves the copy matching your |
| 5 | > installed CLI). In Claude Code cloud sessions the CLI is preinstalled and |
| 6 | > `AGENT_BROWSER_EXECUTABLE_PATH` points at the system Chromium — never run |
| 7 | > `agent-browser install` (its Chrome download fails behind the egress relay). |
| 8 | > Starting the moi server itself: `docs/browser-testing-cloud.md`. |
| 9 | |
| 10 | Fast browser automation CLI for AI agents. Chrome/Chromium via CDP, no |
| 11 | Playwright or Puppeteer dependency. Accessibility-tree snapshots with compact |
| 12 | `@eN` refs let agents interact with pages in ~200-400 tokens instead of |
| 13 | parsing raw HTML. |
| 14 | |
| 15 | Most normal web tasks (navigate, read, click, fill, extract, screenshot) are |
| 16 | covered here. Load a specialized skill when the task falls outside browser |
| 17 | web pages — see [When to load another skill](#when-to-load-another-skill). |
| 18 | |
| 19 | ## The core loop |
| 20 | |
| 21 | ```bash |
| 22 | agent-browser open <url> # 1. Open a page |
| 23 | agent-browser snapshot -i # 2. See what's on it (interactive elements only) |
| 24 | agent-browser click @e3 # 3. Act on refs from the snapshot |
| 25 | agent-browser snapshot -i # 4. Re-snapshot after any page change |
| 26 | ``` |
| 27 | |
| 28 | Refs (`@e1`, `@e2`, ...) are assigned fresh on every snapshot. They become |
| 29 | **stale the moment the page changes** — after clicks that navigate, form |
| 30 | submits, dynamic re-renders, dialog opens. Always re-snapshot before your |
| 31 | next ref interaction. |
| 32 | |
| 33 | ## Quickstart |
| 34 | |
| 35 | ```bash |
| 36 | # Install once |
| 37 | npm i -g agent-browser && agent-browser install |
| 38 | |
| 39 | # Take a screenshot of a page |
| 40 | agent-browser open https://example.com |
| 41 | agent-browser screenshot home.png |
| 42 | agent-browser close |
| 43 | |
| 44 | # Search, click a result, and capture it |
| 45 | agent-browser open https://duckduckgo.com |
| 46 | agent-browser snapshot -i # find the search box ref |
| 47 | agent-browser fill @e1 "agent-browser cli" |
| 48 | agent-browser press Enter |
| 49 | agent-browser wait --load networkidle |
| 50 | agent-browser snapshot -i # refs now reflect results |
| 51 | agent-browser click @e5 # click a result |
| 52 | agent-browser screenshot result.png |
| 53 | ``` |
| 54 | |
| 55 | The browser stays running across commands so these feel like a single |
| 56 | session. Use `agent-browser close` (or `close --all`) when you're done. |
| 57 | |
| 58 | ## Reading a page |
| 59 | |
| 60 | ```bash |
| 61 | agent-browser snapshot # full tree (verbose) |
| 62 | agent-browser snapshot -i # interactive elements only (preferred) |
| 63 | agent-browser snapshot -i -u # include href urls on links |
| 64 | agent-browser snapshot -i -c # compact (no empty structural nodes) |
| 65 | agent-browser snapshot -i -d 3 # cap depth at 3 levels |
| 66 | agent-browser snapshot -s "#main" # scope to a CSS selector |
| 67 | agent-browser snapshot -i --json # machine-readable output |
| 68 | ``` |
| 69 | |
| 70 | Snapshot output looks like: |
| 71 | |
| 72 | ``` |
| 73 | Page: Example - Log in |
| 74 | URL: https://example.com/login |
| 75 | |
| 76 | @e1 [heading] "Log in" |
| 77 | @e2 [form] |
| 78 | @e3 [input type="email"] placeholder="Email" |
| 79 | @e4 [input type="password"] placeholder="Password" |
| 80 | @e5 [button type="submit"] "Continue" |
| 81 | @e6 [link] "Forgot password?" |
| 82 | ``` |
| 83 | |
| 84 | For unstructured reading (no refs needed): |
| 85 | |
| 86 | ```bash |
| 87 | agent-browser get text @e1 # visible text of an element |
| 88 | agent-browser get html @e1 # innerHTML |
| 89 | agent-browser get attr @e1 href # any attribute |
| 90 | agent-browser get value @e1 # input value |
| 91 | agent-browser get title # page title |
| 92 | agent-browser get url # current URL |
| 93 | agent-browser get count ".item" # count matching elements |
| 94 | ``` |
| 95 | |
| 96 | ## Interacting |
| 97 | |
| 98 | ```bash |
| 99 | agent-browser click @e1 # click |
| 100 | agent-browser click @e1 --new-tab # open link in new tab instead of navigating |
| 101 | agent-browser dblclick @e1 # double-click |
| 102 | agent-browser hover @e1 # hover |
| 103 | agent-browser focus @e1 # focus (useful before keyboard input) |
| 104 | agent-browser fill @e2 "hello" # clear then type |
| 105 | agent-browser type @e2 " world" # type without clearing |
| 106 | agent-browser press Enter # press a key at current focus |
| 107 | agent-browser press Control+a # key combination |
| 108 | agent-browser check @e3 # check checkbox |
| 109 | agent-browser uncheck @e3 # uncheck |
| 110 | agent-browser select @e4 "option- |