@@ -23,7 +23,6 @@ export interface CommandOutput {
23
23
stdout : string
24
24
stderr : string
25
25
}
26
- /** Result of a screenshot operation */
27
26
export interface ScreenshotResult {
28
27
width : number
29
28
height : number
@@ -38,6 +37,22 @@ export interface UIElementAttributes {
38
37
properties : Record < string , string | undefined | null >
39
38
isKeyboardFocusable ?: boolean
40
39
}
40
+ export interface ExploredElementDetail {
41
+ role : string
42
+ name ?: string
43
+ id ?: string
44
+ bounds ?: Bounds
45
+ value ?: string
46
+ description ?: string
47
+ text ?: string
48
+ parentId ?: string
49
+ childrenIds : Array < string >
50
+ suggestedSelector : string
51
+ }
52
+ export interface ExploreResponse {
53
+ parent : Element
54
+ children : Array < ExploredElementDetail >
55
+ }
41
56
/** Main entry point for desktop automation. */
42
57
export declare class Desktop {
43
58
/**
@@ -96,50 +111,50 @@ export declare class Desktop {
96
111
*/
97
112
activateApplication ( name : string ) : void
98
113
/**
99
- * Capture a screenshot of the primary monitor.
114
+ * (async) Capture a screenshot of the primary monitor.
100
115
*
101
116
* @returns {Promise<ScreenshotResult> } The screenshot data.
102
117
*/
103
118
captureScreen ( ) : Promise < ScreenshotResult >
104
119
/**
105
- * Run a shell command.
120
+ * (async) Run a shell command.
106
121
*
107
122
* @param {string } [windowsCommand] - Command to run on Windows.
108
123
* @param {string } [unixCommand] - Command to run on Unix.
109
124
* @returns {Promise<CommandOutput> } The command output.
110
125
*/
111
126
runCommand ( windowsCommand ?: string | undefined | null , unixCommand ?: string | undefined | null ) : Promise < CommandOutput >
112
127
/**
113
- * Capture a screenshot of a specific monitor.
128
+ * (async) Capture a screenshot of a specific monitor.
114
129
*
115
130
* @param {string } name - The name of the monitor to capture.
116
131
* @returns {Promise<ScreenshotResult> } The screenshot data.
117
132
*/
118
133
captureMonitorByName ( name : string ) : Promise < ScreenshotResult >
119
134
/**
120
- * Perform OCR on an image file.
135
+ * (async) Perform OCR on an image file.
121
136
*
122
137
* @param {string } imagePath - Path to the image file.
123
138
* @returns {Promise<string> } The extracted text.
124
139
*/
125
140
ocrImagePath ( imagePath : string ) : Promise < string >
126
141
/**
127
- * Perform OCR on a screenshot.
142
+ * (async) Perform OCR on a screenshot.
128
143
*
129
144
* @param {ScreenshotResult } screenshot - The screenshot to process.
130
145
* @returns {Promise<string> } The extracted text.
131
146
*/
132
147
ocrScreenshot ( screenshot : ScreenshotResult ) : Promise < string >
133
148
/**
134
- * Find a window by criteria.
149
+ * (async) Find a window by criteria.
135
150
*
136
151
* @param {string } [titleContains] - Text that should be in the window title.
137
152
* @param {number } [timeoutMs] - Timeout in milliseconds.
138
153
* @returns {Promise<Element> } The found window element.
139
154
*/
140
155
findWindowByCriteria ( titleContains ?: string | undefined | null , timeoutMs ?: number | undefined | null ) : Promise < Element >
141
156
/**
142
- * Get the currently focused browser window.
157
+ * (async) Get the currently focused browser window.
143
158
*
144
159
* @returns {Promise<Element> } The current browser window element.
145
160
*/
@@ -152,13 +167,13 @@ export declare class Desktop {
152
167
*/
153
168
locator ( selector : string ) : Locator
154
169
/**
155
- * Get the currently focused window.
170
+ * (async) Get the currently focused window.
156
171
*
157
172
* @returns {Promise<Element> } The current window element.
158
173
*/
159
174
getCurrentWindow ( ) : Promise < Element >
160
175
/**
161
- * Get the currently focused application.
176
+ * (async) Get the currently focused application.
162
177
*
163
178
* @returns {Promise<Element> } The current application element.
164
179
*/
@@ -360,25 +375,31 @@ export declare class Element {
360
375
* @returns {Element | null } The containing window element, if available.
361
376
*/
362
377
window ( ) : Element | null
378
+ /**
379
+ * Explore this element and its direct children.
380
+ *
381
+ * @returns {ExploreResponse } Details about the element and its children.
382
+ */
383
+ explore ( ) : ExploreResponse
363
384
}
364
385
/** Locator for finding UI elements by selector. */
365
386
export declare class Locator {
366
387
/**
367
- * Get the first matching element.
388
+ * (async) Get the first matching element.
368
389
*
369
390
* @returns {Promise<Element> } The first matching element.
370
391
*/
371
392
first ( ) : Promise < Element >
372
393
/**
373
- * Get all matching elements.
394
+ * (async) Get all matching elements.
374
395
*
375
396
* @param {number } [timeoutMs] - Timeout in milliseconds.
376
397
* @param {number } [depth] - Maximum depth to search.
377
398
* @returns {Promise<Array<Element>> } List of matching elements.
378
399
*/
379
400
all ( timeoutMs ?: number | undefined | null , depth ?: number | undefined | null ) : Promise < Array < Element > >
380
401
/**
381
- * Wait for the first matching element.
402
+ * (async) Wait for the first matching element.
382
403
*
383
404
* @param {number } [timeoutMs] - Timeout in milliseconds.
384
405
* @returns {Promise<Element> } The first matching element.
@@ -406,14 +427,14 @@ export declare class Locator {
406
427
*/
407
428
locator ( selector : string ) : Locator
408
429
/**
409
- * Click on the first matching element.
430
+ * (async) Click on the first matching element.
410
431
*
411
432
* @param {number } [timeoutMs] - Timeout in milliseconds.
412
433
* @returns {Promise<ClickResult> } Result of the click operation.
413
434
*/
414
435
click ( timeoutMs ?: number | undefined | null ) : Promise < ClickResult >
415
436
/**
416
- * Type text into the first matching element.
437
+ * (async) Type text into the first matching element.
417
438
*
418
439
* @param {string } text - The text to type.
419
440
* @param {boolean } [useClipboard] - Whether to use clipboard for pasting.
@@ -422,58 +443,58 @@ export declare class Locator {
422
443
*/
423
444
typeText ( text : string , useClipboard ?: boolean | undefined | null , timeoutMs ?: number | undefined | null ) : Promise < void >
424
445
/**
425
- * Press a key on the first matching element.
446
+ * (async) Press a key on the first matching element.
426
447
*
427
448
* @param {string } key - The key to press.
428
449
* @param {number } [timeoutMs] - Timeout in milliseconds.
429
450
* @returns {Promise<void> }
430
451
*/
431
452
pressKey ( key : string , timeoutMs ?: number | undefined | null ) : Promise < void >
432
453
/**
433
- * Get text from the first matching element.
454
+ * (async) Get text from the first matching element.
434
455
*
435
456
* @param {number } [maxDepth] - Maximum depth to search for text.
436
457
* @param {number } [timeoutMs] - Timeout in milliseconds.
437
458
* @returns {Promise<string> } The element's text content.
438
459
*/
439
460
text ( maxDepth ?: number | undefined | null , timeoutMs ?: number | undefined | null ) : Promise < string >
440
461
/**
441
- * Get attributes from the first matching element.
462
+ * (async) Get attributes from the first matching element.
442
463
*
443
464
* @param {number } [timeoutMs] - Timeout in milliseconds.
444
465
* @returns {Promise<UIElementAttributes> } The element's attributes.
445
466
*/
446
467
attributes ( timeoutMs ?: number | undefined | null ) : Promise < UIElementAttributes >
447
468
/**
448
- * Get bounds from the first matching element.
469
+ * (async) Get bounds from the first matching element.
449
470
*
450
471
* @param {number } [timeoutMs] - Timeout in milliseconds.
451
472
* @returns {Promise<Bounds> } The element's bounds.
452
473
*/
453
474
bounds ( timeoutMs ?: number | undefined | null ) : Promise < Bounds >
454
475
/**
455
- * Check if the element is visible.
476
+ * (async) Check if the element is visible.
456
477
*
457
478
* @param {number } [timeoutMs] - Timeout in milliseconds.
458
479
* @returns {Promise<boolean> } True if the element is visible.
459
480
*/
460
481
isVisible ( timeoutMs ?: number | undefined | null ) : Promise < boolean >
461
482
/**
462
- * Wait for the element to be enabled.
483
+ * (async) Wait for the element to be enabled.
463
484
*
464
485
* @param {number } [timeoutMs] - Timeout in milliseconds.
465
486
* @returns {Promise<Element> } The enabled element.
466
487
*/
467
488
expectEnabled ( timeoutMs ?: number | undefined | null ) : Promise < Element >
468
489
/**
469
- * Wait for the element to be visible.
490
+ * (async) Wait for the element to be visible.
470
491
*
471
492
* @param {number } [timeoutMs] - Timeout in milliseconds.
472
493
* @returns {Promise<Element> } The visible element.
473
494
*/
474
495
expectVisible ( timeoutMs ?: number | undefined | null ) : Promise < Element >
475
496
/**
476
- * Wait for the element's text to equal the expected text.
497
+ * (async) Wait for the element's text to equal the expected text.
477
498
*
478
499
* @param {string } expectedText - The expected text.
479
500
* @param {number } [maxDepth] - Maximum depth to search for text.
@@ -482,26 +503,33 @@ export declare class Locator {
482
503
*/
483
504
expectTextEquals ( expectedText : string , maxDepth ?: number | undefined | null , timeoutMs ?: number | undefined | null ) : Promise < Element >
484
505
/**
485
- * Double click on the first matching element.
506
+ * (async) Double click on the first matching element.
486
507
*
487
508
* @param {number } [timeoutMs] - Timeout in milliseconds.
488
509
* @returns {Promise<ClickResult> } Result of the click operation.
489
510
*/
490
511
doubleClick ( timeoutMs ?: number | undefined | null ) : Promise < ClickResult >
491
512
/**
492
- * Right click on the first matching element.
513
+ * (async) Right click on the first matching element.
493
514
*
494
515
* @param {number } [timeoutMs] - Timeout in milliseconds.
495
516
* @returns {Promise<void> }
496
517
*/
497
518
rightClick ( timeoutMs ?: number | undefined | null ) : Promise < void >
498
519
/**
499
- * Hover over the first matching element.
520
+ * (async) Hover over the first matching element.
500
521
*
501
522
* @param {number } [timeoutMs] - Timeout in milliseconds.
502
523
* @returns {Promise<void> }
503
524
*/
504
525
hover ( timeoutMs ?: number | undefined | null ) : Promise < void >
526
+ /**
527
+ * (async) Explore the first matching element and its direct children.
528
+ *
529
+ * @param {number } [timeoutMs] - Timeout in milliseconds.
530
+ * @returns {Promise<ExploreResponse> } Details about the element and its children.
531
+ */
532
+ explore ( timeoutMs ?: number | undefined | null ) : Promise < ExploreResponse >
505
533
}
506
534
/** Thrown when an element is not found. */
507
535
export declare class ElementNotFoundError {
0 commit comments