testdriverai 7.2.50 → 7.2.51
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/agents.md +15 -0
- package/package.json +1 -1
- package/sdk.js +1 -1
package/agents.md
CHANGED
|
@@ -93,6 +93,7 @@ The SDK has TypeScript types in `sdk.d.ts`. Key methods:
|
|
|
93
93
|
| `pressKeys([keys])` | Press keyboard keys |
|
|
94
94
|
| `scroll(direction)` | Scroll the page |
|
|
95
95
|
| `exec(language, code)` | Execute code in sandbox |
|
|
96
|
+
| `screenshot(scale, silent, mouse)` | Capture screenshot as base64 PNG |
|
|
96
97
|
| `ai(task)` | AI exploratory loop (see note below) |
|
|
97
98
|
|
|
98
99
|
### About `ai()` - Use for Exploration, Not Final Tests
|
|
@@ -382,6 +383,20 @@ const output = await testdriver.exec("sh", "ls -la", 5000);
|
|
|
382
383
|
const date = await testdriver.exec("pwsh", "Get-Date", 5000);
|
|
383
384
|
```
|
|
384
385
|
|
|
386
|
+
### Capturing Screenshots
|
|
387
|
+
```javascript
|
|
388
|
+
// Capture a screenshot and save to file
|
|
389
|
+
const screenshot = await testdriver.screenshot();
|
|
390
|
+
const filepath = 'screenshot.png';
|
|
391
|
+
fs.writeFileSync(filepath, Buffer.from(screenshot, 'base64'));
|
|
392
|
+
console.log('Screenshot saved to:', filepath);
|
|
393
|
+
|
|
394
|
+
// Capture with mouse cursor visible
|
|
395
|
+
const screenshotWithMouse = await testdriver.screenshot(1, false, true);
|
|
396
|
+
fs.writeFileSync('screenshot-with-mouse.png', Buffer.from(screenshotWithMouse, 'base64'));
|
|
397
|
+
console.log('Screenshot with mouse saved to: screenshot-with-mouse.png');
|
|
398
|
+
```
|
|
399
|
+
|
|
385
400
|
## Tips for Agents
|
|
386
401
|
|
|
387
402
|
1. **Always check `sdk.d.ts`** for method signatures and types
|
package/package.json
CHANGED
package/sdk.js
CHANGED
|
@@ -1344,7 +1344,7 @@ class TestDriverSDK {
|
|
|
1344
1344
|
await this.__connectionPromise;
|
|
1345
1345
|
}
|
|
1346
1346
|
if (!this.connected) {
|
|
1347
|
-
throw new Error('Not connected to sandbox. Call connect() first
|
|
1347
|
+
throw new Error('Not connected to sandbox. Call connect() first.');
|
|
1348
1348
|
}
|
|
1349
1349
|
}
|
|
1350
1350
|
|