@aspiresys/visor 1.1.5 → 1.1.6
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/dist/app.js +4 -4
- package/dist/display.d.ts +1 -0
- package/dist/display.js +16 -0
- package/dist/index.d.ts +785 -783
- package/dist/index.js +812 -803
- package/dist/matcher.js +16 -9
- package/dist/mouse.js +2 -4
- package/dist/ocr.js +12 -13
- package/dist/screen.js +1 -1
- package/dist/text.js +17 -11
- package/package.json +2 -1
package/dist/index.d.ts
CHANGED
|
@@ -5,327 +5,327 @@ export declare class Visor {
|
|
|
5
5
|
Key: typeof Key;
|
|
6
6
|
Button: typeof Button;
|
|
7
7
|
/**
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
8
|
+
* Finds an image on screen using OpenCV
|
|
9
|
+
* and performs a left mouse click
|
|
10
|
+
* on the matched region.
|
|
11
|
+
*
|
|
12
|
+
* @param image Optional image filename or path.
|
|
13
|
+
*
|
|
14
|
+
* @param confidence Match confidence threshold.
|
|
15
|
+
*
|
|
16
|
+
* Accepted range:
|
|
17
|
+
* 0.0 to 1.0
|
|
18
|
+
*
|
|
19
|
+
* Default:
|
|
20
|
+
* 0.8
|
|
21
|
+
*
|
|
22
|
+
* Recommended values:
|
|
23
|
+
* - 0.7 for dynamic UI
|
|
24
|
+
* - 0.8 for standard usage
|
|
25
|
+
* - 0.9+ for strict matching
|
|
26
|
+
*
|
|
27
|
+
* Lower confidence increases
|
|
28
|
+
* flexibility but may increase
|
|
29
|
+
* false positives.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* await visor.click("save.png");
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* await visor.click("./images/save.png", 0.9);
|
|
36
|
+
*/
|
|
37
37
|
click(image?: string, confidence?: number): Promise<void>;
|
|
38
38
|
/**
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
39
|
+
* Performs a right mouse click.
|
|
40
|
+
*
|
|
41
|
+
* If an image is provided, the framework
|
|
42
|
+
* first finds the image on screen and
|
|
43
|
+
* moves the mouse to the matched region
|
|
44
|
+
* before performing the click.
|
|
45
|
+
*
|
|
46
|
+
* @param image Image filename or path.
|
|
47
|
+
* @param confidence Match confidence threshold.
|
|
48
|
+
*
|
|
49
|
+
* Accepted range:
|
|
50
|
+
* 0.0 to 1.0
|
|
51
|
+
*
|
|
52
|
+
* Default:
|
|
53
|
+
* 0.8
|
|
54
|
+
* @throws Error if image is not found.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* await visor.rightClick("file.png");
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* await visor.rightClick();
|
|
61
|
+
*/
|
|
62
62
|
rightClick(image?: string, confidence?: number): Promise<void>;
|
|
63
63
|
/**
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
64
|
+
* Performs a double left mouse click.
|
|
65
|
+
*
|
|
66
|
+
* If an image is provided, the framework
|
|
67
|
+
* first finds the image on screen and
|
|
68
|
+
* moves the mouse to the matched region
|
|
69
|
+
* before performing the click.
|
|
70
|
+
*
|
|
71
|
+
* @param image Image filename or path.
|
|
72
|
+
* @param confidence Match confidence threshold.
|
|
73
|
+
*
|
|
74
|
+
* Accepted range:
|
|
75
|
+
* 0.0 to 1.0
|
|
76
|
+
*
|
|
77
|
+
* Default:
|
|
78
|
+
* 0.8
|
|
79
|
+
*
|
|
80
|
+
* @throws Error if image is not found.
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* await visor.doubleClick("folder.png");
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* await visor.doubleClick();
|
|
87
|
+
*/
|
|
88
88
|
doubleClick(image?: string, confidence?: number): Promise<void>;
|
|
89
89
|
/**
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
90
|
+
* Finds the best matching image on screen
|
|
91
|
+
* using OpenCV template matching.
|
|
92
|
+
*
|
|
93
|
+
* @param image Image filename or path.
|
|
94
|
+
*
|
|
95
|
+
* @param confidence Match confidence threshold.
|
|
96
|
+
*
|
|
97
|
+
* Accepted range:
|
|
98
|
+
* 0.0 to 1.0
|
|
99
|
+
*
|
|
100
|
+
* Default:
|
|
101
|
+
* 0.8
|
|
102
|
+
*
|
|
103
|
+
* Recommended values:
|
|
104
|
+
* - 0.7 for dynamic UI
|
|
105
|
+
* - 0.8 for standard usage
|
|
106
|
+
* - 0.9+ for strict matching
|
|
107
|
+
*
|
|
108
|
+
* Higher confidence improves
|
|
109
|
+
* matching accuracy but may fail
|
|
110
|
+
* on scaled or slightly modified UI.
|
|
111
|
+
*
|
|
112
|
+
* @returns Best matched region or null.
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* const region =
|
|
116
|
+
* await visor.find("save.png");
|
|
117
|
+
*/
|
|
118
118
|
find(image: string, confidence?: number): Promise<import("./types").Region>;
|
|
119
119
|
/**
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
120
|
+
* Checks whether an image exists
|
|
121
|
+
* on the current screen.
|
|
122
|
+
*
|
|
123
|
+
* @param image Image filename or path.
|
|
124
|
+
* @param confidence Match confidence threshold.
|
|
125
|
+
*
|
|
126
|
+
* Accepted range:
|
|
127
|
+
* 0.0 to 1.0
|
|
128
|
+
*
|
|
129
|
+
* Default:
|
|
130
|
+
* 0.8
|
|
131
|
+
*
|
|
132
|
+
* @returns True if image exists.
|
|
133
|
+
*
|
|
134
|
+
* @example
|
|
135
|
+
* const exists =
|
|
136
|
+
* await visor.exists("login.png");
|
|
137
|
+
*/
|
|
138
138
|
exists(image: string, confidence?: number): Promise<boolean>;
|
|
139
139
|
/**
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
140
|
+
* Finds all matching occurrences of an image
|
|
141
|
+
* on the current screen using OpenCV.
|
|
142
|
+
*
|
|
143
|
+
* @param image Image filename or path.
|
|
144
|
+
* @param confidence Match confidence threshold.
|
|
145
|
+
*
|
|
146
|
+
* Accepted range:
|
|
147
|
+
* 0.0 to 1.0
|
|
148
|
+
*
|
|
149
|
+
* Default:
|
|
150
|
+
* 0.8
|
|
151
|
+
*
|
|
152
|
+
* Lower confidence may return
|
|
153
|
+
* more false-positive matches.
|
|
154
|
+
*
|
|
155
|
+
* @returns Array of matched regions.
|
|
156
|
+
*
|
|
157
|
+
* @example
|
|
158
|
+
* const matches =
|
|
159
|
+
* await visor.findAll("icon.png");
|
|
160
|
+
*/
|
|
161
161
|
findAll(image: string, confidence?: number): Promise<import("./types").Region[]>;
|
|
162
162
|
/**
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
163
|
+
* Finds all image matches and prints
|
|
164
|
+
* a formatted match preview including
|
|
165
|
+
* coordinates and confidence values.
|
|
166
|
+
*
|
|
167
|
+
* Useful for debugging and visual
|
|
168
|
+
* automation tuning.
|
|
169
|
+
*
|
|
170
|
+
* @param image Image filename or path.
|
|
171
|
+
* @param confidence Match confidence threshold.
|
|
172
|
+
*
|
|
173
|
+
* Accepted range:
|
|
174
|
+
* 0.0 to 1.0
|
|
175
|
+
*
|
|
176
|
+
* Default:
|
|
177
|
+
* 0.8
|
|
178
|
+
*
|
|
179
|
+
* @returns Array of matched regions.
|
|
180
|
+
*
|
|
181
|
+
* @example
|
|
182
|
+
* await visor.previewMatches("button.png");
|
|
183
|
+
*/
|
|
184
184
|
previewMatches(image: string, confidence?: number): Promise<import("./types").Region[]>;
|
|
185
185
|
/**
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
186
|
+
* Waits until an image appears
|
|
187
|
+
* on the screen.
|
|
188
|
+
*
|
|
189
|
+
* @param image Image filename or path.
|
|
190
|
+
*
|
|
191
|
+
* @param confidence Match confidence threshold.
|
|
192
|
+
*
|
|
193
|
+
* Accepted range:
|
|
194
|
+
* 0.0 to 1.0
|
|
195
|
+
*
|
|
196
|
+
* Default:
|
|
197
|
+
* 0.8
|
|
198
|
+
*
|
|
199
|
+
* Recommended values:
|
|
200
|
+
* - 0.7 for dynamic UI
|
|
201
|
+
* - 0.8 for standard usage
|
|
202
|
+
* - 0.9+ for strict matching
|
|
203
|
+
*
|
|
204
|
+
* @param timeout Timeout duration
|
|
205
|
+
* in milliseconds.
|
|
206
|
+
*
|
|
207
|
+
* Default:
|
|
208
|
+
* 5000ms
|
|
209
|
+
*
|
|
210
|
+
* Recommended range:
|
|
211
|
+
* 1000ms to 30000ms
|
|
212
|
+
*
|
|
213
|
+
* @throws Error if timeout occurs.
|
|
214
|
+
*
|
|
215
|
+
* @example
|
|
216
|
+
* await visor.wait("loading-done.png");
|
|
217
|
+
*/
|
|
218
218
|
wait(image: string, { confidence, timeout }?: {
|
|
219
219
|
confidence?: number;
|
|
220
220
|
timeout?: number;
|
|
221
221
|
}): Promise<boolean>;
|
|
222
222
|
/**
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
223
|
+
* Waits until an image disappears
|
|
224
|
+
* from the screen.
|
|
225
|
+
*
|
|
226
|
+
* @param image Image filename or path.
|
|
227
|
+
* @param confidence Match confidence threshold.
|
|
228
|
+
*
|
|
229
|
+
* Accepted range:
|
|
230
|
+
* 0.0 to 1.0
|
|
231
|
+
*
|
|
232
|
+
* Default:
|
|
233
|
+
* 0.8
|
|
234
|
+
* @param timeout Timeout duration
|
|
235
|
+
* in milliseconds.
|
|
236
|
+
*
|
|
237
|
+
* Default:
|
|
238
|
+
* 5000ms
|
|
239
|
+
*
|
|
240
|
+
* Recommended range:
|
|
241
|
+
* 1000ms to 30000ms
|
|
242
|
+
* @throws Error if timeout occurs.
|
|
243
|
+
*
|
|
244
|
+
* @example
|
|
245
|
+
* await visor.waitToVanish("spinner.png");
|
|
246
|
+
*/
|
|
247
247
|
waitToVanish(image: string, { confidence, timeout }?: {
|
|
248
248
|
confidence?: number;
|
|
249
249
|
timeout?: number;
|
|
250
250
|
}): Promise<boolean>;
|
|
251
251
|
/**
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
252
|
+
* Waits until specific text appears
|
|
253
|
+
* on screen using OCR.
|
|
254
|
+
*
|
|
255
|
+
* Performance Note:
|
|
256
|
+
* OCR operations are computationally
|
|
257
|
+
* expensive and may take 1–5 seconds
|
|
258
|
+
* depending on screen complexity.
|
|
259
|
+
*
|
|
260
|
+
* @param text Text to search for.
|
|
261
|
+
*
|
|
262
|
+
* @param timeout Timeout duration
|
|
263
|
+
* in milliseconds.
|
|
264
|
+
*
|
|
265
|
+
* Default:
|
|
266
|
+
* 5000ms
|
|
267
|
+
*
|
|
268
|
+
* Recommended range:
|
|
269
|
+
* 1000ms to 30000ms
|
|
270
|
+
*
|
|
271
|
+
* @throws Error if timeout occurs.
|
|
272
|
+
*
|
|
273
|
+
* @example
|
|
274
|
+
* await visor.waitText("Success");
|
|
275
|
+
*/
|
|
276
276
|
waitText(text: string, timeout?: number): Promise<boolean>;
|
|
277
277
|
/**
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
278
|
+
* Waits until specific text disappears
|
|
279
|
+
* from screen using OCR.
|
|
280
|
+
* Performance Note:
|
|
281
|
+
* OCR operations are computationally
|
|
282
|
+
* expensive and may take 1–5 seconds
|
|
283
|
+
* depending on screen complexity.
|
|
284
|
+
*
|
|
285
|
+
* @param text Text to search for.
|
|
286
|
+
* @param timeout Timeout duration
|
|
287
|
+
* in milliseconds.
|
|
288
|
+
*
|
|
289
|
+
* Default:
|
|
290
|
+
* 5000ms
|
|
291
|
+
*
|
|
292
|
+
* Recommended range:
|
|
293
|
+
* 1000ms to 30000ms
|
|
294
|
+
*
|
|
295
|
+
* @throws Error if timeout occurs.
|
|
296
|
+
*
|
|
297
|
+
* @example
|
|
298
|
+
* await visor.waitTextToVanish("Loading");
|
|
299
|
+
*/
|
|
300
300
|
waitTextToVanish(text: string, timeout?: number): Promise<boolean>;
|
|
301
301
|
/**
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
302
|
+
* Finds text on screen using OCR
|
|
303
|
+
* and performs a left mouse click
|
|
304
|
+
* on the matched text region.
|
|
305
|
+
*
|
|
306
|
+
* @param text Text to search for.
|
|
307
|
+
* @param index Index of the text to click.
|
|
308
|
+
*
|
|
309
|
+
* @throws Error if text is not found.
|
|
310
|
+
*
|
|
311
|
+
* @example
|
|
312
|
+
* await visor.clickText("Login");
|
|
313
|
+
*/
|
|
314
314
|
clickText(text: string, index?: number): Promise<void>;
|
|
315
315
|
/**
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
316
|
+
* Finds text on screen or inside
|
|
317
|
+
* a specific region using OCR.
|
|
318
|
+
*
|
|
319
|
+
* @param text Text to search for.
|
|
320
|
+
* @param index Index of the text to search.
|
|
321
|
+
* @param region Optional search region.
|
|
322
|
+
*
|
|
323
|
+
* @returns Matched text region or null.
|
|
324
|
+
*
|
|
325
|
+
* @example
|
|
326
|
+
* const region =
|
|
327
|
+
* await visor.findText("Submit");
|
|
328
|
+
*/
|
|
329
329
|
findText(text: string, index?: number, region?: {
|
|
330
330
|
x: number;
|
|
331
331
|
y: number;
|
|
@@ -333,18 +333,18 @@ export declare class Visor {
|
|
|
333
333
|
height: number;
|
|
334
334
|
}): Promise<import("./types").Region>;
|
|
335
335
|
/**
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
336
|
+
* Checks whether specific text exists
|
|
337
|
+
* on screen using OCR.
|
|
338
|
+
*
|
|
339
|
+
* @param text Text to search for.
|
|
340
|
+
* @param region Optional search region.
|
|
341
|
+
*
|
|
342
|
+
* @returns True if text exists.
|
|
343
|
+
*
|
|
344
|
+
* @example
|
|
345
|
+
* const exists =
|
|
346
|
+
* await visor.existsText("Teams");
|
|
347
|
+
*/
|
|
348
348
|
existsText(text: string, region?: {
|
|
349
349
|
x: number;
|
|
350
350
|
y: number;
|
|
@@ -352,22 +352,22 @@ export declare class Visor {
|
|
|
352
352
|
height: number;
|
|
353
353
|
}): Promise<boolean>;
|
|
354
354
|
/**
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
355
|
+
* Performs OCR on a specific
|
|
356
|
+
* screen region.
|
|
357
|
+
*
|
|
358
|
+
* @param region Screen region coordinates.
|
|
359
|
+
*
|
|
360
|
+
* @returns OCR result object.
|
|
361
|
+
*
|
|
362
|
+
* @example
|
|
363
|
+
* const result =
|
|
364
|
+
* await visor.readRegion({
|
|
365
|
+
* x: 100,
|
|
366
|
+
* y: 100,
|
|
367
|
+
* width: 500,
|
|
368
|
+
* height: 300
|
|
369
|
+
* });
|
|
370
|
+
*/
|
|
371
371
|
readRegion(region: {
|
|
372
372
|
x: number;
|
|
373
373
|
y: number;
|
|
@@ -375,362 +375,364 @@ export declare class Visor {
|
|
|
375
375
|
height: number;
|
|
376
376
|
}): Promise<any>;
|
|
377
377
|
/**
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
378
|
+
* Performs OCR on the entire screen
|
|
379
|
+
* using Tesseract OCR.
|
|
380
|
+
*
|
|
381
|
+
* Captures the current screen,
|
|
382
|
+
* preprocesses the image, and
|
|
383
|
+
* extracts readable text content.
|
|
384
|
+
*
|
|
385
|
+
* Performance Note:
|
|
386
|
+
* OCR is computationally expensive
|
|
387
|
+
* and may take 1–5 seconds depending
|
|
388
|
+
* on:
|
|
389
|
+
* - screen complexity
|
|
390
|
+
* - text density
|
|
391
|
+
* - display resolution
|
|
392
|
+
* - system performance
|
|
393
|
+
*
|
|
394
|
+
* Returns:
|
|
395
|
+
* - extracted text
|
|
396
|
+
* - OCR metadata
|
|
397
|
+
* - TSV layout information
|
|
398
|
+
* - HOCR data
|
|
399
|
+
*
|
|
400
|
+
* @returns OCR result object.
|
|
401
|
+
*
|
|
402
|
+
* @example
|
|
403
|
+
* const result =
|
|
404
|
+
* await visor.readScreen();
|
|
405
|
+
*
|
|
406
|
+
* log(result.text);
|
|
407
|
+
*/
|
|
408
408
|
readScreen(): Promise<any>;
|
|
409
409
|
/**
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
410
|
+
* Captures a screenshot of the
|
|
411
|
+
* current screen and saves it
|
|
412
|
+
* to the specified path.
|
|
413
|
+
*
|
|
414
|
+
* Supported formats depend on
|
|
415
|
+
* the output file extension.
|
|
416
|
+
*
|
|
417
|
+
* @param path Output image path.
|
|
418
|
+
*
|
|
419
|
+
* @example
|
|
420
|
+
* await visor.captureScreenshot(
|
|
421
|
+
* "./screenshots/home.png"
|
|
422
|
+
* );
|
|
423
|
+
*/
|
|
424
424
|
captureScreenshot(path: string): Promise<void>;
|
|
425
425
|
/**
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
426
|
+
* Opens a desktop application,
|
|
427
|
+
* executable, file, folder,
|
|
428
|
+
* or URL using Windows shell.
|
|
429
|
+
*
|
|
430
|
+
* Performance Note:
|
|
431
|
+
* Some Electron-based applications
|
|
432
|
+
* may require additional startup
|
|
433
|
+
* stabilization time.
|
|
434
|
+
*
|
|
435
|
+
* @param command App name, executable,
|
|
436
|
+
* file path, or URL.
|
|
437
|
+
*
|
|
438
|
+
* @example
|
|
439
|
+
* await visor.openApp("notepad");
|
|
440
|
+
*
|
|
441
|
+
* @example
|
|
442
|
+
* await visor.openApp("chrome.exe");
|
|
443
|
+
*/
|
|
444
444
|
openApp(command: string): Promise<void>;
|
|
445
445
|
/**
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
446
|
+
* Drags one visual element and
|
|
447
|
+
* drops it onto another using
|
|
448
|
+
* image matching.
|
|
449
|
+
*
|
|
450
|
+
* @param source Source image.
|
|
451
|
+
*
|
|
452
|
+
* @param target Target image.
|
|
453
|
+
*
|
|
454
|
+
* @param confidence Match confidence threshold.
|
|
455
|
+
*
|
|
456
|
+
* Accepted range:
|
|
457
|
+
* 0.0 to 1.0
|
|
458
|
+
*
|
|
459
|
+
* Default:
|
|
460
|
+
* 0.8
|
|
461
|
+
*
|
|
462
|
+
* Recommended values:
|
|
463
|
+
* - 0.7 for dynamic UI
|
|
464
|
+
* - 0.8 for standard usage
|
|
465
|
+
* - 0.9+ for strict matching
|
|
466
|
+
*
|
|
467
|
+
* @throws Error if source or target
|
|
468
|
+
* image is not found.
|
|
469
|
+
*
|
|
470
|
+
* @example
|
|
471
|
+
* await visor.dragDrop(
|
|
472
|
+
* "file.png",
|
|
473
|
+
* "folder.png"
|
|
474
|
+
* );
|
|
475
|
+
*/
|
|
476
476
|
dragDrop(source: string, target: string, confidence?: number): Promise<void>;
|
|
477
477
|
/**
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
478
|
+
* Moves the mouse cursor to the
|
|
479
|
+
* matched image location without
|
|
480
|
+
* performing a click.
|
|
481
|
+
*
|
|
482
|
+
* @param image Image filename or path.
|
|
483
|
+
* @param confidence Match confidence threshold.
|
|
484
|
+
*
|
|
485
|
+
* Accepted range:
|
|
486
|
+
* 0.0 to 1.0
|
|
487
|
+
*
|
|
488
|
+
* Default:
|
|
489
|
+
* 0.8
|
|
490
|
+
*
|
|
491
|
+
* @throws Error if image is not found.
|
|
492
|
+
*
|
|
493
|
+
* @example
|
|
494
|
+
* await visor.hover("menu.png");
|
|
495
|
+
*/
|
|
496
496
|
hover(image: string, confidence?: number): Promise<void>;
|
|
497
497
|
/**
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
498
|
+
* Scrolls the mouse wheel downward.
|
|
499
|
+
*
|
|
500
|
+
* @param amount Scroll amount.
|
|
501
|
+
*
|
|
502
|
+
* Default:
|
|
503
|
+
* 500
|
|
504
|
+
*
|
|
505
|
+
* Recommended range:
|
|
506
|
+
* 100 to 3000
|
|
507
|
+
*
|
|
508
|
+
* @example
|
|
509
|
+
* await visor.scrollDown(1000);
|
|
510
|
+
*/
|
|
511
511
|
scrollDown(amount?: number): Promise<void>;
|
|
512
512
|
/**
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
513
|
+
* Scrolls the mouse wheel upward.
|
|
514
|
+
*
|
|
515
|
+
* @param amount Scroll amount.
|
|
516
|
+
*
|
|
517
|
+
* Default:
|
|
518
|
+
* 500
|
|
519
|
+
*
|
|
520
|
+
* Recommended range:
|
|
521
|
+
* 100 to 3000
|
|
522
|
+
*
|
|
523
|
+
* @example
|
|
524
|
+
* await visor.scrollUp(1000);
|
|
525
|
+
*/
|
|
526
526
|
scrollUp(amount?: number): Promise<void>;
|
|
527
527
|
/**
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
528
|
+
* Types text using keyboard automation.
|
|
529
|
+
*
|
|
530
|
+
* @param text Text to type.
|
|
531
|
+
*
|
|
532
|
+
* @example
|
|
533
|
+
* await visor.type("Hello World");
|
|
534
|
+
*/
|
|
535
535
|
type(text: string): Promise<void>;
|
|
536
536
|
/**
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
537
|
+
* Presses one or more keyboard keys.
|
|
538
|
+
*
|
|
539
|
+
* Supports both single key presses
|
|
540
|
+
* and hotkey combinations.
|
|
541
|
+
*
|
|
542
|
+
* @param keys Keyboard keys to press.
|
|
543
|
+
*
|
|
544
|
+
* @example
|
|
545
|
+
* await visor.press(visor.Key.Enter);
|
|
546
|
+
*
|
|
547
|
+
* @example
|
|
548
|
+
* await visor.press(
|
|
549
|
+
* visor.Key.LeftControl,
|
|
550
|
+
* visor.Key.S
|
|
551
|
+
* );
|
|
552
|
+
*/
|
|
553
553
|
press(...keys: any[]): Promise<void>;
|
|
554
554
|
/**
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
555
|
+
* Pauses execution for a specified
|
|
556
|
+
* duration.
|
|
557
|
+
*
|
|
558
|
+
* Useful for:
|
|
559
|
+
* - UI stabilization
|
|
560
|
+
* - animation completion
|
|
561
|
+
* - Electron rendering delays
|
|
562
|
+
* - OCR synchronization
|
|
563
|
+
* - desktop transition handling
|
|
564
|
+
*
|
|
565
|
+
* Recommended for short stabilization
|
|
566
|
+
* waits rather than long fixed delays.
|
|
567
|
+
*
|
|
568
|
+
* @param ms Delay duration
|
|
569
|
+
* in milliseconds.
|
|
570
|
+
*
|
|
571
|
+
* Recommended range:
|
|
572
|
+
* 200ms to 5000ms
|
|
573
|
+
*
|
|
574
|
+
* Excessive sleep usage may
|
|
575
|
+
* slow automation execution.
|
|
576
|
+
*
|
|
577
|
+
* @example
|
|
578
|
+
* await visor.sleep(2000);
|
|
579
|
+
*/
|
|
580
580
|
sleep(ms: number): Promise<unknown>;
|
|
581
581
|
/**
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
582
|
+
* Moves the mouse cursor to the
|
|
583
|
+
* specified screen coordinates.
|
|
584
|
+
*
|
|
585
|
+
* Coordinates should match the
|
|
586
|
+
* current display scaling setup.
|
|
587
|
+
*
|
|
588
|
+
* @param x X coordinate.
|
|
589
|
+
* @param y Y coordinate.
|
|
590
|
+
*
|
|
591
|
+
* @example
|
|
592
|
+
* await visor.moveMouse(500, 300);
|
|
593
|
+
*/
|
|
594
594
|
moveMouse(x: number, y: number): Promise<void>;
|
|
595
595
|
/**
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
596
|
+
* Returns the current mouse cursor
|
|
597
|
+
* position.
|
|
598
|
+
*
|
|
599
|
+
* @returns Current mouse coordinates.
|
|
600
|
+
*
|
|
601
|
+
* @example
|
|
602
|
+
* const pos =
|
|
603
|
+
* await visor.getMousePosition();
|
|
604
|
+
*/
|
|
605
605
|
getMousePosition(): Promise<Point>;
|
|
606
606
|
/**
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
607
|
+
* Sets the display scaling factor
|
|
608
|
+
* used for coordinate normalization
|
|
609
|
+
* and image matching.
|
|
610
|
+
*
|
|
611
|
+
* Required for:
|
|
612
|
+
* - high-DPI displays
|
|
613
|
+
* - Windows display scaling
|
|
614
|
+
* - accurate mouse positioning
|
|
615
|
+
* - reliable template matching
|
|
616
|
+
*
|
|
617
|
+
* Common values:
|
|
618
|
+
* - 1.0 = 100% scaling
|
|
619
|
+
* - 1.25 = 125% scaling
|
|
620
|
+
* - 1.5 = 150% scaling
|
|
621
|
+
* - 2.0 = 200% scaling
|
|
622
|
+
*
|
|
623
|
+
* Incorrect scaling values may cause:
|
|
624
|
+
* - inaccurate clicks
|
|
625
|
+
* - failed image matching
|
|
626
|
+
* - incorrect OCR regions
|
|
627
|
+
* - offset mouse movement
|
|
628
|
+
*
|
|
629
|
+
* @param scale Display scaling factor.
|
|
630
|
+
*
|
|
631
|
+
* Recommended range:
|
|
632
|
+
* 1.0 to 2.0
|
|
633
|
+
*
|
|
634
|
+
* @example
|
|
635
|
+
* visor.setScaleFactor(1.5);
|
|
636
|
+
*/
|
|
637
637
|
setScaleFactor(scale: number): void;
|
|
638
638
|
/**
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
639
|
+
* Returns the current display
|
|
640
|
+
* scaling factor.
|
|
641
|
+
*
|
|
642
|
+
* @returns Current scale factor.
|
|
643
|
+
*
|
|
644
|
+
* @example
|
|
645
|
+
* const scale =
|
|
646
|
+
* visor.getScaleFactor();
|
|
647
|
+
*/
|
|
648
648
|
getScaleFactor(): number;
|
|
649
649
|
/**
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
650
|
+
* Enables or disables debug logging.
|
|
651
|
+
*
|
|
652
|
+
* @param mode Debug mode state.
|
|
653
|
+
*
|
|
654
|
+
* @example
|
|
655
|
+
* visor.setDebug(true);
|
|
656
|
+
*/
|
|
657
657
|
setDebug(mode: boolean): void;
|
|
658
658
|
/**
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
659
|
+
* Sets the default image search path
|
|
660
|
+
* used for visual automation APIs.
|
|
661
|
+
*
|
|
662
|
+
* @param path Image directory path.
|
|
663
|
+
*
|
|
664
|
+
* @example
|
|
665
|
+
* visor.setImagePath("./images");
|
|
666
|
+
*/
|
|
667
667
|
setImagePath(path: string): void;
|
|
668
668
|
/**
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
669
|
+
* Returns the current default
|
|
670
|
+
* image search path.
|
|
671
|
+
*
|
|
672
|
+
* @returns Image path.
|
|
673
|
+
*
|
|
674
|
+
* @example
|
|
675
|
+
* const path =
|
|
676
|
+
* visor.getImagePath();
|
|
677
|
+
*/
|
|
678
678
|
getImagePath(): string;
|
|
679
679
|
/**
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
680
|
+
* Sets the default output path
|
|
681
|
+
* used for visual automation APIs.
|
|
682
|
+
*
|
|
683
|
+
* @param path Output directory path.
|
|
684
|
+
*
|
|
685
|
+
* @example
|
|
686
|
+
* visor.setOutputPath("./images");
|
|
687
|
+
*/
|
|
688
688
|
setOutputPath(path: string): void;
|
|
689
689
|
/**
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
690
|
+
* Returns the current default
|
|
691
|
+
* Output path.
|
|
692
|
+
*
|
|
693
|
+
* @returns Output path.
|
|
694
|
+
*
|
|
695
|
+
* @example
|
|
696
|
+
* const path =
|
|
697
|
+
* visor.getOutputPath();
|
|
698
|
+
*/
|
|
699
699
|
getOutputPath(): string;
|
|
700
700
|
/**
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
701
|
+
* Closes a desktop application
|
|
702
|
+
* using Windows taskkill.
|
|
703
|
+
*
|
|
704
|
+
* @param processName Process executable name.
|
|
705
|
+
*
|
|
706
|
+
* @example
|
|
707
|
+
* await visor.closeApp("notepad.exe");
|
|
708
|
+
*
|
|
709
|
+
* @example
|
|
710
|
+
* await visor.closeApp("ms-teams.exe");
|
|
711
|
+
*/
|
|
712
712
|
closeApp(processName: string): Promise<void>;
|
|
713
713
|
/**
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
714
|
+
* Loads multiple framework settings
|
|
715
|
+
* at once from a configuration object.
|
|
716
|
+
*
|
|
717
|
+
* Useful for centralized framework
|
|
718
|
+
* initialization and project setup.
|
|
719
|
+
*
|
|
720
|
+
* Supported settings:
|
|
721
|
+
* - scaleFactor
|
|
722
|
+
* - imagePath
|
|
723
|
+
* - ssOutputPath
|
|
724
|
+
* - debug
|
|
725
|
+
*
|
|
726
|
+
* @param config Framework configuration object.
|
|
727
|
+
*
|
|
728
|
+
* @example
|
|
729
|
+
* visor.loadConfig({
|
|
730
|
+
* scaleFactor: 1.5,
|
|
731
|
+
* imagePath: "./images",
|
|
732
|
+
* ssOutputPath: "./screenshots",
|
|
733
|
+
* debug: true
|
|
734
|
+
* });
|
|
735
|
+
*/
|
|
734
736
|
loadConfig(config: {
|
|
735
737
|
scaleFactor?: number;
|
|
736
738
|
imagePath?: string;
|
|
@@ -738,168 +740,168 @@ export declare class Visor {
|
|
|
738
740
|
debug?: boolean;
|
|
739
741
|
}): void;
|
|
740
742
|
/**
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
743
|
+
* Finds the first matching image
|
|
744
|
+
* from a list of possible images.
|
|
745
|
+
*
|
|
746
|
+
* Useful for handling:
|
|
747
|
+
* - light/dark themes
|
|
748
|
+
* - UI variations
|
|
749
|
+
* - multiple visual states
|
|
750
|
+
*
|
|
751
|
+
* @param images Array of image filenames or paths.
|
|
752
|
+
* @param confidence Match confidence threshold.
|
|
753
|
+
*
|
|
754
|
+
* Accepted range:
|
|
755
|
+
* 0.0 to 1.0
|
|
756
|
+
*
|
|
757
|
+
* Default:
|
|
758
|
+
* 0.8
|
|
759
|
+
*
|
|
760
|
+
* @returns Object containing matched image
|
|
761
|
+
* and region, or null if none matched.
|
|
762
|
+
*
|
|
763
|
+
* @example
|
|
764
|
+
* const result =
|
|
765
|
+
* await visor.findAny([
|
|
766
|
+
* "chat-light.png",
|
|
767
|
+
* "chat-dark.png"
|
|
768
|
+
* ]);
|
|
769
|
+
*/
|
|
768
770
|
findAny(images: string[], confidence?: number): Promise<{
|
|
769
771
|
image: string;
|
|
770
772
|
region: import("./types").Region;
|
|
771
773
|
}>;
|
|
772
774
|
/**
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
775
|
+
* Checks whether any image from
|
|
776
|
+
* a list exists on the current screen.
|
|
777
|
+
*
|
|
778
|
+
* Useful for handling:
|
|
779
|
+
* - multiple themes
|
|
780
|
+
* - alternate UI layouts
|
|
781
|
+
* - dynamic visual states
|
|
782
|
+
*
|
|
783
|
+
* @param images Array of image filenames or paths.
|
|
784
|
+
* @param confidence Match confidence threshold.
|
|
785
|
+
*
|
|
786
|
+
* Accepted range:
|
|
787
|
+
* 0.0 to 1.0
|
|
788
|
+
*
|
|
789
|
+
* Default:
|
|
790
|
+
* 0.8
|
|
791
|
+
*
|
|
792
|
+
* @returns True if any image exists.
|
|
793
|
+
*
|
|
794
|
+
* @example
|
|
795
|
+
* const exists =
|
|
796
|
+
* await visor.existsAny([
|
|
797
|
+
* "save-light.png",
|
|
798
|
+
* "save-dark.png"
|
|
799
|
+
* ]);
|
|
800
|
+
*/
|
|
799
801
|
existsAny(images: string[], confidence?: number): Promise<boolean>;
|
|
800
802
|
/**
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
803
|
+
* Finds the first matching image
|
|
804
|
+
* from a list and performs a
|
|
805
|
+
* left mouse click on it.
|
|
806
|
+
*
|
|
807
|
+
* Useful for handling:
|
|
808
|
+
* - light/dark themes
|
|
809
|
+
* - UI variations
|
|
810
|
+
* - dynamic buttons/icons
|
|
811
|
+
*
|
|
812
|
+
* @param images Array of image
|
|
813
|
+
* filenames or paths.
|
|
814
|
+
*
|
|
815
|
+
* @param confidence Match confidence threshold.
|
|
816
|
+
*
|
|
817
|
+
* Accepted range:
|
|
818
|
+
* 0.0 to 1.0
|
|
819
|
+
*
|
|
820
|
+
* Default:
|
|
821
|
+
* 0.8
|
|
822
|
+
*
|
|
823
|
+
* Recommended values:
|
|
824
|
+
* - 0.7 for dynamic UI
|
|
825
|
+
* - 0.8 for standard usage
|
|
826
|
+
* - 0.9+ for strict matching
|
|
827
|
+
*
|
|
828
|
+
* Lower confidence increases
|
|
829
|
+
* flexibility but may increase
|
|
830
|
+
* false positives.
|
|
831
|
+
*
|
|
832
|
+
* @throws Error if none of the
|
|
833
|
+
* images are found.
|
|
834
|
+
*
|
|
835
|
+
* @example
|
|
836
|
+
* await visor.clickAny([
|
|
837
|
+
* "send-light.png",
|
|
838
|
+
* "send-dark.png"
|
|
839
|
+
* ]);
|
|
840
|
+
*/
|
|
839
841
|
clickAny(images: string[], confidence?: number): Promise<void>;
|
|
840
842
|
/**
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
843
|
+
* Waits until any image from
|
|
844
|
+
* a list appears on screen.
|
|
845
|
+
*
|
|
846
|
+
* Useful for handling:
|
|
847
|
+
* - multiple themes
|
|
848
|
+
* - alternate UI layouts
|
|
849
|
+
* - dynamic application states
|
|
850
|
+
*
|
|
851
|
+
* @param images Array of image
|
|
852
|
+
* filenames or paths.
|
|
853
|
+
*
|
|
854
|
+
* @param confidence Match confidence threshold.
|
|
855
|
+
*
|
|
856
|
+
* Accepted range:
|
|
857
|
+
* 0.0 to 1.0
|
|
858
|
+
*
|
|
859
|
+
* Default:
|
|
860
|
+
* 0.8
|
|
861
|
+
*
|
|
862
|
+
* Recommended values:
|
|
863
|
+
* - 0.7 for dynamic UI
|
|
864
|
+
* - 0.8 for standard usage
|
|
865
|
+
* - 0.9+ for strict matching
|
|
866
|
+
*
|
|
867
|
+
* Lower confidence increases
|
|
868
|
+
* flexibility but may increase
|
|
869
|
+
* false positives.
|
|
870
|
+
*
|
|
871
|
+
* @param timeout Timeout duration
|
|
872
|
+
* in milliseconds.
|
|
873
|
+
*
|
|
874
|
+
* Default:
|
|
875
|
+
* 5000ms
|
|
876
|
+
*
|
|
877
|
+
* Recommended range:
|
|
878
|
+
* 1000ms to 30000ms
|
|
879
|
+
*
|
|
880
|
+
* @throws Error if timeout occurs.
|
|
881
|
+
*
|
|
882
|
+
* @example
|
|
883
|
+
* await visor.waitAny([
|
|
884
|
+
* "home-light.png",
|
|
885
|
+
* "home-dark.png"
|
|
886
|
+
* ]);
|
|
887
|
+
*/
|
|
886
888
|
waitAny(images: string[], { confidence, timeout }?: {
|
|
887
889
|
confidence?: number;
|
|
888
890
|
timeout?: number;
|
|
889
891
|
}): Promise<boolean>;
|
|
890
892
|
/**
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
893
|
+
* Terminates shared OCR worker.
|
|
894
|
+
*
|
|
895
|
+
* Useful for framework cleanup
|
|
896
|
+
* after long automation sessions.
|
|
897
|
+
*
|
|
898
|
+
* Recommended for:
|
|
899
|
+
* - long-running automation
|
|
900
|
+
* - memory cleanup
|
|
901
|
+
* - graceful framework shutdown
|
|
902
|
+
* @example
|
|
903
|
+
* await visor.terminateOCR();
|
|
904
|
+
*/
|
|
903
905
|
terminateOCR(): Promise<void>;
|
|
904
906
|
}
|
|
905
907
|
export declare const visor: Visor;
|