Browser
The nems browser command
Every command agents and scripts can use to drive a browser pane.
nems browser drives the browser pane in your tab, and opens one beside you if there's none. Agents learn it from the nems-browser skill. The same commands are available as MCP tools.
The loop
nems browser open http://localhost:3000 # load the page
nems browser snapshot # read it, with refs
nems browser click e7 # act on a ref
nems browser type e3 "[email protected]"
nems browser press Enter --snapshot-after # act, then read the new page
A snapshot shows each element with a ref, like button "Continue" [e7] or link "Docs" [e9] → /docs. Refs change when the page changes, so use the latest snapshot.
Commands
| Command | What it does |
|---|---|
open <url> |
Load a URL and wait for it. |
snapshot |
The page as text, with refs e1, e2… |
click <target> |
Click an element. |
hover <target> |
Hover an element. |
type <target> "<text>" |
Replace a field's text, or pick a <select> option. - reads the text from standard input. |
press <key> [--on <target>] |
Press a key: Enter, Tab, Escape, ArrowDown, Shift+Tab… |
find role <role> [--name "<name>"] |
Find elements by role and name. |
wait-for "<text>" |
Wait until the page shows the text. |
wait --selector "<css>" |
Wait until an element is visible. |
screenshot [<file.png>] [<target>] |
Save a screenshot of the page or one element. Add --full-page for the whole page. |
console [--all] [--history] |
Recent console errors and warnings. --all for every message. |
viewport <size> |
Size the page: 390x844, phone, tablet, laptop, desktop, or reset. |
emulate [--color-scheme dark|light] [--reduced-motion reduce] |
Emulate dark mode or reduced motion. emulate reset undoes it. |
eval "<js>" |
Run JavaScript in the page. You approve it in Nems. |
state save <file> / state load <file> |
Save or restore cookies and local storage. |
back, forward, reload, url |
Navigation, and the current address and title. |
A <target> is a ref (e12), a CSS selector ("#checkout"), or --role button --name "Continue".
Without a file name, screenshots are saved in a Nems Screenshots folder in your temporary folder, and the command prints the path.
Options
| Option | What it does |
|---|---|
--snapshot-after |
Print the new page after open, click, type or press. |
--timeout-ms <n> |
How long to wait for pages and elements. The default is 30000. |
--pane <handle> |
Use another browser pane than the one in your tab. |
Good habits for agents
- Read a fresh snapshot before acting, rather than guessing selectors.
- After changing the app,
reloadand checkconsolebefore saying it works. - Use
screenshotwhen the layout matters; a snapshot only has the text. - Avoid
evalunless nothing else works, because it asks you for approval. - If you take control of the page, the agent waits until you hand it back.
Something missing or unclear? Tell us