@testdriverai/agent 7.11.229-canary → 7.11.232-test

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/docs/_data/examples-manifest.json +16 -16
  2. package/docs/_scripts/generate-examples.js +38 -45
  3. package/docs/agent.mdx +174 -93
  4. package/docs/assert.mdx +73 -269
  5. package/docs/aws-setup.mdx +196 -314
  6. package/docs/bring-your-own-machine.mdx +139 -206
  7. package/docs/cache.mdx +144 -151
  8. package/docs/caching.mdx +99 -89
  9. package/docs/captcha.mdx +126 -111
  10. package/docs/ci-cd.mdx +154 -543
  11. package/docs/click.mdx +74 -229
  12. package/docs/client.mdx +177 -231
  13. package/docs/copilot/auto-healing.mdx +86 -370
  14. package/docs/copilot/running-tests.mdx +121 -930
  15. package/docs/customizing-devices.mdx +74 -251
  16. package/docs/dashcam.mdx +72 -405
  17. package/docs/debugging-with-screenshots.mdx +105 -371
  18. package/docs/docs.json +79 -22
  19. package/docs/double-click.mdx +48 -68
  20. package/docs/errors.mdx +102 -176
  21. package/docs/events.mdx +170 -327
  22. package/docs/examples/{hover-text-with-description.mdx → add-to-cart.mdx} +30 -35
  23. package/docs/examples/assert.mdx +28 -41
  24. package/docs/examples/click-button.mdx +71 -0
  25. package/docs/examples/{hover-image.mdx → click-icon.mdx} +32 -28
  26. package/docs/examples/element-not-found.mdx +27 -26
  27. package/docs/examples/findall-coffee-icons.mdx +28 -32
  28. package/docs/examples/installer.mdx +61 -25
  29. package/docs/examples/launch-vscode-linux.mdx +28 -51
  30. package/docs/examples/navigate-and-scroll.mdx +82 -0
  31. package/docs/examples/parse.mdx +24 -28
  32. package/docs/examples/press-keys.mdx +28 -25
  33. package/docs/examples/scroll.mdx +25 -27
  34. package/docs/examples/type.mdx +26 -21
  35. package/docs/exec.mdx +92 -256
  36. package/docs/extract.mdx +69 -170
  37. package/docs/find.mdx +140 -736
  38. package/docs/focus-application.mdx +69 -246
  39. package/docs/generating-tests.mdx +103 -137
  40. package/docs/guide/best-practices-polling.mdx +65 -141
  41. package/docs/hosted.mdx +80 -144
  42. package/docs/hover.mdx +62 -235
  43. package/docs/locating-elements.mdx +74 -369
  44. package/docs/making-assertions.mdx +116 -74
  45. package/docs/mcp-setup.mdx +80 -63
  46. package/docs/mouse-down.mdx +48 -125
  47. package/docs/mouse-up.mdx +47 -129
  48. package/docs/options.mdx +75 -48
  49. package/docs/parse.mdx +95 -184
  50. package/docs/performing-actions.mdx +104 -94
  51. package/docs/press-keys.mdx +59 -299
  52. package/docs/provision.mdx +137 -182
  53. package/docs/quickstart-claude.mdx +85 -0
  54. package/docs/quickstart-github.mdx +62 -32
  55. package/docs/quickstart-manual.mdx +60 -33
  56. package/docs/quickstart-vscode.mdx +97 -0
  57. package/docs/quickstart.mdx +26 -9
  58. package/docs/redraw.mdx +101 -165
  59. package/docs/reusable-code.mdx +97 -200
  60. package/docs/right-click.mdx +47 -89
  61. package/docs/screenshot.mdx +47 -201
  62. package/docs/screenshots.mdx +87 -137
  63. package/docs/scroll.mdx +71 -154
  64. package/docs/secrets.mdx +96 -91
  65. package/docs/self-hosted.mdx +83 -142
  66. package/docs/snippets/enterprise.mdx +15 -0
  67. package/docs/styles.css +68 -0
  68. package/docs/test-results-json.mdx +167 -204
  69. package/docs/type.mdx +56 -304
  70. package/docs/variables.mdx +121 -81
  71. package/docs/wait.mdx +33 -31
  72. package/docs/what-is-testdriver.mdx +80 -32
  73. package/examples/{hover-text-with-description.test.mjs → add-to-cart.test.mjs} +4 -5
  74. package/examples/assert.test.mjs +3 -20
  75. package/examples/{hover-text.test.mjs → click-button.test.mjs} +3 -4
  76. package/examples/{hover-image.test.mjs → click-icon.test.mjs} +5 -6
  77. package/examples/element-not-found.test.mjs +3 -5
  78. package/examples/findall-coffee-icons.test.mjs +3 -3
  79. package/examples/installer.test.mjs +1 -1
  80. package/examples/launch-vscode-linux.test.mjs +6 -33
  81. package/examples/{scroll-keyboard.test.mjs → navigate-and-scroll.test.mjs} +4 -5
  82. package/examples/parse.test.mjs +1 -2
  83. package/examples/press-keys.test.mjs +4 -4
  84. package/examples/scroll.test.mjs +3 -6
  85. package/examples/type.test.mjs +5 -2
  86. package/lib/provision.js +6 -2
  87. package/package.json +1 -1
  88. package/sdk.d.ts +4 -2
  89. package/sdk.js +1 -1
  90. package/docs/claude-mcp-plugin.mdx +0 -244
  91. package/docs/elements.mdx +0 -606
  92. package/docs/examples/ai.mdx +0 -78
  93. package/docs/examples/captcha-api.mdx +0 -92
  94. package/docs/examples/chrome-extension.mdx +0 -156
  95. package/docs/examples/drag-and-drop.mdx +0 -100
  96. package/docs/examples/formatted-logging.mdx +0 -74
  97. package/docs/examples/hover-text.mdx +0 -70
  98. package/docs/examples/match-image.mdx +0 -97
  99. package/docs/examples/scroll-keyboard.mdx +0 -80
  100. package/docs/examples/scroll-until-text.mdx +0 -109
