testdriverai 7.3.11 → 7.3.13
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.
- package/.github/skills/testdriver:ai/SKILL.md +204 -0
- package/.github/skills/testdriver:assert/SKILL.md +284 -0
- package/.github/skills/testdriver:aws-setup/SKILL.md +515 -0
- package/.github/skills/testdriver:caching/SKILL.md +124 -0
- package/.github/skills/testdriver:captcha/SKILL.md +159 -0
- package/.github/skills/testdriver:ci-cd/SKILL.md +602 -0
- package/.github/skills/testdriver:click/SKILL.md +286 -0
- package/.github/skills/testdriver:client/SKILL.md +339 -0
- package/.github/skills/testdriver:cloud/SKILL.md +119 -0
- package/.github/skills/testdriver:customizing-devices/SKILL.md +153 -0
- package/.github/skills/testdriver:dashcam/SKILL.md +418 -0
- package/.github/skills/testdriver:debugging-with-screenshots/SKILL.md +271 -0
- package/.github/skills/testdriver:device-config/SKILL.md +317 -0
- package/.github/skills/testdriver:double-click/SKILL.md +102 -0
- package/.github/skills/testdriver:elements/SKILL.md +605 -0
- package/.github/skills/testdriver:enterprise/SKILL.md +114 -0
- package/.github/skills/testdriver:examples/SKILL.md +7 -0
- package/.github/skills/testdriver:exec/SKILL.md +345 -0
- package/.github/skills/testdriver:find/SKILL.md +721 -0
- package/.github/skills/testdriver:focus-application/SKILL.md +293 -0
- package/.github/skills/testdriver:generating-tests/SKILL.md +36 -0
- package/.github/skills/testdriver:hover/SKILL.md +278 -0
- package/.github/skills/testdriver:locating-elements/SKILL.md +71 -0
- package/.github/skills/testdriver:making-assertions/SKILL.md +32 -0
- package/.github/skills/testdriver:mcp-workflow/SKILL.md +410 -0
- package/.github/skills/testdriver:mouse-down/SKILL.md +161 -0
- package/.github/skills/testdriver:mouse-up/SKILL.md +164 -0
- package/.github/skills/testdriver:performing-actions/SKILL.md +51 -0
- package/.github/skills/testdriver:press-keys/SKILL.md +348 -0
- package/.github/skills/testdriver:quickstart/SKILL.md +161 -0
- package/.github/skills/testdriver:reusable-code/SKILL.md +240 -0
- package/.github/skills/testdriver:right-click/SKILL.md +123 -0
- package/.github/skills/testdriver:running-tests/SKILL.md +181 -0
- package/.github/skills/testdriver:screenshot/SKILL.md +167 -0
- package/.github/skills/testdriver:scroll/SKILL.md +299 -0
- package/.github/skills/testdriver:secrets/SKILL.md +115 -0
- package/.github/skills/testdriver:self-hosted/SKILL.md +65 -0
- package/.github/skills/testdriver:test-writer/SKILL.md +451 -0
- package/.github/skills/testdriver:testdriver/SKILL.md +523 -0
- package/.github/skills/testdriver:testdriver-mechanic/SKILL.md +165 -0
- package/.github/skills/testdriver:type/SKILL.md +357 -0
- package/.github/skills/testdriver:variables/SKILL.md +111 -0
- package/.github/skills/testdriver:waiting-for-elements/SKILL.md +66 -0
- package/.github/skills/testdriver:what-is-testdriver/SKILL.md +54 -0
- package/.github/workflows/acceptance-windows-scheduled.yaml +6 -1
- package/.github/workflows/acceptance.yaml +0 -36
- package/.github/workflows/update-examples.yaml +53 -0
- package/CHANGELOG.md +8 -0
- package/agent/events.js +1 -0
- package/agent/index.js +8 -0
- package/agent/lib/commands.js +48 -29
- package/agent/lib/redraw.js +3 -1
- package/agent/lib/sandbox.js +166 -14
- package/agent/lib/sdk.js +142 -3
- package/agent/lib/system.js +4 -6
- package/ai/skills/testdriver:ai/SKILL.md +204 -0
- package/ai/skills/testdriver:assert/SKILL.md +315 -0
- package/ai/skills/testdriver:aws-setup/SKILL.md +448 -0
- package/ai/skills/testdriver:caching/SKILL.md +124 -0
- package/ai/skills/testdriver:captcha/SKILL.md +159 -0
- package/ai/skills/testdriver:ci-cd/SKILL.md +602 -0
- package/ai/skills/testdriver:click/SKILL.md +286 -0
- package/ai/skills/testdriver:client/SKILL.md +372 -0
- package/ai/skills/testdriver:cloud/SKILL.md +119 -0
- package/ai/skills/testdriver:customizing-devices/SKILL.md +153 -0
- package/ai/skills/testdriver:dashcam/SKILL.md +418 -0
- package/ai/skills/testdriver:debugging-with-screenshots/SKILL.md +401 -0
- package/ai/skills/testdriver:device-config/SKILL.md +317 -0
- package/ai/skills/testdriver:double-click/SKILL.md +102 -0
- package/ai/skills/testdriver:elements/SKILL.md +605 -0
- package/ai/skills/testdriver:enterprise/SKILL.md +114 -0
- package/ai/skills/testdriver:examples/SKILL.md +7 -0
- package/ai/skills/testdriver:exec/SKILL.md +345 -0
- package/ai/skills/testdriver:find/SKILL.md +745 -0
- package/ai/skills/testdriver:focus-application/SKILL.md +293 -0
- package/ai/skills/testdriver:generating-tests/SKILL.md +36 -0
- package/ai/skills/testdriver:hover/SKILL.md +278 -0
- package/ai/skills/testdriver:locating-elements/SKILL.md +71 -0
- package/ai/skills/testdriver:making-assertions/SKILL.md +32 -0
- package/ai/skills/testdriver:mcp-workflow/SKILL.md +410 -0
- package/ai/skills/testdriver:mouse-down/SKILL.md +161 -0
- package/ai/skills/testdriver:mouse-up/SKILL.md +164 -0
- package/ai/skills/testdriver:ocr/SKILL.md +235 -0
- package/ai/skills/testdriver:performing-actions/SKILL.md +51 -0
- package/ai/skills/testdriver:press-keys/SKILL.md +348 -0
- package/ai/skills/testdriver:quickstart/SKILL.md +146 -0
- package/ai/skills/testdriver:reusable-code/SKILL.md +240 -0
- package/ai/skills/testdriver:right-click/SKILL.md +123 -0
- package/ai/skills/testdriver:running-tests/SKILL.md +185 -0
- package/ai/skills/testdriver:screenshot/SKILL.md +248 -0
- package/ai/skills/testdriver:scroll/SKILL.md +335 -0
- package/ai/skills/testdriver:secrets/SKILL.md +115 -0
- package/ai/skills/testdriver:self-hosted/SKILL.md +65 -0
- package/ai/skills/testdriver:test-writer/SKILL.md +451 -0
- package/ai/skills/testdriver:testdriver/SKILL.md +631 -0
- package/ai/skills/testdriver:testdriver-mechanic/SKILL.md +165 -0
- package/ai/skills/testdriver:type/SKILL.md +357 -0
- package/ai/skills/testdriver:variables/SKILL.md +111 -0
- package/ai/skills/testdriver:waiting-for-elements/SKILL.md +66 -0
- package/ai/skills/testdriver:what-is-testdriver/SKILL.md +54 -0
- package/debugger/index.html +12 -2
- package/docs/v7/examples/scroll-keyboard.mdx +1 -1
- package/docs/v7/find.mdx +1 -0
- package/examples/config.mjs +1 -1
- package/examples/findall-coffee-icons.test.mjs +42 -0
- package/examples/flake-diffthreshold-001.test.mjs +9 -0
- package/examples/flake-diffthreshold-01.test.mjs +9 -0
- package/examples/flake-diffthreshold-05.test.mjs +9 -0
- package/examples/{z_flake-noredraw-cache.test.mjs → flake-noredraw-cache.test.mjs} +2 -2
- package/examples/{z_flake-noredraw-nocache.test.mjs → flake-noredraw-nocache.test.mjs} +2 -2
- package/examples/{z_flake-redraw-cache.test.mjs → flake-redraw-cache.test.mjs} +2 -2
- package/examples/{z_flake-redraw-nocache.test.mjs → flake-redraw-nocache.test.mjs} +2 -2
- package/examples/flake-rocket-match.test.mjs +30 -0
- package/examples/{z_flake-shared.mjs → flake-shared.mjs} +2 -2
- package/examples/parse.test.mjs +19 -0
- package/examples/scroll-keyboard.test.mjs +1 -1
- package/interfaces/cli/lib/base.js +6 -0
- package/interfaces/logger.js +51 -13
- package/interfaces/vitest-plugin.mjs +137 -0
- package/lib/core/index.d.ts +22 -0
- package/lib/init-project.js +105 -6
- package/lib/vitest/hooks.mjs +2 -5
- package/lib/vitest/setup-disable-defender.mjs +52 -0
- package/package.json +2 -1
- package/sdk-log-formatter.js +90 -0
- package/sdk.d.ts +88 -51
- package/sdk.js +128 -21
- package/setup/aws/disable-defender.sh +42 -0
- package/vitest.config.mjs +1 -3
- package/examples/z_flake-diffthreshold-001.test.mjs +0 -9
- package/examples/z_flake-diffthreshold-01.test.mjs +0 -9
- package/examples/z_flake-diffthreshold-05.test.mjs +0 -9
- /package/{examples → manual}/captcha-api.test.mjs +0 -0
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: testdriver:exec
|
|
3
|
+
description: Execute code or shell commands in the sandbox
|
|
4
|
+
---
|
|
5
|
+
<!-- Generated from exec.mdx. DO NOT EDIT. -->
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
Execute JavaScript code in the browser or PowerShell commands in the Windows sandbox environment.
|
|
10
|
+
|
|
11
|
+
## Syntax
|
|
12
|
+
|
|
13
|
+
```javascript
|
|
14
|
+
await testdriver.exec(language, code, timeout, silent)
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Parameters
|
|
18
|
+
|
|
19
|
+
<ParamField path="language" type="string" required>
|
|
20
|
+
Language to execute: `'js'` (JavaScript) or `'pwsh'` (PowerShell)
|
|
21
|
+
</ParamField>
|
|
22
|
+
|
|
23
|
+
<ParamField path="code" type="string" required>
|
|
24
|
+
Code or command to execute
|
|
25
|
+
</ParamField>
|
|
26
|
+
|
|
27
|
+
<ParamField path="timeout" type="number" required>
|
|
28
|
+
Timeout in milliseconds
|
|
29
|
+
</ParamField>
|
|
30
|
+
|
|
31
|
+
<ParamField path="silent" type="boolean" default="false">
|
|
32
|
+
Suppress output if `true`
|
|
33
|
+
</ParamField>
|
|
34
|
+
|
|
35
|
+
## Returns
|
|
36
|
+
|
|
37
|
+
`Promise<string>` - Command output
|
|
38
|
+
|
|
39
|
+
## JavaScript Execution
|
|
40
|
+
|
|
41
|
+
Execute JavaScript in the browser context (Windows sandbox only).
|
|
42
|
+
|
|
43
|
+
### DOM Manipulation
|
|
44
|
+
|
|
45
|
+
```javascript
|
|
46
|
+
// Click an element via JavaScript
|
|
47
|
+
await testdriver.exec('js', `
|
|
48
|
+
document.querySelector('#submit-button').click();
|
|
49
|
+
`, 5000);
|
|
50
|
+
|
|
51
|
+
// Fill a form
|
|
52
|
+
await testdriver.exec('js', `
|
|
53
|
+
document.querySelector('#username').value = 'testuser';
|
|
54
|
+
document.querySelector('#password').value = 'password123';
|
|
55
|
+
document.querySelector('#login-form').submit();
|
|
56
|
+
`, 5000);
|
|
57
|
+
|
|
58
|
+
// Scroll to element
|
|
59
|
+
await testdriver.exec('js', `
|
|
60
|
+
document.querySelector('#footer').scrollIntoView();
|
|
61
|
+
`, 5000);
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Reading Page Data
|
|
65
|
+
|
|
66
|
+
```javascript
|
|
67
|
+
// Get page title
|
|
68
|
+
const title = await testdriver.exec('js', 'document.title', 5000);
|
|
69
|
+
console.log('Page title:', title);
|
|
70
|
+
|
|
71
|
+
// Get all links
|
|
72
|
+
const links = await testdriver.exec('js', `
|
|
73
|
+
Array.from(document.querySelectorAll('a'))
|
|
74
|
+
.map(a => a.href)
|
|
75
|
+
.join('\\n')
|
|
76
|
+
`, 5000);
|
|
77
|
+
|
|
78
|
+
// Check if element exists
|
|
79
|
+
const exists = await testdriver.exec('js', `
|
|
80
|
+
document.querySelector('.error-message') !== null
|
|
81
|
+
`, 5000);
|
|
82
|
+
|
|
83
|
+
// Get element text
|
|
84
|
+
const text = await testdriver.exec('js', `
|
|
85
|
+
document.querySelector('.notification').textContent
|
|
86
|
+
`, 5000);
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## PowerShell Execution
|
|
90
|
+
|
|
91
|
+
Execute PowerShell commands in the Windows sandbox.
|
|
92
|
+
|
|
93
|
+
### Software Installation
|
|
94
|
+
|
|
95
|
+
```javascript
|
|
96
|
+
// Install npm package globally
|
|
97
|
+
await testdriver.exec('pwsh', 'npm install -g http-server', 30000);
|
|
98
|
+
|
|
99
|
+
// Install via Chocolatey
|
|
100
|
+
await testdriver.exec('pwsh', 'choco install firefox -y', 60000);
|
|
101
|
+
|
|
102
|
+
// Download and run installer
|
|
103
|
+
await testdriver.exec('pwsh', `
|
|
104
|
+
Invoke-WebRequest -Uri "https://example.com/setup.exe" -OutFile "C:\\setup.exe"
|
|
105
|
+
Start-Process -FilePath "C:\\setup.exe" -ArgumentList "/S" -Wait
|
|
106
|
+
`, 120000);
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### File Operations
|
|
110
|
+
|
|
111
|
+
```javascript
|
|
112
|
+
// Create a file
|
|
113
|
+
await testdriver.exec('pwsh', `
|
|
114
|
+
Set-Content -Path "C:\\test.txt" -Value "Hello World"
|
|
115
|
+
`, 5000);
|
|
116
|
+
|
|
117
|
+
// Read a file
|
|
118
|
+
const content = await testdriver.exec('pwsh',
|
|
119
|
+
'Get-Content -Path "C:\\test.txt"',
|
|
120
|
+
5000
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
// Copy files
|
|
124
|
+
await testdriver.exec('pwsh',
|
|
125
|
+
'Copy-Item -Path "C:\\source.txt" -Destination "C:\\dest.txt"',
|
|
126
|
+
5000
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
// Delete files
|
|
130
|
+
await testdriver.exec('pwsh',
|
|
131
|
+
'Remove-Item -Path "C:\\test.txt"',
|
|
132
|
+
5000
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
// List directory
|
|
136
|
+
const files = await testdriver.exec('pwsh',
|
|
137
|
+
'Get-ChildItem -Path "C:\\Users\\testdriver\\Documents"',
|
|
138
|
+
5000
|
|
139
|
+
);
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### Process Management
|
|
143
|
+
|
|
144
|
+
```javascript
|
|
145
|
+
// List running processes
|
|
146
|
+
const processes = await testdriver.exec('pwsh', 'Get-Process', 5000);
|
|
147
|
+
|
|
148
|
+
// Start application
|
|
149
|
+
await testdriver.exec('pwsh', `
|
|
150
|
+
Start-Process "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe" -ArgumentList "--start-maximized", "https://example.com"
|
|
151
|
+
`, 5000);
|
|
152
|
+
|
|
153
|
+
// Kill a process
|
|
154
|
+
await testdriver.exec('pwsh', 'Stop-Process -Name "chrome" -Force', 5000);
|
|
155
|
+
|
|
156
|
+
// Wait for process
|
|
157
|
+
await testdriver.exec('pwsh', 'Start-Process notepad -Wait', 30000);
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Environment Variables
|
|
161
|
+
|
|
162
|
+
```javascript
|
|
163
|
+
// Set environment variable (session)
|
|
164
|
+
await testdriver.exec('pwsh', '$env:MY_VAR = "value"', 5000);
|
|
165
|
+
|
|
166
|
+
// Get environment variable
|
|
167
|
+
const value = await testdriver.exec('pwsh', '$env:MY_VAR', 5000);
|
|
168
|
+
|
|
169
|
+
// Set persistent environment variable
|
|
170
|
+
await testdriver.exec('pwsh', `
|
|
171
|
+
[Environment]::SetEnvironmentVariable("MY_VAR", "value", "User")
|
|
172
|
+
`, 5000);
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Network Operations
|
|
176
|
+
|
|
177
|
+
```javascript
|
|
178
|
+
// Test connectivity
|
|
179
|
+
const pingResult = await testdriver.exec('pwsh',
|
|
180
|
+
'Test-NetConnection google.com',
|
|
181
|
+
10000
|
|
182
|
+
);
|
|
183
|
+
|
|
184
|
+
// Download file
|
|
185
|
+
await testdriver.exec('pwsh', `
|
|
186
|
+
Invoke-WebRequest -Uri "https://example.com/file.zip" -OutFile "C:\\Downloads\\file.zip"
|
|
187
|
+
`, 30000);
|
|
188
|
+
|
|
189
|
+
// Check if port is open
|
|
190
|
+
const portOpen = await testdriver.exec('pwsh',
|
|
191
|
+
'Test-NetConnection -ComputerName localhost -Port 3000',
|
|
192
|
+
5000
|
|
193
|
+
);
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## Silent Execution
|
|
197
|
+
|
|
198
|
+
Suppress output for background operations:
|
|
199
|
+
|
|
200
|
+
```javascript
|
|
201
|
+
// Silent installation
|
|
202
|
+
await testdriver.exec('pwsh', 'npm install -g some-package', 30000, true);
|
|
203
|
+
|
|
204
|
+
// Start background process
|
|
205
|
+
await testdriver.exec('pwsh', 'Start-Process notepad', 5000, true);
|
|
206
|
+
|
|
207
|
+
// Run setup script silently
|
|
208
|
+
await testdriver.exec('pwsh', '.\\setup.ps1', 60000, true);
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
## Best Practices
|
|
212
|
+
|
|
213
|
+
<Check>
|
|
214
|
+
**Use appropriate timeouts**
|
|
215
|
+
|
|
216
|
+
```javascript
|
|
217
|
+
// Quick operations: 5000ms
|
|
218
|
+
await testdriver.exec('js', 'document.title', 5000);
|
|
219
|
+
|
|
220
|
+
// Installations: 30000-60000ms
|
|
221
|
+
await testdriver.exec('pwsh', 'npm install -g package', 30000);
|
|
222
|
+
|
|
223
|
+
// Downloads or complex operations: 60000-120000ms
|
|
224
|
+
await testdriver.exec('pwsh', 'Install-Module Something', 120000);
|
|
225
|
+
```
|
|
226
|
+
</Check>
|
|
227
|
+
|
|
228
|
+
<Check>
|
|
229
|
+
**Handle errors gracefully**
|
|
230
|
+
|
|
231
|
+
```javascript
|
|
232
|
+
try {
|
|
233
|
+
await testdriver.exec('pwsh', 'Some-Command', 5000);
|
|
234
|
+
} catch (error) {
|
|
235
|
+
console.error('Command failed:', error.message);
|
|
236
|
+
// Fallback or retry logic
|
|
237
|
+
}
|
|
238
|
+
```
|
|
239
|
+
</Check>
|
|
240
|
+
|
|
241
|
+
<Check>
|
|
242
|
+
**Use silent mode for background tasks**
|
|
243
|
+
|
|
244
|
+
```javascript
|
|
245
|
+
// Silent install
|
|
246
|
+
await testdriver.exec('pwsh', 'npm install -g tool', 30000, true);
|
|
247
|
+
|
|
248
|
+
// Background service
|
|
249
|
+
await testdriver.exec('pwsh', 'Start-Service MyService', 5000, true);
|
|
250
|
+
```
|
|
251
|
+
</Check>
|
|
252
|
+
|
|
253
|
+
<Warning>
|
|
254
|
+
**Escape strings properly in PowerShell**
|
|
255
|
+
|
|
256
|
+
Use proper escaping for special characters:
|
|
257
|
+
|
|
258
|
+
```javascript
|
|
259
|
+
// Use backticks for newlines
|
|
260
|
+
await testdriver.exec('pwsh', `
|
|
261
|
+
Write-Host "Line 1\`nLine 2"
|
|
262
|
+
`, 5000);
|
|
263
|
+
|
|
264
|
+
// Use single quotes to avoid variable expansion
|
|
265
|
+
await testdriver.exec('pwsh',
|
|
266
|
+
"Write-Host 'Text with $special chars'",
|
|
267
|
+
5000
|
|
268
|
+
);
|
|
269
|
+
```
|
|
270
|
+
</Warning>
|
|
271
|
+
|
|
272
|
+
## Complete Example
|
|
273
|
+
|
|
274
|
+
```javascript
|
|
275
|
+
import { beforeAll, afterAll, describe, it } from 'vitest';
|
|
276
|
+
import TestDriver from 'testdriverai';
|
|
277
|
+
|
|
278
|
+
describe('Code Execution', () => {
|
|
279
|
+
let testdriver;
|
|
280
|
+
|
|
281
|
+
beforeAll(async () => {
|
|
282
|
+
client = new TestDriver(process.env.TD_API_KEY);
|
|
283
|
+
await testdriver.auth();
|
|
284
|
+
await testdriver.connect();
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
afterAll(async () => {
|
|
288
|
+
await testdriver.disconnect();
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
it('should execute JavaScript in browser', async () => {
|
|
292
|
+
await testdriver.focusApplication('Google Chrome');
|
|
293
|
+
|
|
294
|
+
// Get page info via JavaScript
|
|
295
|
+
const title = await testdriver.exec('js', 'document.title', 5000);
|
|
296
|
+
console.log('Page title:', title);
|
|
297
|
+
|
|
298
|
+
// Manipulate DOM
|
|
299
|
+
await testdriver.exec('js', `
|
|
300
|
+
document.querySelector('#username').value = 'testuser';
|
|
301
|
+
`, 5000);
|
|
302
|
+
|
|
303
|
+
// Verify
|
|
304
|
+
const value = await testdriver.exec('js', `
|
|
305
|
+
document.querySelector('#username').value
|
|
306
|
+
`, 5000);
|
|
307
|
+
|
|
308
|
+
expect(value).toBe('testuser');
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
it('should install and use tools', async () => {
|
|
312
|
+
// Install tool
|
|
313
|
+
await testdriver.exec('pwsh', 'npm install -g http-server', 30000, true);
|
|
314
|
+
|
|
315
|
+
// Create HTML file
|
|
316
|
+
await testdriver.exec('pwsh', `
|
|
317
|
+
Set-Content -Path "C:\\index.html" -Value "<h1>Test Page</h1>"
|
|
318
|
+
`, 5000);
|
|
319
|
+
|
|
320
|
+
// Start server in background
|
|
321
|
+
await testdriver.exec('pwsh', `
|
|
322
|
+
Start-Process pwsh -ArgumentList "-Command", "http-server C:\\ -p 8080"
|
|
323
|
+
`, 5000, true);
|
|
324
|
+
|
|
325
|
+
await new Promise(r => setTimeout(r, 3000));
|
|
326
|
+
|
|
327
|
+
// Launch browser
|
|
328
|
+
await testdriver.exec('pwsh', `
|
|
329
|
+
Start-Process chrome -ArgumentList "http://localhost:8080"
|
|
330
|
+
`, 5000);
|
|
331
|
+
|
|
332
|
+
await testdriver.focusApplication('Google Chrome');
|
|
333
|
+
|
|
334
|
+
// Verify page loaded
|
|
335
|
+
const content = await testdriver.exec('js', 'document.body.textContent', 5000);
|
|
336
|
+
expect(content).toContain('Test Page');
|
|
337
|
+
});
|
|
338
|
+
});
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
## Related Methods
|
|
342
|
+
|
|
343
|
+
- [`focusApplication()`](/v7/focus-application) - Focus apps before exec
|
|
344
|
+
- [`find()`](/v7/find) - Locate elements (alternative to DOM manipulation)
|
|
345
|
+
- [`type()`](/v7/type) - Type text (alternative to JS form filling)
|