askui 0.18.0 → 0.19.0
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/cjs/core/ai-element/ai-element-collection.d.ts +10 -0
- package/dist/cjs/core/ai-element/ai-element-collection.js +78 -0
- package/dist/cjs/core/ai-element/ai-element-error.d.ts +2 -0
- package/dist/cjs/core/ai-element/ai-element-error.js +6 -0
- package/dist/cjs/core/ai-element/ai-element.d.ts +27 -0
- package/dist/cjs/core/ai-element/ai-element.js +31 -0
- package/dist/cjs/core/model/custom-element-json.d.ts +32 -15
- package/dist/cjs/core/model/custom-element.d.ts +3 -2
- package/dist/cjs/core/model/custom-element.js +4 -2
- package/dist/cjs/core/reporting/step-reporter.js +15 -6
- package/dist/cjs/execution/dsl.d.ts +488 -113
- package/dist/cjs/execution/dsl.js +519 -113
- package/dist/cjs/execution/index.d.ts +1 -1
- package/dist/cjs/execution/index.js +11 -3
- package/dist/cjs/execution/inference-client.js +9 -4
- package/dist/cjs/execution/ui-control-client-dependency-builder.d.ts +1 -0
- package/dist/cjs/execution/ui-control-client-dependency-builder.js +6 -3
- package/dist/cjs/execution/ui-control-client.d.ts +101 -16
- package/dist/cjs/execution/ui-control-client.js +142 -52
- package/dist/cjs/execution/ui-controller-client-interface.d.ts +2 -0
- package/dist/cjs/execution/ui-controller-client.d.ts +1 -0
- package/dist/cjs/execution/ui-controller-client.js +11 -1
- package/dist/cjs/execution/ui-controller-not-connected-error.d.ts +4 -0
- package/dist/cjs/execution/ui-controller-not-connected-error.js +12 -0
- package/dist/cjs/main.d.ts +1 -1
- package/dist/cjs/main.js +12 -3
- package/dist/cjs/utils/analytics/analytics.d.ts +3 -1
- package/dist/cjs/utils/analytics/analytics.js +5 -0
- package/dist/cjs/utils/http/custom-errors/index.js +1 -1
- package/dist/cjs/utils/http/http-client-got.js +46 -20
- package/dist/esm/core/ai-element/ai-element-collection.d.ts +10 -0
- package/dist/esm/core/ai-element/ai-element-collection.js +71 -0
- package/dist/esm/core/ai-element/ai-element-error.d.ts +2 -0
- package/dist/esm/core/ai-element/ai-element-error.js +2 -0
- package/dist/esm/core/ai-element/ai-element.d.ts +27 -0
- package/dist/esm/core/ai-element/ai-element.js +28 -0
- package/dist/esm/core/model/custom-element-json.d.ts +32 -15
- package/dist/esm/core/model/custom-element.d.ts +3 -2
- package/dist/esm/core/model/custom-element.js +4 -2
- package/dist/esm/core/reporting/step-reporter.js +15 -6
- package/dist/esm/execution/dsl.d.ts +488 -113
- package/dist/esm/execution/dsl.js +519 -113
- package/dist/esm/execution/index.d.ts +1 -1
- package/dist/esm/execution/index.js +1 -1
- package/dist/esm/execution/inference-client.js +9 -4
- package/dist/esm/execution/ui-control-client-dependency-builder.d.ts +1 -0
- package/dist/esm/execution/ui-control-client-dependency-builder.js +6 -3
- package/dist/esm/execution/ui-control-client.d.ts +101 -16
- package/dist/esm/execution/ui-control-client.js +142 -49
- package/dist/esm/execution/ui-controller-client-interface.d.ts +2 -0
- package/dist/esm/execution/ui-controller-client.d.ts +1 -0
- package/dist/esm/execution/ui-controller-client.js +11 -1
- package/dist/esm/execution/ui-controller-not-connected-error.d.ts +4 -0
- package/dist/esm/execution/ui-controller-not-connected-error.js +8 -0
- package/dist/esm/main.d.ts +1 -1
- package/dist/esm/main.js +1 -1
- package/dist/esm/utils/analytics/analytics.d.ts +3 -1
- package/dist/esm/utils/analytics/analytics.js +5 -0
- package/dist/esm/utils/http/custom-errors/index.js +1 -1
- package/dist/esm/utils/http/http-client-got.js +46 -20
- package/package.json +1 -1
|
@@ -8,6 +8,10 @@ export declare type ANDROID_KEY = 'home' | 'back' | 'call' | 'endcall' | '0' | '
|
|
|
8
8
|
export declare type MODIFIER_KEY = 'command' | 'alt' | 'control' | 'shift' | 'right_shift';
|
|
9
9
|
export declare type COLOR = 'black' | 'white' | 'red' | 'green' | 'yellow green' | 'orange' | 'yellow' | 'purple' | 'pink' | 'gray' | 'lime green' | 'royal blue';
|
|
10
10
|
export declare type PC_AND_MODIFIER_KEY = 'command' | 'alt' | 'control' | 'shift' | 'right_shift' | 'backspace' | 'delete' | 'enter' | 'tab' | 'escape' | 'up' | 'down' | 'right' | 'left' | 'home' | 'end' | 'pageup' | 'pagedown' | 'f1' | 'f2' | 'f3' | 'f4' | 'f5' | 'f6' | 'f7' | 'f8' | 'f9' | 'f10' | 'f11' | 'f12' | 'space' | '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z' | 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I' | 'J' | 'K' | 'L' | 'M' | 'N' | 'O' | 'P' | 'Q' | 'R' | 'S' | 'T' | 'U' | 'V' | 'W' | 'X' | 'Y' | 'Z' | '!' | '"' | '#' | '$' | '%' | '&' | "'" | '(' | ')' | '*' | '+' | ',' | '-' | '.' | '/' | ':' | ';' | '<' | '=' | '>' | '?' | '@' | '[' | '\\' | ']' | '^' | '_' | '`' | '{' | '|' | '}' | '~ ';
|
|
11
|
+
export interface CommandExecutorContext {
|
|
12
|
+
customElementsJson: CustomElementJson[];
|
|
13
|
+
aiElementNames: string[];
|
|
14
|
+
}
|
|
11
15
|
declare abstract class FluentBase {
|
|
12
16
|
protected prev?: FluentBase | undefined;
|
|
13
17
|
constructor(prev?: FluentBase | undefined);
|
|
@@ -85,9 +89,11 @@ export declare class FluentFilters extends FluentBase {
|
|
|
85
89
|
*
|
|
86
90
|
* **Examples:**
|
|
87
91
|
* ```typescript
|
|
88
|
-
* await aui.
|
|
92
|
+
* await aui.click().button().contains().text().withText('Google Search').exec()
|
|
89
93
|
* ```
|
|
90
94
|
*
|
|
95
|
+
* 
|
|
96
|
+
*
|
|
91
97
|
* @return {FluentFiltersOrRelations}
|
|
92
98
|
*/
|
|
93
99
|
button(): FluentFiltersOrRelations;
|
|
@@ -121,13 +127,20 @@ export declare class FluentFilters extends FluentBase {
|
|
|
121
127
|
/**
|
|
122
128
|
* Filters for an UI element 'text'.
|
|
123
129
|
*
|
|
124
|
-
*
|
|
130
|
+
* Takes an optional parameter to filter for a specific text.
|
|
131
|
+
* See the examples below.
|
|
132
|
+
*
|
|
125
133
|
* See also the filters `withTextRegex()` and `withExactText()`
|
|
126
134
|
*
|
|
127
135
|
* **Examples:**
|
|
128
136
|
* ```typescript
|
|
129
|
-
* await aui.click().text().
|
|
137
|
+
* await aui.click().text().exec();
|
|
138
|
+
* await aui.click().text('Username').exec();
|
|
139
|
+
*
|
|
140
|
+
* // Matching with an exact text
|
|
130
141
|
* await aui.click().text().withExactText('Username').exec();
|
|
142
|
+
*
|
|
143
|
+
* // Matching with a regex
|
|
131
144
|
* await aui.click().text().withTextRegex('\b[Ss]\w+').exec();
|
|
132
145
|
* ```
|
|
133
146
|
*
|
|
@@ -144,13 +157,17 @@ export declare class FluentFilters extends FluentBase {
|
|
|
144
157
|
* icon().withText('plus')
|
|
145
158
|
* ```
|
|
146
159
|
*
|
|
160
|
+
* 
|
|
161
|
+
*
|
|
147
162
|
* **Note:** This is an alpha feature. The prediction of the icon name is sometimes unstable. Use custom elements as an alternative.
|
|
148
163
|
*
|
|
149
164
|
* @return {FluentFiltersOrRelations}
|
|
150
165
|
*/
|
|
151
166
|
icon(): FluentFiltersOrRelations;
|
|
152
167
|
/**
|
|
153
|
-
* Filters for a 'custom element', that is a UI element which is defined by providing an image and other parameters such as degree of rotation. It allows filtering for a UI element
|
|
168
|
+
* Filters for a 'custom element', that is a UI element which is defined by providing an image and other parameters such as degree of rotation. It allows filtering for a UI element based on an image instead of using text or element descriptions like `button().withText('Submit')` in `await aui.click().button().withText('Submit').exec()`.
|
|
169
|
+
*
|
|
170
|
+
* See the tutorial - [Custom Element](https://docs.askui.com/docs/general/Tutorials/custom-element) for more detail.
|
|
154
171
|
*
|
|
155
172
|
* **Example**
|
|
156
173
|
* ```typescript
|
|
@@ -160,6 +177,7 @@ export declare class FluentFilters extends FluentBase {
|
|
|
160
177
|
* customImage: './logo.png', // required
|
|
161
178
|
* name: 'myLogo', // optional
|
|
162
179
|
* threshold: 0.9, // optional, defaults to 0.9
|
|
180
|
+
* stopThreshold: 0.9, // optional, defaults to 0.9
|
|
163
181
|
* rotationDegreePerStep: 0, // optional, defaults to 0
|
|
164
182
|
* imageCompareFormat: 'grayscale', // optional, defaults to 'grayscale'
|
|
165
183
|
* // mask:{x:0, y:0}[] // optional, a polygon to match only a certain area of the custom element
|
|
@@ -174,12 +192,13 @@ export declare class FluentFilters extends FluentBase {
|
|
|
174
192
|
* - **name** (*`string`, optional*):
|
|
175
193
|
* - A unique name that can be used for filtering for the custom element. If not given, any text inside the custom image will be detected via OCR.
|
|
176
194
|
* - **threshold** (*`number`, optional*):
|
|
177
|
-
* - A threshold for how much a UI element needs to be similar to the custom element as defined. Takes values between `0.0` (== all elements are recognized as the custom element which is probably not what you want) and `1.0` (== elements need to look exactly like the `customImage` which is unlikely to be achieved as even minor differences count). Defaults to `0.9`.
|
|
195
|
+
* - A threshold for how much a UI element needs to be similar to the custom element as defined by the image. Takes values between `0.0` (== all elements are recognized as the custom element which is probably not what you want) and `1.0` (== elements need to look exactly like the `customImage` which is unlikely to be achieved as even minor differences count). Defaults to `0.9`.
|
|
196
|
+
* - **stopThreshold** (*`number`, optional*):
|
|
197
|
+
* - A threshold for when to stop searching for UI elements similar to the custom element. As soon as UI elements have been found that are at least as similar as the `stopThreshold`, the search is going to stop. After that elements are filtered using the `threshold`. Because of that the `stopThreshold` should be greater than or equal to `threshold`. It is primarily to be used as a speed improvement (by lowering the value). Takes values between `0.0` and `1.0`. Defaults to `0.9`.
|
|
178
198
|
* - **rotationDegreePerStep** (*`number`, optional*):
|
|
179
199
|
* - Step size in rotation degree. Rotates the custom image by this step size until 360° is exceeded. The range is from `0` to `360`. Defaults to `0`.
|
|
180
|
-
* - **imageCompareFormat** (*`'RGB' | 'grayscale'`, optional*):
|
|
181
|
-
* - The color compare style. 'greyscale' compares the brightness of each pixel whereas 'RGB' compares all three
|
|
182
|
-
* of the given custom image.
|
|
200
|
+
* - **imageCompareFormat** (*`'RGB' | 'grayscale' | 'edges'`, optional*):
|
|
201
|
+
* - The color compare style. 'edges' compares only edges, 'greyscale' compares the brightness of each pixel whereas 'RGB' compares all three colors (red, green, blue). Defaults to 'grayscale'.
|
|
183
202
|
*
|
|
184
203
|
*
|
|
185
204
|
* @param {CustomElementJson} customElement - The custom element to filter for.
|
|
@@ -187,6 +206,14 @@ export declare class FluentFilters extends FluentBase {
|
|
|
187
206
|
* @return {FluentFiltersOrRelations}
|
|
188
207
|
*/
|
|
189
208
|
customElement(customElement: CustomElementJson): FluentFiltersOrRelations;
|
|
209
|
+
/**
|
|
210
|
+
* Detects an AI Element created with the workflow creator.
|
|
211
|
+
*
|
|
212
|
+
* @param {string} aiElementName - Name of the AI Element.
|
|
213
|
+
*
|
|
214
|
+
* @return {FluentFiltersOrRelations}
|
|
215
|
+
*/
|
|
216
|
+
aiElement(aiElementName: string): FluentFiltersOrRelations;
|
|
190
217
|
/**
|
|
191
218
|
* Filters for a UI element 'image'.
|
|
192
219
|
*
|
|
@@ -196,10 +223,14 @@ export declare class FluentFilters extends FluentBase {
|
|
|
196
223
|
* await aui.click().image().exec();
|
|
197
224
|
*
|
|
198
225
|
* // Works if you have an image with
|
|
199
|
-
* // a
|
|
200
|
-
* await aui.click().image().above().text().withText('
|
|
226
|
+
* // a text below
|
|
227
|
+
* await aui.click().image().above().text().withText('Automating WebGL').exec();
|
|
201
228
|
* ```
|
|
202
229
|
*
|
|
230
|
+
* 
|
|
231
|
+
*
|
|
232
|
+
*
|
|
233
|
+
*
|
|
203
234
|
* @return {FluentFiltersOrRelations}
|
|
204
235
|
*/
|
|
205
236
|
image(): FluentFiltersOrRelations;
|
|
@@ -216,11 +247,21 @@ export declare class FluentFilters extends FluentBase {
|
|
|
216
247
|
* await aui.typeIn('Oh yeah').textfield().below().text().withText('E-Mail Address').exec();
|
|
217
248
|
* ```
|
|
218
249
|
*
|
|
250
|
+
* 
|
|
251
|
+
*
|
|
252
|
+
*
|
|
253
|
+
*
|
|
219
254
|
* @return {FluentFiltersOrRelations}
|
|
220
255
|
*/
|
|
221
256
|
textfield(): FluentFiltersOrRelations;
|
|
222
257
|
/**
|
|
223
|
-
* Filters for similar
|
|
258
|
+
* Filters for similar -- meaning >70% similar -- text.
|
|
259
|
+
*
|
|
260
|
+
* Takes an optional parameter to specify the similarity. Usually you need the optional parameter for long texts you want to match precisely.
|
|
261
|
+
*
|
|
262
|
+
* _We use [RapidFuzz](https://maxbachmann.github.io/RapidFuzz/Usage/fuzz.html#ratio) which calculates the similarity like this:_
|
|
263
|
+
*
|
|
264
|
+
* `1 - (distance / (lengthString1 + lengthString2))`
|
|
224
265
|
*
|
|
225
266
|
* **Examples:**
|
|
226
267
|
* ```typescript
|
|
@@ -235,6 +276,11 @@ export declare class FluentFilters extends FluentBase {
|
|
|
235
276
|
* // usually false
|
|
236
277
|
* 'atebxtc' === withText('text') => false
|
|
237
278
|
* 'other' === withText('text') => false
|
|
279
|
+
*
|
|
280
|
+
* // optional parameter: similarity_score
|
|
281
|
+
* '978-0-201-00650-6' == withText('978-0-201-00') => true with 82.76 similarity
|
|
282
|
+
* '978-0-201-00650-6' == withText('978-0-201-00', 90) => false with 82.76 < 90 similarity
|
|
283
|
+
* '978-0-201-00650-6' == withText('978-0-201-00', 90) => true with 93.75 < 90 similarity
|
|
238
284
|
* ```
|
|
239
285
|
* 
|
|
240
286
|
*
|
|
@@ -256,6 +302,10 @@ export declare class FluentFilters extends FluentBase {
|
|
|
256
302
|
* await aui.get().text().withTextRegex('\b[Ss]\w+').exec()
|
|
257
303
|
* ```
|
|
258
304
|
*
|
|
305
|
+
* 
|
|
306
|
+
*
|
|
307
|
+
*
|
|
308
|
+
*
|
|
259
309
|
* @param {string} regex_pattern - A regex pattern
|
|
260
310
|
*
|
|
261
311
|
* @return {FluentFiltersOrRelations}
|
|
@@ -277,6 +327,10 @@ export declare class FluentFilters extends FluentBase {
|
|
|
277
327
|
* await aui.moveMouseTo().text().withExactText('Password').exec()
|
|
278
328
|
* ```
|
|
279
329
|
*
|
|
330
|
+
* 
|
|
331
|
+
*
|
|
332
|
+
*
|
|
333
|
+
*
|
|
280
334
|
* @param {string} text - A text to be matched.
|
|
281
335
|
*
|
|
282
336
|
* @return {FluentFiltersOrRelations}
|
|
@@ -301,17 +355,28 @@ export declare class FluentFilters extends FluentBase {
|
|
|
301
355
|
/**
|
|
302
356
|
* Filters elements based on a textual description.
|
|
303
357
|
*
|
|
304
|
-
*
|
|
358
|
+
* **What Should I Write as Matching Text**
|
|
359
|
+
*
|
|
305
360
|
* The text description inside the `matching()` should describe the element visually.
|
|
306
361
|
* It understands color, some famous company/product names, general descriptions.
|
|
307
362
|
*
|
|
308
|
-
* It sometimes requires a bit of playing to find a matching description:
|
|
309
|
-
* E.g. `puzzle piece` can fail
|
|
363
|
+
* It sometimes requires a bit of playing around to find a matching description:
|
|
364
|
+
* E.g. `puzzle piece` can fail while `an icon showing a puzzle piece` might work.
|
|
310
365
|
* Generally the more detail the better.
|
|
311
366
|
*
|
|
312
367
|
* **Examples:**
|
|
313
368
|
* ```typescript
|
|
314
|
-
*
|
|
369
|
+
* // Select the black sneaker from a bunch of sneakers
|
|
370
|
+
* await aui.click().element().matching('a black sneaker shoe').exec();
|
|
371
|
+
*
|
|
372
|
+
* // Select an image that has text in it
|
|
373
|
+
* await aui.click().element().matching('has Burger King in it').exec();
|
|
374
|
+
* await aui.click().element().matching('has adidas in it').exec();
|
|
375
|
+
*
|
|
376
|
+
* // Target a logo/image by describing it
|
|
377
|
+
* await aui.click().element().matching('a mask on purple background and a firefox logo').exec();
|
|
378
|
+
* await aui.click().element().matching('logo looking like an apple with one bite bitten off').exec();
|
|
379
|
+
* await aui.click().element().matching('logo looking like a seashell').exec();
|
|
315
380
|
* ```
|
|
316
381
|
*
|
|
317
382
|
* @param {string} text - A description of the target element.
|
|
@@ -451,14 +516,19 @@ export declare class FluentFiltersOrRelations extends FluentFilters {
|
|
|
451
516
|
/**
|
|
452
517
|
* Filters for an element right of another element.
|
|
453
518
|
*
|
|
519
|
+
* Takes an optional parameter `index` to select the `nth` element (starting with 0)
|
|
520
|
+
*
|
|
454
521
|
* **Examples:**
|
|
455
522
|
* ```typescript
|
|
456
|
-
* -------------- --------------
|
|
457
|
-
* | leftEl | |
|
|
458
|
-
* -------------- --------------
|
|
523
|
+
* -------------- -------------- --------------
|
|
524
|
+
* | leftEl | | rightEl0 | | rightEl1 |
|
|
525
|
+
* -------------- -------------- --------------
|
|
459
526
|
*
|
|
460
|
-
* // Returns
|
|
527
|
+
* // Returns rightEl0 because rightEl0 is the first element right of leftEl
|
|
461
528
|
* ...rightEl().rightOf().leftEl()
|
|
529
|
+
* ...rightEl().rightOf(0).leftEl()
|
|
530
|
+
* // Returns rightEl1 because rightEl1 is the second element right of leftEl
|
|
531
|
+
* ...rightEl().rightOf(1).leftEl()
|
|
462
532
|
* // Returns no element because leftEl is left of rightEl
|
|
463
533
|
* ...leftEl().rightOf().rightEl()
|
|
464
534
|
* ```
|
|
@@ -470,14 +540,19 @@ export declare class FluentFiltersOrRelations extends FluentFilters {
|
|
|
470
540
|
/**
|
|
471
541
|
* Filters for an element left of another element.
|
|
472
542
|
*
|
|
543
|
+
* Takes an optional parameter `index` to select the `nth` element (starting with 0)
|
|
544
|
+
*
|
|
473
545
|
* **Examples:**
|
|
474
546
|
* ```typescript
|
|
475
|
-
* -------------- --------------
|
|
476
|
-
* |
|
|
477
|
-
* -------------- --------------
|
|
547
|
+
* -------------- -------------- --------------
|
|
548
|
+
* | leftEl1 | | leftEl0 | | rightEl |
|
|
549
|
+
* -------------- -------------- --------------
|
|
478
550
|
*
|
|
479
|
-
* // Returns
|
|
551
|
+
* // Returns leftEl0 because leftEl0 is the first element left of rightEl
|
|
480
552
|
* ...leftEl().leftOf().rightEl()
|
|
553
|
+
* ...leftEl().leftOf(0).rightEl()
|
|
554
|
+
* // Returns leftEl1 because leftEl1 is the second element left of rightEl
|
|
555
|
+
* ...leftEl().leftOf(1).rightEl()
|
|
481
556
|
* // Returns no element because rightEl is left of leftEl
|
|
482
557
|
* ...rightEl().leftOf().leftEl()
|
|
483
558
|
* ```
|
|
@@ -489,17 +564,25 @@ export declare class FluentFiltersOrRelations extends FluentFilters {
|
|
|
489
564
|
/**
|
|
490
565
|
* Filters for an element below another element.
|
|
491
566
|
*
|
|
567
|
+
* Takes an optional parameter `index` to select the `nth` element (starting with 0)
|
|
568
|
+
*
|
|
492
569
|
* **Examples:**
|
|
493
570
|
* ```typescript
|
|
494
571
|
* --------------
|
|
495
572
|
* | text |
|
|
496
573
|
* --------------
|
|
497
574
|
* --------------
|
|
498
|
-
* |
|
|
575
|
+
* | button0 |
|
|
576
|
+
* --------------
|
|
577
|
+
* --------------
|
|
578
|
+
* | button1 |
|
|
499
579
|
* --------------
|
|
500
580
|
*
|
|
501
|
-
* // Returns
|
|
581
|
+
* // Returns button0 because button0 is the first button below text
|
|
502
582
|
* ...button().below().text()
|
|
583
|
+
* ...button().below(0).text()
|
|
584
|
+
* // Returns button1 because button1 is the second button below text
|
|
585
|
+
* ...button().below(1).text()
|
|
503
586
|
* // Returns no element because text is above button
|
|
504
587
|
* ...text().below().button()
|
|
505
588
|
* ```
|
|
@@ -511,17 +594,25 @@ export declare class FluentFiltersOrRelations extends FluentFilters {
|
|
|
511
594
|
/**
|
|
512
595
|
* Filters for an element above another element.
|
|
513
596
|
*
|
|
597
|
+
* Takes an optional parameter `index` to select the `nth` element (starting with 0)
|
|
598
|
+
*
|
|
514
599
|
* **Examples:**
|
|
515
600
|
* ```typescript
|
|
516
601
|
* --------------
|
|
517
|
-
* |
|
|
602
|
+
* | text1 |
|
|
603
|
+
* --------------
|
|
604
|
+
* --------------
|
|
605
|
+
* | text0 |
|
|
518
606
|
* --------------
|
|
519
607
|
* --------------
|
|
520
608
|
* | button |
|
|
521
609
|
* --------------
|
|
522
610
|
*
|
|
523
|
-
* // Returns
|
|
611
|
+
* // Returns text0 because text0 is the first element above button
|
|
524
612
|
* ...text().above().button()
|
|
613
|
+
* ...text().above(0).button()
|
|
614
|
+
* // Returns text1 because text1 is the second element above button
|
|
615
|
+
* ...text().above(1).button()
|
|
525
616
|
* // Returns no element because button is below text
|
|
526
617
|
* ...button().above().text()
|
|
527
618
|
* ```
|
|
@@ -641,9 +732,11 @@ export declare class FluentFiltersCondition extends FluentBase {
|
|
|
641
732
|
*
|
|
642
733
|
* **Examples:**
|
|
643
734
|
* ```typescript
|
|
644
|
-
* await aui.
|
|
735
|
+
* await aui.click().button().contains().text().withText('Google Search').exec()
|
|
645
736
|
* ```
|
|
646
737
|
*
|
|
738
|
+
* 
|
|
739
|
+
*
|
|
647
740
|
* @return {FluentFiltersOrRelationsCondition}
|
|
648
741
|
*/
|
|
649
742
|
button(): FluentFiltersOrRelationsCondition;
|
|
@@ -677,13 +770,20 @@ export declare class FluentFiltersCondition extends FluentBase {
|
|
|
677
770
|
/**
|
|
678
771
|
* Filters for an UI element 'text'.
|
|
679
772
|
*
|
|
680
|
-
*
|
|
773
|
+
* Takes an optional parameter to filter for a specific text.
|
|
774
|
+
* See the examples below.
|
|
775
|
+
*
|
|
681
776
|
* See also the filters `withTextRegex()` and `withExactText()`
|
|
682
777
|
*
|
|
683
778
|
* **Examples:**
|
|
684
779
|
* ```typescript
|
|
685
|
-
* await aui.click().text().
|
|
780
|
+
* await aui.click().text().exec();
|
|
781
|
+
* await aui.click().text('Username').exec();
|
|
782
|
+
*
|
|
783
|
+
* // Matching with an exact text
|
|
686
784
|
* await aui.click().text().withExactText('Username').exec();
|
|
785
|
+
*
|
|
786
|
+
* // Matching with a regex
|
|
687
787
|
* await aui.click().text().withTextRegex('\b[Ss]\w+').exec();
|
|
688
788
|
* ```
|
|
689
789
|
*
|
|
@@ -700,13 +800,17 @@ export declare class FluentFiltersCondition extends FluentBase {
|
|
|
700
800
|
* icon().withText('plus')
|
|
701
801
|
* ```
|
|
702
802
|
*
|
|
803
|
+
* 
|
|
804
|
+
*
|
|
703
805
|
* **Note:** This is an alpha feature. The prediction of the icon name is sometimes unstable. Use custom elements as an alternative.
|
|
704
806
|
*
|
|
705
807
|
* @return {FluentFiltersOrRelationsCondition}
|
|
706
808
|
*/
|
|
707
809
|
icon(): FluentFiltersOrRelationsCondition;
|
|
708
810
|
/**
|
|
709
|
-
* Filters for a 'custom element', that is a UI element which is defined by providing an image and other parameters such as degree of rotation. It allows filtering for a UI element
|
|
811
|
+
* Filters for a 'custom element', that is a UI element which is defined by providing an image and other parameters such as degree of rotation. It allows filtering for a UI element based on an image instead of using text or element descriptions like `button().withText('Submit')` in `await aui.click().button().withText('Submit').exec()`.
|
|
812
|
+
*
|
|
813
|
+
* See the tutorial - [Custom Element](https://docs.askui.com/docs/general/Tutorials/custom-element) for more detail.
|
|
710
814
|
*
|
|
711
815
|
* **Example**
|
|
712
816
|
* ```typescript
|
|
@@ -716,6 +820,7 @@ export declare class FluentFiltersCondition extends FluentBase {
|
|
|
716
820
|
* customImage: './logo.png', // required
|
|
717
821
|
* name: 'myLogo', // optional
|
|
718
822
|
* threshold: 0.9, // optional, defaults to 0.9
|
|
823
|
+
* stopThreshold: 0.9, // optional, defaults to 0.9
|
|
719
824
|
* rotationDegreePerStep: 0, // optional, defaults to 0
|
|
720
825
|
* imageCompareFormat: 'grayscale', // optional, defaults to 'grayscale'
|
|
721
826
|
* // mask:{x:0, y:0}[] // optional, a polygon to match only a certain area of the custom element
|
|
@@ -730,12 +835,13 @@ export declare class FluentFiltersCondition extends FluentBase {
|
|
|
730
835
|
* - **name** (*`string`, optional*):
|
|
731
836
|
* - A unique name that can be used for filtering for the custom element. If not given, any text inside the custom image will be detected via OCR.
|
|
732
837
|
* - **threshold** (*`number`, optional*):
|
|
733
|
-
* - A threshold for how much a UI element needs to be similar to the custom element as defined. Takes values between `0.0` (== all elements are recognized as the custom element which is probably not what you want) and `1.0` (== elements need to look exactly like the `customImage` which is unlikely to be achieved as even minor differences count). Defaults to `0.9`.
|
|
838
|
+
* - A threshold for how much a UI element needs to be similar to the custom element as defined by the image. Takes values between `0.0` (== all elements are recognized as the custom element which is probably not what you want) and `1.0` (== elements need to look exactly like the `customImage` which is unlikely to be achieved as even minor differences count). Defaults to `0.9`.
|
|
839
|
+
* - **stopThreshold** (*`number`, optional*):
|
|
840
|
+
* - A threshold for when to stop searching for UI elements similar to the custom element. As soon as UI elements have been found that are at least as similar as the `stopThreshold`, the search is going to stop. After that elements are filtered using the `threshold`. Because of that the `stopThreshold` should be greater than or equal to `threshold`. It is primarily to be used as a speed improvement (by lowering the value). Takes values between `0.0` and `1.0`. Defaults to `0.9`.
|
|
734
841
|
* - **rotationDegreePerStep** (*`number`, optional*):
|
|
735
842
|
* - Step size in rotation degree. Rotates the custom image by this step size until 360° is exceeded. The range is from `0` to `360`. Defaults to `0`.
|
|
736
|
-
* - **imageCompareFormat** (*`'RGB' | 'grayscale'`, optional*):
|
|
737
|
-
* - The color compare style. 'greyscale' compares the brightness of each pixel whereas 'RGB' compares all three
|
|
738
|
-
* of the given custom image.
|
|
843
|
+
* - **imageCompareFormat** (*`'RGB' | 'grayscale' | 'edges'`, optional*):
|
|
844
|
+
* - The color compare style. 'edges' compares only edges, 'greyscale' compares the brightness of each pixel whereas 'RGB' compares all three colors (red, green, blue). Defaults to 'grayscale'.
|
|
739
845
|
*
|
|
740
846
|
*
|
|
741
847
|
* @param {CustomElementJson} customElement - The custom element to filter for.
|
|
@@ -743,6 +849,14 @@ export declare class FluentFiltersCondition extends FluentBase {
|
|
|
743
849
|
* @return {FluentFiltersOrRelationsCondition}
|
|
744
850
|
*/
|
|
745
851
|
customElement(customElement: CustomElementJson): FluentFiltersOrRelationsCondition;
|
|
852
|
+
/**
|
|
853
|
+
* Detects an AI Element created with the workflow creator.
|
|
854
|
+
*
|
|
855
|
+
* @param {string} aiElementName - Name of the AI Element.
|
|
856
|
+
*
|
|
857
|
+
* @return {FluentFiltersOrRelationsCondition}
|
|
858
|
+
*/
|
|
859
|
+
aiElement(aiElementName: string): FluentFiltersOrRelationsCondition;
|
|
746
860
|
/**
|
|
747
861
|
* Filters for a UI element 'image'.
|
|
748
862
|
*
|
|
@@ -752,10 +866,14 @@ export declare class FluentFiltersCondition extends FluentBase {
|
|
|
752
866
|
* await aui.click().image().exec();
|
|
753
867
|
*
|
|
754
868
|
* // Works if you have an image with
|
|
755
|
-
* // a
|
|
756
|
-
* await aui.click().image().above().text().withText('
|
|
869
|
+
* // a text below
|
|
870
|
+
* await aui.click().image().above().text().withText('Automating WebGL').exec();
|
|
757
871
|
* ```
|
|
758
872
|
*
|
|
873
|
+
* 
|
|
874
|
+
*
|
|
875
|
+
*
|
|
876
|
+
*
|
|
759
877
|
* @return {FluentFiltersOrRelationsCondition}
|
|
760
878
|
*/
|
|
761
879
|
image(): FluentFiltersOrRelationsCondition;
|
|
@@ -772,11 +890,21 @@ export declare class FluentFiltersCondition extends FluentBase {
|
|
|
772
890
|
* await aui.typeIn('Oh yeah').textfield().below().text().withText('E-Mail Address').exec();
|
|
773
891
|
* ```
|
|
774
892
|
*
|
|
893
|
+
* 
|
|
894
|
+
*
|
|
895
|
+
*
|
|
896
|
+
*
|
|
775
897
|
* @return {FluentFiltersOrRelationsCondition}
|
|
776
898
|
*/
|
|
777
899
|
textfield(): FluentFiltersOrRelationsCondition;
|
|
778
900
|
/**
|
|
779
|
-
* Filters for similar
|
|
901
|
+
* Filters for similar -- meaning >70% similar -- text.
|
|
902
|
+
*
|
|
903
|
+
* Takes an optional parameter to specify the similarity. Usually you need the optional parameter for long texts you want to match precisely.
|
|
904
|
+
*
|
|
905
|
+
* _We use [RapidFuzz](https://maxbachmann.github.io/RapidFuzz/Usage/fuzz.html#ratio) which calculates the similarity like this:_
|
|
906
|
+
*
|
|
907
|
+
* `1 - (distance / (lengthString1 + lengthString2))`
|
|
780
908
|
*
|
|
781
909
|
* **Examples:**
|
|
782
910
|
* ```typescript
|
|
@@ -791,6 +919,11 @@ export declare class FluentFiltersCondition extends FluentBase {
|
|
|
791
919
|
* // usually false
|
|
792
920
|
* 'atebxtc' === withText('text') => false
|
|
793
921
|
* 'other' === withText('text') => false
|
|
922
|
+
*
|
|
923
|
+
* // optional parameter: similarity_score
|
|
924
|
+
* '978-0-201-00650-6' == withText('978-0-201-00') => true with 82.76 similarity
|
|
925
|
+
* '978-0-201-00650-6' == withText('978-0-201-00', 90) => false with 82.76 < 90 similarity
|
|
926
|
+
* '978-0-201-00650-6' == withText('978-0-201-00', 90) => true with 93.75 < 90 similarity
|
|
794
927
|
* ```
|
|
795
928
|
* 
|
|
796
929
|
*
|
|
@@ -812,6 +945,10 @@ export declare class FluentFiltersCondition extends FluentBase {
|
|
|
812
945
|
* await aui.get().text().withTextRegex('\b[Ss]\w+').exec()
|
|
813
946
|
* ```
|
|
814
947
|
*
|
|
948
|
+
* 
|
|
949
|
+
*
|
|
950
|
+
*
|
|
951
|
+
*
|
|
815
952
|
* @param {string} regex_pattern - A regex pattern
|
|
816
953
|
*
|
|
817
954
|
* @return {FluentFiltersOrRelationsCondition}
|
|
@@ -833,6 +970,10 @@ export declare class FluentFiltersCondition extends FluentBase {
|
|
|
833
970
|
* await aui.moveMouseTo().text().withExactText('Password').exec()
|
|
834
971
|
* ```
|
|
835
972
|
*
|
|
973
|
+
* 
|
|
974
|
+
*
|
|
975
|
+
*
|
|
976
|
+
*
|
|
836
977
|
* @param {string} text - A text to be matched.
|
|
837
978
|
*
|
|
838
979
|
* @return {FluentFiltersOrRelationsCondition}
|
|
@@ -857,17 +998,28 @@ export declare class FluentFiltersCondition extends FluentBase {
|
|
|
857
998
|
/**
|
|
858
999
|
* Filters elements based on a textual description.
|
|
859
1000
|
*
|
|
860
|
-
*
|
|
1001
|
+
* **What Should I Write as Matching Text**
|
|
1002
|
+
*
|
|
861
1003
|
* The text description inside the `matching()` should describe the element visually.
|
|
862
1004
|
* It understands color, some famous company/product names, general descriptions.
|
|
863
1005
|
*
|
|
864
|
-
* It sometimes requires a bit of playing to find a matching description:
|
|
865
|
-
* E.g. `puzzle piece` can fail
|
|
1006
|
+
* It sometimes requires a bit of playing around to find a matching description:
|
|
1007
|
+
* E.g. `puzzle piece` can fail while `an icon showing a puzzle piece` might work.
|
|
866
1008
|
* Generally the more detail the better.
|
|
867
1009
|
*
|
|
868
1010
|
* **Examples:**
|
|
869
1011
|
* ```typescript
|
|
870
|
-
*
|
|
1012
|
+
* // Select the black sneaker from a bunch of sneakers
|
|
1013
|
+
* await aui.click().element().matching('a black sneaker shoe').exec();
|
|
1014
|
+
*
|
|
1015
|
+
* // Select an image that has text in it
|
|
1016
|
+
* await aui.click().element().matching('has Burger King in it').exec();
|
|
1017
|
+
* await aui.click().element().matching('has adidas in it').exec();
|
|
1018
|
+
*
|
|
1019
|
+
* // Target a logo/image by describing it
|
|
1020
|
+
* await aui.click().element().matching('a mask on purple background and a firefox logo').exec();
|
|
1021
|
+
* await aui.click().element().matching('logo looking like an apple with one bite bitten off').exec();
|
|
1022
|
+
* await aui.click().element().matching('logo looking like a seashell').exec();
|
|
871
1023
|
* ```
|
|
872
1024
|
*
|
|
873
1025
|
* @param {string} text - A description of the target element.
|
|
@@ -1007,14 +1159,19 @@ export declare class FluentFiltersOrRelationsCondition extends FluentFiltersCond
|
|
|
1007
1159
|
/**
|
|
1008
1160
|
* Filters for an element right of another element.
|
|
1009
1161
|
*
|
|
1162
|
+
* Takes an optional parameter `index` to select the `nth` element (starting with 0)
|
|
1163
|
+
*
|
|
1010
1164
|
* **Examples:**
|
|
1011
1165
|
* ```typescript
|
|
1012
|
-
* -------------- --------------
|
|
1013
|
-
* | leftEl | |
|
|
1014
|
-
* -------------- --------------
|
|
1166
|
+
* -------------- -------------- --------------
|
|
1167
|
+
* | leftEl | | rightEl0 | | rightEl1 |
|
|
1168
|
+
* -------------- -------------- --------------
|
|
1015
1169
|
*
|
|
1016
|
-
* // Returns
|
|
1170
|
+
* // Returns rightEl0 because rightEl0 is the first element right of leftEl
|
|
1017
1171
|
* ...rightEl().rightOf().leftEl()
|
|
1172
|
+
* ...rightEl().rightOf(0).leftEl()
|
|
1173
|
+
* // Returns rightEl1 because rightEl1 is the second element right of leftEl
|
|
1174
|
+
* ...rightEl().rightOf(1).leftEl()
|
|
1018
1175
|
* // Returns no element because leftEl is left of rightEl
|
|
1019
1176
|
* ...leftEl().rightOf().rightEl()
|
|
1020
1177
|
* ```
|
|
@@ -1026,14 +1183,19 @@ export declare class FluentFiltersOrRelationsCondition extends FluentFiltersCond
|
|
|
1026
1183
|
/**
|
|
1027
1184
|
* Filters for an element left of another element.
|
|
1028
1185
|
*
|
|
1186
|
+
* Takes an optional parameter `index` to select the `nth` element (starting with 0)
|
|
1187
|
+
*
|
|
1029
1188
|
* **Examples:**
|
|
1030
1189
|
* ```typescript
|
|
1031
|
-
* -------------- --------------
|
|
1032
|
-
* |
|
|
1033
|
-
* -------------- --------------
|
|
1190
|
+
* -------------- -------------- --------------
|
|
1191
|
+
* | leftEl1 | | leftEl0 | | rightEl |
|
|
1192
|
+
* -------------- -------------- --------------
|
|
1034
1193
|
*
|
|
1035
|
-
* // Returns
|
|
1194
|
+
* // Returns leftEl0 because leftEl0 is the first element left of rightEl
|
|
1036
1195
|
* ...leftEl().leftOf().rightEl()
|
|
1196
|
+
* ...leftEl().leftOf(0).rightEl()
|
|
1197
|
+
* // Returns leftEl1 because leftEl1 is the second element left of rightEl
|
|
1198
|
+
* ...leftEl().leftOf(1).rightEl()
|
|
1037
1199
|
* // Returns no element because rightEl is left of leftEl
|
|
1038
1200
|
* ...rightEl().leftOf().leftEl()
|
|
1039
1201
|
* ```
|
|
@@ -1045,17 +1207,25 @@ export declare class FluentFiltersOrRelationsCondition extends FluentFiltersCond
|
|
|
1045
1207
|
/**
|
|
1046
1208
|
* Filters for an element below another element.
|
|
1047
1209
|
*
|
|
1210
|
+
* Takes an optional parameter `index` to select the `nth` element (starting with 0)
|
|
1211
|
+
*
|
|
1048
1212
|
* **Examples:**
|
|
1049
1213
|
* ```typescript
|
|
1050
1214
|
* --------------
|
|
1051
1215
|
* | text |
|
|
1052
1216
|
* --------------
|
|
1053
1217
|
* --------------
|
|
1054
|
-
* |
|
|
1218
|
+
* | button0 |
|
|
1219
|
+
* --------------
|
|
1220
|
+
* --------------
|
|
1221
|
+
* | button1 |
|
|
1055
1222
|
* --------------
|
|
1056
1223
|
*
|
|
1057
|
-
* // Returns
|
|
1224
|
+
* // Returns button0 because button0 is the first button below text
|
|
1058
1225
|
* ...button().below().text()
|
|
1226
|
+
* ...button().below(0).text()
|
|
1227
|
+
* // Returns button1 because button1 is the second button below text
|
|
1228
|
+
* ...button().below(1).text()
|
|
1059
1229
|
* // Returns no element because text is above button
|
|
1060
1230
|
* ...text().below().button()
|
|
1061
1231
|
* ```
|
|
@@ -1067,17 +1237,25 @@ export declare class FluentFiltersOrRelationsCondition extends FluentFiltersCond
|
|
|
1067
1237
|
/**
|
|
1068
1238
|
* Filters for an element above another element.
|
|
1069
1239
|
*
|
|
1240
|
+
* Takes an optional parameter `index` to select the `nth` element (starting with 0)
|
|
1241
|
+
*
|
|
1070
1242
|
* **Examples:**
|
|
1071
1243
|
* ```typescript
|
|
1072
1244
|
* --------------
|
|
1073
|
-
* |
|
|
1245
|
+
* | text1 |
|
|
1246
|
+
* --------------
|
|
1247
|
+
* --------------
|
|
1248
|
+
* | text0 |
|
|
1074
1249
|
* --------------
|
|
1075
1250
|
* --------------
|
|
1076
1251
|
* | button |
|
|
1077
1252
|
* --------------
|
|
1078
1253
|
*
|
|
1079
|
-
* // Returns
|
|
1254
|
+
* // Returns text0 because text0 is the first element above button
|
|
1080
1255
|
* ...text().above().button()
|
|
1256
|
+
* ...text().above(0).button()
|
|
1257
|
+
* // Returns text1 because text1 is the second element above button
|
|
1258
|
+
* ...text().above(1).button()
|
|
1081
1259
|
* // Returns no element because button is below text
|
|
1082
1260
|
* ...button().above().text()
|
|
1083
1261
|
* ```
|
|
@@ -1145,12 +1323,12 @@ export declare class FluentFiltersOrRelationsCondition extends FluentFiltersCond
|
|
|
1145
1323
|
* **Examples:**
|
|
1146
1324
|
* ```typescript
|
|
1147
1325
|
* // Stops execution at this point when the element does not exist.
|
|
1148
|
-
* await aui.expect().text(
|
|
1326
|
+
* await aui.expect().text('Login').exists().exec()
|
|
1149
1327
|
*
|
|
1150
1328
|
* // This will catch the error and log a message
|
|
1151
1329
|
* // But the execution will continue afterwards
|
|
1152
1330
|
* try {
|
|
1153
|
-
* await aui.expect().text(
|
|
1331
|
+
* await aui.expect().text('Login').exists().exec()
|
|
1154
1332
|
* } catch (error) {
|
|
1155
1333
|
* console.log('Too bad we could not find the element!');
|
|
1156
1334
|
* }
|
|
@@ -1169,12 +1347,12 @@ export declare class FluentFiltersOrRelationsCondition extends FluentFiltersCond
|
|
|
1169
1347
|
* **Examples:**
|
|
1170
1348
|
* ```typescript
|
|
1171
1349
|
* // Stops execution at this point when the element does exist.
|
|
1172
|
-
* await aui.expect().text(
|
|
1350
|
+
* await aui.expect().text('Login').notExists().exec()
|
|
1173
1351
|
*
|
|
1174
1352
|
* // This will catch the error and log a message
|
|
1175
1353
|
* // But the execution will continue afterwards
|
|
1176
1354
|
* try {
|
|
1177
|
-
* await aui.expect().text(
|
|
1355
|
+
* await aui.expect().text('Login').notExists().exec()
|
|
1178
1356
|
* } catch (error) {
|
|
1179
1357
|
* console.log('Too bad we could find the element!');
|
|
1180
1358
|
* }
|
|
@@ -1195,8 +1373,8 @@ export declare abstract class FluentCommand extends FluentBase {
|
|
|
1195
1373
|
*
|
|
1196
1374
|
* **Examples:**
|
|
1197
1375
|
* ```typescript
|
|
1198
|
-
* await aui.expect().text(
|
|
1199
|
-
* await aui.expect().text(
|
|
1376
|
+
* await aui.expect().text('Login').exists().exec()
|
|
1377
|
+
* await aui.expect().text('Login').notExists().exec()
|
|
1200
1378
|
* ```
|
|
1201
1379
|
*
|
|
1202
1380
|
* @return {FluentFiltersCondition}
|
|
@@ -1209,9 +1387,13 @@ export declare abstract class FluentCommand extends FluentBase {
|
|
|
1209
1387
|
*
|
|
1210
1388
|
* **Example:**
|
|
1211
1389
|
* ```typescript
|
|
1212
|
-
* await aui.click().button().withText('
|
|
1390
|
+
* await aui.click().button().withText('Google Search').exec();
|
|
1213
1391
|
* ```
|
|
1214
1392
|
*
|
|
1393
|
+
* 
|
|
1394
|
+
*
|
|
1395
|
+
*
|
|
1396
|
+
*
|
|
1215
1397
|
* @return {FluentFilters}
|
|
1216
1398
|
*/
|
|
1217
1399
|
click(): FluentFilters;
|
|
@@ -1220,9 +1402,13 @@ export declare abstract class FluentCommand extends FluentBase {
|
|
|
1220
1402
|
*
|
|
1221
1403
|
* **Example:**
|
|
1222
1404
|
* ```typescript
|
|
1223
|
-
* await aui.moveMouseTo().
|
|
1405
|
+
* await aui.moveMouseTo().text().withText('Grinning_Face').exec()
|
|
1224
1406
|
* ```
|
|
1225
1407
|
*
|
|
1408
|
+
* 
|
|
1409
|
+
*
|
|
1410
|
+
*
|
|
1411
|
+
*
|
|
1226
1412
|
* @return {FluentFilters}
|
|
1227
1413
|
*/
|
|
1228
1414
|
moveMouseTo(): FluentFilters;
|
|
@@ -1252,9 +1438,11 @@ export declare abstract class FluentCommand extends FluentBase {
|
|
|
1252
1438
|
*
|
|
1253
1439
|
* **Example:**
|
|
1254
1440
|
* ```typescript
|
|
1255
|
-
* await aui.
|
|
1441
|
+
* await aui.scrollInside(0,-500).text().withText('Bottom sheet').exec();
|
|
1256
1442
|
* ```
|
|
1257
1443
|
*
|
|
1444
|
+
* 
|
|
1445
|
+
*
|
|
1258
1446
|
* @param {number} x_offset - A (positive/negative) x direction.
|
|
1259
1447
|
* @param {number} y_offset - A (positive/negative) y direction.
|
|
1260
1448
|
*
|
|
@@ -1304,12 +1492,14 @@ export declare abstract class FluentCommand extends FluentBase {
|
|
|
1304
1492
|
*
|
|
1305
1493
|
* **Examples:**
|
|
1306
1494
|
* ```typescript
|
|
1307
|
-
* await aui.type('
|
|
1495
|
+
* await aui.type('askui@askui.com').exec()
|
|
1308
1496
|
*
|
|
1309
1497
|
* // mask the text so it is not send to the askui-inference server
|
|
1310
1498
|
* await aui.type('Type some text', { isSecret: true, secretMask: '**' }).exec()
|
|
1311
1499
|
* ```
|
|
1312
1500
|
*
|
|
1501
|
+
* 
|
|
1502
|
+
*
|
|
1313
1503
|
* @param {string} text - A text to type
|
|
1314
1504
|
*
|
|
1315
1505
|
* @return {Exec}
|
|
@@ -1320,9 +1510,11 @@ export declare abstract class FluentCommand extends FluentBase {
|
|
|
1320
1510
|
*
|
|
1321
1511
|
* **Example:**
|
|
1322
1512
|
* ```typescript
|
|
1323
|
-
* await aui.moveMouseRelatively(
|
|
1513
|
+
* await aui.moveMouseRelatively(0, 50).exec();
|
|
1324
1514
|
* ```
|
|
1325
1515
|
*
|
|
1516
|
+
* 
|
|
1517
|
+
*
|
|
1326
1518
|
* @param {number} x_offset - A (positive/negative) x direction.
|
|
1327
1519
|
* @param {number} y_offset - A (positive/negative) y direction.
|
|
1328
1520
|
*
|
|
@@ -1339,6 +1531,8 @@ export declare abstract class FluentCommand extends FluentBase {
|
|
|
1339
1531
|
* await aui.moveMouse(500, 500).exec();
|
|
1340
1532
|
* ```
|
|
1341
1533
|
*
|
|
1534
|
+
* 
|
|
1535
|
+
*
|
|
1342
1536
|
* @param {number} x_coordinate - A (positive/negative) x coordinate.
|
|
1343
1537
|
* @param {number} y_coordinate - A (positive/negative) y coordinate.
|
|
1344
1538
|
*
|
|
@@ -1354,10 +1548,12 @@ export declare abstract class FluentCommand extends FluentBase {
|
|
|
1354
1548
|
*
|
|
1355
1549
|
* **Example:**
|
|
1356
1550
|
* ```typescript
|
|
1357
|
-
* // Scroll
|
|
1358
|
-
* await aui.scroll(0,
|
|
1551
|
+
* // Scroll 500 pixels down in y direction
|
|
1552
|
+
* await aui.scroll(0, -500).exec()
|
|
1359
1553
|
* ```
|
|
1360
1554
|
*
|
|
1555
|
+
* 
|
|
1556
|
+
*
|
|
1361
1557
|
* @param {number} x_offset - A (positive/negative) x direction.
|
|
1362
1558
|
* @param {number} y_offset - A (positive/negative) y direction.
|
|
1363
1559
|
*
|
|
@@ -1448,6 +1644,8 @@ export declare abstract class FluentCommand extends FluentBase {
|
|
|
1448
1644
|
* await aui.mouseDoubleLeftClick().exec();
|
|
1449
1645
|
* ```
|
|
1450
1646
|
*
|
|
1647
|
+
* 
|
|
1648
|
+
*
|
|
1451
1649
|
* @return {Exec}
|
|
1452
1650
|
*/
|
|
1453
1651
|
mouseDoubleLeftClick(): Exec;
|
|
@@ -1486,22 +1684,34 @@ export declare abstract class FluentCommand extends FluentBase {
|
|
|
1486
1684
|
/**
|
|
1487
1685
|
* Toggles mouse down (Left mouse key/tap).
|
|
1488
1686
|
*
|
|
1687
|
+
* This is the equivalent to **mouse-left-press-and-hold**. It holds the mouse button until the `mouseToogleUp()` is called. Often combined with `mouseToggleUP` to automate **drag-and-drop**.
|
|
1688
|
+
*
|
|
1489
1689
|
* **Example:**
|
|
1490
1690
|
* ```typescript
|
|
1491
1691
|
* await aui.mouseToggleDown().exec();
|
|
1692
|
+
* await aui.moveMouseRelatively(-400,0).exec();
|
|
1693
|
+
* await aui.mouseToggleUp().exec();
|
|
1492
1694
|
* ```
|
|
1493
1695
|
*
|
|
1696
|
+
* 
|
|
1697
|
+
*
|
|
1494
1698
|
* @return {Exec}
|
|
1495
1699
|
*/
|
|
1496
1700
|
mouseToggleDown(): Exec;
|
|
1497
1701
|
/**
|
|
1498
1702
|
* Toggles mouse up (Left mouse key/tap).
|
|
1499
1703
|
*
|
|
1704
|
+
* This is the equivalent to releasing the pressing mouse left button. Often combined with `mouseToggleDown()` to automate **drag-and-drop**.
|
|
1705
|
+
*
|
|
1500
1706
|
* **Example:**
|
|
1501
1707
|
* ```typescript
|
|
1708
|
+
* await aui.mouseToggleDown().exec();
|
|
1709
|
+
* await aui.moveMouseRelatively(-400,0).exec();
|
|
1502
1710
|
* await aui.mouseToggleUp().exec();
|
|
1503
1711
|
* ```
|
|
1504
1712
|
*
|
|
1713
|
+
* 
|
|
1714
|
+
*
|
|
1505
1715
|
* @return {Exec}
|
|
1506
1716
|
*/
|
|
1507
1717
|
mouseToggleUp(): Exec;
|
|
@@ -1510,8 +1720,13 @@ export declare abstract class FluentCommand extends FluentBase {
|
|
|
1510
1720
|
*
|
|
1511
1721
|
* **Operating system specific mappings:**
|
|
1512
1722
|
* 1. Windows: `command`-key maps to `windows`-key
|
|
1513
|
-
* ---
|
|
1514
1723
|
*
|
|
1724
|
+
* **Examples:**
|
|
1725
|
+
* ```typescript
|
|
1726
|
+
* await aui.pressThreeKeys('control', 'command' 'space').exec();
|
|
1727
|
+
* ```
|
|
1728
|
+
*
|
|
1729
|
+
* 
|
|
1515
1730
|
*
|
|
1516
1731
|
* @param {MODIFIER_KEY} first_key - A modifier key
|
|
1517
1732
|
* @param {MODIFIER_KEY} second_key - A modifier key
|
|
@@ -1539,8 +1754,13 @@ export declare abstract class FluentCommand extends FluentBase {
|
|
|
1539
1754
|
*
|
|
1540
1755
|
* **Operating system specific mappings:**
|
|
1541
1756
|
* 1. Windows: `command`-key maps to `windows`-key
|
|
1542
|
-
* ---
|
|
1543
1757
|
*
|
|
1758
|
+
* **Examples:**
|
|
1759
|
+
* ```typescript
|
|
1760
|
+
* await aui.pressKey('tab').exec();
|
|
1761
|
+
* ```
|
|
1762
|
+
*
|
|
1763
|
+
* 
|
|
1544
1764
|
*
|
|
1545
1765
|
* @param {PC_AND_MODIFIER_KEY} key - A key
|
|
1546
1766
|
*
|
|
@@ -1558,7 +1778,15 @@ export declare abstract class FluentCommand extends FluentBase {
|
|
|
1558
1778
|
*/
|
|
1559
1779
|
pressAndroidThirdKey(first_key: ANDROID_KEY, second_key: ANDROID_KEY, third_key: ANDROID_KEY): Exec;
|
|
1560
1780
|
/**
|
|
1561
|
-
* Press two Android keys like `
|
|
1781
|
+
* Press two Android keys like `volume_down+power`
|
|
1782
|
+
* See [API docs](https://docs.askui.com/docs/api/Actions/pressandroidtwokey) for available keys.
|
|
1783
|
+
*
|
|
1784
|
+
* **Examples:**
|
|
1785
|
+
* ```typescript
|
|
1786
|
+
* await aui.pressAndroidTwoKey('volume_down', 'power').exec();
|
|
1787
|
+
* ```
|
|
1788
|
+
*
|
|
1789
|
+
* 
|
|
1562
1790
|
*
|
|
1563
1791
|
* @param {ANDROID_KEY} first_key - A Android key
|
|
1564
1792
|
* @param {ANDROID_KEY} second_key - A Android key
|
|
@@ -1567,14 +1795,22 @@ export declare abstract class FluentCommand extends FluentBase {
|
|
|
1567
1795
|
*/
|
|
1568
1796
|
pressAndroidTwoKey(first_key: ANDROID_KEY, second_key: ANDROID_KEY): Exec;
|
|
1569
1797
|
/**
|
|
1570
|
-
* Press one Android key like `
|
|
1798
|
+
* Press one Android key like `del`
|
|
1799
|
+
* See [API docs](https://docs.askui.com/docs/api/Actions/pressandroidtwokey) for available keys.
|
|
1800
|
+
*
|
|
1801
|
+
* **Examples:**
|
|
1802
|
+
* ```typescript
|
|
1803
|
+
* await aui.pressAndroidKey('notification').exec();
|
|
1804
|
+
* ```
|
|
1805
|
+
*
|
|
1806
|
+
* 
|
|
1571
1807
|
*
|
|
1572
1808
|
* @param {ANDROID_KEY} key - A Android key
|
|
1573
1809
|
*
|
|
1574
1810
|
* @return {Exec}
|
|
1575
1811
|
*/
|
|
1576
1812
|
pressAndroidKey(key: ANDROID_KEY): Exec;
|
|
1577
|
-
abstract fluentCommandExecutor(instruction: string,
|
|
1813
|
+
abstract fluentCommandExecutor(instruction: string, context: CommandExecutorContext): Promise<void>;
|
|
1578
1814
|
}
|
|
1579
1815
|
export interface ExecutableGetter {
|
|
1580
1816
|
exec(): Promise<DetectedElement[]>;
|
|
@@ -1642,9 +1878,11 @@ export declare class FluentFiltersGetter extends FluentBase {
|
|
|
1642
1878
|
*
|
|
1643
1879
|
* **Examples:**
|
|
1644
1880
|
* ```typescript
|
|
1645
|
-
* await aui.
|
|
1881
|
+
* await aui.click().button().contains().text().withText('Google Search').exec()
|
|
1646
1882
|
* ```
|
|
1647
1883
|
*
|
|
1884
|
+
* 
|
|
1885
|
+
*
|
|
1648
1886
|
* @return {FluentFiltersOrRelationsGetter}
|
|
1649
1887
|
*/
|
|
1650
1888
|
button(): FluentFiltersOrRelationsGetter;
|
|
@@ -1678,13 +1916,20 @@ export declare class FluentFiltersGetter extends FluentBase {
|
|
|
1678
1916
|
/**
|
|
1679
1917
|
* Filters for an UI element 'text'.
|
|
1680
1918
|
*
|
|
1681
|
-
*
|
|
1919
|
+
* Takes an optional parameter to filter for a specific text.
|
|
1920
|
+
* See the examples below.
|
|
1921
|
+
*
|
|
1682
1922
|
* See also the filters `withTextRegex()` and `withExactText()`
|
|
1683
1923
|
*
|
|
1684
1924
|
* **Examples:**
|
|
1685
1925
|
* ```typescript
|
|
1686
|
-
* await aui.click().text().
|
|
1926
|
+
* await aui.click().text().exec();
|
|
1927
|
+
* await aui.click().text('Username').exec();
|
|
1928
|
+
*
|
|
1929
|
+
* // Matching with an exact text
|
|
1687
1930
|
* await aui.click().text().withExactText('Username').exec();
|
|
1931
|
+
*
|
|
1932
|
+
* // Matching with a regex
|
|
1688
1933
|
* await aui.click().text().withTextRegex('\b[Ss]\w+').exec();
|
|
1689
1934
|
* ```
|
|
1690
1935
|
*
|
|
@@ -1701,13 +1946,17 @@ export declare class FluentFiltersGetter extends FluentBase {
|
|
|
1701
1946
|
* icon().withText('plus')
|
|
1702
1947
|
* ```
|
|
1703
1948
|
*
|
|
1949
|
+
* 
|
|
1950
|
+
*
|
|
1704
1951
|
* **Note:** This is an alpha feature. The prediction of the icon name is sometimes unstable. Use custom elements as an alternative.
|
|
1705
1952
|
*
|
|
1706
1953
|
* @return {FluentFiltersOrRelationsGetter}
|
|
1707
1954
|
*/
|
|
1708
1955
|
icon(): FluentFiltersOrRelationsGetter;
|
|
1709
1956
|
/**
|
|
1710
|
-
* Filters for a 'custom element', that is a UI element which is defined by providing an image and other parameters such as degree of rotation. It allows filtering for a UI element
|
|
1957
|
+
* Filters for a 'custom element', that is a UI element which is defined by providing an image and other parameters such as degree of rotation. It allows filtering for a UI element based on an image instead of using text or element descriptions like `button().withText('Submit')` in `await aui.click().button().withText('Submit').exec()`.
|
|
1958
|
+
*
|
|
1959
|
+
* See the tutorial - [Custom Element](https://docs.askui.com/docs/general/Tutorials/custom-element) for more detail.
|
|
1711
1960
|
*
|
|
1712
1961
|
* **Example**
|
|
1713
1962
|
* ```typescript
|
|
@@ -1717,6 +1966,7 @@ export declare class FluentFiltersGetter extends FluentBase {
|
|
|
1717
1966
|
* customImage: './logo.png', // required
|
|
1718
1967
|
* name: 'myLogo', // optional
|
|
1719
1968
|
* threshold: 0.9, // optional, defaults to 0.9
|
|
1969
|
+
* stopThreshold: 0.9, // optional, defaults to 0.9
|
|
1720
1970
|
* rotationDegreePerStep: 0, // optional, defaults to 0
|
|
1721
1971
|
* imageCompareFormat: 'grayscale', // optional, defaults to 'grayscale'
|
|
1722
1972
|
* // mask:{x:0, y:0}[] // optional, a polygon to match only a certain area of the custom element
|
|
@@ -1731,12 +1981,13 @@ export declare class FluentFiltersGetter extends FluentBase {
|
|
|
1731
1981
|
* - **name** (*`string`, optional*):
|
|
1732
1982
|
* - A unique name that can be used for filtering for the custom element. If not given, any text inside the custom image will be detected via OCR.
|
|
1733
1983
|
* - **threshold** (*`number`, optional*):
|
|
1734
|
-
* - A threshold for how much a UI element needs to be similar to the custom element as defined. Takes values between `0.0` (== all elements are recognized as the custom element which is probably not what you want) and `1.0` (== elements need to look exactly like the `customImage` which is unlikely to be achieved as even minor differences count). Defaults to `0.9`.
|
|
1984
|
+
* - A threshold for how much a UI element needs to be similar to the custom element as defined by the image. Takes values between `0.0` (== all elements are recognized as the custom element which is probably not what you want) and `1.0` (== elements need to look exactly like the `customImage` which is unlikely to be achieved as even minor differences count). Defaults to `0.9`.
|
|
1985
|
+
* - **stopThreshold** (*`number`, optional*):
|
|
1986
|
+
* - A threshold for when to stop searching for UI elements similar to the custom element. As soon as UI elements have been found that are at least as similar as the `stopThreshold`, the search is going to stop. After that elements are filtered using the `threshold`. Because of that the `stopThreshold` should be greater than or equal to `threshold`. It is primarily to be used as a speed improvement (by lowering the value). Takes values between `0.0` and `1.0`. Defaults to `0.9`.
|
|
1735
1987
|
* - **rotationDegreePerStep** (*`number`, optional*):
|
|
1736
1988
|
* - Step size in rotation degree. Rotates the custom image by this step size until 360° is exceeded. The range is from `0` to `360`. Defaults to `0`.
|
|
1737
|
-
* - **imageCompareFormat** (*`'RGB' | 'grayscale'`, optional*):
|
|
1738
|
-
* - The color compare style. 'greyscale' compares the brightness of each pixel whereas 'RGB' compares all three
|
|
1739
|
-
* of the given custom image.
|
|
1989
|
+
* - **imageCompareFormat** (*`'RGB' | 'grayscale' | 'edges'`, optional*):
|
|
1990
|
+
* - The color compare style. 'edges' compares only edges, 'greyscale' compares the brightness of each pixel whereas 'RGB' compares all three colors (red, green, blue). Defaults to 'grayscale'.
|
|
1740
1991
|
*
|
|
1741
1992
|
*
|
|
1742
1993
|
* @param {CustomElementJson} customElement - The custom element to filter for.
|
|
@@ -1744,6 +1995,14 @@ export declare class FluentFiltersGetter extends FluentBase {
|
|
|
1744
1995
|
* @return {FluentFiltersOrRelationsGetter}
|
|
1745
1996
|
*/
|
|
1746
1997
|
customElement(customElement: CustomElementJson): FluentFiltersOrRelationsGetter;
|
|
1998
|
+
/**
|
|
1999
|
+
* Detects an AI Element created with the workflow creator.
|
|
2000
|
+
*
|
|
2001
|
+
* @param {string} aiElementName - Name of the AI Element.
|
|
2002
|
+
*
|
|
2003
|
+
* @return {FluentFiltersOrRelationsGetter}
|
|
2004
|
+
*/
|
|
2005
|
+
aiElement(aiElementName: string): FluentFiltersOrRelationsGetter;
|
|
1747
2006
|
/**
|
|
1748
2007
|
* Filters for a UI element 'image'.
|
|
1749
2008
|
*
|
|
@@ -1753,10 +2012,14 @@ export declare class FluentFiltersGetter extends FluentBase {
|
|
|
1753
2012
|
* await aui.click().image().exec();
|
|
1754
2013
|
*
|
|
1755
2014
|
* // Works if you have an image with
|
|
1756
|
-
* // a
|
|
1757
|
-
* await aui.click().image().above().text().withText('
|
|
2015
|
+
* // a text below
|
|
2016
|
+
* await aui.click().image().above().text().withText('Automating WebGL').exec();
|
|
1758
2017
|
* ```
|
|
1759
2018
|
*
|
|
2019
|
+
* 
|
|
2020
|
+
*
|
|
2021
|
+
*
|
|
2022
|
+
*
|
|
1760
2023
|
* @return {FluentFiltersOrRelationsGetter}
|
|
1761
2024
|
*/
|
|
1762
2025
|
image(): FluentFiltersOrRelationsGetter;
|
|
@@ -1773,11 +2036,21 @@ export declare class FluentFiltersGetter extends FluentBase {
|
|
|
1773
2036
|
* await aui.typeIn('Oh yeah').textfield().below().text().withText('E-Mail Address').exec();
|
|
1774
2037
|
* ```
|
|
1775
2038
|
*
|
|
2039
|
+
* 
|
|
2040
|
+
*
|
|
2041
|
+
*
|
|
2042
|
+
*
|
|
1776
2043
|
* @return {FluentFiltersOrRelationsGetter}
|
|
1777
2044
|
*/
|
|
1778
2045
|
textfield(): FluentFiltersOrRelationsGetter;
|
|
1779
2046
|
/**
|
|
1780
|
-
* Filters for similar
|
|
2047
|
+
* Filters for similar -- meaning >70% similar -- text.
|
|
2048
|
+
*
|
|
2049
|
+
* Takes an optional parameter to specify the similarity. Usually you need the optional parameter for long texts you want to match precisely.
|
|
2050
|
+
*
|
|
2051
|
+
* _We use [RapidFuzz](https://maxbachmann.github.io/RapidFuzz/Usage/fuzz.html#ratio) which calculates the similarity like this:_
|
|
2052
|
+
*
|
|
2053
|
+
* `1 - (distance / (lengthString1 + lengthString2))`
|
|
1781
2054
|
*
|
|
1782
2055
|
* **Examples:**
|
|
1783
2056
|
* ```typescript
|
|
@@ -1792,6 +2065,11 @@ export declare class FluentFiltersGetter extends FluentBase {
|
|
|
1792
2065
|
* // usually false
|
|
1793
2066
|
* 'atebxtc' === withText('text') => false
|
|
1794
2067
|
* 'other' === withText('text') => false
|
|
2068
|
+
*
|
|
2069
|
+
* // optional parameter: similarity_score
|
|
2070
|
+
* '978-0-201-00650-6' == withText('978-0-201-00') => true with 82.76 similarity
|
|
2071
|
+
* '978-0-201-00650-6' == withText('978-0-201-00', 90) => false with 82.76 < 90 similarity
|
|
2072
|
+
* '978-0-201-00650-6' == withText('978-0-201-00', 90) => true with 93.75 < 90 similarity
|
|
1795
2073
|
* ```
|
|
1796
2074
|
* 
|
|
1797
2075
|
*
|
|
@@ -1813,6 +2091,10 @@ export declare class FluentFiltersGetter extends FluentBase {
|
|
|
1813
2091
|
* await aui.get().text().withTextRegex('\b[Ss]\w+').exec()
|
|
1814
2092
|
* ```
|
|
1815
2093
|
*
|
|
2094
|
+
* 
|
|
2095
|
+
*
|
|
2096
|
+
*
|
|
2097
|
+
*
|
|
1816
2098
|
* @param {string} regex_pattern - A regex pattern
|
|
1817
2099
|
*
|
|
1818
2100
|
* @return {FluentFiltersOrRelationsGetter}
|
|
@@ -1834,6 +2116,10 @@ export declare class FluentFiltersGetter extends FluentBase {
|
|
|
1834
2116
|
* await aui.moveMouseTo().text().withExactText('Password').exec()
|
|
1835
2117
|
* ```
|
|
1836
2118
|
*
|
|
2119
|
+
* 
|
|
2120
|
+
*
|
|
2121
|
+
*
|
|
2122
|
+
*
|
|
1837
2123
|
* @param {string} text - A text to be matched.
|
|
1838
2124
|
*
|
|
1839
2125
|
* @return {FluentFiltersOrRelationsGetter}
|
|
@@ -1858,17 +2144,28 @@ export declare class FluentFiltersGetter extends FluentBase {
|
|
|
1858
2144
|
/**
|
|
1859
2145
|
* Filters elements based on a textual description.
|
|
1860
2146
|
*
|
|
1861
|
-
*
|
|
2147
|
+
* **What Should I Write as Matching Text**
|
|
2148
|
+
*
|
|
1862
2149
|
* The text description inside the `matching()` should describe the element visually.
|
|
1863
2150
|
* It understands color, some famous company/product names, general descriptions.
|
|
1864
2151
|
*
|
|
1865
|
-
* It sometimes requires a bit of playing to find a matching description:
|
|
1866
|
-
* E.g. `puzzle piece` can fail
|
|
2152
|
+
* It sometimes requires a bit of playing around to find a matching description:
|
|
2153
|
+
* E.g. `puzzle piece` can fail while `an icon showing a puzzle piece` might work.
|
|
1867
2154
|
* Generally the more detail the better.
|
|
1868
2155
|
*
|
|
1869
2156
|
* **Examples:**
|
|
1870
2157
|
* ```typescript
|
|
1871
|
-
*
|
|
2158
|
+
* // Select the black sneaker from a bunch of sneakers
|
|
2159
|
+
* await aui.click().element().matching('a black sneaker shoe').exec();
|
|
2160
|
+
*
|
|
2161
|
+
* // Select an image that has text in it
|
|
2162
|
+
* await aui.click().element().matching('has Burger King in it').exec();
|
|
2163
|
+
* await aui.click().element().matching('has adidas in it').exec();
|
|
2164
|
+
*
|
|
2165
|
+
* // Target a logo/image by describing it
|
|
2166
|
+
* await aui.click().element().matching('a mask on purple background and a firefox logo').exec();
|
|
2167
|
+
* await aui.click().element().matching('logo looking like an apple with one bite bitten off').exec();
|
|
2168
|
+
* await aui.click().element().matching('logo looking like a seashell').exec();
|
|
1872
2169
|
* ```
|
|
1873
2170
|
*
|
|
1874
2171
|
* @param {string} text - A description of the target element.
|
|
@@ -2008,14 +2305,19 @@ export declare class FluentFiltersOrRelationsGetter extends FluentFiltersGetter
|
|
|
2008
2305
|
/**
|
|
2009
2306
|
* Filters for an element right of another element.
|
|
2010
2307
|
*
|
|
2308
|
+
* Takes an optional parameter `index` to select the `nth` element (starting with 0)
|
|
2309
|
+
*
|
|
2011
2310
|
* **Examples:**
|
|
2012
2311
|
* ```typescript
|
|
2013
|
-
* -------------- --------------
|
|
2014
|
-
* | leftEl | |
|
|
2015
|
-
* -------------- --------------
|
|
2312
|
+
* -------------- -------------- --------------
|
|
2313
|
+
* | leftEl | | rightEl0 | | rightEl1 |
|
|
2314
|
+
* -------------- -------------- --------------
|
|
2016
2315
|
*
|
|
2017
|
-
* // Returns
|
|
2316
|
+
* // Returns rightEl0 because rightEl0 is the first element right of leftEl
|
|
2018
2317
|
* ...rightEl().rightOf().leftEl()
|
|
2318
|
+
* ...rightEl().rightOf(0).leftEl()
|
|
2319
|
+
* // Returns rightEl1 because rightEl1 is the second element right of leftEl
|
|
2320
|
+
* ...rightEl().rightOf(1).leftEl()
|
|
2019
2321
|
* // Returns no element because leftEl is left of rightEl
|
|
2020
2322
|
* ...leftEl().rightOf().rightEl()
|
|
2021
2323
|
* ```
|
|
@@ -2027,14 +2329,19 @@ export declare class FluentFiltersOrRelationsGetter extends FluentFiltersGetter
|
|
|
2027
2329
|
/**
|
|
2028
2330
|
* Filters for an element left of another element.
|
|
2029
2331
|
*
|
|
2332
|
+
* Takes an optional parameter `index` to select the `nth` element (starting with 0)
|
|
2333
|
+
*
|
|
2030
2334
|
* **Examples:**
|
|
2031
2335
|
* ```typescript
|
|
2032
|
-
* -------------- --------------
|
|
2033
|
-
* |
|
|
2034
|
-
* -------------- --------------
|
|
2336
|
+
* -------------- -------------- --------------
|
|
2337
|
+
* | leftEl1 | | leftEl0 | | rightEl |
|
|
2338
|
+
* -------------- -------------- --------------
|
|
2035
2339
|
*
|
|
2036
|
-
* // Returns
|
|
2340
|
+
* // Returns leftEl0 because leftEl0 is the first element left of rightEl
|
|
2037
2341
|
* ...leftEl().leftOf().rightEl()
|
|
2342
|
+
* ...leftEl().leftOf(0).rightEl()
|
|
2343
|
+
* // Returns leftEl1 because leftEl1 is the second element left of rightEl
|
|
2344
|
+
* ...leftEl().leftOf(1).rightEl()
|
|
2038
2345
|
* // Returns no element because rightEl is left of leftEl
|
|
2039
2346
|
* ...rightEl().leftOf().leftEl()
|
|
2040
2347
|
* ```
|
|
@@ -2046,17 +2353,25 @@ export declare class FluentFiltersOrRelationsGetter extends FluentFiltersGetter
|
|
|
2046
2353
|
/**
|
|
2047
2354
|
* Filters for an element below another element.
|
|
2048
2355
|
*
|
|
2356
|
+
* Takes an optional parameter `index` to select the `nth` element (starting with 0)
|
|
2357
|
+
*
|
|
2049
2358
|
* **Examples:**
|
|
2050
2359
|
* ```typescript
|
|
2051
2360
|
* --------------
|
|
2052
2361
|
* | text |
|
|
2053
2362
|
* --------------
|
|
2054
2363
|
* --------------
|
|
2055
|
-
* |
|
|
2364
|
+
* | button0 |
|
|
2365
|
+
* --------------
|
|
2366
|
+
* --------------
|
|
2367
|
+
* | button1 |
|
|
2056
2368
|
* --------------
|
|
2057
2369
|
*
|
|
2058
|
-
* // Returns
|
|
2370
|
+
* // Returns button0 because button0 is the first button below text
|
|
2059
2371
|
* ...button().below().text()
|
|
2372
|
+
* ...button().below(0).text()
|
|
2373
|
+
* // Returns button1 because button1 is the second button below text
|
|
2374
|
+
* ...button().below(1).text()
|
|
2060
2375
|
* // Returns no element because text is above button
|
|
2061
2376
|
* ...text().below().button()
|
|
2062
2377
|
* ```
|
|
@@ -2068,17 +2383,25 @@ export declare class FluentFiltersOrRelationsGetter extends FluentFiltersGetter
|
|
|
2068
2383
|
/**
|
|
2069
2384
|
* Filters for an element above another element.
|
|
2070
2385
|
*
|
|
2386
|
+
* Takes an optional parameter `index` to select the `nth` element (starting with 0)
|
|
2387
|
+
*
|
|
2071
2388
|
* **Examples:**
|
|
2072
2389
|
* ```typescript
|
|
2073
2390
|
* --------------
|
|
2074
|
-
* |
|
|
2391
|
+
* | text1 |
|
|
2392
|
+
* --------------
|
|
2393
|
+
* --------------
|
|
2394
|
+
* | text0 |
|
|
2075
2395
|
* --------------
|
|
2076
2396
|
* --------------
|
|
2077
2397
|
* | button |
|
|
2078
2398
|
* --------------
|
|
2079
2399
|
*
|
|
2080
|
-
* // Returns
|
|
2400
|
+
* // Returns text0 because text0 is the first element above button
|
|
2081
2401
|
* ...text().above().button()
|
|
2402
|
+
* ...text().above(0).button()
|
|
2403
|
+
* // Returns text1 because text1 is the second element above button
|
|
2404
|
+
* ...text().above(1).button()
|
|
2082
2405
|
* // Returns no element because button is below text
|
|
2083
2406
|
* ...button().above().text()
|
|
2084
2407
|
* ```
|
|
@@ -2153,22 +2476,74 @@ export declare abstract class Getter extends FluentCommand {
|
|
|
2153
2476
|
*
|
|
2154
2477
|
* **Examples:**
|
|
2155
2478
|
* ```typescript
|
|
2156
|
-
* const text = await aui.get().text(
|
|
2479
|
+
* const text = await aui.get().text('Sign').exec();
|
|
2157
2480
|
* console.log(text);
|
|
2481
|
+
*
|
|
2482
|
+
* // Console output
|
|
2483
|
+
* [
|
|
2484
|
+
* DetectedElement {
|
|
2485
|
+
* name: 'TEXT',
|
|
2486
|
+
* text: 'Sign In',
|
|
2487
|
+
* bndbox: BoundingBox {
|
|
2488
|
+
* xmin: 1128.2720982142857,
|
|
2489
|
+
* ymin: 160.21332310267857,
|
|
2490
|
+
* xmax: 1178.8204241071428,
|
|
2491
|
+
* ymax: 180.83512834821428
|
|
2492
|
+
* }
|
|
2493
|
+
* }
|
|
2494
|
+
* ]
|
|
2158
2495
|
* ```
|
|
2159
|
-
*
|
|
2160
|
-
*
|
|
2496
|
+
*
|
|
2497
|
+
* // *************************************************** //
|
|
2498
|
+
* // Examples on how to work with the returned elements //
|
|
2499
|
+
* // *************************************************** //
|
|
2500
|
+
* const texts = await aui.get().text().below().textfield().exec();
|
|
2501
|
+
*
|
|
2502
|
+
* // We can get a lot of elements this way
|
|
2503
|
+
* console.log(texts);
|
|
2504
|
+
*
|
|
2505
|
+
* // Console output
|
|
2506
|
+
* [
|
|
2161
2507
|
* DetectedElement {
|
|
2162
|
-
*
|
|
2163
|
-
*
|
|
2164
|
-
*
|
|
2165
|
-
*
|
|
2166
|
-
*
|
|
2167
|
-
*
|
|
2168
|
-
*
|
|
2169
|
-
*
|
|
2170
|
-
*
|
|
2171
|
-
*
|
|
2508
|
+
* name: 'TEXT',
|
|
2509
|
+
* text: 'Sign In',
|
|
2510
|
+
* bndbox: BoundingBox {
|
|
2511
|
+
* xmin: 1128.2720982142857,
|
|
2512
|
+
* ymin: 160.21332310267857,
|
|
2513
|
+
* xmax: 1178.8204241071428,
|
|
2514
|
+
* ymax: 180.83512834821428
|
|
2515
|
+
* },
|
|
2516
|
+
* },
|
|
2517
|
+
* DetectedElement {
|
|
2518
|
+
* name: 'TEXT',
|
|
2519
|
+
* text: 'Login',
|
|
2520
|
+
* bndbox: BoundingBox {
|
|
2521
|
+
* xmin: 250.8204241071428,
|
|
2522
|
+
* ymin: 300.21332310267857,
|
|
2523
|
+
* xmax: 450.6304241071428,
|
|
2524
|
+
* ymax: 950.47812834821428
|
|
2525
|
+
* },
|
|
2526
|
+
* },
|
|
2527
|
+
* ... 10 more items
|
|
2528
|
+
* ]
|
|
2529
|
+
*
|
|
2530
|
+
* // Extract the FIRST element
|
|
2531
|
+
* // Arrays start with index 0!
|
|
2532
|
+
* const firstTextElement = texts[0];
|
|
2533
|
+
* const textOfFirstElement = firstElement.text;
|
|
2534
|
+
*
|
|
2535
|
+
* console.log(textOfFirstElement);
|
|
2536
|
+
*
|
|
2537
|
+
* // Console output
|
|
2538
|
+
* Sign In
|
|
2539
|
+
*
|
|
2540
|
+
* // Log the text of the SECOND element
|
|
2541
|
+
* // with shorter code
|
|
2542
|
+
* const texts = await aui.get().text().below().textfield().exec();
|
|
2543
|
+
* console.log(texts[1].text)
|
|
2544
|
+
*
|
|
2545
|
+
* // Console output
|
|
2546
|
+
* Login
|
|
2172
2547
|
* ```
|
|
2173
2548
|
*
|
|
2174
2549
|
* @return {FluentFiltersGetter}
|
|
@@ -2214,7 +2589,7 @@ export declare abstract class Getter extends FluentCommand {
|
|
|
2214
2589
|
* @return {ExecGetter}
|
|
2215
2590
|
*/
|
|
2216
2591
|
getAll(): ExecGetter;
|
|
2217
|
-
abstract getterExecutor(instruction: string,
|
|
2592
|
+
abstract getterExecutor(instruction: string, context: CommandExecutorContext): Promise<DetectedElement[]>;
|
|
2218
2593
|
}
|
|
2219
2594
|
export declare abstract class ApiCommands extends Getter {
|
|
2220
2595
|
}
|