@@ -1,112 +1,90 @@
1
1
  ---
2
- title: "Run on Your Own Machine"
3
- sidebarTitle: "Your Own Machine"
4
- description: "Run the TestDriver runner on a laptop, desktop, or VM you control and drive it from your tests."
2
+ title: "Run tests on your own machine"
3
+ sidebarTitle: "Your own machine"
4
+ description: "Run the TestDriver runner on a laptop, desktop, or VM you control, and point your tests at it."
5
5
  icon: "display"
6
6
  ---
7
7
 
8
- 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.
8
+ import { EnterpriseBadge, EnterpriseCta } from '/snippets/enterprise.mdx';
9
9
 
10
- 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.
10
+ Run your tests on a machine you control instead of a cloud sandbox. It can be a laptop, a lab machine, or a VM in your own data center.
11
11
 
12
- ```mermaid
13
- graph LR
14
- A[Your Test] --> B[TestDriver API]
15
- B --> C[Ably Channel]
16
- C --> D[Runner on your machine]
17
- D --> C
18
- ```
12
+ Use it when the cloud can't reproduce the machine under test, for example:
19
13
 
20
- <Note>
21
- 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.
22
- </Note>
14
+ - Specific hardware, or a device plugged in over USB.
15
+ - A licensed desktop app.
16
+ - An app that only reaches your internal network.
23
17
 
24
- ## Choose your path
18
+ The machine runs the TestDriver **runner**. Your test sends commands to it through the TestDriver API.
25
19
 
26
- | Your machine | Use |
27
- |---|---|
28
- | Windows EC2 instance in your AWS account | [AWS Setup Guide](/aws-setup). Instances are spawned and provisioned automatically. |
29
- | Any other machine (macOS, Linux, Windows, on-prem VM) | This guide. You start the runner yourself. |
20
+ <EnterpriseCta feature="Running tests on your own machines" />
21
+
22
+ <Note>
23
+ The runner only makes outbound connections, to the TestDriver API and to Ably for realtime messages. You don't need to open an inbound port.
24
+ </Note>
30
25
 
