Skip to main content
TestDriver normally provisions a cloud sandbox for you. You can instead run the runner on a machine you own: a developer laptop, an office Mac, a lab Windows box, or a VM in your own data center. Your tests then drive that machine instead of a cloud sandbox. This is useful when the machine under test cannot be replicated in the cloud: specific hardware, a licensed desktop application, a device plugged into USB, or an app that only reaches an internal network.
The runner only makes outbound connections, to the TestDriver API and to Ably. You do not need to open an inbound port or expose the machine to the internet.

Choose your path

If you want unlimited execution, assisted setup, and custom VM images, see Self-Hosted (Enterprise).

Prerequisites

Every machine that runs the runner needs:
  • Node.js 18 or newer
  • Python 3 with pyautogui and Pillow
  • A real, unlocked desktop session. The runner drives the mouse and keyboard, so the screen must be awake and not locked. Disable screen savers, sleep, and lock timers.
  • Google Chrome on the PATH, if your tests launch a browser
  • Outbound HTTPS and WebSocket access to api.testdriver.ai and *.ably.io
Install the Python dependencies:

Platform notes

macOS blocks synthetic input and screen capture until you allow it explicitly. Without this the runner connects but every click and screenshot silently fails.Open System Settings → Privacy & Security and add your terminal application (Terminal, iTerm, or whichever app starts the runner) to both:
  • Accessibility (lets the runner move the mouse and type)
  • Screen Recording (lets the runner take screenshots)
Quit and reopen the terminal after granting permissions, otherwise the old process keeps the old denial.On Retina displays, screenshots are captured at physical pixels and downscaled to logical points so that coordinates returned by the AI line up with where clicks actually land. No configuration is needed.
The runner needs an X11 display. On a desktop machine, set DISPLAY to your existing session. On a headless server, start a virtual framebuffer first:
To watch the session, add a VNC server and noVNC:
Disable screen blanking so the desktop stays visible:
Run the runner in a console or RDP session that stays signed in. If the session locks or disconnects, the desktop is torn down and automation stops. Configure the machine to auto-logon and disable the lock screen timeout.

Step 1: Install the runner

This installs two commands. You use testdriver-sandbox-agent, which connects your machine to a TestDriver session. Verify the install:

Step 2: Register the machine

Ask the API for a session bound to your machine’s IP address:
The response contains the sandbox ID and the Ably credentials the runner needs:
Pass os: "linux" on macOS. The value only describes the session to the API; the runner detects the real platform itself.

Write the config file

The runner reads its credentials from a JSON file on disk. Copy sandboxId and the whole agent block into it:
/tmp/testdriver-agent.json
To put the file somewhere else, set CONFIG_PATH to its full path before starting the runner.
This file holds a session token and your API key. Keep it readable only by the user running the runner, do not commit it, and delete it when the machine is no longer in use.

Step 3: Start the runner

You should see the runner connect and announce itself:
Leave this process running. On Linux, set DISPLAY first:

Step 4: Point your test at the machine

Pass the machine’s ip and the sandbox ID from step 2:
tests/my-machine.test.mjs
Run it:
newSandbox: false stops the SDK from provisioning a cloud sandbox. Without it, your test runs in the cloud and ignores your machine.
Each config file covers one session. The Ably token in it expires (see its expires field), so repeat steps 2 and 3 to get fresh credentials before the next run.

Logs

The runner also writes a status file next to the log (testdriver-agent-status.json) with the sandbox ID, process ID, detected IP, and start time.

Security

  • Use a dedicated machine or user account. The runner can click anything on the desktop and run shell commands sent by your tests. Do not point it at a machine holding personal credentials or production access.
  • Treat the config file as a secret. It contains a session token and your API key.
  • Do not expose VNC to the internet. If you add VNC for debugging, bind it to localhost or your VPN and tunnel in over SSH.
  • Rotate your API key if a machine is decommissioned or shared.

Troubleshooting

The session ended, which happens when the runner stops or your test disconnects. Repeat step 2 to get a fresh sandbox ID and token, update the config file, restart the runner, and use the new ID in your test.
Accessibility or Screen Recording permission is missing. Add your terminal application to both lists under System Settings → Privacy & Security, then fully quit and reopen the terminal.
The runner cannot find /tmp/testdriver-agent.json (or C:\Windows\Temp\testdriver-agent.json). Write the config file on the same machine and readable by the same user that starts the runner. To use a different location, set CONFIG_PATH.
Pass newSandbox: false to TestDriver() and make sure both ip and sandboxId reach connect(). If either is undefined, the SDK falls back to cloud provisioning.
Confirm TD_API_KEY matches the environment in TD_API_ROOT. Keys are scoped per environment. Get your key at console.testdriver.ai/team.
DISPLAY points at a display with no desktop running, or the screen blanked. Start a desktop on that display and disable blanking with xset s off && xset s noblank && xset -dpms.

Environment variables