@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.
- package/docs/_data/examples-manifest.json +16 -16
- package/docs/_scripts/generate-examples.js +38 -45
- package/docs/agent.mdx +174 -93
- package/docs/assert.mdx +73 -269
- package/docs/aws-setup.mdx +196 -314
- package/docs/bring-your-own-machine.mdx +139 -206
- package/docs/cache.mdx +144 -151
- package/docs/caching.mdx +99 -89
- package/docs/captcha.mdx +126 -111
- package/docs/ci-cd.mdx +154 -543
- package/docs/click.mdx +74 -229
- package/docs/client.mdx +177 -231
- package/docs/copilot/auto-healing.mdx +86 -370
- package/docs/copilot/running-tests.mdx +121 -930
- package/docs/customizing-devices.mdx +74 -251
- package/docs/dashcam.mdx +72 -405
- package/docs/debugging-with-screenshots.mdx +105 -371
- package/docs/docs.json +79 -22
- package/docs/double-click.mdx +48 -68
- package/docs/errors.mdx +102 -176
- package/docs/events.mdx +170 -327
- package/docs/examples/{hover-text-with-description.mdx → add-to-cart.mdx} +30 -35
- package/docs/examples/assert.mdx +28 -41
- package/docs/examples/click-button.mdx +71 -0
- package/docs/examples/{hover-image.mdx → click-icon.mdx} +32 -28
- package/docs/examples/element-not-found.mdx +27 -26
- package/docs/examples/findall-coffee-icons.mdx +28 -32
- package/docs/examples/installer.mdx +61 -25
- package/docs/examples/launch-vscode-linux.mdx +28 -51
- package/docs/examples/navigate-and-scroll.mdx +82 -0
- package/docs/examples/parse.mdx +24 -28
- package/docs/examples/press-keys.mdx +28 -25
- package/docs/examples/scroll.mdx +25 -27
- package/docs/examples/type.mdx +26 -21
- package/docs/exec.mdx +92 -256
- package/docs/extract.mdx +69 -170
- package/docs/find.mdx +140 -736
- package/docs/focus-application.mdx +69 -246
- package/docs/generating-tests.mdx +103 -137
- package/docs/guide/best-practices-polling.mdx +65 -141
- package/docs/hosted.mdx +80 -144
- package/docs/hover.mdx +62 -235
- package/docs/locating-elements.mdx +74 -369
- package/docs/making-assertions.mdx +116 -74
- package/docs/mcp-setup.mdx +80 -63
- package/docs/mouse-down.mdx +48 -125
- package/docs/mouse-up.mdx +47 -129
- package/docs/options.mdx +75 -48
- package/docs/parse.mdx +95 -184
- package/docs/performing-actions.mdx +104 -94
- package/docs/press-keys.mdx +59 -299
- package/docs/provision.mdx +137 -182
- package/docs/quickstart-claude.mdx +85 -0
- package/docs/quickstart-github.mdx +62 -32
- package/docs/quickstart-manual.mdx +60 -33
- package/docs/quickstart-vscode.mdx +97 -0
- package/docs/quickstart.mdx +26 -9
- package/docs/redraw.mdx +101 -165
- package/docs/reusable-code.mdx +97 -200
- package/docs/right-click.mdx +47 -89
- package/docs/screenshot.mdx +47 -201
- package/docs/screenshots.mdx +87 -137
- package/docs/scroll.mdx +71 -154
- package/docs/secrets.mdx +96 -91
- package/docs/self-hosted.mdx +83 -142
- package/docs/snippets/enterprise.mdx +15 -0
- package/docs/styles.css +68 -0
- package/docs/test-results-json.mdx +167 -204
- package/docs/type.mdx +56 -304
- package/docs/variables.mdx +121 -81
- package/docs/wait.mdx +33 -31
- package/docs/what-is-testdriver.mdx +80 -32
- package/examples/{hover-text-with-description.test.mjs → add-to-cart.test.mjs} +4 -5
- package/examples/assert.test.mjs +3 -20
- package/examples/{hover-text.test.mjs → click-button.test.mjs} +3 -4
- package/examples/{hover-image.test.mjs → click-icon.test.mjs} +5 -6
- package/examples/element-not-found.test.mjs +3 -5
- package/examples/findall-coffee-icons.test.mjs +3 -3
- package/examples/installer.test.mjs +1 -1
- package/examples/launch-vscode-linux.test.mjs +6 -33
- package/examples/{scroll-keyboard.test.mjs → navigate-and-scroll.test.mjs} +4 -5
- package/examples/parse.test.mjs +1 -2
- package/examples/press-keys.test.mjs +4 -4
- package/examples/scroll.test.mjs +3 -6
- package/examples/type.test.mjs +5 -2
- package/lib/provision.js +6 -2
- package/package.json +1 -1
- package/sdk.d.ts +4 -2
- package/sdk.js +1 -1
- package/docs/claude-mcp-plugin.mdx +0 -244
- package/docs/elements.mdx +0 -606
- package/docs/examples/ai.mdx +0 -78
- package/docs/examples/captcha-api.mdx +0 -92
- package/docs/examples/chrome-extension.mdx +0 -156
- package/docs/examples/drag-and-drop.mdx +0 -100
- package/docs/examples/formatted-logging.mdx +0 -74
- package/docs/examples/hover-text.mdx +0 -70
- package/docs/examples/match-image.mdx +0 -97
- package/docs/examples/scroll-keyboard.mdx +0 -80
- package/docs/examples/scroll-until-text.mdx +0 -109
package/docs/hover.mdx
CHANGED
|
@@ -1,279 +1,106 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: "hover()"
|
|
3
3
|
sidebarTitle: "hover"
|
|
4
|
-
description: "
|
|
4
|
+
description: "Move the mouse over an element or a point without clicking, to reveal tooltips and menus."
|
|
5
5
|
icon: "hand-pointer"
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
Move the mouse cursor onto elements or coordinates without a click. Use this to show tooltips, dropdowns, and hover effects.
|
|
11
|
-
|
|
12
|
-
## Element Hover
|
|
13
|
-
|
|
14
|
-
Put the cursor on a found element.
|
|
15
|
-
|
|
16
|
-
### Syntax
|
|
8
|
+
Move the mouse onto an element without clicking. Use it to reveal tooltips, dropdown menus and hover styles.
|
|
17
9
|
|
|
18
10
|
```javascript
|
|
19
|
-
await
|
|
11
|
+
await testdriver.find('Products menu in the top navigation').hover();
|
|
12
|
+
await testdriver.find('Laptops in the Products dropdown').click();
|
|
20
13
|
```
|
|
21
14
|
|
|
22
|
-
|
|
15
|
+
## element.hover()
|
|
23
16
|
|
|
24
|
-
`
|
|
25
|
-
|
|
26
|
-
### Examples
|
|
27
|
-
|
|
28
|
-
```javascript
|
|
29
|
-
// Find and hover
|
|
30
|
-
const tooltip = await testdriver.find('info icon');
|
|
31
|
-
await tooltip.hover();
|
|
17
|
+
Moves the mouse to the point where [`find()`](/find) located the element. It's the same as `element.click('hover')`.
|
|
32
18
|
|
|
33
|
-
|
|
34
|
-
|
|
19
|
+
```typescript
|
|
20
|
+
element.hover(): Promise<void>
|
|
21
|
+
```
|
|
35
22
|
|
|
36
|
-
|
|
37
|
-
const menu = await testdriver.find('Products menu');
|
|
38
|
-
await menu.hover();
|
|
23
|
+
It takes no parameters.
|
|
39
24
|
|
|
40
|
-
|
|
41
|
-
await submenu.click();
|
|
42
|
-
```
|
|
25
|
+
### Errors
|
|
43
26
|
|
|
44
|
-
|
|
27
|
+
Throws an `ElementNotFoundError` if `find()` didn't locate the element. See [click()](/click#errors) for how to check `found()` first.
|
|
45
28
|
|
|
46
|
-
|
|
29
|
+
## testdriver.hover(options)
|
|
47
30
|
|
|
48
|
-
|
|
31
|
+
Moves the mouse to a point on the screen by its coordinates. Prefer `element.hover()`, which keeps working when the layout or screen size changes.
|
|
49
32
|
|
|
50
|
-
```
|
|
51
|
-
|
|
33
|
+
```typescript
|
|
34
|
+
testdriver.hover(options: { x: number; y: number }): Promise<void>
|
|
52
35
|
```
|
|
53
36
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
<ParamField path="x" type="number" required>
|
|
57
|
-
|
|
37
|
+
<ParamField path="options" type="object" required>
|
|
38
|
+
<Expandable title="properties">
|
|
39
|
+
<ParamField path="x" type="number" required>
|
|
40
|
+
Distance from the left edge of the screen, in pixels.
|
|
41
|
+
</ParamField>
|
|
42
|
+
<ParamField path="y" type="number" required>
|
|
43
|
+
Distance from the top edge of the screen, in pixels.
|
|
44
|
+
</ParamField>
|
|
45
|
+
</Expandable>
|
|
58
46
|
</ParamField>
|
|
59
47
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
48
|
+
```javascript
|
|
49
|
+
await testdriver.hover({ x: 640, y: 360 });
|
|
50
|
+
```
|
|
63
51
|
|
|
64
|
-
|
|
52
|
+
<Note>
|
|
53
|
+
The older form `testdriver.hover(x, y)` still works. Use the options object in new tests.
|
|
54
|
+
</Note>
|
|
65
55
|
|
|
66
|
-
|
|
56
|
+
## Examples
|
|
67
57
|
|
|
68
|
-
###
|
|
58
|
+
### Read a tooltip
|
|
69
59
|
|
|
70
60
|
```javascript
|
|
71
|
-
|
|
72
|
-
await testdriver.
|
|
73
|
-
|
|
74
|
-
// Hover and wait
|
|
75
|
-
await testdriver.hover(500, 300);
|
|
76
|
-
await new Promise(r => setTimeout(r, 1000));
|
|
61
|
+
await testdriver.find('help icon next to the Password label').hover();
|
|
62
|
+
const tooltip = await testdriver.extract('the text of the tooltip');
|
|
77
63
|
```
|
|
78
64
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
<Check>
|
|
82
|
-
**Prefer element hover over coordinates**
|
|
83
|
-
|
|
84
|
-
```javascript
|
|
85
|
-
// ✅ Preferred
|
|
86
|
-
const icon = await testdriver.find('info icon');
|
|
87
|
-
await icon.hover();
|
|
88
|
-
|
|
89
|
-
// ❌ Avoid
|
|
90
|
-
await testdriver.hover(500, 300);
|
|
91
|
-
```
|
|
92
|
-
</Check>
|
|
93
|
-
|
|
94
|
-
<Check>
|
|
95
|
-
**Wait after hovering for dynamic content**
|
|
96
|
-
|
|
97
|
-
```javascript
|
|
98
|
-
const menuItem = await testdriver.find('Settings menu');
|
|
99
|
-
await menuItem.hover();
|
|
100
|
-
|
|
101
|
-
// Wait for submenu to appear
|
|
102
|
-
await new Promise(r => setTimeout(r, 500));
|
|
103
|
-
|
|
104
|
-
const subItem = await testdriver.find('Profile submenu');
|
|
105
|
-
await subItem.click();
|
|
106
|
-
```
|
|
107
|
-
</Check>
|
|
65
|
+
### Check a hover style
|
|
108
66
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
const element = await testdriver.find('tooltip trigger');
|
|
114
|
-
if (!element.found()) {
|
|
115
|
-
throw new Error('Element not found');
|
|
116
|
-
}
|
|
117
|
-
await element.hover();
|
|
118
|
-
```
|
|
119
|
-
</Check>
|
|
120
|
-
|
|
121
|
-
## Use Cases
|
|
67
|
+
```javascript
|
|
68
|
+
await testdriver.find('Sign in button').hover();
|
|
69
|
+
await testdriver.assert('the Sign in button is highlighted');
|
|
70
|
+
```
|
|
122
71
|
|
|
123
|
-
|
|
124
|
-
<Accordion title="Tooltips">
|
|
125
|
-
```javascript
|
|
126
|
-
// Hover to show tooltip
|
|
127
|
-
const icon = await testdriver.find('help icon');
|
|
128
|
-
await icon.hover();
|
|
129
|
-
|
|
130
|
-
await new Promise(r => setTimeout(r, 1000));
|
|
131
|
-
|
|
132
|
-
// Read tooltip content
|
|
133
|
-
const tooltipText = await testdriver.extract('the tooltip text');
|
|
134
|
-
console.log('Tooltip:', tooltipText);
|
|
135
|
-
```
|
|
136
|
-
</Accordion>
|
|
137
|
-
|
|
138
|
-
<Accordion title="Dropdown Menus">
|
|
139
|
-
```javascript
|
|
140
|
-
// Hover to reveal dropdown
|
|
141
|
-
const menuItem = await testdriver.find('Products menu item');
|
|
142
|
-
await menuItem.hover();
|
|
143
|
-
|
|
144
|
-
// Wait for dropdown animation
|
|
145
|
-
await new Promise(r => setTimeout(r, 500));
|
|
146
|
-
|
|
147
|
-
// Click submenu option
|
|
148
|
-
const category = await testdriver.find('Electronics category');
|
|
149
|
-
await category.click();
|
|
150
|
-
```
|
|
151
|
-
</Accordion>
|
|
152
|
-
|
|
153
|
-
<Accordion title="Image Previews">
|
|
154
|
-
```javascript
|
|
155
|
-
// Hover over thumbnail to see preview
|
|
156
|
-
const thumbnail = await testdriver.find('product thumbnail');
|
|
157
|
-
await thumbnail.hover();
|
|
158
|
-
|
|
159
|
-
await new Promise(r => setTimeout(r, 800));
|
|
160
|
-
|
|
161
|
-
// Verify preview appears
|
|
162
|
-
await testdriver.assert('product preview is displayed');
|
|
163
|
-
```
|
|
164
|
-
</Accordion>
|
|
165
|
-
|
|
166
|
-
<Accordion title="Hover Effects">
|
|
167
|
-
```javascript
|
|
168
|
-
// Test hover state styling
|
|
169
|
-
const button = await testdriver.find('call to action button');
|
|
170
|
-
await button.hover();
|
|
171
|
-
|
|
172
|
-
await new Promise(r => setTimeout(r, 500));
|
|
173
|
-
|
|
174
|
-
// Verify hover effect
|
|
175
|
-
await testdriver.assert('button background changed to blue');
|
|
176
|
-
```
|
|
177
|
-
</Accordion>
|
|
178
|
-
|
|
179
|
-
<Accordion title="Drag and Drop">
|
|
180
|
-
```javascript
|
|
181
|
-
// Use hover in drag and drop
|
|
182
|
-
const item = await testdriver.find('draggable item');
|
|
183
|
-
await item.mouseDown();
|
|
184
|
-
|
|
185
|
-
// Hover over drop zone
|
|
186
|
-
const dropZone = await testdriver.find('drop area');
|
|
187
|
-
await dropZone.hover();
|
|
188
|
-
|
|
189
|
-
await new Promise(r => setTimeout(r, 300));
|
|
190
|
-
await dropZone.mouseUp();
|
|
191
|
-
```
|
|
192
|
-
</Accordion>
|
|
193
|
-
</AccordionGroup>
|
|
72
|
+
### Drag an item
|
|
194
73
|
|
|
195
|
-
|
|
74
|
+
`hover()` moves the mouse while the button is held down by [`mouseDown()`](/mouse-down):
|
|
196
75
|
|
|
197
76
|
```javascript
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
let testdriver;
|
|
77
|
+
await testdriver.find('Task card titled "Write docs"').mouseDown();
|
|
78
|
+
await testdriver.find('Done column').hover();
|
|
79
|
+
await testdriver.find('Done column').mouseUp();
|
|
80
|
+
```
|
|
203
81
|
|
|
204
|
-
|
|
205
|
-
client = new TestDriver(process.env.TD_API_KEY);
|
|
206
|
-
await testdriver.auth();
|
|
207
|
-
await testdriver.connect();
|
|
208
|
-
});
|
|
82
|
+
## Complete example
|
|
209
83
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
84
|
+
```javascript tests/hover.test.mjs
|
|
85
|
+
import { describe, expect, it } from 'vitest';
|
|
86
|
+
import { TestDriver } from 'testdriverai/vitest/hooks';
|
|
213
87
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
const infoIcon = await testdriver.find('information icon');
|
|
219
|
-
await infoIcon.hover();
|
|
220
|
-
|
|
221
|
-
// Wait for tooltip to appear
|
|
222
|
-
await new Promise(r => setTimeout(r, 1000));
|
|
223
|
-
|
|
224
|
-
// Verify tooltip is visible
|
|
225
|
-
await testdriver.assert('tooltip is displayed');
|
|
226
|
-
|
|
227
|
-
// Extract tooltip text
|
|
228
|
-
const tooltipText = await testdriver.extract('the tooltip message');
|
|
229
|
-
console.log('Tooltip says:', tooltipText);
|
|
230
|
-
});
|
|
88
|
+
describe('Hover', () => {
|
|
89
|
+
it('highlights the sign in button on hover', async (context) => {
|
|
90
|
+
const testdriver = TestDriver(context);
|
|
91
|
+
await testdriver.provision.chrome({ url: 'https://testdriver-sandbox.vercel.app/login' });
|
|
231
92
|
|
|
232
|
-
|
|
233
|
-
// Hover over main menu
|
|
234
|
-
const menu = await testdriver.find('Navigation menu');
|
|
235
|
-
await menu.hover();
|
|
236
|
-
|
|
237
|
-
// Wait for dropdown
|
|
238
|
-
await new Promise(r => setTimeout(r, 500));
|
|
239
|
-
|
|
240
|
-
// Hover over submenu item
|
|
241
|
-
const submenu = await testdriver.find('Account submenu');
|
|
242
|
-
await submenu.hover();
|
|
243
|
-
|
|
244
|
-
await new Promise(r => setTimeout(r, 300));
|
|
245
|
-
|
|
246
|
-
// Click nested menu item
|
|
247
|
-
const settings = await testdriver.find('Settings option');
|
|
248
|
-
await settings.click();
|
|
249
|
-
|
|
250
|
-
await testdriver.assert('settings page is displayed');
|
|
251
|
-
});
|
|
93
|
+
await testdriver.find('Sign in button below the password field').hover();
|
|
252
94
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
const productImg = await testdriver.find('product 1 thumbnail');
|
|
256
|
-
await productImg.hover();
|
|
257
|
-
|
|
258
|
-
// Wait for preview
|
|
259
|
-
await new Promise(r => setTimeout(r, 800));
|
|
260
|
-
|
|
261
|
-
// Verify preview appeared
|
|
262
|
-
await testdriver.assert('large product preview is shown');
|
|
263
|
-
|
|
264
|
-
// Move away
|
|
265
|
-
const otherElement = await testdriver.find('page heading');
|
|
266
|
-
await otherElement.hover();
|
|
267
|
-
|
|
268
|
-
// Verify preview disappeared
|
|
269
|
-
await new Promise(r => setTimeout(r, 500));
|
|
270
|
-
await testdriver.assert('product preview is hidden');
|
|
95
|
+
const result = await testdriver.assert('the mouse pointer is over the Sign in button');
|
|
96
|
+
expect(result).toBe(true);
|
|
271
97
|
});
|
|
272
98
|
});
|
|
273
99
|
```
|
|
274
100
|
|
|
275
|
-
## Related
|
|
101
|
+
## Related
|
|
276
102
|
|
|
277
|
-
- [
|
|
278
|
-
- [
|
|
279
|
-
- [
|
|
103
|
+
- [find()](/find): locate the element to hover over
|
|
104
|
+
- [click()](/click): click after a menu opens
|
|
105
|
+
- [mouseDown()](/mouse-down) and [mouseUp()](/mouse-up): drag and drop
|
|
106
|
+
- [Perform actions](/performing-actions): every kind of action in one guide
|