REPL¶
The wavexis repl command launches an interactive shell for live browser sessions. It opens a non-headless browser and lets you execute commands in real time — navigate, click, type, take screenshots, evaluate JavaScript, and inspect page state without writing scripts.
When to use the REPL¶
The REPL is designed for interactive exploration and debugging. Use it when you need to:
- Explore a page before writing a multi-action config — test selectors, check element visibility, verify JavaScript expressions.
- Debug automation flows — step through actions one at a time and observe the browser visually.
- Inspect page state — check cookies, URL, title, or evaluate arbitrary JavaScript on the current page.
- Prototype sequences — try click → type → screenshot interactively, then encode the working sequence into a YAML config.
Launching¶
This opens a Chrome window (non-headless) and starts the interactive prompt:
Commands¶
The REPL supports 16 commands, each mapping to a backend operation:
| Command | Syntax | Description |
|---|---|---|
navigate |
navigate <url> |
Navigate to a URL |
screenshot |
screenshot [filename] |
Take a screenshot, save to file or screenshot.png |
eval |
eval <expression> |
Evaluate a JavaScript expression |
click |
click <selector> |
Click an element by CSS selector |
type |
type <selector> <text> |
Type text into an input element |
fill |
fill <selector> <text> |
Fill an input element (replaces content) |
hover |
hover <selector> |
Hover over an element |
key |
key <key> |
Press a keyboard key (e.g. Enter, Tab) |
cookies |
cookies |
Get all cookies for the current page |
url |
url |
Print the current page URL |
title |
title |
Print the current page title |
wait |
wait <seconds> |
Wait for a specified duration |
back |
back |
Navigate back in browser history |
forward |
forward |
Navigate forward in browser history |
reload |
reload |
Reload the current page |
help |
help |
Show available commands |
exit |
exit or quit |
Exit the REPL |
Examples¶
Basic navigation and inspection¶
wavexis> navigate https://example.com
wavexis> title
Example Domain
wavexis> url
https://example.com/
wavexis> eval document.querySelector('h1').textContent
Example Domain
Form interaction¶
wavexis> navigate https://example.com/login
wavexis> type #username admin@example.com
wavexis> type #password secret123
wavexis> click #login-button
wavexis> wait 2
wavexis> title
Dashboard - Example App
wavexis> screenshot dashboard.png
Cookie inspection¶
wavexis> navigate https://example.com
wavexis> cookies
[{"name": "session", "value": "abc123", "domain": ".example.com", ...}]
Keyboard input¶
wavexis> navigate https://example.com/search
wavexis> type #search-input hello world
wavexis> key Enter
wavexis> wait 1
wavexis> screenshot results.png
How it works¶
The REPL uses an async event loop that:
- Launches a non-headless browser via the configured backend (CDP or BiDi).
- Reads input from stdin, parses it with
shlex.splitfor proper quoting. - Dispatches the command to the corresponding backend method.
- Prints the result (or saves to file for screenshots).
- Loops until
exit/quitor EOF.
The browser stays open for the duration of the session, so you can chain commands without re-launching. This makes the REPL significantly faster than running individual CLI commands for exploratory work.
Tips¶
- Selectors — Use CSS selectors (e.g.
#id,.class,tag). Quote selectors with special characters:click "button[data-action='submit']". - Multi-word text — The
typeandfillcommands accept text with spaces. The REPL usesshlex.splitso you can quote:type #input "hello world". - Screenshots — Without a filename, screenshots are saved to
screenshot.png. Provide a path to customize:screenshot /tmp/page.png. - Backend selection — Use
--backend bidito launch the REPL with the BiDi backend:wavexis --backend bidi repl.