Headed browsers on remote development servers
--head, --headed, and --human-interaction need a graphical display on the
machine running the CLI. A remote terminal or browser IDE normally has none.
The error mentioning missing DISPLAY and WAYLAND_DISPLAY means Chromium
cannot open a window there.
Setting DISPLAY=:99 alone does not create a display. Xvfb creates a virtual
display, but you also need a viewer to interact with it.
Choose a connectionβ
| Setup | Approach |
|---|---|
| Local graphical desktop | Run the CLI in that desktop's terminal. |
| SSH with a local X server | Use X11 forwarding. |
| VS Code Remote SSH or browser IDE | Run a virtual display and noVNC, then privately forward the viewer port. |
| Unattended CI | Use headless mode and structured handoff results; local takeover requires a terminal and a viewer. |
These are development-machine display options. They do not provide managed Testronaut remote takeover or automatically install a remote-control service.
code-server through Tailscaleβ
If your IDE opens at an address like https://dev-machine.tailnet.ts.net/, use
code-server's authenticated subpath proxy to reach the viewer on the same host.
No separate Tailscale Serve route is needed.
After installing the packages listed below, a checkout of this documentation repository includes a helper that starts an X-authorized display, a password-protected VNC server, and a loopback-only noVNC endpoint:
python3 scripts/dev-browser.py
Run it from the documentation repository in a persistent server terminal. It
requires display :99 and ports 5900/6080 to be free and prints:
- An
environmentfile to source in each mission terminal, setting bothDISPLAYandXAUTHORITY. - A private
passwordfile to read when the viewer asks for its VNC password. - The viewer path:
/proxy/6080/vnc.html?path=proxy/6080/websockify&resize=remote.
Open that path on your existing code-server origin, replacing the IDE's
?folder=... query. For example:
https://dev-machine.tailnet.ts.net/proxy/6080/vnc.html?path=proxy/6080/websockify&resize=remote
The explicit path parameter routes the VNC WebSocket through code-server too.
Sign into code-server first, then enter the generated VNC password in noVNC.
Do not put either password in the URL. The services bind to localhost and use
the existing IDE authentication and Tailscale connection for remote access.
In the mission's terminal, source the exact environment path printed by the helper, then start the CLI:
source /tmp/testronaut-dev-browser.SESSION/environment
npx --no-install testronaut missions/loginMFA.mission.js --human-interaction
Replace SESSION with the actual directory printed at startup. Unlike the
manual setup below, the helper enables X authentication, so setting DISPLAY
alone is insufficient. This still counts as a local CLI browser: the CLI and
browser run together on the dev server, while you view its display remotely.
Stop the helper with Ctrl+C in its terminal or send SIGTERM to the PID it prints. It stops all three services and removes session credentials. The helper does not install a boot service; start it again after a server reboot. Closing the viewer tab does not stop it or pause an active agent.
See code-server's proxy documentation for its authenticated HTTP and WebSocket forwarding behavior.
SSH with X11 forwardingβ
Your computer needs an X server, and the server must permit X11 forwarding and
have xauth installed. Connect from a terminal on your computer:
ssh -X user@dev-server
printenv DISPLAY
npx --no-install testronaut missions/loginMFA.mission.js --human-interaction
SSH sets DISPLAY when forwarding succeeds; do not replace it manually. If
DISPLAY is empty, fix SSH/X-server configuration first. A VS Code integrated
remote terminal does not automatically inherit forwarding from another SSH
connection.
Browser-based viewer on Debian or Ubuntuβ
This example uses Xvfb for the display, x11vnc for desktop input, and noVNC with websockify for the browser viewer. Install the packages on the dev server:
sudo apt-get update
sudo apt-get install xvfb xauth x11vnc novnc websockify
Use three persistent terminals on the server. The example assumes display
:99 and ports 5900 and 6080 are free; choose different values together if
needed. Each service remains in the foreground so Ctrl+C stops that service.
In the first terminal, create a display:
Xvfb :99 -screen 0 1440x900x24 -nolisten tcp
In the second terminal, set a VNC password interactively, then share that display on loopback only. The password file path below is dedicated to this dev viewer:
mkdir -p ~/.vnc
chmod 700 ~/.vnc
x11vnc -storepasswd ~/.vnc/testronaut.pass
x11vnc -display :99 -localhost -rfbport 5900 -forever \
-rfbauth ~/.vnc/testronaut.pass
In the third terminal, expose the noVNC static files and WebSocket bridge on loopback only:
websockify --web=/usr/share/novnc 127.0.0.1:6080 127.0.0.1:5900
Keep both ports private. Anyone allowed to use the viewer can interact with the signed-in browser. On a shared server, use an isolated per-user environment; loopback binding alone does not isolate other server users.
Connect from your computerβ
With VS Code Remote SSH, forward server port 6080 using the Ports panel and
keep its visibility private. With ordinary SSH, run this on your computer:
ssh -N -L 127.0.0.1:6080:127.0.0.1:6080 user@dev-server
Open http://127.0.0.1:6080/vnc.html on your computer, connect, and enter the
VNC password. If an IDE assigns a different local port or a private forwarded
URL, use that address instead. Browser IDEs must support WebSockets and private,
authenticated port forwarding.
Start the missionβ
In another interactive server terminal, from your mission project directory:
DISPLAY=:99 npx --no-install testronaut missions/loginMFA.mission.js --human-interaction
The browser appears in the noVNC tab. Type pause in the mission terminal and
wait for Agent paused before interacting. Type resume in that terminal
to return control. See Human-action handoffs.
After the run, stop websockify, x11vnc, and Xvfb with Ctrl+C in their respective terminals, and close the port forward. Closing the viewer tab alone does not stop the mission or desktop services.
Only need an MFA code?β
A short terminal code prompt does not need a display. Omit both --head and
--human-interaction:
npx --no-install testronaut missions/loginMFA.mission.js
The agent can still request a short code using
request_human_input. It cannot provide live visual
browser takeover in this mode.