Skip to content

Browser

ht browser controls the built-in browser panes. Designed for agents, CI scripts, and visual regression workflows.

Terminal window
ht browser open <url> # open in current pane (creates one if needed)
ht browser open-split <url> # open as a new split
ht browser list # list browser surfaces

Every other command targets a specific browser surface:

Terminal window
ht browser <id> <command> [args]
# example:
ht browser browser:2 navigate https://example.org
ht browser browser:2 click "button[type='submit']"

Inside a browser pane, HT_SURFACE is auto-set so you can omit the id:

Terminal window
ht browser navigate https://example.org # uses HT_SURFACE
CommandPurpose
navigate <url>Go to URL.
goto <url>Alias for navigate.
backHistory back.
forwardHistory forward.
reloadReload the page.
url / get-urlPrint the current URL.
identifySurface id, title, URL.

navigate / goto accept http:// and https:// (including localhost / LAN dev servers), about: (e.g. about:blank), data:, and chrome-extension:// URLs. file:// URLs are intentionally rejected for security — they would let a browser pane read arbitrary local files over the socket.

Terminal window
ht browser browser:1 wait --selector "#dashboard" --timeout-ms 15000
ht browser browser:1 wait --text "Welcome" --timeout-ms 15000
ht browser browser:1 wait --load-state complete

Pick at most one of --selector, --text, --load-state. --timeout-ms defaults to 30000.

CommandArgsPurpose
click <selector>Click.
dblclick <selector>Double click.
hover <selector>Hover.
focus <selector>Focus.
check <selector> / uncheck <selector>Toggle a checkbox.
scroll-into-view <selector>Scroll element into viewport.
type <selector> <text>Type text into focused field.
fill <selector> <text>Set value.
press <key>Send a key (e.g. Enter, Escape, Control+a).
keydown <key> / keyup <key>Lower-level key events.
select <selector> <value>Select an <option>.
scroll <x> <y>Scroll the page.
highlight <selector>Visual highlight (debug).
Terminal window
ht browser browser:1 snapshot # accessibility tree
ht browser browser:1 get title
ht browser browser:1 get url
ht browser browser:1 get text "#welcome" # textContent of selector
ht browser browser:1 get value "#email"
ht browser browser:1 is visible "#dashboard"
ht browser browser:1 is enabled "button[type='submit']"
ht browser browser:1 is checked "#agree"
Terminal window
ht browser browser:1 addscript "console.log('hello')"
ht browser browser:1 addstyle "body { background: red }"
ht browser browser:1 eval "document.title"
ht browser browser:1 eval "await fetch('/api/health').then(r => r.json())"

eval returns the JSON-serialized result. Async expressions are awaited automatically.

addscript, addstyle, and eval reject payloads larger than 256 KiB — this only affects pathologically large scripts or stylesheets.

Terminal window
ht browser browser:1 console # tail console logs
ht browser browser:1 console --clear # clear the buffer
ht browser browser:1 errors # tail JS errors
ht browser browser:1 errors --clear
Terminal window
ht browser browser:1 history # list visited URLs (deduped)
ht browser browser:1 history --search "github"
ht browser browser:1 history --clear
Terminal window
ht browser browser:1 find-in-page "search query"

The cancel half is RPC-only (browser.stop_find) — the cancel button lives in the browser-pane UI, not as a ht verb. See RPC-only methods.

Terminal window
ht browser help
ht browser --help # alias
ht browser -h # alias

Prints the same browser-section block as the global ht --help, scoped to browser subcommands. The default error path (Unknown browser subcommand: …) tells users to run this; it points at a real command.

Terminal window
ht browser browser:1 devtools # toggle WebKit inspector
Terminal window
ht browser browser:1 close

These are top-level hyphenated commands (not ht browser <sub>):

Terminal window
ht browser-cookie-list [domain]
ht browser-cookie-get <url>
ht browser-cookie-set <name> <value> --domain <d> [--path /] [--secure true]
ht browser-cookie-delete <domain> <name>
ht browser-cookie-clear [domain]
ht browser-cookie-import <file> [--format json|netscape]
ht browser-cookie-export [--format json|netscape]
ht browser-cookie-capture [--surface S]

A cookie jar is credentials — treat an export like a password file. Storage is partitioned per browserPartitionMode. See the browser.cookie_* API.

Every ht browser <sub> verb also exists as a flat command, kept so older scripts keep working. They map to the same RPC:

Terminal window
ht browser-open [url] ht browser-navigate <url> ht browser-url
ht browser-split [url] ht browser-back ht browser-forward
ht browser-reload ht browser-close ht browser-eval <js>
ht browser-snapshot ht browser-find <query> ht browser-devtools
ht browser-history ht browser-clear-history

Prefer the ht browser … form in new scripts — it is the one that gets new subcommands.