31
- <Tip>
32
- If you want unlimited execution, assisted setup, and custom VM images, see [Self-Hosted (Enterprise)](/self-hosted).
33
- </Tip>
26
+ For Windows EC2 instances that start and stop automatically, use the [AWS setup](/aws-setup) instead.
34
27
 
35
- ## Prerequisites
28
+ ## Before you begin
36
29
 
37
- Every machine that runs the runner needs:
30
+ The machine needs:
38
31
 
39
- - **Node.js 18 or newer**
40
- - **Python 3** with `pyautogui` and `Pillow`
41
- - **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.
42
- - **Google Chrome** on the `PATH`, if your tests launch a browser
43
- - Outbound HTTPS and WebSocket access to `api.testdriver.ai` and `*.ably.io`
32
+ - **Node.js 18 or newer.**
33
+ - **Python 3** with `pyautogui` and `Pillow`. The runner uses them for the mouse, keyboard, and screenshots.
34
+ - **An unlocked desktop session.** The runner drives the real screen, so turn off sleep, screen savers, and lock timers.
35
+ - **Outbound HTTPS and WebSocket access** to `api.testdriver.ai` and `*.ably.io`.
36
+ - **`curl` and `jq`**, to register the machine in step 2.
44
37
 
45
- Install the Python dependencies:
38
+ You also need your TestDriver API key in `TD_API_KEY`. Copy it from the [API keys page](https://console.testdriver.ai/team/api-keys).
46
39
 
47
40
  <Tabs>
48
41
  <Tab title="macOS">
42
+
49
43
  ```bash
50
- brew install python
51
44
  pip3 install pyautogui Pillow
52
45
  ```
46
+
47
+ macOS blocks synthetic input and screen capture until you allow them. Open **System Settings → Privacy & Security** and add the terminal app that starts the runner to both lists:
48
+
49
+ - **Accessibility**, so the runner can move the mouse and type.
50
+ - **Screen Recording**, so the runner can take screenshots.
51
+
52
+ Quit and reopen the terminal after you change these settings.
53
+
53
54
  </Tab>
54
55
  <Tab title="Linux">
56
+
55
57
  ```bash
56
58
  sudo apt-get install -y python3-pip python3-xlib
57
59
  pip3 install pyautogui Pillow
58
60
  ```
59
- </Tab>
60
- <Tab title="Windows">
61
- ```powershell
62
- pip install pyautogui Pillow
63
- ```
64
- </Tab>
65
- </Tabs>
66
61
 
67
- ### Platform notes
68
-
69
- <AccordionGroup>
70
- <Accordion title="macOS: grant Accessibility and Screen Recording permissions">
71
- macOS blocks synthetic input and screen capture until you allow it explicitly. Without this the runner connects but every click and screenshot silently fails.
72
-
73
- Open **System Settings → Privacy & Security** and add your terminal application (Terminal, iTerm, or whichever app starts the runner) to **both**:
74
-
75
- - **Accessibility** (lets the runner move the mouse and type)
76
- - **Screen Recording** (lets the runner take screenshots)
77
-
78
- Quit and reopen the terminal after granting permissions, otherwise the old process keeps the old denial.
79
-
80
- 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.
81
- </Accordion>
82
-
83
- <Accordion title="Linux: provide a display">
84
- 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:
62
+ The runner needs an X11 display. It uses `:0` unless `DISPLAY` is set. On a server without a desktop, start a virtual display first:
85
63
 
86
64
  ```bash
87
- sudo apt-get install -y xvfb xfce4 xfce4-terminal dbus-x11 wmctrl
65
+ sudo apt-get install -y xvfb xfce4 dbus-x11
88
66
  Xvfb :0 -screen 0 1366x768x24 &
89
- export DISPLAY=:0
67
+ DISPLAY=:0 startxfce4 &
90
68
  ```
91
69
 
92
- To watch the session, add a VNC server and noVNC:
70
+ Turn off screen blanking so the desktop stays visible:
93
71
 
94
72
  ```bash
95
- sudo apt-get install -y x11vnc novnc websockify
96
- x11vnc -display :0 -forever -shared &
73
+ export DISPLAY=:0
74
+ xset s off && xset s noblank && xset -dpms
97
75
  ```
98
76
 
99
- Disable screen blanking so the desktop stays visible:
77
+ </Tab>
78
+ <Tab title="Windows">
100
79
 
101
- ```bash
102
- xset s off && xset s noblank && xset -dpms
80
+ ```powershell
81
+ pip install pyautogui Pillow
103
82
  ```
104
- </Accordion>
105
83
 
106
- <Accordion title="Windows: keep the console session active">
107
- 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.
108
- </Accordion>
109
- </AccordionGroup>
84
+ Run the runner in a console or RDP session that stays signed in. If the session locks or disconnects, Windows tears down the desktop and automation stops. Set the machine to sign in automatically and turn off the lock screen.
85
+
86
+ </Tab>
87
+ </Tabs>
110
88
 
111
89
  ## Step 1: Install the runner
112
90
 
@@ -114,208 +92,163 @@ Install the Python dependencies:
114
92
  npm install -g @testdriverai/runner
115
93
  ```
116
94
 
117
- This installs two commands. You use `testdriver-sandbox-agent`, which connects your machine to a TestDriver session.
118
-
119
- Verify the install:
120
-
121
- ```bash
122
- testdriver-sandbox-agent --help || echo "installed"
123
- ```
95
+ This installs the `testdriver-sandbox-agent` command, which connects the machine to a TestDriver session.
124
96
 
125
97
  ## Step 2: Register the machine
126
98
 
127
- Ask the API for a session bound to your machine's IP address:
99
+ Ask the API for a session on this machine. Replace `192.168.1.50` with the machine's IP address, and set `os` to `windows` on a Windows machine:
128
100
 
129
101
  ```bash
130
- curl -X POST https://api.testdriver.ai/api/v7/sandbox/authenticate \
102
+ curl -sS -X POST https://api.testdriver.ai/api/v7/sandbox/authenticate \
131
103
  -H "Content-Type: application/json" \
132
- -d '{
133
- "apiKey": "your_api_key",
134
- "ip": "192.168.1.50",
135
- "os": "linux",
136
- "keepAlive": 900000
137
- }'
104
+ -d "{
105
+ \"apiKey\": \"$TD_API_KEY\",
106
+ \"apiRoot\": \"https://api.testdriver.ai\",
107
+ \"ip\": \"192.168.1.50\",
108
+ \"os\": \"linux\",
109
+ \"keepAlive\": 900000
110
+ }" > td-session.json
138
111
  ```
139
112
 
140
- The response contains the sandbox ID and the Ably credentials the runner needs:
141
-
142
- ```json
143
- {
144
- "success": true,
145
- "sandboxId": "sb-69cce96e-1e0",
146
- "agent": {
147
- "token": {
148
- "token": "aFC5YQ.Ki9G9...",
149
- "keyName": "aFC5YQ.ZIdTww",
150
- "issued": 1791908438832,
151
- "expires": 1791930038832,
152
- "capability": "{\"testdriver:...:sb-69cce96e-1e0\":[\"history\",\"presence\",\"publish\",\"subscribe\"]}",
153
- "clientId": "agent-sb-69cce96e-1e0"
154
- },
155
- "channel": "testdriver:...:sb-69cce96e-1e0"
156
- }
157
- }
158
- ```
113
+ The response includes a sandbox ID and an `agentConfig` object with everything the runner needs. Write `agentConfig` to the runner's config file, and print the sandbox ID:
159
114
 
160
- <Note>
161
- Pass `os: "linux"` on macOS. The value only describes the session to the API; the runner detects the real platform itself.
162
- </Note>
163
-
164
- ### Write the config file
165
-
166
- The runner reads its credentials from a JSON file on disk. Copy `sandboxId` and the whole `agent` block into it:
167
-
168
- | Platform | Config file path |
169
- |---|---|
170
- | macOS / Linux | `/tmp/testdriver-agent.json` |
171
- | Windows | `C:\Windows\Temp\testdriver-agent.json` |
172
-
173
- ```json /tmp/testdriver-agent.json
174
- {
175
- "sandboxId": "sb-69cce96e-1e0",
176
- "apiRoot": "https://api.testdriver.ai",
177
- "apiKey": "your_api_key",
178
- "ably": {
179
- "token": {
180
- "token": "aFC5YQ.Ki9G9...",
181
- "keyName": "aFC5YQ.ZIdTww",
182
- "issued": 1791908438832,
183
- "expires": 1791930038832,
184
- "capability": "{\"testdriver:...:sb-69cce96e-1e0\":[\"history\",\"presence\",\"publish\",\"subscribe\"]}",
185
- "clientId": "agent-sb-69cce96e-1e0"
186
- },
187
- "channel": "testdriver:...:sb-69cce96e-1e0"
188
- }
189
- }
115
+ ```bash
116
+ jq '.agentConfig' td-session.json > /tmp/testdriver-agent.json
117
+ chmod 600 /tmp/testdriver-agent.json
118
+ jq -r '.sandboxId' td-session.json
190
119
  ```
191
120
 
192
- | Field | Source | Purpose |
193
- |---|---|---|
194
- | `sandboxId` | `sandboxId` from the response | Identifies this session. Your test attaches to it. |
195
- | `apiRoot` | The API you called | Where the runner uploads screenshots |
196
- | `apiKey` | Your team API key | Authenticates those uploads |
197
- | `ably.token` | `agent.token` from the response, copied verbatim | Realtime credentials |
198
- | `ably.channel` | `agent.channel` from the response | Channel the runner listens on |
121
+ On Windows, run these commands in Git Bash and write the file to `/c/Windows/Temp/testdriver-agent.json` instead.
199
122
 
200
- To put the file somewhere else, set `CONFIG_PATH` to its full path before starting the runner.
123
+ Save the sandbox ID, such as `sb-69cce96e-1e0`, for step 4.
201
124
 
202
125
  <Warning>
203
- 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.
126
+ The config file contains your API key and a session token. Keep it readable only by the user who runs the runner, and never commit it.
204
127
  </Warning>
205
128
 
129
+ To keep the config file somewhere else, set `CONFIG_PATH` to its full path before you start the runner.
130
+
131
+ A registered machine uses one of your plan's concurrency slots while its session is open.
132
+
206
133
  ## Step 3: Start the runner
207
134
 
208
135
  ```bash
209
136
  testdriver-sandbox-agent
210
137
  ```
211
138
 
212
- You should see the runner connect and announce itself:
139
+ The runner reads the config file, connects, and waits for commands:
213
140
 
141
+ ```text
142
+ [2026-10-21T15:04:05.000Z] TestDriver Sandbox Agent starting...
143
+ [2026-10-21T15:04:05.100Z] Sandbox ID: sb-69cce96e-1e0
144
+ [2026-10-21T15:04:05.100Z] Transport: Ably
145
+ [2026-10-21T15:04:06.200Z] Automation module initialized
146
+ [2026-10-21T15:04:07.300Z] Agent ready — listening for commands via Ably
214
147
  ```
215
- [agent] TestDriver Sandbox Agent starting...
216
- [agent] Sandbox ID: sb-69cce96e-1e0
217
- [agent] Transport: Ably
218
- [agent] Automation module initialized
219
- [realtime] Publishing control: type=runner.ready
220
- [agent] Agent ready — listening for commands via Ably
221
- ```
222
-
223
- Leave this process running. On Linux, set `DISPLAY` first:
224
148
 
225
- ```bash
226
- DISPLAY=:0 testdriver-sandbox-agent
227
- ```
149
+ Leave it running. If the config file doesn't exist yet, the runner waits up to 5 minutes for it.
228
150
 
229
151
  ## Step 4: Point your test at the machine
230
152
 
231
- Pass the machine's `ip` and the sandbox ID from step 2:
153
+ Pass the machine's `ip` and the `sandboxId` from step 2 to `TestDriver()`. Setting `sandboxId` stops TestDriver from creating a cloud sandbox.
232
154
 
233
155
  ```javascript tests/my-machine.test.mjs
234
- import { describe, expect, it } from "vitest";
235
- import { TestDriver } from "testdriverai/vitest/hooks";
156
+ import { describe, it } from 'vitest';
157
+ import { TestDriver } from 'testdriverai/vitest/hooks';
236
158
 
237
- describe("My machine", () => {
238
- it("runs against my own hardware", async (context) => {
239
- const testdriver = TestDriver(context, { newSandbox: false });
240
-
241
- await testdriver.connect({
159
+ describe('My machine', () => {
160
+ it('signs in to the desktop app', async (context) => {
161
+ const testdriver = TestDriver(context, {
242
162
  ip: process.env.TD_MACHINE_IP,
243
163
  sandboxId: process.env.TD_SANDBOX_ID,
244
164
  });
245
165
 
246
- const button = await testdriver.find("Sign In button");
247
- await button.click();
248
-
249
- const result = await testdriver.assert("the dashboard is visible");
250
- expect(result).toBeTruthy();
166
+ await testdriver.find('Sign in button').click();
167
+ await testdriver.assert('the dashboard is visible');
251
168
  });
252
169
  });
253
170
  ```
254
171
 
255
- Run it:
172
+ On a Windows machine, also pass `os: 'windows'`.
173
+
174
+ <Warning>
175
+ Run these tests with the `CI` environment variable unset. When `CI` is set, TestDriver always requests a new sandbox and ignores `sandboxId`, so the test waits for a runner that never connects.
176
+ </Warning>
177
+
178
+ Run the test from any computer:
256
179
 
257
180
  ```bash
258
- TD_MACHINE_IP=192.168.1.50 TD_SANDBOX_ID=sb-69cce96e-1e0 vitest run
181
+ TD_MACHINE_IP=192.168.1.50 TD_SANDBOX_ID=sb-69cce96e-1e0 npx vitest run
259
182
  ```
260
183
 
261
- <Note>
262
- `newSandbox: false` stops the SDK from provisioning a cloud sandbox. Without it, your test runs in the cloud and ignores your machine.
263
- </Note>
264
-
265
- <Note>
266
- 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.
267
- </Note>
184
+ Each registration covers one session. When the test disconnects, the session ends. Repeat steps 2 and 3 before the next run.
268
185
 
269
186
  ## Logs
270
187
 
271
188
  | Platform | Runner log |
272
- |---|---|
273
- | macOS / Linux | `/tmp/testdriver-agent.log` |
189
+ | --- | --- |
190
+ | macOS and Linux | `/tmp/testdriver-agent.log` |
274
191
  | Windows | `C:\Windows\Temp\testdriver-agent.log` |
275
192
 
276
- 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.
193
+ The runner also writes `testdriver-agent-status.json` in the same folder, with the sandbox ID, process ID, IP address, and start time.
277
194
 
278
195
  ## Security
279
196
 
280
- - **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.
281
- - **Treat the config file as a secret.** It contains a session token and your API key.
282
- - **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.
283
- - **Rotate your API key** if a machine is decommissioned or shared.
197
+ - **Use a dedicated machine or user account.** The runner can click anything on the desktop and run shell commands sent by your tests.
198
+ - **Treat the config file as a secret.** It contains your API key and a session token.
199
+ - **Keep VNC private.** If you add a VNC server for debugging, expose it only on localhost or your VPN.
200
+ - **Rotate your API key** on the [API keys page](https://console.testdriver.ai/team/api-keys) when you retire or share a machine.
284
201
 
285
202
  ## Troubleshooting
286
203
 
287
204
  <AccordionGroup>
288
205
  <Accordion title="Sandbox has expired and is no longer available">
289
- 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.
290
- </Accordion>
291
206
 
292
- <Accordion title="Runner starts but clicks and screenshots do nothing (macOS)">
293
- 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.
207
+ The session ended, which happens after a test disconnects or the session's `keepAlive` runs out. Repeat steps 2 and 3 for a fresh sandbox ID, and use the new ID in your test.
208
+
294
209
  </Accordion>
210
+ <Accordion title="The runner connects, but clicks and screenshots do nothing (macOS)">
211
+
212
+ Accessibility or Screen Recording permission is missing. Add your terminal app to both lists in **System Settings → Privacy & Security**, then quit and reopen it.
295
213
 
296
- <Accordion title="Waiting for config file">
297
- 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`.
298
214
  </Accordion>
215
+ <Accordion title="Config file not found after 300s">
216
+
217
+ The runner couldn't find the config file. Write it on the same machine, readable by the user who starts the runner, or set `CONFIG_PATH` to where it is.
299
218
 
300
- <Accordion title="Test provisions a cloud sandbox instead of using my machine">
301
- 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.
302
219
  </Accordion>
220
+ <Accordion title="The test runs in a cloud sandbox instead">
221
+
222
+ Check that both `TD_MACHINE_IP` and `TD_SANDBOX_ID` are set when you run the test. If `sandboxId` is undefined, TestDriver creates a cloud sandbox.
303
223
 
304
- <Accordion title="Invalid API key">
305
- Confirm `TD_API_KEY` matches the environment in `TD_API_ROOT`. Keys are scoped per environment. Get your key at [console.testdriver.ai/team](https://console.testdriver.ai/team).
306
224
  </Accordion>
225
+ <Accordion title="Screenshots are blank or frozen (Linux)">
226
+
227
+ `DISPLAY` points at a display with no desktop, or the screen blanked. Start a desktop on that display and turn off blanking with `xset s off && xset s noblank && xset -dpms`.
307
228
 
308
- <Accordion title="Screenshots are blank or show a frozen desktop (Linux)">
309
- `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`.
310
229
  </Accordion>
311
230
  </AccordionGroup>
312
231
 
313
- ## Environment variables
314
-
315
- | Variable | Default | Purpose |
316
- |---|---|---|
317
- | `TD_API_KEY` | Required | Your team API key |
318
- | `TD_API_ROOT` | `https://api.testdriver.ai` | API server to register with |
319
- | `CONFIG_PATH` | `/tmp/testdriver-agent.json` | Override the runner config file location |
320
- | `DISPLAY` | `:0` | X11 display (Linux) |
321
- | `SENTRY_DSN` | Unset | Error reporting endpoint |
232
+ ## Runner environment variables
233
+
234
+ | Variable | Default | Description |
235
+ | --- | --- | --- |
236
+ | `CONFIG_PATH` | `/tmp/testdriver-agent.json`, or `C:\Windows\Temp\testdriver-agent.json` on Windows | Where the runner reads its config file |
237
+ | `DISPLAY` | `:0` | The X11 display to drive (Linux) |
238
+
239
+ ## Next steps
240
+
241
+ <CardGroup cols={2}>
242
+ <Card title="Self-host on AWS" icon="aws" href="/aws-setup">
243
+ Start a fresh Windows EC2 instance for each test.
244
+ </Card>
245
+ <Card title="Self-hosted" icon="server" href="/self-hosted">
246
+ What the Enterprise plan includes.
247
+ </Card>
248
+ <Card title="Locate elements" icon="crosshairs" href="/locating-elements">
249
+ Describe elements so TestDriver finds them on any screen.
250
+ </Card>
251
+ <Card title="Make assertions" icon="circle-check" href="/making-assertions">
252
+ Check that your app reached the right state.
253
+ </Card>
254
+ </CardGroup>