askui 0.7.2 → 0.9.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.
Files changed (43) hide show
  1. package/dist/cjs/execution/dsl.d.ts +592 -1333
  2. package/dist/cjs/execution/dsl.js +1111 -2383
  3. package/dist/cjs/execution/inference-client.d.ts +3 -1
  4. package/dist/cjs/execution/inference-client.js +3 -1
  5. package/dist/cjs/execution/model-composition-branch.d.ts +8 -0
  6. package/dist/cjs/execution/ui-control-client.js +2 -1
  7. package/dist/cjs/execution/ui-controller-client-interface.d.ts +2 -0
  8. package/dist/cjs/execution/ui-controller-client.js +1 -1
  9. package/dist/esm/execution/dsl.d.ts +592 -1333
  10. package/dist/esm/execution/dsl.js +1119 -2391
  11. package/dist/esm/execution/inference-client.d.ts +3 -1
  12. package/dist/esm/execution/inference-client.js +3 -1
  13. package/dist/esm/execution/model-composition-branch.d.ts +8 -0
  14. package/dist/esm/execution/ui-control-client.js +2 -1
  15. package/dist/esm/execution/ui-controller-client-interface.d.ts +2 -0
  16. package/dist/esm/execution/ui-controller-client.js +1 -1
  17. package/dist/example_projects_templates/typescript_jest/test/README.md +2 -2
  18. package/dist/example_projects_templates/typescript_jest/test/my-first-askui-test-suite.test.ts +3 -3
  19. package/package.json +1 -1
  20. package/dist/cjs/core/annotation/annotation-json.d.ts +0 -5
  21. package/dist/cjs/core/model/test-case-dto/custom-element.spec.js +0 -53
  22. package/dist/cjs/execution/dsl.spec.d.ts +0 -1
  23. package/dist/cjs/execution/dsl.spec.js +0 -75
  24. package/dist/cjs/execution/read-environment-credentials.spec.d.ts +0 -1
  25. package/dist/cjs/execution/read-environment-credentials.spec.js +0 -11
  26. package/dist/cjs/lib/ui-controller-args.spec.d.ts +0 -1
  27. package/dist/cjs/lib/ui-controller-args.spec.js +0 -23
  28. package/dist/cjs/utils/http/credentials.spec.d.ts +0 -1
  29. package/dist/cjs/utils/http/credentials.spec.js +0 -11
  30. package/dist/esm/core/annotation/annotation-json.d.ts +0 -5
  31. package/dist/esm/core/annotation/annotation-json.js +0 -1
  32. package/dist/esm/core/model/test-case-dto/custom-element.spec.d.ts +0 -1
  33. package/dist/esm/core/model/test-case-dto/custom-element.spec.js +0 -51
  34. package/dist/esm/execution/dsl.spec.d.ts +0 -1
  35. package/dist/esm/execution/dsl.spec.js +0 -73
  36. package/dist/esm/execution/read-environment-credentials.spec.d.ts +0 -1
  37. package/dist/esm/execution/read-environment-credentials.spec.js +0 -9
  38. package/dist/esm/lib/ui-controller-args.spec.d.ts +0 -1
  39. package/dist/esm/lib/ui-controller-args.spec.js +0 -21
  40. package/dist/esm/utils/http/credentials.spec.d.ts +0 -1
  41. package/dist/esm/utils/http/credentials.spec.js +0 -9
  42. /package/dist/cjs/{core/annotation/annotation-json.js → execution/model-composition-branch.js} +0 -0
  43. /package/dist/{cjs/core/model/test-case-dto/custom-element.spec.d.ts → esm/execution/model-composition-branch.js} +0 -0
@@ -63,1795 +63,287 @@ exports.Exec = Exec;
63
63
  // Filters
64
64
  class FluentFilters extends FluentBase {
65
65
  /**
66
- * Filters for a UI element 'wizard item active'.
67
- *
68
- * @return {FluentFiltersOrRelations}
69
- */
70
- wizardItemActive() {
71
- this._textStr = 'wizard item active';
72
- return new FluentFiltersOrRelations(this);
73
- }
74
- /**
75
- * Filters for a UI element 'wizard item'.
66
+ * Filters for a UI element 'table'.
76
67
  *
77
68
  * @return {FluentFiltersOrRelations}
78
69
  */
79
- wizardItem() {
80
- this._textStr = 'wizard item';
70
+ table() {
71
+ this._textStr = 'table';
81
72
  return new FluentFiltersOrRelations(this);
82
73
  }
83
74
  /**
84
- * Filters for a UI element 'wizard'.
75
+ * Filters for a UI element 'switch'.
85
76
  *
86
77
  * @return {FluentFiltersOrRelations}
87
78
  */
88
- wizard() {
89
- this._textStr = 'wizard';
79
+ switch() {
80
+ this._textStr = 'switch';
90
81
  return new FluentFiltersOrRelations(this);
91
82
  }
92
83
  /**
93
- * Filters for a UI element 'windows bar'.
84
+ * Filters for a UI element 'container'.
94
85
  *
95
86
  * @return {FluentFiltersOrRelations}
96
87
  */
97
- windowsBar() {
98
- this._textStr = 'windows bar';
88
+ container() {
89
+ this._textStr = 'container';
99
90
  return new FluentFiltersOrRelations(this);
100
91
  }
101
92
  /**
102
- * Filters for a UI element 'window'.
93
+ * Filters for a UI element 'checkbox'.
103
94
  *
104
95
  * @return {FluentFiltersOrRelations}
105
96
  */
106
- window() {
107
- this._textStr = 'window';
97
+ checkbox() {
98
+ this._textStr = 'checkbox';
108
99
  return new FluentFiltersOrRelations(this);
109
100
  }
110
101
  /**
111
- * Filters for a UI element 'video'.
102
+ * Filters for a UI element 'button'.
112
103
  *
113
- * @return {FluentFiltersOrRelations}
114
- */
115
- video() {
116
- this._textStr = 'video';
117
- return new FluentFiltersOrRelations(this);
118
- }
119
- /**
120
- * Filters for a UI element 'url'.
104
+ * **Examples:**
105
+ * ```typescript
106
+ * await aui.moveMouseTo().button().exec()
107
+ * ```
121
108
  *
122
109
  * @return {FluentFiltersOrRelations}
123
110
  */
124
- url() {
125
- this._textStr = 'url';
111
+ button() {
112
+ this._textStr = 'button';
126
113
  return new FluentFiltersOrRelations(this);
127
114
  }
128
115
  /**
129
- * Filters for a UI element 'tooltip'.
116
+ * Filters for an UI element 'text'.
130
117
  *
131
- * @return {FluentFiltersOrRelations}
132
- */
133
- tooltip() {
134
- this._textStr = 'tooltip';
135
- return new FluentFiltersOrRelations(this);
136
- }
137
- /**
138
- * Filters for a UI element 'textfield'.
118
+ * Often combined with the filter `withText()` as shown in the below examples.
119
+ * See also the filters `withTextRegex()` and `withExactText()`
139
120
  *
140
- * @return {FluentFiltersOrRelations}
141
- */
142
- textfield() {
143
- this._textStr = 'textfield';
144
- return new FluentFiltersOrRelations(this);
145
- }
146
- /**
147
- * Filters for a UI element 'textarea'.
121
+ * **Examples:**
122
+ * ```typescript
123
+ * await aui.click().text().withText('Password').exec();
124
+ * await aui.click().text().withExactText('Username').exec();
125
+ * await aui.click().text().withTextRegex('\b[Ss]\w+').exec();
126
+ * ```
148
127
  *
149
128
  * @return {FluentFiltersOrRelations}
150
129
  */
151
- textarea() {
152
- this._textStr = 'textarea';
130
+ text() {
131
+ this._textStr = 'text';
153
132
  return new FluentFiltersOrRelations(this);
154
133
  }
155
134
  /**
156
- * Filters for a UI element 'table row'.
135
+ * Filters for a UI element 'icon'.
157
136
  *
158
- * @return {FluentFiltersOrRelations}
159
- */
160
- tableRow() {
161
- this._textStr = 'table row';
162
- return new FluentFiltersOrRelations(this);
163
- }
164
- /**
165
- * Filters for a UI element 'table header'.
137
+ * You can combine it with the element-description 'withText()' to look for a specific icon.
166
138
  *
167
- * @return {FluentFiltersOrRelations}
168
- */
169
- tableHeader() {
170
- this._textStr = 'table header';
171
- return new FluentFiltersOrRelations(this);
172
- }
173
- /**
174
- * Filters for a UI element 'table column'.
139
+ * **Examples:**
140
+ * ```typescript
141
+ * icon().withText('plus')
142
+ * ```
175
143
  *
176
- * @return {FluentFiltersOrRelations}
177
- */
178
- tableColumn() {
179
- this._textStr = 'table column';
180
- return new FluentFiltersOrRelations(this);
181
- }
182
- /**
183
- * Filters for a UI element 'table'.
144
+ * **Note:** This is an alpha feature. The prediction of the icon name is sometimes unstable. Use custom elements as an alternative.
184
145
  *
185
146
  * @return {FluentFiltersOrRelations}
186
147
  */
187
- table() {
188
- this._textStr = 'table';
148
+ icon() {
149
+ this._textStr = 'icon';
189
150
  return new FluentFiltersOrRelations(this);
190
151
  }
191
152
  /**
192
- * Filters for a UI element 'tab selected'.
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 that is not recognized by our machine learning models by default. It can also be used for pixel assertions of elements using classical [template matching](https://en.wikipedia.org/wiki/Template_matching).
193
154
  *
194
- * @return {FluentFiltersOrRelations}
195
- */
196
- tabSelected() {
197
- this._textStr = 'tab selected';
198
- return new FluentFiltersOrRelations(this);
199
- }
200
- /**
201
- * Filters for a UI element 'tab bar'.
155
+ * **Example**
156
+ * ```typescript
157
+ * await aui
158
+ * .click()
159
+ * .customElement({
160
+ * customImage: './logo.png', // required
161
+ * name: 'myLogo', // optional
162
+ * threshold: 0.9, // optional, defaults to 0.9
163
+ * rotationDegreePerStep: 0, // optional, defaults to 0
164
+ * imageCompareFormat: 'grayscale', // optional, defaults to 'grayscale'
165
+ * // mask:{x:0, y:0}[] // optional, a polygon to match only a certain area of the custom element
166
+ * })
167
+ * .exec();
168
+ * ```
169
+ *
170
+ * **Arguments**
171
+ *
172
+ * - **customImage** (*`string`, required*):
173
+ * - A cropped image in the form of a base64 string or file path.
174
+ * - **name** (*`string`, optional*):
175
+ * - 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
+ * - **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`.
178
+ * - **rotationDegreePerStep** (*`number`, optional*):
179
+ * - 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 color. Defaults to 'grayscale'.
182
+ * of the given custom image.
202
183
  *
203
- * @return {FluentFiltersOrRelations}
204
- */
205
- tabBar() {
206
- this._textStr = 'tab bar';
207
- return new FluentFiltersOrRelations(this);
208
- }
209
- /**
210
- * Filters for a UI element 'tab active'.
211
184
  *
212
- * @return {FluentFiltersOrRelations}
213
- */
214
- tabActive() {
215
- this._textStr = 'tab active';
216
- return new FluentFiltersOrRelations(this);
217
- }
218
- /**
219
- * Filters for a UI element 'tab'.
185
+ * @param {CustomElementJson} customElement - The custom element to filter for.
220
186
  *
221
187
  * @return {FluentFiltersOrRelations}
222
188
  */
223
- tab() {
224
- this._textStr = 'tab';
189
+ customElement(customElement) {
190
+ this._textStr = 'custom element';
191
+ this._params.set('customElement', customElement);
225
192
  return new FluentFiltersOrRelations(this);
226
193
  }
227
194
  /**
228
- * Filters for a UI element 'switch enabled'.
195
+ * Filters for a UI element 'image'.
229
196
  *
230
- * @return {FluentFiltersOrRelations}
231
- */
232
- switchEnabled() {
233
- this._textStr = 'switch enabled';
234
- return new FluentFiltersOrRelations(this);
235
- }
236
- /**
237
- * Filters for a UI element 'switch disabled'.
197
+ * **Examples:**
198
+ * ```typescript
199
+ * // Works if there is only one image visible on the screen
200
+ * await aui.click().image().exec();
238
201
  *
239
- * @return {FluentFiltersOrRelations}
240
- */
241
- switchDisabled() {
242
- this._textStr = 'switch disabled';
243
- return new FluentFiltersOrRelations(this);
244
- }
245
- /**
246
- * Filters for a UI element 'status bar'.
202
+ * // Works if you have an image with
203
+ * // a caption text below
204
+ * await aui.click().image().above().text().withText('The caption').exec();
205
+ * ```
247
206
  *
248
207
  * @return {FluentFiltersOrRelations}
249
208
  */
250
- statusBar() {
251
- this._textStr = 'status bar';
209
+ image() {
210
+ this._textStr = 'image';
252
211
  return new FluentFiltersOrRelations(this);
253
212
  }
254
213
  /**
255
- * Filters for a UI element 'slider indicator'.
214
+ * Filters for a UI element 'textfield'.
256
215
  *
257
- * @return {FluentFiltersOrRelations}
258
- */
259
- sliderIndicator() {
260
- this._textStr = 'slider indicator';
261
- return new FluentFiltersOrRelations(this);
262
- }
263
- /**
264
- * Filters for a UI element 'slider'.
216
+ * **Examples:**
217
+ * ```typescript
218
+ * // Works if there is only one textfield visible on the screen
219
+ * await aui.typeIn('Oh yeah').textfield().exec();
265
220
  *
266
- * @return {FluentFiltersOrRelations}
267
- */
268
- slider() {
269
- this._textStr = 'slider';
270
- return new FluentFiltersOrRelations(this);
271
- }
272
- /**
273
- * Filters for a UI element 'sidebar'.
221
+ * // Works if you have a labeled textfield
222
+ * // Label is above the textfield
223
+ * await aui.typeIn('Oh yeah').textfield().below().text().withText('E-Mail Address').exec();
224
+ * ```
274
225
  *
275
226
  * @return {FluentFiltersOrRelations}
276
227
  */
277
- sidebar() {
278
- this._textStr = 'sidebar';
228
+ textfield() {
229
+ this._textStr = 'textfield';
279
230
  return new FluentFiltersOrRelations(this);
280
231
  }
281
232
  /**
282
- * Filters for a UI element 'scroll bar'.
233
+ * Filters for similar (doesn't need to be a 100% equal) text.
283
234
  *
284
- * @return {FluentFiltersOrRelations}
285
- */
286
- scrollBar() {
287
- this._textStr = 'scroll bar';
288
- return new FluentFiltersOrRelations(this);
289
- }
290
- /**
291
- * Filters for a UI element 'rect'.
235
+ * **Examples:**
236
+ * ```typescript
237
+ * 'text' === withText('text') => true
238
+ * 'test' === withText('text') => true
239
+ * 'Test' === withText('text') => true
240
+ * 'Text' === withText('text') => true
241
+ * 'TEXT' === withText('text') => true
242
+ * 'texst' === withText('text') => true
243
+ * 'texts' === withText('text') => true
292
244
  *
293
- * @return {FluentFiltersOrRelations}
294
- */
295
- rect() {
296
- this._textStr = 'rect';
297
- return new FluentFiltersOrRelations(this);
298
- }
299
- /**
300
- * Filters for a UI element 'recaptcha'.
245
+ * // usually false
246
+ * 'atebxtc' === withText('text') => false
247
+ * 'other' === withText('text') => false
248
+ * ```
249
+ * ![](https://docs.askui.com/img/gif/withText.gif)
301
250
  *
302
- * @return {FluentFiltersOrRelations}
303
- */
304
- recaptcha() {
305
- this._textStr = 'recaptcha';
306
- return new FluentFiltersOrRelations(this);
307
- }
308
- /**
309
- * Filters for a UI element 'rate'.
251
+ * @param {string} text - A text to be matched.
310
252
  *
311
253
  * @return {FluentFiltersOrRelations}
312
254
  */
313
- rate() {
314
- this._textStr = 'rate';
255
+ withText(text) {
256
+ this._textStr = `with text ${Separators.STRING}${text}${Separators.STRING}`;
315
257
  return new FluentFiltersOrRelations(this);
316
258
  }
317
259
  /**
318
- * Filters for a UI element 'radio button unselected'.
260
+ * Filters for texts, which match the regex pattern.
319
261
  *
320
- * @return {FluentFiltersOrRelations}
321
- */
322
- radioButtonUnselected() {
323
- this._textStr = 'radio button unselected';
324
- return new FluentFiltersOrRelations(this);
325
- }
326
- /**
327
- * Filters for a UI element 'radio button selected'.
262
+ * **Examples:**
328
263
  *
329
- * @return {FluentFiltersOrRelations}
330
- */
331
- radioButtonSelected() {
332
- this._textStr = 'radio button selected';
333
- return new FluentFiltersOrRelations(this);
334
- }
335
- /**
336
- * Filters for a UI element 'progressbar'.
264
+ * ```typescript
265
+ * 'The rain in Spain' === withTextRegex('\b[Ss]\w+') => true
266
+ * 'The rain in Portugal' === withTextRegex('\b[Ss]\w+') => false
267
+ * 'The rain in switzerland' === withTextRegex('\b[Ss]\w+') => true
337
268
  *
338
- * @return {FluentFiltersOrRelations}
339
- */
340
- progressbar() {
341
- this._textStr = 'progressbar';
342
- return new FluentFiltersOrRelations(this);
343
- }
344
- /**
345
- * Filters for a UI element 'progress bar'.
269
+ * await aui.get().text().withTextRegex('\b[Ss]\w+').exec()
270
+ * ```
346
271
  *
347
- * @return {FluentFiltersOrRelations}
348
- */
349
- progressBar() {
350
- this._textStr = 'progress bar';
351
- return new FluentFiltersOrRelations(this);
352
- }
353
- /**
354
- * Filters for a UI element 'popover'.
272
+ * @param {string} regex_pattern - A regex pattern
355
273
  *
356
274
  * @return {FluentFiltersOrRelations}
357
275
  */
358
- popover() {
359
- this._textStr = 'popover';
276
+ withTextRegex(regex_pattern) {
277
+ this._textStr = `match regex pattern ${Separators.STRING}${regex_pattern}${Separators.STRING}`;
360
278
  return new FluentFiltersOrRelations(this);
361
279
  }
362
280
  /**
363
- * Filters for a UI element 'pil'.
281
+ * Filters for equal text.
364
282
  *
365
- * @return {FluentFiltersOrRelations}
366
- */
367
- pil() {
368
- this._textStr = 'pil';
369
- return new FluentFiltersOrRelations(this);
370
- }
371
- /**
372
- * Filters for a UI element 'password'.
283
+ * **Note:** This should be only used in cases where the similarity
284
+ * comparison of {@link FluentFilters.withText()} allows not for
285
+ * specific enough filtering (too many elements).
373
286
  *
374
- * @return {FluentFiltersOrRelations}
375
- */
376
- password() {
377
- this._textStr = 'password';
378
- return new FluentFiltersOrRelations(this);
379
- }
380
- /**
381
- * Filters for a UI element 'pager'.
287
+ * **Examples:**
288
+ * ```typescript
289
+ * 'text' === withExactText('text') => true
290
+ * 'test' === withExactText('text') => false
291
+ * 'other' === withExactText('text') => false
382
292
  *
383
- * @return {FluentFiltersOrRelations}
384
- */
385
- pager() {
386
- this._textStr = 'pager';
387
- return new FluentFiltersOrRelations(this);
388
- }
389
- /**
390
- * Filters for a UI element 'navigation bar'.
293
+ * await aui.moveMouseTo().text().withExactText('Password').exec()
294
+ * ```
391
295
  *
392
- * @return {FluentFiltersOrRelations}
393
- */
394
- navigationBar() {
395
- this._textStr = 'navigation bar';
396
- return new FluentFiltersOrRelations(this);
397
- }
398
- /**
399
- * Filters for a UI element 'mouse text'.
296
+ * @param {string} text - A text to be matched.
400
297
  *
401
298
  * @return {FluentFiltersOrRelations}
402
299
  */
403
- mouseText() {
404
- this._textStr = 'mouse text';
300
+ withExactText(text) {
301
+ this._textStr = `equals text ${Separators.STRING}${text}${Separators.STRING}`;
405
302
  return new FluentFiltersOrRelations(this);
406
303
  }
407
304
  /**
408
- * Filters for a UI element 'mouse pointer'.
305
+ * Filters for text containing the text provided as an argument.
409
306
  *
410
- * @return {FluentFiltersOrRelations}
411
- */
412
- mousePointer() {
413
- this._textStr = 'mouse pointer';
414
- return new FluentFiltersOrRelations(this);
415
- }
416
- /**
417
- * Filters for a UI element 'mouse cursor'.
307
+ * **Examples:**
308
+ * ```typescript
309
+ * 'This is a text' === containsText('text') => true
310
+ * 'This is a text' === containsText('other text') => false
311
+ * 'This is a text' === containsText('other') => false
312
+ * ```
313
+ * ![](https://docs.askui.com/img/gif/containsText.gif)
418
314
  *
419
- * @return {FluentFiltersOrRelations}
420
- */
421
- mouseCursor() {
422
- this._textStr = 'mouse cursor';
423
- return new FluentFiltersOrRelations(this);
424
- }
425
- /**
426
- * Filters for a UI element 'modal'.
315
+ * @param {string} text - A text to be matched.
427
316
  *
428
317
  * @return {FluentFiltersOrRelations}
429
318
  */
430
- modal() {
431
- this._textStr = 'modal';
319
+ containsText(text) {
320
+ this._textStr = `contain text ${Separators.STRING}${text}${Separators.STRING}`;
432
321
  return new FluentFiltersOrRelations(this);
433
322
  }
434
323
  /**
435
- * Filters for a UI element 'message box'.
324
+ * Filters elements based on a textual description.
436
325
  *
437
- * @return {FluentFiltersOrRelations}
438
- */
439
- messageBox() {
440
- this._textStr = 'message box';
441
- return new FluentFiltersOrRelations(this);
442
- }
443
- /**
444
- * Filters for a UI element 'map'.
326
+ * @param {string} text - A description of the target element.
445
327
  *
446
328
  * @return {FluentFiltersOrRelations}
447
329
  */
448
- map() {
449
- this._textStr = 'map';
330
+ matching(text) {
331
+ this._textStr = `matching ${Separators.STRING}${text}${Separators.STRING}`;
450
332
  return new FluentFiltersOrRelations(this);
451
333
  }
334
+ }
335
+ exports.FluentFilters = FluentFilters;
336
+ // Relations
337
+ class FluentFiltersOrRelations extends FluentFilters {
452
338
  /**
453
- * Filters for a UI element 'logo'.
339
+ * Logic or operator
454
340
  *
455
- * @return {FluentFiltersOrRelations}
456
- */
457
- logo() {
458
- this._textStr = 'logo';
459
- return new FluentFiltersOrRelations(this);
460
- }
461
- /**
462
- * Filters for a UI element 'link'.
463
- *
464
- * @return {FluentFiltersOrRelations}
465
- */
466
- link() {
467
- this._textStr = 'link';
468
- return new FluentFiltersOrRelations(this);
469
- }
470
- /**
471
- * Filters for a UI element 'keyboard'.
472
- *
473
- * @return {FluentFiltersOrRelations}
474
- */
475
- keyboard() {
476
- this._textStr = 'keyboard';
477
- return new FluentFiltersOrRelations(this);
478
- }
479
- /**
480
- * Filters for a UI element 'image'.
481
- *
482
- * @return {FluentFiltersOrRelations}
483
- */
484
- image() {
485
- this._textStr = 'image';
486
- return new FluentFiltersOrRelations(this);
487
- }
488
- /**
489
- * Filters for a UI element 'header'.
490
- *
491
- * @return {FluentFiltersOrRelations}
492
- */
493
- header() {
494
- this._textStr = 'header';
495
- return new FluentFiltersOrRelations(this);
496
- }
497
- /**
498
- * Filters for a UI element 'footer'.
499
- *
500
- * @return {FluentFiltersOrRelations}
501
- */
502
- footer() {
503
- this._textStr = 'footer';
504
- return new FluentFiltersOrRelations(this);
505
- }
506
- /**
507
- * Filters for a UI element 'flag'.
508
- *
509
- * @return {FluentFiltersOrRelations}
510
- */
511
- flag() {
512
- this._textStr = 'flag';
513
- return new FluentFiltersOrRelations(this);
514
- }
515
- /**
516
- * Filters for a UI element 'dropdown menu'.
517
- *
518
- * @return {FluentFiltersOrRelations}
519
- */
520
- dropdownMenu() {
521
- this._textStr = 'dropdown menu';
522
- return new FluentFiltersOrRelations(this);
523
- }
524
- /**
525
- * Filters for a UI element 'divider'.
526
- *
527
- * @return {FluentFiltersOrRelations}
528
- */
529
- divider() {
530
- this._textStr = 'divider';
531
- return new FluentFiltersOrRelations(this);
532
- }
533
- /**
534
- * Filters for a UI element 'circle'.
535
- *
536
- * @return {FluentFiltersOrRelations}
537
- */
538
- circle() {
539
- this._textStr = 'circle';
540
- return new FluentFiltersOrRelations(this);
541
- }
542
- /**
543
- * Filters for a UI element 'checkbox unchecked'.
544
- *
545
- * @return {FluentFiltersOrRelations}
546
- */
547
- checkboxUnchecked() {
548
- this._textStr = 'checkbox unchecked';
549
- return new FluentFiltersOrRelations(this);
550
- }
551
- /**
552
- * Filters for a UI element 'checkbox checked'.
553
- *
554
- * @return {FluentFiltersOrRelations}
555
- */
556
- checkboxChecked() {
557
- this._textStr = 'checkbox checked';
558
- return new FluentFiltersOrRelations(this);
559
- }
560
- /**
561
- * Filters for a UI element 'chart pie'.
562
- *
563
- * @return {FluentFiltersOrRelations}
564
- */
565
- chartPie() {
566
- this._textStr = 'chart pie';
567
- return new FluentFiltersOrRelations(this);
568
- }
569
- /**
570
- * Filters for a UI element 'chart'.
571
- *
572
- * @return {FluentFiltersOrRelations}
573
- */
574
- chart() {
575
- this._textStr = 'chart';
576
- return new FluentFiltersOrRelations(this);
577
- }
578
- /**
579
- * Filters for a UI element 'card'.
580
- *
581
- * @return {FluentFiltersOrRelations}
582
- */
583
- card() {
584
- this._textStr = 'card';
585
- return new FluentFiltersOrRelations(this);
586
- }
587
- /**
588
- * Filters for a UI element 'browser bar'.
589
- *
590
- * @return {FluentFiltersOrRelations}
591
- */
592
- browserBar() {
593
- this._textStr = 'browser bar';
594
- return new FluentFiltersOrRelations(this);
595
- }
596
- /**
597
- * Filters for a UI element 'breadcrumb'.
598
- *
599
- * @return {FluentFiltersOrRelations}
600
- */
601
- breadcrumb() {
602
- this._textStr = 'breadcrumb';
603
- return new FluentFiltersOrRelations(this);
604
- }
605
- /**
606
- * Filters for a UI element 'banner'.
607
- *
608
- * @return {FluentFiltersOrRelations}
609
- */
610
- banner() {
611
- this._textStr = 'banner';
612
- return new FluentFiltersOrRelations(this);
613
- }
614
- /**
615
- * Filters for a UI element 'badge'.
616
- *
617
- * @return {FluentFiltersOrRelations}
618
- */
619
- badge() {
620
- this._textStr = 'badge';
621
- return new FluentFiltersOrRelations(this);
622
- }
623
- /**
624
- * Filters for a UI element 'alert'.
625
- *
626
- * @return {FluentFiltersOrRelations}
627
- */
628
- alert() {
629
- this._textStr = 'alert';
630
- return new FluentFiltersOrRelations(this);
631
- }
632
- /**
633
- * Filters for a UI element 'unknown'.
634
- *
635
- * @return {FluentFiltersOrRelations}
636
- */
637
- unknown() {
638
- this._textStr = 'unknown';
639
- return new FluentFiltersOrRelations(this);
640
- }
641
- /**
642
- * Filters for an UI element 'button'.
643
- *
644
- * **Examples:**
645
- * ```typescript
646
- * await aui.moveMouseTo().button().exec()
647
- * ```
648
- *
649
- * @return {FluentFiltersOrRelations}
650
- */
651
- button() {
652
- this._textStr = 'button';
653
- return new FluentFiltersOrRelations(this);
654
- }
655
- /**
656
- * Filters for an UI element 'text'.
657
- *
658
- * @return {FluentFiltersOrRelations}
659
- */
660
- text() {
661
- this._textStr = 'text';
662
- return new FluentFiltersOrRelations(this);
663
- }
664
- /**
665
- * Filters for an UI element 'dropdown'.
666
- *
667
- * @return {FluentFiltersOrRelations}
668
- */
669
- dropdown() {
670
- this._textStr = 'dropdown';
671
- return new FluentFiltersOrRelations(this);
672
- }
673
- /**
674
- * Filters for an UI element 'icon'.
675
- *
676
- * You can combine it with the 'withText' command to look for a specific icon.
677
- *
678
- * **Examples:**
679
- * ```typescript
680
- * icon().withText('plus')
681
- * ```
682
- *
683
- * Note: This is an alpha feature. The prediction of the icon name is sometimes unstable. Use custom elements as an alternative.
684
- *
685
- * @return {FluentFiltersOrRelations}
686
- */
687
- icon() {
688
- this._textStr = 'icon';
689
- return new FluentFiltersOrRelations(this);
690
- }
691
- /**
692
- * Filters for a custom UI element (see {@link CustomElementJson}).
693
- *
694
- * **Important**: This increases the runtime quite a bit. So
695
- * only use it when absolutely necessary.
696
- *
697
- * @param {CustomElementJson} customElement - The custom element to filter for.
698
- *
699
- * @return {FluentFiltersOrRelations}
700
- */
701
- customElement(customElement) {
702
- this._textStr = 'custom element';
703
- this._params.set('customElement', customElement);
704
- return new FluentFiltersOrRelations(this);
705
- }
706
- /**
707
- * Filters for a UI element 'checkbox' checked or unchecked.
708
- *
709
- * @return {FluentFiltersOrRelations}
710
- */
711
- checkbox() {
712
- this._textStr = 'checkbox';
713
- return new FluentFiltersOrRelations(this);
714
- }
715
- /**
716
- * Filters for similar (doesn't need to be a 100% equal) text.
717
- *
718
- * **Examples:**
719
- * ```typescript
720
- * 'text' === withText('text') => true
721
- * 'test' === withText('text') => true
722
- * 'Test' === withText('text') => true
723
- * 'Text' === withText('text') => true
724
- * 'TEXT' === withText('text') => true
725
- * 'texst' === withText('text') => true
726
- * 'texts' === withText('text') => true
727
- *
728
- * // usually false
729
- * 'atebxtc' === withText('text') => false
730
- * 'other' === withText('text') => false
731
- * ```
732
- * ![](https://docs.askui.com/img/gif/withText.gif)
733
- *
734
- * @param {string} text - A text to be matched.
735
- *
736
- * @return {FluentFiltersOrRelations}
737
- */
738
- withText(text) {
739
- this._textStr = `with text ${Separators.STRING}${text}${Separators.STRING}`;
740
- return new FluentFiltersOrRelations(this);
741
- }
742
- /**
743
- * Filters for texts, which match the regex pattern.
744
- *
745
- * **Examples:**
746
- *
747
- * ```typescript
748
- * 'The rain in Spain' === withTextRegex('\b[Ss]\w+') => true
749
- * 'The rain in Portugal' === withTextRegex('\b[Ss]\w+') => false
750
- * 'The rain in switzerland' === withTextRegex('\b[Ss]\w+') => true
751
- *
752
- * await aui.get().text().withTextRegex('\b[Ss]\w+').exec()
753
- * ```
754
- *
755
- * @param {string} regex_pattern - A regex pattern
756
- *
757
- * @return {FluentFiltersOrRelations}
758
- */
759
- withTextRegex(regex_pattern) {
760
- this._textStr = `match regex pattern ${Separators.STRING}${regex_pattern}${Separators.STRING}`;
761
- return new FluentFiltersOrRelations(this);
762
- }
763
- /**
764
- * Filters for equal text.
765
- *
766
- * **Note:** This should be only used in cases where the similarity
767
- * comparison of {@link FluentFilters.withText()} allows not for
768
- * specific enough filtering (too many elements).
769
- *
770
- * **Examples:**
771
- * ```typescript
772
- * 'text' === withExactText('text') => true
773
- * 'test' === withExactText('text') => false
774
- * 'other' === withExactText('text') => false
775
- *
776
- * await aui.moveMouseTo().text().withExactText('Password').exec()
777
- * ```
778
- *
779
- * @param {string} text - A text to be matched.
780
- *
781
- * @return {FluentFiltersOrRelations}
782
- */
783
- withExactText(text) {
784
- this._textStr = `equals text ${Separators.STRING}${text}${Separators.STRING}`;
785
- return new FluentFiltersOrRelations(this);
786
- }
787
- /**
788
- * Filters for text containing the text provided as an argument.
789
- *
790
- * **Examples:**
791
- * ```typescript
792
- * 'This is an text' === containsText('text') => true
793
- * 'This is an text' === containsText('other text') => false
794
- * 'This is an text' === containsText('other') => false
795
- * ```
796
- * ![](https://docs.askui.com/img/gif/containsText.gif)
797
- *
798
- * @param {string} text - A text to be matched.
799
- *
800
- * @return {FluentFiltersOrRelations}
801
- */
802
- containsText(text) {
803
- this._textStr = `contain text ${Separators.STRING}${text}${Separators.STRING}`;
804
- return new FluentFiltersOrRelations(this);
805
- }
806
- }
807
- exports.FluentFilters = FluentFilters;
808
- // Relations
809
- class FluentFiltersOrRelations extends FluentFilters {
810
- /**
811
- * Logic or operator
812
- *
813
- * **Examples:**
814
- * ```text
815
- * scene 1
816
- * -------------- ---------------
817
- * | button | | icon |
818
- * -------------- ---------------
819
- *
820
- * scene 2
821
- * -------------- ---------------
822
- * | button | | text |
823
- * -------------- ---------------
824
- *
825
- * ```
826
- * In case, that your reference element can have multiple values, in the following example, the element right of the button can be either icon or text.
827
- * You can use **the `or()` relation**, so your teststep is valid for both scenes
828
- * ```typescript
829
- * const button = await aui.get().button().rightOf().icon().or().text().exec();
830
- * console.log(button);
831
- * ```
832
- * Returns the same button for both cases
833
- * ```text
834
- * console output: [
835
- * DetectedElement {
836
- * name: 'BUTTON',
837
- * text: 'button',
838
- * bndbox: BoundingBox {
839
- * xmin: 900,
840
- * ymin: 910,
841
- * xmax: 920,
842
- * ymax: 930
843
- * }
844
- * }
845
- * ]
846
- * ```
847
- *
848
- * @return {FluentFilters}
849
- */
850
- or() {
851
- this._textStr = 'or';
852
- return new FluentFilters(this);
853
- }
854
- /**
855
- * Logic and operator
856
- *
857
- * **Examples:**
858
- * ```text
859
- * example scene:
860
- * --------------- ----------------
861
- * | icon user | | icon search |
862
- * --------------- ---------------n```
863
- * ```typescript
864
- * const icons = await aui.get().icon().exec();
865
- * console.log(icons);
866
- * ```
867
- * Using only the filter icon, the get command will return both icons
868
- * ```text
869
- * console output: [
870
- * DetectedElement {
871
- * name: 'ICON',
872
- * text: 'user',
873
- * bndbox: BoundingBox {
874
- * xmin: 1000,
875
- * ymin: 1010,
876
- * xmax: 1020,
877
- * ymax: 1030
878
- * }
879
- * },
880
- * DetectedElement {
881
- * name: 'ICON',
882
- * text: 'search',
883
- * bndbox: BoundingBox {
884
- * xmin: 900,
885
- * ymin: 910,
886
- * xmax: 920,
887
- * ymax: 930
888
- * }
889
- * }
890
- * ]
891
- * ```
892
- * You can combine filters with **the `and()` relation** and specify exactly which icon you want
893
- * ```typescript
894
- * const icons = await aui.get().icon().and().withText('user').exec()
895
- * console.log(icons)
896
- * ```
897
- * The get command returns only the user icon although both elements are icons
898
- * ```text
899
- * console output: [
900
- * DetectedElement {
901
- * name: 'ICON',
902
- * text: 'user',
903
- * bndbox: BoundingBox {
904
- * xmin: 900,
905
- * ymin: 910,
906
- * xmax: 920,
907
- * ymax: 930
908
- * }
909
- * }
910
- * ]
911
- * ```
912
- *
913
- * @return {FluentFilters}
914
- */
915
- and() {
916
- this._textStr = 'and';
917
- return new FluentFilters(this);
918
- }
919
- /**
920
- * Filters for an element inside another element.
921
- *
922
- * **Examples:**
923
- * ```typescript
924
- * --------------------
925
- * | outerEl |
926
- * | -------------- |
927
- * | | innerEl | |
928
- * | -------------- |
929
- * | |
930
- * --------------------
931
- *
932
- * // Returns innerEl because innerEl is inside outerEl
933
- * ...innerEl().in().outerEl()
934
- * // Returns nothing because innerEl is not inside outerEl
935
- * ...outerEl().in().innerEl()
936
- * ```
937
- * ![](https://docs.askui.com/img/gif/in.gif)
938
- *
939
- * @return {FluentFilters}
940
- */
941
- in() {
942
- this._textStr = 'in';
943
- return new FluentFilters(this);
944
- }
945
- /**
946
- * Filters for an element right of another element.
947
- *
948
- * **Examples:**
949
- * ```typescript
950
- * -------------- --------------
951
- * | leftEl | | rightEl |
952
- * -------------- --------------
953
- *
954
- * // Returns rightEl because rightEl is right of leftEl
955
- * ...rightEl().rightOf().leftEl()
956
- * // Returns no element because leftEl is left of rightEl
957
- * ...leftEl().rightOf().rightEl()
958
- * ```
959
- * ![](https://docs.askui.com/img/gif/rightOf.gif)
960
- *
961
- * @return {FluentFilters}
962
- */
963
- rightOf() {
964
- this._textStr = 'right of';
965
- return new FluentFilters(this);
966
- }
967
- /**
968
- * Filters for an element left of another element.
969
- *
970
- * **Examples:**
971
- * ```typescript
972
- * -------------- --------------
973
- * | leftEl | | rightEl |
974
- * -------------- --------------
975
- *
976
- * // Returns leftEl because leftEl is left of rightEl
977
- * ...leftEl().leftOf().rightEl()
978
- * // Returns no element because rightEl is left of leftEl
979
- * ...rightEl().leftOf().leftEl()
980
- * ```
981
- * ![](https://docs.askui.com/img/gif/leftOf.gif)
982
- *
983
- * @return {FluentFilters}
984
- */
985
- leftOf() {
986
- this._textStr = 'left of';
987
- return new FluentFilters(this);
988
- }
989
- /**
990
- * Filters for an element below another element.
991
- *
992
- * **Examples:**
993
- * ```typescript
994
- * --------------
995
- * | text |
996
- * --------------
997
- * --------------
998
- * | button |
999
- * --------------
1000
- *
1001
- * // Returns button because button is below text
1002
- * ...button().below().text()
1003
- * // Returns no element because text is above button
1004
- * ...text().below().button()
1005
- * ```
1006
- * ![](https://docs.askui.com/img/gif/below.gif)
1007
- *
1008
- * @return {FluentFilters}
1009
- */
1010
- below() {
1011
- this._textStr = 'below';
1012
- return new FluentFilters(this);
1013
- }
1014
- /**
1015
- * Filters for an element above another element.
1016
- *
1017
- * **Examples:**
1018
- * ```typescript
1019
- * --------------
1020
- * | text |
1021
- * --------------
1022
- * --------------
1023
- * | button |
1024
- * --------------
1025
- *
1026
- * // Returns text because text is above button
1027
- * ...text().above().button()
1028
- * // Returns no element because button is below text
1029
- * ...button().above().text()
1030
- * ```
1031
- * ![](https://docs.askui.com/img/gif/above.gif)
1032
- *
1033
- * @return {FluentFilters}
1034
- */
1035
- above() {
1036
- this._textStr = 'above';
1037
- return new FluentFilters(this);
1038
- }
1039
- /**
1040
- * Filters for an element nearest to another element.
1041
- *
1042
- * **Examples:**
1043
- * ```typescript
1044
- * --------------
1045
- * | button 1 |
1046
- * --------------
1047
- * --------------
1048
- * | text |
1049
- * --------------
1050
- *
1051
- *
1052
- *
1053
- * --------------
1054
- * | button 2 |
1055
- * --------------
1056
- *
1057
- * // Returns button 1 because button 1 is nearer to the text than button 2
1058
- * ...button().nearestTo().text()
1059
- * ```
1060
- * ![](https://docs.askui.com/img/gif/nearestTo.gif)
1061
- *
1062
- * @return {FluentFilters}
1063
- */
1064
- nearestTo() {
1065
- this._textStr = 'nearest to';
1066
- return new FluentFilters(this);
1067
- }
1068
- /**
1069
- * Filters for an element containing another element.
1070
- *
1071
- * **Example:**
1072
- * ```typescript
1073
- * --------------------
1074
- * | outerEl |
1075
- * | -------------- |
1076
- * | | innerEl | |
1077
- * | -------------- |
1078
- * | |
1079
- * --------------------
1080
- *
1081
- * // Returns outerEl because outerEl contains innerEl
1082
- * ...outerEl().contains().innerEl()
1083
- * // Returns no element because innerEl contains no outerEl
1084
- * ...innerEl().contains().outerEl()
1085
- * ```
1086
- * ![](https://docs.askui.com/img/gif/contains.gif)
1087
- *
1088
- * @return {FluentFilters}
1089
- */
1090
- contains() {
1091
- this._textStr = 'contains';
1092
- return new FluentFilters(this);
1093
- }
1094
- exec() {
1095
- return this.fluentCommandStringBuilder();
1096
- }
1097
- }
1098
- exports.FluentFiltersOrRelations = FluentFiltersOrRelations;
1099
- // Filters
1100
- class FluentFiltersCondition extends FluentBase {
1101
- /**
1102
- * Filters for a UI element 'wizard item active'.
1103
- *
1104
- * @return {FluentFiltersOrRelationsCondition}
1105
- */
1106
- wizardItemActive() {
1107
- this._textStr = 'wizard item active';
1108
- return new FluentFiltersOrRelationsCondition(this);
1109
- }
1110
- /**
1111
- * Filters for a UI element 'wizard item'.
1112
- *
1113
- * @return {FluentFiltersOrRelationsCondition}
1114
- */
1115
- wizardItem() {
1116
- this._textStr = 'wizard item';
1117
- return new FluentFiltersOrRelationsCondition(this);
1118
- }
1119
- /**
1120
- * Filters for a UI element 'wizard'.
1121
- *
1122
- * @return {FluentFiltersOrRelationsCondition}
1123
- */
1124
- wizard() {
1125
- this._textStr = 'wizard';
1126
- return new FluentFiltersOrRelationsCondition(this);
1127
- }
1128
- /**
1129
- * Filters for a UI element 'windows bar'.
1130
- *
1131
- * @return {FluentFiltersOrRelationsCondition}
1132
- */
1133
- windowsBar() {
1134
- this._textStr = 'windows bar';
1135
- return new FluentFiltersOrRelationsCondition(this);
1136
- }
1137
- /**
1138
- * Filters for a UI element 'window'.
1139
- *
1140
- * @return {FluentFiltersOrRelationsCondition}
1141
- */
1142
- window() {
1143
- this._textStr = 'window';
1144
- return new FluentFiltersOrRelationsCondition(this);
1145
- }
1146
- /**
1147
- * Filters for a UI element 'video'.
1148
- *
1149
- * @return {FluentFiltersOrRelationsCondition}
1150
- */
1151
- video() {
1152
- this._textStr = 'video';
1153
- return new FluentFiltersOrRelationsCondition(this);
1154
- }
1155
- /**
1156
- * Filters for a UI element 'url'.
1157
- *
1158
- * @return {FluentFiltersOrRelationsCondition}
1159
- */
1160
- url() {
1161
- this._textStr = 'url';
1162
- return new FluentFiltersOrRelationsCondition(this);
1163
- }
1164
- /**
1165
- * Filters for a UI element 'tooltip'.
1166
- *
1167
- * @return {FluentFiltersOrRelationsCondition}
1168
- */
1169
- tooltip() {
1170
- this._textStr = 'tooltip';
1171
- return new FluentFiltersOrRelationsCondition(this);
1172
- }
1173
- /**
1174
- * Filters for a UI element 'textfield'.
1175
- *
1176
- * @return {FluentFiltersOrRelationsCondition}
1177
- */
1178
- textfield() {
1179
- this._textStr = 'textfield';
1180
- return new FluentFiltersOrRelationsCondition(this);
1181
- }
1182
- /**
1183
- * Filters for a UI element 'textarea'.
1184
- *
1185
- * @return {FluentFiltersOrRelationsCondition}
1186
- */
1187
- textarea() {
1188
- this._textStr = 'textarea';
1189
- return new FluentFiltersOrRelationsCondition(this);
1190
- }
1191
- /**
1192
- * Filters for a UI element 'table row'.
1193
- *
1194
- * @return {FluentFiltersOrRelationsCondition}
1195
- */
1196
- tableRow() {
1197
- this._textStr = 'table row';
1198
- return new FluentFiltersOrRelationsCondition(this);
1199
- }
1200
- /**
1201
- * Filters for a UI element 'table header'.
1202
- *
1203
- * @return {FluentFiltersOrRelationsCondition}
1204
- */
1205
- tableHeader() {
1206
- this._textStr = 'table header';
1207
- return new FluentFiltersOrRelationsCondition(this);
1208
- }
1209
- /**
1210
- * Filters for a UI element 'table column'.
1211
- *
1212
- * @return {FluentFiltersOrRelationsCondition}
1213
- */
1214
- tableColumn() {
1215
- this._textStr = 'table column';
1216
- return new FluentFiltersOrRelationsCondition(this);
1217
- }
1218
- /**
1219
- * Filters for a UI element 'table'.
1220
- *
1221
- * @return {FluentFiltersOrRelationsCondition}
1222
- */
1223
- table() {
1224
- this._textStr = 'table';
1225
- return new FluentFiltersOrRelationsCondition(this);
1226
- }
1227
- /**
1228
- * Filters for a UI element 'tab selected'.
1229
- *
1230
- * @return {FluentFiltersOrRelationsCondition}
1231
- */
1232
- tabSelected() {
1233
- this._textStr = 'tab selected';
1234
- return new FluentFiltersOrRelationsCondition(this);
1235
- }
1236
- /**
1237
- * Filters for a UI element 'tab bar'.
1238
- *
1239
- * @return {FluentFiltersOrRelationsCondition}
1240
- */
1241
- tabBar() {
1242
- this._textStr = 'tab bar';
1243
- return new FluentFiltersOrRelationsCondition(this);
1244
- }
1245
- /**
1246
- * Filters for a UI element 'tab active'.
1247
- *
1248
- * @return {FluentFiltersOrRelationsCondition}
1249
- */
1250
- tabActive() {
1251
- this._textStr = 'tab active';
1252
- return new FluentFiltersOrRelationsCondition(this);
1253
- }
1254
- /**
1255
- * Filters for a UI element 'tab'.
1256
- *
1257
- * @return {FluentFiltersOrRelationsCondition}
1258
- */
1259
- tab() {
1260
- this._textStr = 'tab';
1261
- return new FluentFiltersOrRelationsCondition(this);
1262
- }
1263
- /**
1264
- * Filters for a UI element 'switch enabled'.
1265
- *
1266
- * @return {FluentFiltersOrRelationsCondition}
1267
- */
1268
- switchEnabled() {
1269
- this._textStr = 'switch enabled';
1270
- return new FluentFiltersOrRelationsCondition(this);
1271
- }
1272
- /**
1273
- * Filters for a UI element 'switch disabled'.
1274
- *
1275
- * @return {FluentFiltersOrRelationsCondition}
1276
- */
1277
- switchDisabled() {
1278
- this._textStr = 'switch disabled';
1279
- return new FluentFiltersOrRelationsCondition(this);
1280
- }
1281
- /**
1282
- * Filters for a UI element 'status bar'.
1283
- *
1284
- * @return {FluentFiltersOrRelationsCondition}
1285
- */
1286
- statusBar() {
1287
- this._textStr = 'status bar';
1288
- return new FluentFiltersOrRelationsCondition(this);
1289
- }
1290
- /**
1291
- * Filters for a UI element 'slider indicator'.
1292
- *
1293
- * @return {FluentFiltersOrRelationsCondition}
1294
- */
1295
- sliderIndicator() {
1296
- this._textStr = 'slider indicator';
1297
- return new FluentFiltersOrRelationsCondition(this);
1298
- }
1299
- /**
1300
- * Filters for a UI element 'slider'.
1301
- *
1302
- * @return {FluentFiltersOrRelationsCondition}
1303
- */
1304
- slider() {
1305
- this._textStr = 'slider';
1306
- return new FluentFiltersOrRelationsCondition(this);
1307
- }
1308
- /**
1309
- * Filters for a UI element 'sidebar'.
1310
- *
1311
- * @return {FluentFiltersOrRelationsCondition}
1312
- */
1313
- sidebar() {
1314
- this._textStr = 'sidebar';
1315
- return new FluentFiltersOrRelationsCondition(this);
1316
- }
1317
- /**
1318
- * Filters for a UI element 'scroll bar'.
1319
- *
1320
- * @return {FluentFiltersOrRelationsCondition}
1321
- */
1322
- scrollBar() {
1323
- this._textStr = 'scroll bar';
1324
- return new FluentFiltersOrRelationsCondition(this);
1325
- }
1326
- /**
1327
- * Filters for a UI element 'rect'.
1328
- *
1329
- * @return {FluentFiltersOrRelationsCondition}
1330
- */
1331
- rect() {
1332
- this._textStr = 'rect';
1333
- return new FluentFiltersOrRelationsCondition(this);
1334
- }
1335
- /**
1336
- * Filters for a UI element 'recaptcha'.
1337
- *
1338
- * @return {FluentFiltersOrRelationsCondition}
1339
- */
1340
- recaptcha() {
1341
- this._textStr = 'recaptcha';
1342
- return new FluentFiltersOrRelationsCondition(this);
1343
- }
1344
- /**
1345
- * Filters for a UI element 'rate'.
1346
- *
1347
- * @return {FluentFiltersOrRelationsCondition}
1348
- */
1349
- rate() {
1350
- this._textStr = 'rate';
1351
- return new FluentFiltersOrRelationsCondition(this);
1352
- }
1353
- /**
1354
- * Filters for a UI element 'radio button unselected'.
1355
- *
1356
- * @return {FluentFiltersOrRelationsCondition}
1357
- */
1358
- radioButtonUnselected() {
1359
- this._textStr = 'radio button unselected';
1360
- return new FluentFiltersOrRelationsCondition(this);
1361
- }
1362
- /**
1363
- * Filters for a UI element 'radio button selected'.
1364
- *
1365
- * @return {FluentFiltersOrRelationsCondition}
1366
- */
1367
- radioButtonSelected() {
1368
- this._textStr = 'radio button selected';
1369
- return new FluentFiltersOrRelationsCondition(this);
1370
- }
1371
- /**
1372
- * Filters for a UI element 'progressbar'.
1373
- *
1374
- * @return {FluentFiltersOrRelationsCondition}
1375
- */
1376
- progressbar() {
1377
- this._textStr = 'progressbar';
1378
- return new FluentFiltersOrRelationsCondition(this);
1379
- }
1380
- /**
1381
- * Filters for a UI element 'progress bar'.
1382
- *
1383
- * @return {FluentFiltersOrRelationsCondition}
1384
- */
1385
- progressBar() {
1386
- this._textStr = 'progress bar';
1387
- return new FluentFiltersOrRelationsCondition(this);
1388
- }
1389
- /**
1390
- * Filters for a UI element 'popover'.
1391
- *
1392
- * @return {FluentFiltersOrRelationsCondition}
1393
- */
1394
- popover() {
1395
- this._textStr = 'popover';
1396
- return new FluentFiltersOrRelationsCondition(this);
1397
- }
1398
- /**
1399
- * Filters for a UI element 'pil'.
1400
- *
1401
- * @return {FluentFiltersOrRelationsCondition}
1402
- */
1403
- pil() {
1404
- this._textStr = 'pil';
1405
- return new FluentFiltersOrRelationsCondition(this);
1406
- }
1407
- /**
1408
- * Filters for a UI element 'password'.
1409
- *
1410
- * @return {FluentFiltersOrRelationsCondition}
1411
- */
1412
- password() {
1413
- this._textStr = 'password';
1414
- return new FluentFiltersOrRelationsCondition(this);
1415
- }
1416
- /**
1417
- * Filters for a UI element 'pager'.
1418
- *
1419
- * @return {FluentFiltersOrRelationsCondition}
1420
- */
1421
- pager() {
1422
- this._textStr = 'pager';
1423
- return new FluentFiltersOrRelationsCondition(this);
1424
- }
1425
- /**
1426
- * Filters for a UI element 'navigation bar'.
1427
- *
1428
- * @return {FluentFiltersOrRelationsCondition}
1429
- */
1430
- navigationBar() {
1431
- this._textStr = 'navigation bar';
1432
- return new FluentFiltersOrRelationsCondition(this);
1433
- }
1434
- /**
1435
- * Filters for a UI element 'mouse text'.
1436
- *
1437
- * @return {FluentFiltersOrRelationsCondition}
1438
- */
1439
- mouseText() {
1440
- this._textStr = 'mouse text';
1441
- return new FluentFiltersOrRelationsCondition(this);
1442
- }
1443
- /**
1444
- * Filters for a UI element 'mouse pointer'.
1445
- *
1446
- * @return {FluentFiltersOrRelationsCondition}
1447
- */
1448
- mousePointer() {
1449
- this._textStr = 'mouse pointer';
1450
- return new FluentFiltersOrRelationsCondition(this);
1451
- }
1452
- /**
1453
- * Filters for a UI element 'mouse cursor'.
1454
- *
1455
- * @return {FluentFiltersOrRelationsCondition}
1456
- */
1457
- mouseCursor() {
1458
- this._textStr = 'mouse cursor';
1459
- return new FluentFiltersOrRelationsCondition(this);
1460
- }
1461
- /**
1462
- * Filters for a UI element 'modal'.
1463
- *
1464
- * @return {FluentFiltersOrRelationsCondition}
1465
- */
1466
- modal() {
1467
- this._textStr = 'modal';
1468
- return new FluentFiltersOrRelationsCondition(this);
1469
- }
1470
- /**
1471
- * Filters for a UI element 'message box'.
1472
- *
1473
- * @return {FluentFiltersOrRelationsCondition}
1474
- */
1475
- messageBox() {
1476
- this._textStr = 'message box';
1477
- return new FluentFiltersOrRelationsCondition(this);
1478
- }
1479
- /**
1480
- * Filters for a UI element 'map'.
1481
- *
1482
- * @return {FluentFiltersOrRelationsCondition}
1483
- */
1484
- map() {
1485
- this._textStr = 'map';
1486
- return new FluentFiltersOrRelationsCondition(this);
1487
- }
1488
- /**
1489
- * Filters for a UI element 'logo'.
1490
- *
1491
- * @return {FluentFiltersOrRelationsCondition}
1492
- */
1493
- logo() {
1494
- this._textStr = 'logo';
1495
- return new FluentFiltersOrRelationsCondition(this);
1496
- }
1497
- /**
1498
- * Filters for a UI element 'link'.
1499
- *
1500
- * @return {FluentFiltersOrRelationsCondition}
1501
- */
1502
- link() {
1503
- this._textStr = 'link';
1504
- return new FluentFiltersOrRelationsCondition(this);
1505
- }
1506
- /**
1507
- * Filters for a UI element 'keyboard'.
1508
- *
1509
- * @return {FluentFiltersOrRelationsCondition}
1510
- */
1511
- keyboard() {
1512
- this._textStr = 'keyboard';
1513
- return new FluentFiltersOrRelationsCondition(this);
1514
- }
1515
- /**
1516
- * Filters for a UI element 'image'.
1517
- *
1518
- * @return {FluentFiltersOrRelationsCondition}
1519
- */
1520
- image() {
1521
- this._textStr = 'image';
1522
- return new FluentFiltersOrRelationsCondition(this);
1523
- }
1524
- /**
1525
- * Filters for a UI element 'header'.
1526
- *
1527
- * @return {FluentFiltersOrRelationsCondition}
1528
- */
1529
- header() {
1530
- this._textStr = 'header';
1531
- return new FluentFiltersOrRelationsCondition(this);
1532
- }
1533
- /**
1534
- * Filters for a UI element 'footer'.
1535
- *
1536
- * @return {FluentFiltersOrRelationsCondition}
1537
- */
1538
- footer() {
1539
- this._textStr = 'footer';
1540
- return new FluentFiltersOrRelationsCondition(this);
1541
- }
1542
- /**
1543
- * Filters for a UI element 'flag'.
1544
- *
1545
- * @return {FluentFiltersOrRelationsCondition}
1546
- */
1547
- flag() {
1548
- this._textStr = 'flag';
1549
- return new FluentFiltersOrRelationsCondition(this);
1550
- }
1551
- /**
1552
- * Filters for a UI element 'dropdown menu'.
1553
- *
1554
- * @return {FluentFiltersOrRelationsCondition}
1555
- */
1556
- dropdownMenu() {
1557
- this._textStr = 'dropdown menu';
1558
- return new FluentFiltersOrRelationsCondition(this);
1559
- }
1560
- /**
1561
- * Filters for a UI element 'divider'.
1562
- *
1563
- * @return {FluentFiltersOrRelationsCondition}
1564
- */
1565
- divider() {
1566
- this._textStr = 'divider';
1567
- return new FluentFiltersOrRelationsCondition(this);
1568
- }
1569
- /**
1570
- * Filters for a UI element 'circle'.
1571
- *
1572
- * @return {FluentFiltersOrRelationsCondition}
1573
- */
1574
- circle() {
1575
- this._textStr = 'circle';
1576
- return new FluentFiltersOrRelationsCondition(this);
1577
- }
1578
- /**
1579
- * Filters for a UI element 'checkbox unchecked'.
1580
- *
1581
- * @return {FluentFiltersOrRelationsCondition}
1582
- */
1583
- checkboxUnchecked() {
1584
- this._textStr = 'checkbox unchecked';
1585
- return new FluentFiltersOrRelationsCondition(this);
1586
- }
1587
- /**
1588
- * Filters for a UI element 'checkbox checked'.
1589
- *
1590
- * @return {FluentFiltersOrRelationsCondition}
1591
- */
1592
- checkboxChecked() {
1593
- this._textStr = 'checkbox checked';
1594
- return new FluentFiltersOrRelationsCondition(this);
1595
- }
1596
- /**
1597
- * Filters for a UI element 'chart pie'.
1598
- *
1599
- * @return {FluentFiltersOrRelationsCondition}
1600
- */
1601
- chartPie() {
1602
- this._textStr = 'chart pie';
1603
- return new FluentFiltersOrRelationsCondition(this);
1604
- }
1605
- /**
1606
- * Filters for a UI element 'chart'.
1607
- *
1608
- * @return {FluentFiltersOrRelationsCondition}
1609
- */
1610
- chart() {
1611
- this._textStr = 'chart';
1612
- return new FluentFiltersOrRelationsCondition(this);
1613
- }
1614
- /**
1615
- * Filters for a UI element 'card'.
1616
- *
1617
- * @return {FluentFiltersOrRelationsCondition}
1618
- */
1619
- card() {
1620
- this._textStr = 'card';
1621
- return new FluentFiltersOrRelationsCondition(this);
1622
- }
1623
- /**
1624
- * Filters for a UI element 'browser bar'.
1625
- *
1626
- * @return {FluentFiltersOrRelationsCondition}
1627
- */
1628
- browserBar() {
1629
- this._textStr = 'browser bar';
1630
- return new FluentFiltersOrRelationsCondition(this);
1631
- }
1632
- /**
1633
- * Filters for a UI element 'breadcrumb'.
1634
- *
1635
- * @return {FluentFiltersOrRelationsCondition}
1636
- */
1637
- breadcrumb() {
1638
- this._textStr = 'breadcrumb';
1639
- return new FluentFiltersOrRelationsCondition(this);
1640
- }
1641
- /**
1642
- * Filters for a UI element 'banner'.
1643
- *
1644
- * @return {FluentFiltersOrRelationsCondition}
1645
- */
1646
- banner() {
1647
- this._textStr = 'banner';
1648
- return new FluentFiltersOrRelationsCondition(this);
1649
- }
1650
- /**
1651
- * Filters for a UI element 'badge'.
1652
- *
1653
- * @return {FluentFiltersOrRelationsCondition}
1654
- */
1655
- badge() {
1656
- this._textStr = 'badge';
1657
- return new FluentFiltersOrRelationsCondition(this);
1658
- }
1659
- /**
1660
- * Filters for a UI element 'alert'.
1661
- *
1662
- * @return {FluentFiltersOrRelationsCondition}
1663
- */
1664
- alert() {
1665
- this._textStr = 'alert';
1666
- return new FluentFiltersOrRelationsCondition(this);
1667
- }
1668
- /**
1669
- * Filters for a UI element 'unknown'.
1670
- *
1671
- * @return {FluentFiltersOrRelationsCondition}
1672
- */
1673
- unknown() {
1674
- this._textStr = 'unknown';
1675
- return new FluentFiltersOrRelationsCondition(this);
1676
- }
1677
- /**
1678
- * Filters for an UI element 'button'.
1679
- *
1680
- * **Examples:**
1681
- * ```typescript
1682
- * await aui.moveMouseTo().button().exec()
1683
- * ```
1684
- *
1685
- * @return {FluentFiltersOrRelationsCondition}
1686
- */
1687
- button() {
1688
- this._textStr = 'button';
1689
- return new FluentFiltersOrRelationsCondition(this);
1690
- }
1691
- /**
1692
- * Filters for an UI element 'text'.
1693
- *
1694
- * @return {FluentFiltersOrRelationsCondition}
1695
- */
1696
- text() {
1697
- this._textStr = 'text';
1698
- return new FluentFiltersOrRelationsCondition(this);
1699
- }
1700
- /**
1701
- * Filters for an UI element 'dropdown'.
1702
- *
1703
- * @return {FluentFiltersOrRelationsCondition}
1704
- */
1705
- dropdown() {
1706
- this._textStr = 'dropdown';
1707
- return new FluentFiltersOrRelationsCondition(this);
1708
- }
1709
- /**
1710
- * Filters for an UI element 'icon'.
1711
- *
1712
- * You can combine it with the 'withText' command to look for a specific icon.
1713
- *
1714
- * **Examples:**
1715
- * ```typescript
1716
- * icon().withText('plus')
1717
- * ```
1718
- *
1719
- * Note: This is an alpha feature. The prediction of the icon name is sometimes unstable. Use custom elements as an alternative.
1720
- *
1721
- * @return {FluentFiltersOrRelationsCondition}
1722
- */
1723
- icon() {
1724
- this._textStr = 'icon';
1725
- return new FluentFiltersOrRelationsCondition(this);
1726
- }
1727
- /**
1728
- * Filters for a custom UI element (see {@link CustomElementJson}).
1729
- *
1730
- * **Important**: This increases the runtime quite a bit. So
1731
- * only use it when absolutely necessary.
1732
- *
1733
- * @param {CustomElementJson} customElement - The custom element to filter for.
1734
- *
1735
- * @return {FluentFiltersOrRelationsCondition}
1736
- */
1737
- customElement(customElement) {
1738
- this._textStr = 'custom element';
1739
- this._params.set('customElement', customElement);
1740
- return new FluentFiltersOrRelationsCondition(this);
1741
- }
1742
- /**
1743
- * Filters for a UI element 'checkbox' checked or unchecked.
1744
- *
1745
- * @return {FluentFiltersOrRelationsCondition}
1746
- */
1747
- checkbox() {
1748
- this._textStr = 'checkbox';
1749
- return new FluentFiltersOrRelationsCondition(this);
1750
- }
1751
- /**
1752
- * Filters for similar (doesn't need to be a 100% equal) text.
1753
- *
1754
- * **Examples:**
1755
- * ```typescript
1756
- * 'text' === withText('text') => true
1757
- * 'test' === withText('text') => true
1758
- * 'Test' === withText('text') => true
1759
- * 'Text' === withText('text') => true
1760
- * 'TEXT' === withText('text') => true
1761
- * 'texst' === withText('text') => true
1762
- * 'texts' === withText('text') => true
1763
- *
1764
- * // usually false
1765
- * 'atebxtc' === withText('text') => false
1766
- * 'other' === withText('text') => false
1767
- * ```
1768
- * ![](https://docs.askui.com/img/gif/withText.gif)
1769
- *
1770
- * @param {string} text - A text to be matched.
1771
- *
1772
- * @return {FluentFiltersOrRelationsCondition}
1773
- */
1774
- withText(text) {
1775
- this._textStr = `with text ${Separators.STRING}${text}${Separators.STRING}`;
1776
- return new FluentFiltersOrRelationsCondition(this);
1777
- }
1778
- /**
1779
- * Filters for texts, which match the regex pattern.
1780
- *
1781
- * **Examples:**
1782
- *
1783
- * ```typescript
1784
- * 'The rain in Spain' === withTextRegex('\b[Ss]\w+') => true
1785
- * 'The rain in Portugal' === withTextRegex('\b[Ss]\w+') => false
1786
- * 'The rain in switzerland' === withTextRegex('\b[Ss]\w+') => true
1787
- *
1788
- * await aui.get().text().withTextRegex('\b[Ss]\w+').exec()
1789
- * ```
1790
- *
1791
- * @param {string} regex_pattern - A regex pattern
1792
- *
1793
- * @return {FluentFiltersOrRelationsCondition}
1794
- */
1795
- withTextRegex(regex_pattern) {
1796
- this._textStr = `match regex pattern ${Separators.STRING}${regex_pattern}${Separators.STRING}`;
1797
- return new FluentFiltersOrRelationsCondition(this);
1798
- }
1799
- /**
1800
- * Filters for equal text.
1801
- *
1802
- * **Note:** This should be only used in cases where the similarity
1803
- * comparison of {@link FluentFilters.withText()} allows not for
1804
- * specific enough filtering (too many elements).
1805
- *
1806
- * **Examples:**
1807
- * ```typescript
1808
- * 'text' === withExactText('text') => true
1809
- * 'test' === withExactText('text') => false
1810
- * 'other' === withExactText('text') => false
1811
- *
1812
- * await aui.moveMouseTo().text().withExactText('Password').exec()
1813
- * ```
1814
- *
1815
- * @param {string} text - A text to be matched.
1816
- *
1817
- * @return {FluentFiltersOrRelationsCondition}
1818
- */
1819
- withExactText(text) {
1820
- this._textStr = `equals text ${Separators.STRING}${text}${Separators.STRING}`;
1821
- return new FluentFiltersOrRelationsCondition(this);
1822
- }
1823
- /**
1824
- * Filters for text containing the text provided as an argument.
1825
- *
1826
- * **Examples:**
1827
- * ```typescript
1828
- * 'This is an text' === containsText('text') => true
1829
- * 'This is an text' === containsText('other text') => false
1830
- * 'This is an text' === containsText('other') => false
1831
- * ```
1832
- * ![](https://docs.askui.com/img/gif/containsText.gif)
1833
- *
1834
- * @param {string} text - A text to be matched.
1835
- *
1836
- * @return {FluentFiltersOrRelationsCondition}
1837
- */
1838
- containsText(text) {
1839
- this._textStr = `contain text ${Separators.STRING}${text}${Separators.STRING}`;
1840
- return new FluentFiltersOrRelationsCondition(this);
1841
- }
1842
- }
1843
- exports.FluentFiltersCondition = FluentFiltersCondition;
1844
- // Relations
1845
- class FluentFiltersOrRelationsCondition extends FluentFiltersCondition {
1846
- /**
1847
- * Logic or operator
1848
- *
1849
- * **Examples:**
1850
- * ```text
1851
- * scene 1
1852
- * -------------- ---------------
1853
- * | button | | icon |
1854
- * -------------- ---------------
341
+ * **Examples:**
342
+ * ```text
343
+ * scene 1
344
+ * -------------- ---------------
345
+ * | button | | icon |
346
+ * -------------- ---------------
1855
347
  *
1856
348
  * scene 2
1857
349
  * -------------- ---------------
@@ -1860,7 +352,7 @@ class FluentFiltersOrRelationsCondition extends FluentFiltersCondition {
1860
352
  *
1861
353
  * ```
1862
354
  * In case, that your reference element can have multiple values, in the following example, the element right of the button can be either icon or text.
1863
- * You can use **the `or()` relation**, so your teststep is valid for both scenes
355
+ * You can use **the `or()` relation**, so your instruction is valid for both scenes
1864
356
  * ```typescript
1865
357
  * const button = await aui.get().button().rightOf().icon().or().text().exec();
1866
358
  * console.log(button);
@@ -1881,11 +373,11 @@ class FluentFiltersOrRelationsCondition extends FluentFiltersCondition {
1881
373
  * ]
1882
374
  * ```
1883
375
  *
1884
- * @return {FluentFiltersCondition}
376
+ * @return {FluentFilters}
1885
377
  */
1886
378
  or() {
1887
379
  this._textStr = 'or';
1888
- return new FluentFiltersCondition(this);
380
+ return new FluentFilters(this);
1889
381
  }
1890
382
  /**
1891
383
  * Logic and operator
@@ -1895,12 +387,13 @@ class FluentFiltersOrRelationsCondition extends FluentFiltersCondition {
1895
387
  * example scene:
1896
388
  * --------------- ----------------
1897
389
  * | icon user | | icon search |
1898
- * --------------- ---------------n```
390
+ * --------------- ----------------
391
+ * ```
1899
392
  * ```typescript
1900
393
  * const icons = await aui.get().icon().exec();
1901
394
  * console.log(icons);
1902
395
  * ```
1903
- * Using only the filter icon, the get command will return both icons
396
+ * Using only the element-description icon, the get will return both icons
1904
397
  * ```text
1905
398
  * console output: [
1906
399
  * DetectedElement {
@@ -1925,12 +418,12 @@ class FluentFiltersOrRelationsCondition extends FluentFiltersCondition {
1925
418
  * }
1926
419
  * ]
1927
420
  * ```
1928
- * You can combine filters with **the `and()` relation** and specify exactly which icon you want
421
+ * You can combine element-descriptions with **the `and()` relation** and specify exactly which icon you want.
1929
422
  * ```typescript
1930
423
  * const icons = await aui.get().icon().and().withText('user').exec()
1931
424
  * console.log(icons)
1932
425
  * ```
1933
- * The get command returns only the user icon although both elements are icons
426
+ * The get returns only the user icon although both elements are icons.
1934
427
  * ```text
1935
428
  * console output: [
1936
429
  * DetectedElement {
@@ -1946,11 +439,11 @@ class FluentFiltersOrRelationsCondition extends FluentFiltersCondition {
1946
439
  * ]
1947
440
  * ```
1948
441
  *
1949
- * @return {FluentFiltersCondition}
442
+ * @return {FluentFilters}
1950
443
  */
1951
444
  and() {
1952
445
  this._textStr = 'and';
1953
- return new FluentFiltersCondition(this);
446
+ return new FluentFilters(this);
1954
447
  }
1955
448
  /**
1956
449
  * Filters for an element inside another element.
@@ -1972,11 +465,11 @@ class FluentFiltersOrRelationsCondition extends FluentFiltersCondition {
1972
465
  * ```
1973
466
  * ![](https://docs.askui.com/img/gif/in.gif)
1974
467
  *
1975
- * @return {FluentFiltersCondition}
468
+ * @return {FluentFilters}
1976
469
  */
1977
470
  in() {
1978
471
  this._textStr = 'in';
1979
- return new FluentFiltersCondition(this);
472
+ return new FluentFilters(this);
1980
473
  }
1981
474
  /**
1982
475
  * Filters for an element right of another element.
@@ -1994,11 +487,11 @@ class FluentFiltersOrRelationsCondition extends FluentFiltersCondition {
1994
487
  * ```
1995
488
  * ![](https://docs.askui.com/img/gif/rightOf.gif)
1996
489
  *
1997
- * @return {FluentFiltersCondition}
490
+ * @return {FluentFilters}
1998
491
  */
1999
492
  rightOf() {
2000
493
  this._textStr = 'right of';
2001
- return new FluentFiltersCondition(this);
494
+ return new FluentFilters(this);
2002
495
  }
2003
496
  /**
2004
497
  * Filters for an element left of another element.
@@ -2016,11 +509,11 @@ class FluentFiltersOrRelationsCondition extends FluentFiltersCondition {
2016
509
  * ```
2017
510
  * ![](https://docs.askui.com/img/gif/leftOf.gif)
2018
511
  *
2019
- * @return {FluentFiltersCondition}
512
+ * @return {FluentFilters}
2020
513
  */
2021
514
  leftOf() {
2022
515
  this._textStr = 'left of';
2023
- return new FluentFiltersCondition(this);
516
+ return new FluentFilters(this);
2024
517
  }
2025
518
  /**
2026
519
  * Filters for an element below another element.
@@ -2041,11 +534,11 @@ class FluentFiltersOrRelationsCondition extends FluentFiltersCondition {
2041
534
  * ```
2042
535
  * ![](https://docs.askui.com/img/gif/below.gif)
2043
536
  *
2044
- * @return {FluentFiltersCondition}
537
+ * @return {FluentFilters}
2045
538
  */
2046
539
  below() {
2047
540
  this._textStr = 'below';
2048
- return new FluentFiltersCondition(this);
541
+ return new FluentFilters(this);
2049
542
  }
2050
543
  /**
2051
544
  * Filters for an element above another element.
@@ -2066,11 +559,11 @@ class FluentFiltersOrRelationsCondition extends FluentFiltersCondition {
2066
559
  * ```
2067
560
  * ![](https://docs.askui.com/img/gif/above.gif)
2068
561
  *
2069
- * @return {FluentFiltersCondition}
562
+ * @return {FluentFilters}
2070
563
  */
2071
564
  above() {
2072
565
  this._textStr = 'above';
2073
- return new FluentFiltersCondition(this);
566
+ return new FluentFilters(this);
2074
567
  }
2075
568
  /**
2076
569
  * Filters for an element nearest to another element.
@@ -2095,11 +588,11 @@ class FluentFiltersOrRelationsCondition extends FluentFiltersCondition {
2095
588
  * ```
2096
589
  * ![](https://docs.askui.com/img/gif/nearestTo.gif)
2097
590
  *
2098
- * @return {FluentFiltersCondition}
591
+ * @return {FluentFilters}
2099
592
  */
2100
593
  nearestTo() {
2101
594
  this._textStr = 'nearest to';
2102
- return new FluentFiltersCondition(this);
595
+ return new FluentFilters(this);
2103
596
  }
2104
597
  /**
2105
598
  * Filters for an element containing another element.
@@ -2121,986 +614,1152 @@ class FluentFiltersOrRelationsCondition extends FluentFiltersCondition {
2121
614
  * ```
2122
615
  * ![](https://docs.askui.com/img/gif/contains.gif)
2123
616
  *
2124
- * @return {FluentFiltersCondition}
617
+ * @return {FluentFilters}
2125
618
  */
2126
619
  contains() {
2127
620
  this._textStr = 'contains';
2128
- return new FluentFiltersCondition(this);
621
+ return new FluentFilters(this);
622
+ }
623
+ exec() {
624
+ return this.fluentCommandStringBuilder();
2129
625
  }
626
+ }
627
+ exports.FluentFiltersOrRelations = FluentFiltersOrRelations;
628
+ // Filters
629
+ class FluentFiltersCondition extends FluentBase {
2130
630
  /**
2131
- * Expects that filtered element exists.
631
+ * Filters for a UI element 'table'.
2132
632
  *
2133
- * **Examples:**
2134
- * ```typescript
2135
- * await aui.expect().text().withText('Login').exists().exec()
2136
- * ```
633
+ * @return {FluentFiltersOrRelationsCondition}
634
+ */
635
+ table() {
636
+ this._textStr = 'table';
637
+ return new FluentFiltersOrRelationsCondition(this);
638
+ }
639
+ /**
640
+ * Filters for a UI element 'switch'.
2137
641
  *
2138
- * @return {ExecCondition}
642
+ * @return {FluentFiltersOrRelationsCondition}
2139
643
  */
2140
- exists() {
2141
- this._textStr = 'exists';
2142
- return new ExecCondition(this);
644
+ switch() {
645
+ this._textStr = 'switch';
646
+ return new FluentFiltersOrRelationsCondition(this);
647
+ }
648
+ /**
649
+ * Filters for a UI element 'container'.
650
+ *
651
+ * @return {FluentFiltersOrRelationsCondition}
652
+ */
653
+ container() {
654
+ this._textStr = 'container';
655
+ return new FluentFiltersOrRelationsCondition(this);
656
+ }
657
+ /**
658
+ * Filters for a UI element 'checkbox'.
659
+ *
660
+ * @return {FluentFiltersOrRelationsCondition}
661
+ */
662
+ checkbox() {
663
+ this._textStr = 'checkbox';
664
+ return new FluentFiltersOrRelationsCondition(this);
2143
665
  }
2144
666
  /**
2145
- * Expects that filtered element does not exist.
667
+ * Filters for a UI element 'button'.
2146
668
  *
2147
669
  * **Examples:**
2148
670
  * ```typescript
2149
- * await aui.expect().text().withText('Login').notExists().exec()
671
+ * await aui.moveMouseTo().button().exec()
2150
672
  * ```
2151
673
  *
2152
- * @return {ExecCondition}
674
+ * @return {FluentFiltersOrRelationsCondition}
2153
675
  */
2154
- notExists() {
2155
- this._textStr = 'not exists';
2156
- return new ExecCondition(this);
2157
- }
2158
- }
2159
- exports.FluentFiltersOrRelationsCondition = FluentFiltersOrRelationsCondition;
2160
- class ExecCondition extends Exec {
2161
- }
2162
- // Commands
2163
- class FluentCommand extends FluentBase {
2164
- constructor() {
2165
- super(undefined);
676
+ button() {
677
+ this._textStr = 'button';
678
+ return new FluentFiltersOrRelationsCondition(this);
2166
679
  }
2167
680
  /**
2168
- * Expects a condition, e.g., `exists()` or `notExits()`.
681
+ * Filters for an UI element 'text'.
682
+ *
683
+ * Often combined with the filter `withText()` as shown in the below examples.
684
+ * See also the filters `withTextRegex()` and `withExactText()`
2169
685
  *
2170
686
  * **Examples:**
2171
687
  * ```typescript
2172
- * await aui.expect().text().withText('Login').exists().exec()
2173
- * await aui.expect().text().withText('Login').notExists().exec()
688
+ * await aui.click().text().withText('Password').exec();
689
+ * await aui.click().text().withExactText('Username').exec();
690
+ * await aui.click().text().withTextRegex('\b[Ss]\w+').exec();
2174
691
  * ```
2175
692
  *
2176
- * @return {FluentFiltersCondition}
693
+ * @return {FluentFiltersOrRelationsCondition}
2177
694
  */
2178
- expect() {
2179
- this._textStr = 'Expect';
2180
- return new FluentFiltersCondition(this);
695
+ text() {
696
+ this._textStr = 'text';
697
+ return new FluentFiltersOrRelationsCondition(this);
2181
698
  }
2182
699
  /**
2183
- * Clicks on the filtered element.
700
+ * Filters for a UI element 'icon'.
2184
701
  *
2185
- * **Example:**
702
+ * You can combine it with the element-description 'withText()' to look for a specific icon.
703
+ *
704
+ * **Examples:**
2186
705
  * ```typescript
2187
- * await aui.click().button().withText('Submit').exec()
706
+ * icon().withText('plus')
2188
707
  * ```
2189
708
  *
2190
- * @return {FluentFilters}
709
+ * **Note:** This is an alpha feature. The prediction of the icon name is sometimes unstable. Use custom elements as an alternative.
710
+ *
711
+ * @return {FluentFiltersOrRelationsCondition}
2191
712
  */
2192
- click() {
2193
- this._textStr = 'Click on';
2194
- return new FluentFilters(this);
713
+ icon() {
714
+ this._textStr = 'icon';
715
+ return new FluentFiltersOrRelationsCondition(this);
2195
716
  }
2196
717
  /**
2197
- * Move mouse over the filtered element.
718
+ * 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 that is not recognized by our machine learning models by default. It can also be used for pixel assertions of elements using classical [template matching](https://en.wikipedia.org/wiki/Template_matching).
2198
719
  *
2199
- * **Example:**
720
+ * **Example**
2200
721
  * ```typescript
2201
- * await aui.moveMouseTo().button().withText('Submit').exec()
2202
- * ```
722
+ * await aui
723
+ * .click()
724
+ * .customElement({
725
+ * customImage: './logo.png', // required
726
+ * name: 'myLogo', // optional
727
+ * threshold: 0.9, // optional, defaults to 0.9
728
+ * rotationDegreePerStep: 0, // optional, defaults to 0
729
+ * imageCompareFormat: 'grayscale', // optional, defaults to 'grayscale'
730
+ * // mask:{x:0, y:0}[] // optional, a polygon to match only a certain area of the custom element
731
+ * })
732
+ * .exec();
733
+ * ```
734
+ *
735
+ * **Arguments**
736
+ *
737
+ * - **customImage** (*`string`, required*):
738
+ * - A cropped image in the form of a base64 string or file path.
739
+ * - **name** (*`string`, optional*):
740
+ * - 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.
741
+ * - **threshold** (*`number`, optional*):
742
+ * - 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`.
743
+ * - **rotationDegreePerStep** (*`number`, optional*):
744
+ * - 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`.
745
+ * - **imageCompareFormat** (*`'RGB' | 'grayscale'`, optional*):
746
+ * - The color compare style. 'greyscale' compares the brightness of each pixel whereas 'RGB' compares all three color. Defaults to 'grayscale'.
747
+ * of the given custom image.
2203
748
  *
2204
- * @return {FluentFilters}
749
+ *
750
+ * @param {CustomElementJson} customElement - The custom element to filter for.
751
+ *
752
+ * @return {FluentFiltersOrRelationsCondition}
2205
753
  */
2206
- moveMouseTo() {
2207
- this._textStr = 'Move mouse to';
2208
- return new FluentFilters(this);
754
+ customElement(customElement) {
755
+ this._textStr = 'custom element';
756
+ this._params.set('customElement', customElement);
757
+ return new FluentFiltersOrRelationsCondition(this);
2209
758
  }
2210
759
  /**
2211
- * Puts the focus on the filtered element and types in the text.
760
+ * Filters for a UI element 'image'.
2212
761
  *
2213
762
  * **Examples:**
2214
763
  * ```typescript
2215
- * await aui.typeIn('Type some text').textfield().exec()
764
+ * // Works if there is only one image visible on the screen
765
+ * await aui.click().image().exec();
2216
766
  *
2217
- * // mask the text so it is not send to the askui-inference server
2218
- * await aui.typeIn('Type some text', { isSecret: true, secretMask: '**' }).textfield().exec()
767
+ * // Works if you have an image with
768
+ * // a caption text below
769
+ * await aui.click().image().above().text().withText('The caption').exec();
2219
770
  * ```
2220
- * ![](https://docs.askui.com/img/gif/typeIn.gif)
2221
- *
2222
- * @param {string} text - A text to type
2223
771
  *
2224
- * @return {FluentFilters}
772
+ * @return {FluentFiltersOrRelationsCondition}
2225
773
  */
2226
- typeIn(text) {
2227
- this._textStr = `Type ${Separators.STRING}${text}${Separators.STRING} in`;
2228
- return new FluentFilters(this);
774
+ image() {
775
+ this._textStr = 'image';
776
+ return new FluentFiltersOrRelationsCondition(this);
2229
777
  }
2230
778
  /**
2231
- * Moves mouse to the filtered element and scrolls in the x and y direction.
2232
- *
2233
- * **macOS**: May not work as expected!
779
+ * Filters for a UI element 'textfield'.
2234
780
  *
2235
- * **Example:**
781
+ * **Examples:**
2236
782
  * ```typescript
2237
- * await aui.scroll(0, 10).textarea().exec()
2238
- * ```
783
+ * // Works if there is only one textfield visible on the screen
784
+ * await aui.typeIn('Oh yeah').textfield().exec();
2239
785
  *
2240
- * @param {number} x_offset - A (positive/negative) x direction.
2241
- * @param {number} y_offset - A (positive/negative) y direction.
786
+ * // Works if you have a labeled textfield
787
+ * // Label is above the textfield
788
+ * await aui.typeIn('Oh yeah').textfield().below().text().withText('E-Mail Address').exec();
789
+ * ```
2242
790
  *
2243
- * @return {FluentFilters}
791
+ * @return {FluentFiltersOrRelationsCondition}
2244
792
  */
2245
- scrollInside(x_offset, y_offset) {
2246
- this._textStr = `Scroll x ${x_offset} y ${y_offset} in`;
2247
- return new FluentFilters(this);
793
+ textfield() {
794
+ this._textStr = 'textfield';
795
+ return new FluentFiltersOrRelationsCondition(this);
2248
796
  }
2249
797
  /**
2250
- * Moves the mouse relatively to an element in the direction.
2251
- * This can be used when the mouse should not hover over an element anymore.
798
+ * Filters for similar (doesn't need to be a 100% equal) text.
2252
799
  *
2253
800
  * **Examples:**
2254
801
  * ```typescript
2255
- * // Move mouse 30 pixels below button
2256
- * await aui.moveMouseRelativelyTo(0, 30).button().withText('Submit').exec()
802
+ * 'text' === withText('text') => true
803
+ * 'test' === withText('text') => true
804
+ * 'Test' === withText('text') => true
805
+ * 'Text' === withText('text') => true
806
+ * 'TEXT' === withText('text') => true
807
+ * 'texst' === withText('text') => true
808
+ * 'texts' === withText('text') => true
809
+ *
810
+ * // usually false
811
+ * 'atebxtc' === withText('text') => false
812
+ * 'other' === withText('text') => false
2257
813
  * ```
2258
- * ![](https://docs.askui.com/img/gif/moveMouseRelativelyTo.gif)
814
+ * ![](https://docs.askui.com/img/gif/withText.gif)
2259
815
  *
2260
- * @param {number} x_offset - A (positive/negative) x direction.
2261
- * @param {number} y_offset - A (positive/negative) y direction.
816
+ * @param {string} text - A text to be matched.
2262
817
  *
2263
- * @return {FluentFilters}
818
+ * @return {FluentFiltersOrRelationsCondition}
2264
819
  */
2265
- moveMouseRelativelyTo(x_offset, y_offset) {
2266
- this._textStr = `Move mouse x ${x_offset} y ${y_offset} relatively to`;
2267
- return new FluentFilters(this);
820
+ withText(text) {
821
+ this._textStr = `with text ${Separators.STRING}${text}${Separators.STRING}`;
822
+ return new FluentFiltersOrRelationsCondition(this);
2268
823
  }
2269
824
  /**
2270
- * Swipe an element in the x and y direction.
2271
- * Holds the left mouse button down on Windows, Linux and macOS and drags the element.
2272
- * On touch devices it taps the element and then drags it.
825
+ * Filters for texts, which match the regex pattern.
826
+ *
827
+ * **Examples:**
2273
828
  *
2274
- * **Example:**
2275
829
  * ```typescript
2276
- * // Swipe the element 500 to the right
2277
- * await aui.swipe(500, 0).image().exec()
830
+ * 'The rain in Spain' === withTextRegex('\b[Ss]\w+') => true
831
+ * 'The rain in Portugal' === withTextRegex('\b[Ss]\w+') => false
832
+ * 'The rain in switzerland' === withTextRegex('\b[Ss]\w+') => true
833
+ *
834
+ * await aui.get().text().withTextRegex('\b[Ss]\w+').exec()
2278
835
  * ```
2279
- * ![](https://docs.askui.com/img/gif/swipe.gif)
2280
836
  *
2281
- * @param {number} x_offset - A x direction. positive and negative values are accepted
2282
- * @param {number} y_offset - A y direction. positive and negative values are accepted
837
+ * @param {string} regex_pattern - A regex pattern
2283
838
  *
2284
- * @return {FluentFilters}
839
+ * @return {FluentFiltersOrRelationsCondition}
2285
840
  */
2286
- swipe(x_offset, y_offset) {
2287
- this._textStr = `Swipe x ${x_offset} y ${y_offset}`;
2288
- return new FluentFilters(this);
841
+ withTextRegex(regex_pattern) {
842
+ this._textStr = `match regex pattern ${Separators.STRING}${regex_pattern}${Separators.STRING}`;
843
+ return new FluentFiltersOrRelationsCondition(this);
2289
844
  }
2290
845
  /**
2291
- * Types a text at the current position.
2292
- * If you need to focus the element first, use typeIn()
846
+ * Filters for equal text.
847
+ *
848
+ * **Note:** This should be only used in cases where the similarity
849
+ * comparison of {@link FluentFilters.withText()} allows not for
850
+ * specific enough filtering (too many elements).
2293
851
  *
2294
852
  * **Examples:**
2295
853
  * ```typescript
2296
- * await aui.type('Type some text').exec()
854
+ * 'text' === withExactText('text') => true
855
+ * 'test' === withExactText('text') => false
856
+ * 'other' === withExactText('text') => false
2297
857
  *
2298
- * // mask the text so it is not send to the askui-inference serverawait aui.type('Type some text', { isSecret: true, secretMask: '**' }).exec()
858
+ * await aui.moveMouseTo().text().withExactText('Password').exec()
2299
859
  * ```
2300
860
  *
2301
- * @param {string} text - A text to type
861
+ * @param {string} text - A text to be matched.
2302
862
  *
2303
- * @return {Exec}
863
+ * @return {FluentFiltersOrRelationsCondition}
2304
864
  */
2305
- type(text) {
2306
- this._textStr = `Type ${Separators.STRING}${text}${Separators.STRING}`;
2307
- return new Exec(this);
865
+ withExactText(text) {
866
+ this._textStr = `equals text ${Separators.STRING}${text}${Separators.STRING}`;
867
+ return new FluentFiltersOrRelationsCondition(this);
2308
868
  }
2309
869
  /**
2310
- * Moves the mouse from the current position (relative) in x and y direction.
870
+ * Filters for text containing the text provided as an argument.
2311
871
  *
2312
- * @param {number} x_offset - A (positive/negative) x direction.
2313
- * @param {number} y_offset - A (positive/negative) y direction.
872
+ * **Examples:**
873
+ * ```typescript
874
+ * 'This is a text' === containsText('text') => true
875
+ * 'This is a text' === containsText('other text') => false
876
+ * 'This is a text' === containsText('other') => false
877
+ * ```
878
+ * ![](https://docs.askui.com/img/gif/containsText.gif)
2314
879
  *
2315
- * @return {Exec}
880
+ * @param {string} text - A text to be matched.
881
+ *
882
+ * @return {FluentFiltersOrRelationsCondition}
2316
883
  */
2317
- moveMouseRelatively(x_offset, y_offset) {
2318
- this._textStr = `Move mouse from current position with x ${x_offset} y ${y_offset}`;
2319
- return new Exec(this);
884
+ containsText(text) {
885
+ this._textStr = `contain text ${Separators.STRING}${text}${Separators.STRING}`;
886
+ return new FluentFiltersOrRelationsCondition(this);
2320
887
  }
2321
888
  /**
2322
- * Moves the mouse to the absolute x and y coordinates.
889
+ * Filters elements based on a textual description.
2323
890
  *
2324
- * @param {number} x_coordinate - A (positive/negative) x coordinate.
2325
- * @param {number} y_coordinate - A (positive/negative) y coordinate.
891
+ * @param {string} text - A description of the target element.
2326
892
  *
2327
- * @return {Exec}
893
+ * @return {FluentFiltersOrRelationsCondition}
2328
894
  */
2329
- moveMouse(x_coordinate, y_coordinate) {
2330
- this._textStr = `Move mouse to x ${x_coordinate} y ${y_coordinate}`;
2331
- return new Exec(this);
895
+ matching(text) {
896
+ this._textStr = `matching ${Separators.STRING}${text}${Separators.STRING}`;
897
+ return new FluentFiltersOrRelationsCondition(this);
2332
898
  }
899
+ }
900
+ exports.FluentFiltersCondition = FluentFiltersCondition;
901
+ // Relations
902
+ class FluentFiltersOrRelationsCondition extends FluentFiltersCondition {
2333
903
  /**
2334
- * Scrolls based on the current mouse position in the x and y direction.
904
+ * Logic or operator
2335
905
  *
2336
- * **Important**: Mouse must be positioned in a scrollable area.
906
+ * **Examples:**
907
+ * ```text
908
+ * scene 1
909
+ * -------------- ---------------
910
+ * | button | | icon |
911
+ * -------------- ---------------
2337
912
  *
2338
- * **macOS**: May not work as expected!
913
+ * scene 2
914
+ * -------------- ---------------
915
+ * | button | | text |
916
+ * -------------- ---------------
2339
917
  *
2340
- * **Example:**
918
+ * ```
919
+ * In case, that your reference element can have multiple values, in the following example, the element right of the button can be either icon or text.
920
+ * You can use **the `or()` relation**, so your instruction is valid for both scenes
2341
921
  * ```typescript
2342
- * // Scroll 10 up in y direction
2343
- * await aui.scroll(0, 10).exec()
922
+ * const button = await aui.get().button().rightOf().icon().or().text().exec();
923
+ * console.log(button);
924
+ * ```
925
+ * Returns the same button for both cases
926
+ * ```text
927
+ * console output: [
928
+ * DetectedElement {
929
+ * name: 'BUTTON',
930
+ * text: 'button',
931
+ * bndbox: BoundingBox {
932
+ * xmin: 900,
933
+ * ymin: 910,
934
+ * xmax: 920,
935
+ * ymax: 930
936
+ * }
937
+ * }
938
+ * ]
2344
939
  * ```
2345
940
  *
2346
- * @param {number} x_offset - A (positive/negative) x direction.
2347
- * @param {number} y_offset - A (positive/negative) y direction.
2348
- *
2349
- * @return {Exec}
941
+ * @return {FluentFiltersCondition}
2350
942
  */
2351
- scroll(x_offset, y_offset) {
2352
- this._textStr = `Scroll x ${x_offset} y ${y_offset}`;
2353
- return new Exec(this);
943
+ or() {
944
+ this._textStr = 'or';
945
+ return new FluentFiltersCondition(this);
2354
946
  }
2355
947
  /**
2356
- * Executes a shell command on the device.
948
+ * Logic and operator
2357
949
  *
2358
- * **Example:**
950
+ * **Examples:**
951
+ * ```text
952
+ * example scene:
953
+ * --------------- ----------------
954
+ * | icon user | | icon search |
955
+ * --------------- ----------------
956
+ * ```
2359
957
  * ```typescript
2360
- * // Open the lastpass app
2361
- * await aui.execOnShell('monkey -p com.lastpass.authenticator 1').exec()
958
+ * const icons = await aui.get().icon().exec();
959
+ * console.log(icons);
960
+ * ```
961
+ * Using only the element-description icon, the get will return both icons
962
+ * ```text
963
+ * console output: [
964
+ * DetectedElement {
965
+ * name: 'ICON',
966
+ * text: 'user',
967
+ * bndbox: BoundingBox {
968
+ * xmin: 1000,
969
+ * ymin: 1010,
970
+ * xmax: 1020,
971
+ * ymax: 1030
972
+ * }
973
+ * },
974
+ * DetectedElement {
975
+ * name: 'ICON',
976
+ * text: 'search',
977
+ * bndbox: BoundingBox {
978
+ * xmin: 900,
979
+ * ymin: 910,
980
+ * xmax: 920,
981
+ * ymax: 930
982
+ * }
983
+ * }
984
+ * ]
985
+ * ```
986
+ * You can combine element-descriptions with **the `and()` relation** and specify exactly which icon you want.
987
+ * ```typescript
988
+ * const icons = await aui.get().icon().and().withText('user').exec()
989
+ * console.log(icons)
990
+ * ```
991
+ * The get returns only the user icon although both elements are icons.
992
+ * ```text
993
+ * console output: [
994
+ * DetectedElement {
995
+ * name: 'ICON',
996
+ * text: 'user',
997
+ * bndbox: BoundingBox {
998
+ * xmin: 900,
999
+ * ymin: 910,
1000
+ * xmax: 920,
1001
+ * ymax: 930
1002
+ * }
1003
+ * }
1004
+ * ]
2362
1005
  * ```
2363
1006
  *
2364
- * @param {string} shell_command - A shell command which is executed.
2365
- *
2366
- * @return {Exec}
1007
+ * @return {FluentFiltersCondition}
2367
1008
  */
2368
- execOnShell(shell_command) {
2369
- this._textStr = `Execute shell command ${Separators.STRING}${shell_command}${Separators.STRING}`;
2370
- return new Exec(this);
1009
+ and() {
1010
+ this._textStr = 'and';
1011
+ return new FluentFiltersCondition(this);
2371
1012
  }
2372
1013
  /**
2373
- * Clicks with left mouse key.
1014
+ * Filters for an element inside another element.
2374
1015
  *
2375
- * @return {Exec}
2376
- */
2377
- mouseLeftClick() {
2378
- this._textStr = 'Mouse left click';
2379
- return new Exec(this);
2380
- }
2381
- /**
2382
- * Clicks with right mouse key.
1016
+ * **Examples:**
1017
+ * ```typescript
1018
+ * --------------------
1019
+ * | outerEl |
1020
+ * | -------------- |
1021
+ * | | innerEl | |
1022
+ * | -------------- |
1023
+ * | |
1024
+ * --------------------
2383
1025
  *
2384
- * @return {Exec}
2385
- */
2386
- mouseRightClick() {
2387
- this._textStr = 'Mouse right click';
2388
- return new Exec(this);
2389
- }
2390
- /**
2391
- * Clicks with middle mouse key.
1026
+ * // Returns innerEl because innerEl is inside outerEl
1027
+ * ...innerEl().in().outerEl()
1028
+ * // Returns nothing because innerEl is not inside outerEl
1029
+ * ...outerEl().in().innerEl()
1030
+ * ```
1031
+ * ![](https://docs.askui.com/img/gif/in.gif)
2392
1032
  *
2393
- * @return {Exec}
1033
+ * @return {FluentFiltersCondition}
2394
1034
  */
2395
- mouseMiddleClick() {
2396
- this._textStr = 'Mouse middle click';
2397
- return new Exec(this);
1035
+ in() {
1036
+ this._textStr = 'in';
1037
+ return new FluentFiltersCondition(this);
2398
1038
  }
2399
1039
  /**
2400
- * Double-clicks with left mouse key.
1040
+ * Filters for an element right of another element.
2401
1041
  *
2402
- * @return {Exec}
2403
- */
2404
- mouseDoubleLeftClick() {
2405
- this._textStr = 'Mouse double left click';
2406
- return new Exec(this);
2407
- }
2408
- /**
2409
- * Double-clicks with right mouse key.
1042
+ * **Examples:**
1043
+ * ```typescript
1044
+ * -------------- --------------
1045
+ * | leftEl | | rightEl |
1046
+ * -------------- --------------
2410
1047
  *
2411
- * @return {Exec}
2412
- */
2413
- mouseDoubleRightClick() {
2414
- this._textStr = 'Mouse double right click';
2415
- return new Exec(this);
2416
- }
2417
- /**
2418
- * Double-clicks with middle mouse key.
1048
+ * // Returns rightEl because rightEl is right of leftEl
1049
+ * ...rightEl().rightOf().leftEl()
1050
+ * // Returns no element because leftEl is left of rightEl
1051
+ * ...leftEl().rightOf().rightEl()
1052
+ * ```
1053
+ * ![](https://docs.askui.com/img/gif/rightOf.gif)
2419
1054
  *
2420
- * @return {Exec}
1055
+ * @return {FluentFiltersCondition}
2421
1056
  */
2422
- mouseDoubleMiddleClick() {
2423
- this._textStr = 'Mouse double middle click';
2424
- return new Exec(this);
1057
+ rightOf() {
1058
+ this._textStr = 'right of';
1059
+ return new FluentFiltersCondition(this);
2425
1060
  }
2426
1061
  /**
2427
- * Toggles mouse down (Left mouse key).
1062
+ * Filters for an element left of another element.
2428
1063
  *
2429
- * @return {Exec}
2430
- */
2431
- mouseToggleDown() {
2432
- this._textStr = 'Mouse toggle down';
2433
- return new Exec(this);
2434
- }
2435
- /**
2436
- * Toggles mouse up (Left mouse key).
1064
+ * **Examples:**
1065
+ * ```typescript
1066
+ * -------------- --------------
1067
+ * | leftEl | | rightEl |
1068
+ * -------------- --------------
2437
1069
  *
2438
- * @return {Exec}
1070
+ * // Returns leftEl because leftEl is left of rightEl
1071
+ * ...leftEl().leftOf().rightEl()
1072
+ * // Returns no element because rightEl is left of leftEl
1073
+ * ...rightEl().leftOf().leftEl()
1074
+ * ```
1075
+ * ![](https://docs.askui.com/img/gif/leftOf.gif)
1076
+ *
1077
+ * @return {FluentFiltersCondition}
2439
1078
  */
2440
- mouseToggleUp() {
2441
- this._textStr = 'Mouse toggle up';
2442
- return new Exec(this);
1079
+ leftOf() {
1080
+ this._textStr = 'left of';
1081
+ return new FluentFiltersCondition(this);
2443
1082
  }
2444
1083
  /**
2445
- * Press three keys like `CTRL+ALT+DEL`
1084
+ * Filters for an element below another element.
2446
1085
  *
2447
- * @param {MODIFIER_KEY} first_key - A modifier key
2448
- * @param {MODIFIER_KEY} second_key - A modifier key
2449
- * @param {PC_KEY} third_key - A key
1086
+ * **Examples:**
1087
+ * ```typescript
1088
+ * --------------
1089
+ * | text |
1090
+ * --------------
1091
+ * --------------
1092
+ * | button |
1093
+ * --------------
2450
1094
  *
2451
- * @return {Exec}
1095
+ * // Returns button because button is below text
1096
+ * ...button().below().text()
1097
+ * // Returns no element because text is above button
1098
+ * ...text().below().button()
1099
+ * ```
1100
+ * ![](https://docs.askui.com/img/gif/below.gif)
1101
+ *
1102
+ * @return {FluentFiltersCondition}
2452
1103
  */
2453
- pressThreeKeys(first_key, second_key, third_key) {
2454
- this._textStr = `Press key ${first_key} ${second_key} ${third_key}`;
2455
- return new Exec(this);
1104
+ below() {
1105
+ this._textStr = 'below';
1106
+ return new FluentFiltersCondition(this);
2456
1107
  }
2457
1108
  /**
2458
- * Press two keys like `ALT+F4`
1109
+ * Filters for an element above another element.
2459
1110
  *
2460
- * @param {MODIFIER_KEY} first_key - A modifier key
2461
- * @param {PC_KEY} second_key - A key
1111
+ * **Examples:**
1112
+ * ```typescript
1113
+ * --------------
1114
+ * | text |
1115
+ * --------------
1116
+ * --------------
1117
+ * | button |
1118
+ * --------------
2462
1119
  *
2463
- * @return {Exec}
1120
+ * // Returns text because text is above button
1121
+ * ...text().above().button()
1122
+ * // Returns no element because button is below text
1123
+ * ...button().above().text()
1124
+ * ```
1125
+ * ![](https://docs.askui.com/img/gif/above.gif)
1126
+ *
1127
+ * @return {FluentFiltersCondition}
2464
1128
  */
2465
- pressTwoKeys(first_key, second_key) {
2466
- this._textStr = `Press key ${first_key} ${second_key}`;
2467
- return new Exec(this);
1129
+ above() {
1130
+ this._textStr = 'above';
1131
+ return new FluentFiltersCondition(this);
2468
1132
  }
2469
1133
  /**
2470
- * Press one keys like `DEL`
1134
+ * Filters for an element nearest to another element.
2471
1135
  *
2472
- * @param {PC_AND_MODIFIER_KEY} key - A key
1136
+ * **Examples:**
1137
+ * ```typescript
1138
+ * --------------
1139
+ * | button 1 |
1140
+ * --------------
1141
+ * --------------
1142
+ * | text |
1143
+ * --------------
2473
1144
  *
2474
- * @return {Exec}
2475
- */
2476
- pressKey(key) {
2477
- this._textStr = `Press key ${key}`;
2478
- return new Exec(this);
2479
- }
2480
- /**
2481
- * Press three Android keys like `CTRL+ALT+DEL`
2482
1145
  *
2483
- * @param {ANDROID_KEY} first_key - A Android key
2484
- * @param {ANDROID_KEY} second_key - A Android key
2485
- * @param {ANDROID_KEY} third_key - A Android key
2486
1146
  *
2487
- * @return {Exec}
2488
- */
2489
- pressAndroidThirdKey(first_key, second_key, third_key) {
2490
- this._textStr = `Press android key ${first_key} ${second_key} ${third_key}`;
2491
- return new Exec(this);
2492
- }
2493
- /**
2494
- * Press two Android keys like `ALT+F4`
1147
+ * --------------
1148
+ * | button 2 |
1149
+ * --------------
2495
1150
  *
2496
- * @param {ANDROID_KEY} first_key - A Android key
2497
- * @param {ANDROID_KEY} second_key - A Android key
1151
+ * // Returns button 1 because button 1 is nearer to the text than button 2
1152
+ * ...button().nearestTo().text()
1153
+ * ```
1154
+ * ![](https://docs.askui.com/img/gif/nearestTo.gif)
2498
1155
  *
2499
- * @return {Exec}
1156
+ * @return {FluentFiltersCondition}
2500
1157
  */
2501
- pressAndroidTwoKey(first_key, second_key) {
2502
- this._textStr = `Press android key ${first_key} ${second_key}`;
2503
- return new Exec(this);
1158
+ nearestTo() {
1159
+ this._textStr = 'nearest to';
1160
+ return new FluentFiltersCondition(this);
2504
1161
  }
2505
1162
  /**
2506
- * Press one Android keys like `DEL`
1163
+ * Filters for an element containing another element.
2507
1164
  *
2508
- * @param {ANDROID_KEY} key - A Android key
1165
+ * **Example:**
1166
+ * ```typescript
1167
+ * --------------------
1168
+ * | outerEl |
1169
+ * | -------------- |
1170
+ * | | innerEl | |
1171
+ * | -------------- |
1172
+ * | |
1173
+ * --------------------
2509
1174
  *
2510
- * @return {Exec}
2511
- */
2512
- pressAndroidKey(key) {
2513
- this._textStr = `Press android key ${key}`;
2514
- return new Exec(this);
2515
- }
2516
- }
2517
- exports.FluentCommand = FluentCommand;
2518
- class ExecGetter extends FluentBase {
2519
- exec() {
2520
- return this.getterStringBuilder();
2521
- }
2522
- }
2523
- exports.ExecGetter = ExecGetter;
2524
- // Filters
2525
- class FluentFiltersGetter extends FluentBase {
2526
- /**
2527
- * Filters for a UI element 'wizard item active'.
1175
+ * // Returns outerEl because outerEl contains innerEl
1176
+ * ...outerEl().contains().innerEl()
1177
+ * // Returns no element because innerEl contains no outerEl
1178
+ * ...innerEl().contains().outerEl()
1179
+ * ```
1180
+ * ![](https://docs.askui.com/img/gif/contains.gif)
2528
1181
  *
2529
- * @return {FluentFiltersOrRelationsGetter}
1182
+ * @return {FluentFiltersCondition}
2530
1183
  */
2531
- wizardItemActive() {
2532
- this._textStr = 'wizard item active';
2533
- return new FluentFiltersOrRelationsGetter(this);
1184
+ contains() {
1185
+ this._textStr = 'contains';
1186
+ return new FluentFiltersCondition(this);
2534
1187
  }
2535
1188
  /**
2536
- * Filters for a UI element 'wizard item'.
1189
+ * Expects that filtered element exists.
2537
1190
  *
2538
- * @return {FluentFiltersOrRelationsGetter}
2539
- */
2540
- wizardItem() {
2541
- this._textStr = 'wizard item';
2542
- return new FluentFiltersOrRelationsGetter(this);
2543
- }
2544
- /**
2545
- * Filters for a UI element 'wizard'.
1191
+ * Always use together with `expect()`.
2546
1192
  *
2547
- * @return {FluentFiltersOrRelationsGetter}
2548
- */
2549
- wizard() {
2550
- this._textStr = 'wizard';
2551
- return new FluentFiltersOrRelationsGetter(this);
2552
- }
2553
- /**
2554
- * Filters for a UI element 'windows bar'.
1193
+ * **Note** Throws an error and stops the execution when the element is not found. You can catch the error and decide what to do as in the examples below.
2555
1194
  *
2556
- * @return {FluentFiltersOrRelationsGetter}
2557
- */
2558
- windowsBar() {
2559
- this._textStr = 'windows bar';
2560
- return new FluentFiltersOrRelationsGetter(this);
2561
- }
2562
- /**
2563
- * Filters for a UI element 'window'.
1195
+ * **Examples:**
1196
+ * ```typescript
1197
+ * // Stops execution at this point when the element does not exist.
1198
+ * await aui.expect().text().withText('Login').exists().exec()
2564
1199
  *
2565
- * @return {FluentFiltersOrRelationsGetter}
2566
- */
2567
- window() {
2568
- this._textStr = 'window';
2569
- return new FluentFiltersOrRelationsGetter(this);
2570
- }
2571
- /**
2572
- * Filters for a UI element 'video'.
1200
+ * // This will catch the error and log a message
1201
+ * // But the execution will continue afterwards
1202
+ * try {
1203
+ * await aui.expect().text().withText('Login').exists().exec()
1204
+ * } catch (error) {
1205
+ * console.log('Too bad we could not find the element!');
1206
+ * }
1207
+ * ```
2573
1208
  *
2574
- * @return {FluentFiltersOrRelationsGetter}
1209
+ * @return {ExecCondition}
2575
1210
  */
2576
- video() {
2577
- this._textStr = 'video';
2578
- return new FluentFiltersOrRelationsGetter(this);
1211
+ exists() {
1212
+ this._textStr = 'exists';
1213
+ return new ExecCondition(this);
2579
1214
  }
2580
1215
  /**
2581
- * Filters for a UI element 'url'.
1216
+ * Expects that filtered element not exists.
2582
1217
  *
2583
- * @return {FluentFiltersOrRelationsGetter}
2584
- */
2585
- url() {
2586
- this._textStr = 'url';
2587
- return new FluentFiltersOrRelationsGetter(this);
2588
- }
2589
- /**
2590
- * Filters for a UI element 'tooltip'.
1218
+ * Always use together with `expect()`.
2591
1219
  *
2592
- * @return {FluentFiltersOrRelationsGetter}
2593
- */
2594
- tooltip() {
2595
- this._textStr = 'tooltip';
2596
- return new FluentFiltersOrRelationsGetter(this);
2597
- }
2598
- /**
2599
- * Filters for a UI element 'textfield'.
1220
+ * **Note** Throws an error and stops the execution when the element is found. You can catch the error and decide what to do as in the examples below.
2600
1221
  *
2601
- * @return {FluentFiltersOrRelationsGetter}
2602
- */
2603
- textfield() {
2604
- this._textStr = 'textfield';
2605
- return new FluentFiltersOrRelationsGetter(this);
2606
- }
2607
- /**
2608
- * Filters for a UI element 'textarea'.
1222
+ * **Examples:**
1223
+ * ```typescript
1224
+ * // Stops execution at this point when the element does exist.
1225
+ * await aui.expect().text().withText('Login').notExists().exec()
2609
1226
  *
2610
- * @return {FluentFiltersOrRelationsGetter}
2611
- */
2612
- textarea() {
2613
- this._textStr = 'textarea';
2614
- return new FluentFiltersOrRelationsGetter(this);
2615
- }
2616
- /**
2617
- * Filters for a UI element 'table row'.
1227
+ * // This will catch the error and log a message
1228
+ * // But the execution will continue afterwards
1229
+ * try {
1230
+ * await aui.expect().text().withText('Login').notExists().exec()
1231
+ * } catch (error) {
1232
+ * console.log('Too bad we could find the element!');
1233
+ * }
1234
+ * ```
2618
1235
  *
2619
- * @return {FluentFiltersOrRelationsGetter}
1236
+ * @return {ExecCondition}
2620
1237
  */
2621
- tableRow() {
2622
- this._textStr = 'table row';
2623
- return new FluentFiltersOrRelationsGetter(this);
1238
+ notExists() {
1239
+ this._textStr = 'not exists';
1240
+ return new ExecCondition(this);
2624
1241
  }
2625
- /**
2626
- * Filters for a UI element 'table header'.
2627
- *
2628
- * @return {FluentFiltersOrRelationsGetter}
2629
- */
2630
- tableHeader() {
2631
- this._textStr = 'table header';
2632
- return new FluentFiltersOrRelationsGetter(this);
1242
+ }
1243
+ exports.FluentFiltersOrRelationsCondition = FluentFiltersOrRelationsCondition;
1244
+ class ExecCondition extends Exec {
1245
+ }
1246
+ // Commands
1247
+ class FluentCommand extends FluentBase {
1248
+ constructor() {
1249
+ super(undefined);
2633
1250
  }
2634
1251
  /**
2635
- * Filters for a UI element 'table column'.
1252
+ * Expects a condition, e.g., `exists()` or `notExits()`.
2636
1253
  *
2637
- * @return {FluentFiltersOrRelationsGetter}
2638
- */
2639
- tableColumn() {
2640
- this._textStr = 'table column';
2641
- return new FluentFiltersOrRelationsGetter(this);
2642
- }
2643
- /**
2644
- * Filters for a UI element 'table'.
1254
+ * Use the structure `expect().<your filter>.(exists()|notExists()` as shown in the examples below.
2645
1255
  *
2646
- * @return {FluentFiltersOrRelationsGetter}
2647
- */
2648
- table() {
2649
- this._textStr = 'table';
2650
- return new FluentFiltersOrRelationsGetter(this);
2651
- }
2652
- /**
2653
- * Filters for a UI element 'tab selected'.
1256
+ * **Examples:**
1257
+ * ```typescript
1258
+ * await aui.expect().text().withText('Login').exists().exec()
1259
+ * await aui.expect().text().withText('Login').notExists().exec()
1260
+ * ```
2654
1261
  *
2655
- * @return {FluentFiltersOrRelationsGetter}
1262
+ * @return {FluentFiltersCondition}
2656
1263
  */
2657
- tabSelected() {
2658
- this._textStr = 'tab selected';
2659
- return new FluentFiltersOrRelationsGetter(this);
1264
+ expect() {
1265
+ this._textStr = 'Expect';
1266
+ return new FluentFiltersCondition(this);
2660
1267
  }
2661
1268
  /**
2662
- * Filters for a UI element 'tab bar'.
1269
+ * Mouse left-clicks/taps on the filtered element by moving the mouse cursor to the filtered element first.
2663
1270
  *
2664
- * @return {FluentFiltersOrRelationsGetter}
2665
- */
2666
- tabBar() {
2667
- this._textStr = 'tab bar';
2668
- return new FluentFiltersOrRelationsGetter(this);
2669
- }
2670
- /**
2671
- * Filters for a UI element 'tab active'.
1271
+ * If you need a simple mouseleftclick/tap only, use `mouseLeftClick`.
2672
1272
  *
2673
- * @return {FluentFiltersOrRelationsGetter}
2674
- */
2675
- tabActive() {
2676
- this._textStr = 'tab active';
2677
- return new FluentFiltersOrRelationsGetter(this);
2678
- }
2679
- /**
2680
- * Filters for a UI element 'tab'.
1273
+ * **Example:**
1274
+ * ```typescript
1275
+ * await aui.click().button().withText('Submit').exec()
1276
+ * ```
2681
1277
  *
2682
- * @return {FluentFiltersOrRelationsGetter}
1278
+ * @return {FluentFilters}
2683
1279
  */
2684
- tab() {
2685
- this._textStr = 'tab';
2686
- return new FluentFiltersOrRelationsGetter(this);
1280
+ click() {
1281
+ this._textStr = 'Click on';
1282
+ return new FluentFilters(this);
2687
1283
  }
2688
1284
  /**
2689
- * Filters for a UI element 'switch enabled'.
1285
+ * Move mouse over the filtered element.
2690
1286
  *
2691
- * @return {FluentFiltersOrRelationsGetter}
2692
- */
2693
- switchEnabled() {
2694
- this._textStr = 'switch enabled';
2695
- return new FluentFiltersOrRelationsGetter(this);
2696
- }
2697
- /**
2698
- * Filters for a UI element 'switch disabled'.
1287
+ * **Example:**
1288
+ * ```typescript
1289
+ * await aui.moveMouseTo().button().withText('Submit').exec()
1290
+ * ```
2699
1291
  *
2700
- * @return {FluentFiltersOrRelationsGetter}
1292
+ * @return {FluentFilters}
2701
1293
  */
2702
- switchDisabled() {
2703
- this._textStr = 'switch disabled';
2704
- return new FluentFiltersOrRelationsGetter(this);
1294
+ moveMouseTo() {
1295
+ this._textStr = 'Move mouse to';
1296
+ return new FluentFilters(this);
2705
1297
  }
2706
1298
  /**
2707
- * Filters for a UI element 'status bar'.
1299
+ * Puts the focus on the filtered element and types in the text.
2708
1300
  *
2709
- * @return {FluentFiltersOrRelationsGetter}
2710
- */
2711
- statusBar() {
2712
- this._textStr = 'status bar';
2713
- return new FluentFiltersOrRelationsGetter(this);
2714
- }
2715
- /**
2716
- * Filters for a UI element 'slider indicator'.
1301
+ * **Note:** In the current version it copies the text and pastes it.
2717
1302
  *
2718
- * @return {FluentFiltersOrRelationsGetter}
2719
- */
2720
- sliderIndicator() {
2721
- this._textStr = 'slider indicator';
2722
- return new FluentFiltersOrRelationsGetter(this);
2723
- }
2724
- /**
2725
- * Filters for a UI element 'slider'.
1303
+ * **Examples:**
1304
+ * ```typescript
1305
+ * await aui.typeIn('Type some text').textfield().exec()
2726
1306
  *
2727
- * @return {FluentFiltersOrRelationsGetter}
2728
- */
2729
- slider() {
2730
- this._textStr = 'slider';
2731
- return new FluentFiltersOrRelationsGetter(this);
2732
- }
2733
- /**
2734
- * Filters for a UI element 'sidebar'.
1307
+ * // mask the text so it is not send to the askui-inference server
1308
+ * await aui.typeIn('Type some text', { isSecret: true, secretMask: '**' }).textfield().exec()
1309
+ * ```
1310
+ * ![](https://docs.askui.com/img/gif/typeIn.gif)
2735
1311
  *
2736
- * @return {FluentFiltersOrRelationsGetter}
2737
- */
2738
- sidebar() {
2739
- this._textStr = 'sidebar';
2740
- return new FluentFiltersOrRelationsGetter(this);
2741
- }
2742
- /**
2743
- * Filters for a UI element 'scroll bar'.
1312
+ * @param {string} text - A text to type
2744
1313
  *
2745
- * @return {FluentFiltersOrRelationsGetter}
1314
+ * @return {FluentFilters}
2746
1315
  */
2747
- scrollBar() {
2748
- this._textStr = 'scroll bar';
2749
- return new FluentFiltersOrRelationsGetter(this);
1316
+ typeIn(text) {
1317
+ this._textStr = `Type ${Separators.STRING}${text}${Separators.STRING} in`;
1318
+ return new FluentFilters(this);
2750
1319
  }
2751
1320
  /**
2752
- * Filters for a UI element 'rect'.
1321
+ * Moves mouse to the filtered element and scrolls in the x and y direction.
2753
1322
  *
2754
- * @return {FluentFiltersOrRelationsGetter}
2755
- */
2756
- rect() {
2757
- this._textStr = 'rect';
2758
- return new FluentFiltersOrRelationsGetter(this);
2759
- }
2760
- /**
2761
- * Filters for a UI element 'recaptcha'.
1323
+ * **macOS**: May not work as expected!
2762
1324
  *
2763
- * @return {FluentFiltersOrRelationsGetter}
2764
- */
2765
- recaptcha() {
2766
- this._textStr = 'recaptcha';
2767
- return new FluentFiltersOrRelationsGetter(this);
2768
- }
2769
- /**
2770
- * Filters for a UI element 'rate'.
1325
+ * **Example:**
1326
+ * ```typescript
1327
+ * await aui.scroll(0, 10).textarea().exec()
1328
+ * ```
2771
1329
  *
2772
- * @return {FluentFiltersOrRelationsGetter}
2773
- */
2774
- rate() {
2775
- this._textStr = 'rate';
2776
- return new FluentFiltersOrRelationsGetter(this);
2777
- }
2778
- /**
2779
- * Filters for a UI element 'radio button unselected'.
1330
+ * @param {number} x_offset - A (positive/negative) x direction.
1331
+ * @param {number} y_offset - A (positive/negative) y direction.
2780
1332
  *
2781
- * @return {FluentFiltersOrRelationsGetter}
1333
+ * @return {FluentFilters}
2782
1334
  */
2783
- radioButtonUnselected() {
2784
- this._textStr = 'radio button unselected';
2785
- return new FluentFiltersOrRelationsGetter(this);
1335
+ scrollInside(x_offset, y_offset) {
1336
+ this._textStr = `Scroll x ${x_offset} y ${y_offset} in`;
1337
+ return new FluentFilters(this);
2786
1338
  }
2787
1339
  /**
2788
- * Filters for a UI element 'radio button selected'.
1340
+ * Moves the mouse relatively to an element in the direction.
1341
+ * This can be used when the mouse should not hover over an element anymore.
2789
1342
  *
2790
- * @return {FluentFiltersOrRelationsGetter}
2791
- */
2792
- radioButtonSelected() {
2793
- this._textStr = 'radio button selected';
2794
- return new FluentFiltersOrRelationsGetter(this);
2795
- }
2796
- /**
2797
- * Filters for a UI element 'progressbar'.
1343
+ * **Examples:**
1344
+ * ```typescript
1345
+ * // Move mouse 30 pixels below button
1346
+ * await aui.moveMouseRelativelyTo(0, 30).button().withText('Submit').exec()
1347
+ * ```
1348
+ * ![](https://docs.askui.com/img/gif/moveMouseRelativelyTo.gif)
2798
1349
  *
2799
- * @return {FluentFiltersOrRelationsGetter}
2800
- */
2801
- progressbar() {
2802
- this._textStr = 'progressbar';
2803
- return new FluentFiltersOrRelationsGetter(this);
2804
- }
2805
- /**
2806
- * Filters for a UI element 'progress bar'.
1350
+ * @param {number} x_offset - A (positive/negative) x direction.
1351
+ * @param {number} y_offset - A (positive/negative) y direction.
2807
1352
  *
2808
- * @return {FluentFiltersOrRelationsGetter}
1353
+ * @return {FluentFilters}
2809
1354
  */
2810
- progressBar() {
2811
- this._textStr = 'progress bar';
2812
- return new FluentFiltersOrRelationsGetter(this);
1355
+ moveMouseRelativelyTo(x_offset, y_offset) {
1356
+ this._textStr = `Move mouse x ${x_offset} y ${y_offset} relatively to`;
1357
+ return new FluentFilters(this);
2813
1358
  }
2814
1359
  /**
2815
- * Filters for a UI element 'popover'.
1360
+ * Swipe an element in the x and y direction.
1361
+ * Holds the left mouse button down on Windows, Linux and macOS and drags the element.
1362
+ * On touch devices it taps the element and then drags it.
2816
1363
  *
2817
- * @return {FluentFiltersOrRelationsGetter}
2818
- */
2819
- popover() {
2820
- this._textStr = 'popover';
2821
- return new FluentFiltersOrRelationsGetter(this);
2822
- }
2823
- /**
2824
- * Filters for a UI element 'pil'.
1364
+ * **Example:**
1365
+ * ```typescript
1366
+ * // Swipe the element 500 to the right
1367
+ * await aui.swipe(500, 0).image().exec()
1368
+ * ```
1369
+ * ![](https://docs.askui.com/img/gif/swipe.gif)
2825
1370
  *
2826
- * @return {FluentFiltersOrRelationsGetter}
2827
- */
2828
- pil() {
2829
- this._textStr = 'pil';
2830
- return new FluentFiltersOrRelationsGetter(this);
2831
- }
2832
- /**
2833
- * Filters for a UI element 'password'.
1371
+ * @param {number} x_offset - A x direction. positive and negative values are accepted
1372
+ * @param {number} y_offset - A y direction. positive and negative values are accepted
2834
1373
  *
2835
- * @return {FluentFiltersOrRelationsGetter}
1374
+ * @return {FluentFilters}
2836
1375
  */
2837
- password() {
2838
- this._textStr = 'password';
2839
- return new FluentFiltersOrRelationsGetter(this);
1376
+ swipe(x_offset, y_offset) {
1377
+ this._textStr = `Swipe x ${x_offset} y ${y_offset}`;
1378
+ return new FluentFilters(this);
2840
1379
  }
2841
1380
  /**
2842
- * Filters for a UI element 'pager'.
1381
+ * Types a text at the current position.
1382
+ * If you need to focus the element first, use typeIn()
2843
1383
  *
2844
- * @return {FluentFiltersOrRelationsGetter}
2845
- */
2846
- pager() {
2847
- this._textStr = 'pager';
2848
- return new FluentFiltersOrRelationsGetter(this);
2849
- }
2850
- /**
2851
- * Filters for a UI element 'navigation bar'.
1384
+ * **Note:** In the current version it copies the text and pastes it.
2852
1385
  *
2853
- * @return {FluentFiltersOrRelationsGetter}
2854
- */
2855
- navigationBar() {
2856
- this._textStr = 'navigation bar';
2857
- return new FluentFiltersOrRelationsGetter(this);
2858
- }
2859
- /**
2860
- * Filters for a UI element 'mouse text'.
1386
+ * **Examples:**
1387
+ * ```typescript
1388
+ * await aui.type('Type some text').exec()
2861
1389
  *
2862
- * @return {FluentFiltersOrRelationsGetter}
2863
- */
2864
- mouseText() {
2865
- this._textStr = 'mouse text';
2866
- return new FluentFiltersOrRelationsGetter(this);
2867
- }
2868
- /**
2869
- * Filters for a UI element 'mouse pointer'.
1390
+ * // mask the text so it is not send to the askui-inference server
1391
+ * await aui.type('Type some text', { isSecret: true, secretMask: '**' }).exec()
1392
+ * ```
2870
1393
  *
2871
- * @return {FluentFiltersOrRelationsGetter}
2872
- */
2873
- mousePointer() {
2874
- this._textStr = 'mouse pointer';
2875
- return new FluentFiltersOrRelationsGetter(this);
2876
- }
2877
- /**
2878
- * Filters for a UI element 'mouse cursor'.
1394
+ * @param {string} text - A text to type
2879
1395
  *
2880
- * @return {FluentFiltersOrRelationsGetter}
1396
+ * @return {Exec}
2881
1397
  */
2882
- mouseCursor() {
2883
- this._textStr = 'mouse cursor';
2884
- return new FluentFiltersOrRelationsGetter(this);
1398
+ type(text) {
1399
+ this._textStr = `Type ${Separators.STRING}${text}${Separators.STRING}`;
1400
+ return new Exec(this);
2885
1401
  }
2886
1402
  /**
2887
- * Filters for a UI element 'modal'.
1403
+ * Moves the mouse from the current position (relative) in x and y direction.
2888
1404
  *
2889
- * @return {FluentFiltersOrRelationsGetter}
2890
- */
2891
- modal() {
2892
- this._textStr = 'modal';
2893
- return new FluentFiltersOrRelationsGetter(this);
2894
- }
2895
- /**
2896
- * Filters for a UI element 'message box'.
1405
+ * **Example:**
1406
+ * ```typescript
1407
+ * await aui.moveMouseRelatively(20, 20).exec();
1408
+ * ```
2897
1409
  *
2898
- * @return {FluentFiltersOrRelationsGetter}
1410
+ * @param {number} x_offset - A (positive/negative) x direction.
1411
+ * @param {number} y_offset - A (positive/negative) y direction.
1412
+ *
1413
+ * @return {Exec}
2899
1414
  */
2900
- messageBox() {
2901
- this._textStr = 'message box';
2902
- return new FluentFiltersOrRelationsGetter(this);
1415
+ moveMouseRelatively(x_offset, y_offset) {
1416
+ this._textStr = `Move mouse from current position with x ${x_offset} y ${y_offset}`;
1417
+ return new Exec(this);
2903
1418
  }
2904
1419
  /**
2905
- * Filters for a UI element 'map'.
1420
+ * Moves the mouse to the absolute x and y coordinates.
2906
1421
  *
2907
- * @return {FluentFiltersOrRelationsGetter}
1422
+ * If you want to move your mouse cursor to an element, use `moveMouseTo()`.
1423
+ *
1424
+ * **Example:**
1425
+ * ```typescript
1426
+ * await aui.moveMouse(500, 500).exec();
1427
+ * ```
1428
+ *
1429
+ * @param {number} x_coordinate - A (positive/negative) x coordinate.
1430
+ * @param {number} y_coordinate - A (positive/negative) y coordinate.
1431
+ *
1432
+ * @return {Exec}
2908
1433
  */
2909
- map() {
2910
- this._textStr = 'map';
2911
- return new FluentFiltersOrRelationsGetter(this);
1434
+ moveMouse(x_coordinate, y_coordinate) {
1435
+ this._textStr = `Move mouse to x ${x_coordinate} y ${y_coordinate}`;
1436
+ return new Exec(this);
2912
1437
  }
2913
1438
  /**
2914
- * Filters for a UI element 'logo'.
1439
+ * Scrolls based on the current mouse position in the x and y direction.
1440
+ *
1441
+ * **Important**: Mouse must be positioned in a scrollable area.
1442
+ *
1443
+ * **macOS**: May not work as expected!
1444
+ *
1445
+ * **Example:**
1446
+ * ```typescript
1447
+ * // Scroll 10 up in y direction
1448
+ * await aui.scroll(0, 10).exec()
1449
+ * ```
2915
1450
  *
2916
- * @return {FluentFiltersOrRelationsGetter}
2917
- */
2918
- logo() {
2919
- this._textStr = 'logo';
2920
- return new FluentFiltersOrRelationsGetter(this);
2921
- }
2922
- /**
2923
- * Filters for a UI element 'link'.
1451
+ * @param {number} x_offset - A (positive/negative) x direction.
1452
+ * @param {number} y_offset - A (positive/negative) y direction.
2924
1453
  *
2925
- * @return {FluentFiltersOrRelationsGetter}
1454
+ * @return {Exec}
2926
1455
  */
2927
- link() {
2928
- this._textStr = 'link';
2929
- return new FluentFiltersOrRelationsGetter(this);
1456
+ scroll(x_offset, y_offset) {
1457
+ this._textStr = `Scroll x ${x_offset} y ${y_offset}`;
1458
+ return new Exec(this);
2930
1459
  }
2931
1460
  /**
2932
- * Filters for a UI element 'keyboard'.
1461
+ * Executes a shell command on the device your UiController is connected to.
2933
1462
  *
2934
- * @return {FluentFiltersOrRelationsGetter}
1463
+ * **Example:**
1464
+ * ```typescript
1465
+ * // Open the lastpass app
1466
+ * await aui.execOnShell('monkey -p com.lastpass.authenticator 1').exec();
1467
+ *
1468
+ * // Open Google Chrome on Windows
1469
+ * await aui.execOnShell("start chrome").exec()
1470
+ *
1471
+ * ;// Open Google Chrome on macOS
1472
+ * await aui.execOnShell("open -a 'Google Chrome'").exec();
1473
+ *
1474
+ * // Open Google Chrome on Linux
1475
+ * await aui.execOnShell("chrome").exec();
1476
+ * ```
1477
+ *
1478
+ * @param {string} shell_command - A shell command which is executed.
1479
+ *
1480
+ * @return {Exec}
2935
1481
  */
2936
- keyboard() {
2937
- this._textStr = 'keyboard';
2938
- return new FluentFiltersOrRelationsGetter(this);
1482
+ execOnShell(shell_command) {
1483
+ this._textStr = `Execute shell command ${Separators.STRING}${shell_command}${Separators.STRING}`;
1484
+ return new Exec(this);
2939
1485
  }
2940
1486
  /**
2941
- * Filters for a UI element 'image'.
1487
+ * Clicks with left mouse key.
2942
1488
  *
2943
- * @return {FluentFiltersOrRelationsGetter}
1489
+ * If you need to move the mouse first, use `moveMouseTo()`.
1490
+ *
1491
+ * **Examples:**
1492
+ * ```typescript
1493
+ * // Optional: Move mouse to an element first
1494
+ * await aui.moveMouseTo().button().withText('Login').exec();
1495
+ *
1496
+ * await aui.mouseLeftClick().exec();
1497
+ * ```
1498
+ *
1499
+ * @return {Exec}
2944
1500
  */
2945
- image() {
2946
- this._textStr = 'image';
2947
- return new FluentFiltersOrRelationsGetter(this);
1501
+ mouseLeftClick() {
1502
+ this._textStr = 'Mouse left click';
1503
+ return new Exec(this);
2948
1504
  }
2949
1505
  /**
2950
- * Filters for a UI element 'header'.
1506
+ * Clicks with right mouse key.
2951
1507
  *
2952
- * @return {FluentFiltersOrRelationsGetter}
1508
+ * If you need to move the mouse first, use `moveMouseTo()`.
1509
+ *
1510
+ * **Examples:**
1511
+ * ```typescript
1512
+ * // Optional: Move mouse to an element first
1513
+ * await aui.moveMouseTo().button().withText('Login').exec();
1514
+ *
1515
+ * await aui.mouseRightClick().exec();
1516
+ * ```
1517
+ *
1518
+ * @return {Exec}
2953
1519
  */
2954
- header() {
2955
- this._textStr = 'header';
2956
- return new FluentFiltersOrRelationsGetter(this);
1520
+ mouseRightClick() {
1521
+ this._textStr = 'Mouse right click';
1522
+ return new Exec(this);
2957
1523
  }
2958
1524
  /**
2959
- * Filters for a UI element 'footer'.
1525
+ * Clicks with middle mouse key.
2960
1526
  *
2961
- * @return {FluentFiltersOrRelationsGetter}
1527
+ * If you need to move the mouse first, use `moveMouseTo()`.
1528
+ *
1529
+ * **Examples:**
1530
+ * ```typescript
1531
+ * // Optional: Move mouse to an element first
1532
+ * await aui.moveMouseTo().button().withText('Login').exec();
1533
+ *
1534
+ * await aui.mouseMiddleClick().exec();
1535
+ * ```
1536
+ *
1537
+ * @return {Exec}
2962
1538
  */
2963
- footer() {
2964
- this._textStr = 'footer';
2965
- return new FluentFiltersOrRelationsGetter(this);
1539
+ mouseMiddleClick() {
1540
+ this._textStr = 'Mouse middle click';
1541
+ return new Exec(this);
2966
1542
  }
2967
1543
  /**
2968
- * Filters for a UI element 'flag'.
1544
+ * Double-clicks with left mouse key.
2969
1545
  *
2970
- * @return {FluentFiltersOrRelationsGetter}
1546
+ * If you need to move the mouse first, use `moveMouseTo()`.
1547
+ *
1548
+ * **Examples:**
1549
+ * ```typescript
1550
+ * // Optional: Move mouse to an element first
1551
+ * await aui.moveMouseTo().button().withText('Login').exec();
1552
+ *
1553
+ * await aui.mouseDoubleLeftClick().exec();
1554
+ * ```
1555
+ *
1556
+ * @return {Exec}
2971
1557
  */
2972
- flag() {
2973
- this._textStr = 'flag';
2974
- return new FluentFiltersOrRelationsGetter(this);
1558
+ mouseDoubleLeftClick() {
1559
+ this._textStr = 'Mouse double left click';
1560
+ return new Exec(this);
2975
1561
  }
2976
1562
  /**
2977
- * Filters for a UI element 'dropdown menu'.
1563
+ * Double-clicks with right mouse key.
2978
1564
  *
2979
- * @return {FluentFiltersOrRelationsGetter}
1565
+ * If you need to move the mouse first, use `moveMouseTo()`.
1566
+ *
1567
+ * **Examples:**
1568
+ * ```typescript
1569
+ * // Optional: Move mouse to an element first
1570
+ * await aui.moveMouseTo().button().withText('Login').exec();
1571
+ *
1572
+ * await aui.mouseDoubleRightClick().exec();
1573
+ * ```
1574
+ *
1575
+ * @return {Exec}
2980
1576
  */
2981
- dropdownMenu() {
2982
- this._textStr = 'dropdown menu';
2983
- return new FluentFiltersOrRelationsGetter(this);
1577
+ mouseDoubleRightClick() {
1578
+ this._textStr = 'Mouse double right click';
1579
+ return new Exec(this);
2984
1580
  }
2985
1581
  /**
2986
- * Filters for a UI element 'divider'.
1582
+ * Double-clicks with middle mouse key.
2987
1583
  *
2988
- * @return {FluentFiltersOrRelationsGetter}
1584
+ * If you need to move the mouse first, use `moveMouseTo()`.
1585
+ *
1586
+ * **Examples:**
1587
+ * ```typescript
1588
+ * // Optional: Move mouse to an element first
1589
+ * await aui.moveMouseTo().button().withText('Login').exec();
1590
+ *
1591
+ * await aui.mouseDoubleMiddleClick().exec();
1592
+ * ```
1593
+ *
1594
+ * @return {Exec}
2989
1595
  */
2990
- divider() {
2991
- this._textStr = 'divider';
2992
- return new FluentFiltersOrRelationsGetter(this);
1596
+ mouseDoubleMiddleClick() {
1597
+ this._textStr = 'Mouse double middle click';
1598
+ return new Exec(this);
2993
1599
  }
2994
1600
  /**
2995
- * Filters for a UI element 'circle'.
1601
+ * Toggles mouse down (Left mouse key/tap).
2996
1602
  *
2997
- * @return {FluentFiltersOrRelationsGetter}
1603
+ * **Example:**
1604
+ * ```typescript
1605
+ * await aui.mouseToggleDown().exec();
1606
+ * ```
1607
+ *
1608
+ * @return {Exec}
2998
1609
  */
2999
- circle() {
3000
- this._textStr = 'circle';
3001
- return new FluentFiltersOrRelationsGetter(this);
1610
+ mouseToggleDown() {
1611
+ this._textStr = 'Mouse toggle down';
1612
+ return new Exec(this);
3002
1613
  }
3003
1614
  /**
3004
- * Filters for a UI element 'checkbox unchecked'.
1615
+ * Toggles mouse up (Left mouse key/tap).
3005
1616
  *
3006
- * @return {FluentFiltersOrRelationsGetter}
1617
+ * **Example:**
1618
+ * ```typescript
1619
+ * await aui.mouseToggleUp().exec();
1620
+ * ```
1621
+ *
1622
+ * @return {Exec}
3007
1623
  */
3008
- checkboxUnchecked() {
3009
- this._textStr = 'checkbox unchecked';
3010
- return new FluentFiltersOrRelationsGetter(this);
1624
+ mouseToggleUp() {
1625
+ this._textStr = 'Mouse toggle up';
1626
+ return new Exec(this);
3011
1627
  }
3012
1628
  /**
3013
- * Filters for a UI element 'checkbox checked'.
1629
+ * Press three keys like `CTRL+ALT+DEL`
3014
1630
  *
3015
- * @return {FluentFiltersOrRelationsGetter}
1631
+ * **Operating system specific mappings:**
1632
+ * 1. Windows: `command`-key maps to `windows`-key
1633
+ * ---
1634
+ *
1635
+ *
1636
+ * @param {MODIFIER_KEY} first_key - A modifier key
1637
+ * @param {MODIFIER_KEY} second_key - A modifier key
1638
+ * @param {PC_KEY} third_key - A key
1639
+ *
1640
+ * @return {Exec}
3016
1641
  */
3017
- checkboxChecked() {
3018
- this._textStr = 'checkbox checked';
3019
- return new FluentFiltersOrRelationsGetter(this);
1642
+ pressThreeKeys(first_key, second_key, third_key) {
1643
+ this._textStr = `Press key ${first_key} ${second_key} ${third_key}`;
1644
+ return new Exec(this);
3020
1645
  }
3021
1646
  /**
3022
- * Filters for a UI element 'chart pie'.
1647
+ * Press two keys like `ALT+F4`
3023
1648
  *
3024
- * @return {FluentFiltersOrRelationsGetter}
1649
+ * **Operating system specific mappings:**
1650
+ * 1. Windows: `command`-key maps to `windows`-key
1651
+ * ---
1652
+ *
1653
+ *
1654
+ * @param {MODIFIER_KEY} first_key - A modifier key
1655
+ * @param {PC_KEY} second_key - A key
1656
+ *
1657
+ * @return {Exec}
3025
1658
  */
3026
- chartPie() {
3027
- this._textStr = 'chart pie';
3028
- return new FluentFiltersOrRelationsGetter(this);
1659
+ pressTwoKeys(first_key, second_key) {
1660
+ this._textStr = `Press key ${first_key} ${second_key}`;
1661
+ return new Exec(this);
3029
1662
  }
3030
1663
  /**
3031
- * Filters for a UI element 'chart'.
1664
+ * Press one keys like `DEL`
3032
1665
  *
3033
- * @return {FluentFiltersOrRelationsGetter}
1666
+ * **Operating system specific mappings:**
1667
+ * 1. Windows: `command`-key maps to `windows`-key
1668
+ * ---
1669
+ *
1670
+ *
1671
+ * @param {PC_AND_MODIFIER_KEY} key - A key
1672
+ *
1673
+ * @return {Exec}
3034
1674
  */
3035
- chart() {
3036
- this._textStr = 'chart';
3037
- return new FluentFiltersOrRelationsGetter(this);
1675
+ pressKey(key) {
1676
+ this._textStr = `Press key ${key}`;
1677
+ return new Exec(this);
3038
1678
  }
3039
1679
  /**
3040
- * Filters for a UI element 'card'.
1680
+ * Press three Android keys like `CTRL+ALT+DEL`
3041
1681
  *
3042
- * @return {FluentFiltersOrRelationsGetter}
1682
+ * @param {ANDROID_KEY} first_key - A Android key
1683
+ * @param {ANDROID_KEY} second_key - A Android key
1684
+ * @param {ANDROID_KEY} third_key - A Android key
1685
+ *
1686
+ * @return {Exec}
3043
1687
  */
3044
- card() {
3045
- this._textStr = 'card';
3046
- return new FluentFiltersOrRelationsGetter(this);
1688
+ pressAndroidThirdKey(first_key, second_key, third_key) {
1689
+ this._textStr = `Press android key ${first_key} ${second_key} ${third_key}`;
1690
+ return new Exec(this);
3047
1691
  }
3048
1692
  /**
3049
- * Filters for a UI element 'browser bar'.
1693
+ * Press two Android keys like `ALT+F4`
3050
1694
  *
3051
- * @return {FluentFiltersOrRelationsGetter}
1695
+ * @param {ANDROID_KEY} first_key - A Android key
1696
+ * @param {ANDROID_KEY} second_key - A Android key
1697
+ *
1698
+ * @return {Exec}
3052
1699
  */
3053
- browserBar() {
3054
- this._textStr = 'browser bar';
3055
- return new FluentFiltersOrRelationsGetter(this);
1700
+ pressAndroidTwoKey(first_key, second_key) {
1701
+ this._textStr = `Press android key ${first_key} ${second_key}`;
1702
+ return new Exec(this);
3056
1703
  }
3057
1704
  /**
3058
- * Filters for a UI element 'breadcrumb'.
1705
+ * Press one Android key like `DEL`
3059
1706
  *
3060
- * @return {FluentFiltersOrRelationsGetter}
1707
+ * @param {ANDROID_KEY} key - A Android key
1708
+ *
1709
+ * @return {Exec}
3061
1710
  */
3062
- breadcrumb() {
3063
- this._textStr = 'breadcrumb';
3064
- return new FluentFiltersOrRelationsGetter(this);
1711
+ pressAndroidKey(key) {
1712
+ this._textStr = `Press android key ${key}`;
1713
+ return new Exec(this);
1714
+ }
1715
+ }
1716
+ exports.FluentCommand = FluentCommand;
1717
+ class ExecGetter extends FluentBase {
1718
+ exec() {
1719
+ return this.getterStringBuilder();
3065
1720
  }
1721
+ }
1722
+ exports.ExecGetter = ExecGetter;
1723
+ // Filters
1724
+ class FluentFiltersGetter extends FluentBase {
3066
1725
  /**
3067
- * Filters for a UI element 'banner'.
1726
+ * Filters for a UI element 'table'.
3068
1727
  *
3069
1728
  * @return {FluentFiltersOrRelationsGetter}
3070
1729
  */
3071
- banner() {
3072
- this._textStr = 'banner';
1730
+ table() {
1731
+ this._textStr = 'table';
3073
1732
  return new FluentFiltersOrRelationsGetter(this);
3074
1733
  }
3075
1734
  /**
3076
- * Filters for a UI element 'badge'.
1735
+ * Filters for a UI element 'switch'.
3077
1736
  *
3078
1737
  * @return {FluentFiltersOrRelationsGetter}
3079
1738
  */
3080
- badge() {
3081
- this._textStr = 'badge';
1739
+ switch() {
1740
+ this._textStr = 'switch';
3082
1741
  return new FluentFiltersOrRelationsGetter(this);
3083
1742
  }
3084
1743
  /**
3085
- * Filters for a UI element 'alert'.
1744
+ * Filters for a UI element 'container'.
3086
1745
  *
3087
1746
  * @return {FluentFiltersOrRelationsGetter}
3088
1747
  */
3089
- alert() {
3090
- this._textStr = 'alert';
1748
+ container() {
1749
+ this._textStr = 'container';
3091
1750
  return new FluentFiltersOrRelationsGetter(this);
3092
1751
  }
3093
1752
  /**
3094
- * Filters for a UI element 'unknown'.
1753
+ * Filters for a UI element 'checkbox'.
3095
1754
  *
3096
1755
  * @return {FluentFiltersOrRelationsGetter}
3097
1756
  */
3098
- unknown() {
3099
- this._textStr = 'unknown';
1757
+ checkbox() {
1758
+ this._textStr = 'checkbox';
3100
1759
  return new FluentFiltersOrRelationsGetter(this);
3101
1760
  }
3102
1761
  /**
3103
- * Filters for an UI element 'button'.
1762
+ * Filters for a UI element 'button'.
3104
1763
  *
3105
1764
  * **Examples:**
3106
1765
  * ```typescript
@@ -3116,6 +1775,16 @@ class FluentFiltersGetter extends FluentBase {
3116
1775
  /**
3117
1776
  * Filters for an UI element 'text'.
3118
1777
  *
1778
+ * Often combined with the filter `withText()` as shown in the below examples.
1779
+ * See also the filters `withTextRegex()` and `withExactText()`
1780
+ *
1781
+ * **Examples:**
1782
+ * ```typescript
1783
+ * await aui.click().text().withText('Password').exec();
1784
+ * await aui.click().text().withExactText('Username').exec();
1785
+ * await aui.click().text().withTextRegex('\b[Ss]\w+').exec();
1786
+ * ```
1787
+ *
3119
1788
  * @return {FluentFiltersOrRelationsGetter}
3120
1789
  */
3121
1790
  text() {
@@ -3123,25 +1792,16 @@ class FluentFiltersGetter extends FluentBase {
3123
1792
  return new FluentFiltersOrRelationsGetter(this);
3124
1793
  }
3125
1794
  /**
3126
- * Filters for an UI element 'dropdown'.
3127
- *
3128
- * @return {FluentFiltersOrRelationsGetter}
3129
- */
3130
- dropdown() {
3131
- this._textStr = 'dropdown';
3132
- return new FluentFiltersOrRelationsGetter(this);
3133
- }
3134
- /**
3135
- * Filters for an UI element 'icon'.
1795
+ * Filters for a UI element 'icon'.
3136
1796
  *
3137
- * You can combine it with the 'withText' command to look for a specific icon.
1797
+ * You can combine it with the element-description 'withText()' to look for a specific icon.
3138
1798
  *
3139
1799
  * **Examples:**
3140
1800
  * ```typescript
3141
1801
  * icon().withText('plus')
3142
1802
  * ```
3143
1803
  *
3144
- * Note: This is an alpha feature. The prediction of the icon name is sometimes unstable. Use custom elements as an alternative.
1804
+ * **Note:** This is an alpha feature. The prediction of the icon name is sometimes unstable. Use custom elements as an alternative.
3145
1805
  *
3146
1806
  * @return {FluentFiltersOrRelationsGetter}
3147
1807
  */
@@ -3150,10 +1810,37 @@ class FluentFiltersGetter extends FluentBase {
3150
1810
  return new FluentFiltersOrRelationsGetter(this);
3151
1811
  }
3152
1812
  /**
3153
- * Filters for a custom UI element (see {@link CustomElementJson}).
1813
+ * 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 that is not recognized by our machine learning models by default. It can also be used for pixel assertions of elements using classical [template matching](https://en.wikipedia.org/wiki/Template_matching).
1814
+ *
1815
+ * **Example**
1816
+ * ```typescript
1817
+ * await aui
1818
+ * .click()
1819
+ * .customElement({
1820
+ * customImage: './logo.png', // required
1821
+ * name: 'myLogo', // optional
1822
+ * threshold: 0.9, // optional, defaults to 0.9
1823
+ * rotationDegreePerStep: 0, // optional, defaults to 0
1824
+ * imageCompareFormat: 'grayscale', // optional, defaults to 'grayscale'
1825
+ * // mask:{x:0, y:0}[] // optional, a polygon to match only a certain area of the custom element
1826
+ * })
1827
+ * .exec();
1828
+ * ```
1829
+ *
1830
+ * **Arguments**
1831
+ *
1832
+ * - **customImage** (*`string`, required*):
1833
+ * - A cropped image in the form of a base64 string or file path.
1834
+ * - **name** (*`string`, optional*):
1835
+ * - 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.
1836
+ * - **threshold** (*`number`, optional*):
1837
+ * - 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`.
1838
+ * - **rotationDegreePerStep** (*`number`, optional*):
1839
+ * - 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`.
1840
+ * - **imageCompareFormat** (*`'RGB' | 'grayscale'`, optional*):
1841
+ * - The color compare style. 'greyscale' compares the brightness of each pixel whereas 'RGB' compares all three color. Defaults to 'grayscale'.
1842
+ * of the given custom image.
3154
1843
  *
3155
- * **Important**: This increases the runtime quite a bit. So
3156
- * only use it when absolutely necessary.
3157
1844
  *
3158
1845
  * @param {CustomElementJson} customElement - The custom element to filter for.
3159
1846
  *
@@ -3165,12 +1852,41 @@ class FluentFiltersGetter extends FluentBase {
3165
1852
  return new FluentFiltersOrRelationsGetter(this);
3166
1853
  }
3167
1854
  /**
3168
- * Filters for a UI element 'checkbox' checked or unchecked.
1855
+ * Filters for a UI element 'image'.
1856
+ *
1857
+ * **Examples:**
1858
+ * ```typescript
1859
+ * // Works if there is only one image visible on the screen
1860
+ * await aui.click().image().exec();
1861
+ *
1862
+ * // Works if you have an image with
1863
+ * // a caption text below
1864
+ * await aui.click().image().above().text().withText('The caption').exec();
1865
+ * ```
1866
+ *
1867
+ * @return {FluentFiltersOrRelationsGetter}
1868
+ */
1869
+ image() {
1870
+ this._textStr = 'image';
1871
+ return new FluentFiltersOrRelationsGetter(this);
1872
+ }
1873
+ /**
1874
+ * Filters for a UI element 'textfield'.
1875
+ *
1876
+ * **Examples:**
1877
+ * ```typescript
1878
+ * // Works if there is only one textfield visible on the screen
1879
+ * await aui.typeIn('Oh yeah').textfield().exec();
1880
+ *
1881
+ * // Works if you have a labeled textfield
1882
+ * // Label is above the textfield
1883
+ * await aui.typeIn('Oh yeah').textfield().below().text().withText('E-Mail Address').exec();
1884
+ * ```
3169
1885
  *
3170
1886
  * @return {FluentFiltersOrRelationsGetter}
3171
1887
  */
3172
- checkbox() {
3173
- this._textStr = 'checkbox';
1888
+ textfield() {
1889
+ this._textStr = 'textfield';
3174
1890
  return new FluentFiltersOrRelationsGetter(this);
3175
1891
  }
3176
1892
  /**
@@ -3250,9 +1966,9 @@ class FluentFiltersGetter extends FluentBase {
3250
1966
  *
3251
1967
  * **Examples:**
3252
1968
  * ```typescript
3253
- * 'This is an text' === containsText('text') => true
3254
- * 'This is an text' === containsText('other text') => false
3255
- * 'This is an text' === containsText('other') => false
1969
+ * 'This is a text' === containsText('text') => true
1970
+ * 'This is a text' === containsText('other text') => false
1971
+ * 'This is a text' === containsText('other') => false
3256
1972
  * ```
3257
1973
  * ![](https://docs.askui.com/img/gif/containsText.gif)
3258
1974
  *
@@ -3264,6 +1980,17 @@ class FluentFiltersGetter extends FluentBase {
3264
1980
  this._textStr = `contain text ${Separators.STRING}${text}${Separators.STRING}`;
3265
1981
  return new FluentFiltersOrRelationsGetter(this);
3266
1982
  }
1983
+ /**
1984
+ * Filters elements based on a textual description.
1985
+ *
1986
+ * @param {string} text - A description of the target element.
1987
+ *
1988
+ * @return {FluentFiltersOrRelationsGetter}
1989
+ */
1990
+ matching(text) {
1991
+ this._textStr = `matching ${Separators.STRING}${text}${Separators.STRING}`;
1992
+ return new FluentFiltersOrRelationsGetter(this);
1993
+ }
3267
1994
  }
3268
1995
  exports.FluentFiltersGetter = FluentFiltersGetter;
3269
1996
  // Relations
@@ -3285,7 +2012,7 @@ class FluentFiltersOrRelationsGetter extends FluentFiltersGetter {
3285
2012
  *
3286
2013
  * ```
3287
2014
  * In case, that your reference element can have multiple values, in the following example, the element right of the button can be either icon or text.
3288
- * You can use **the `or()` relation**, so your teststep is valid for both scenes
2015
+ * You can use **the `or()` relation**, so your instruction is valid for both scenes
3289
2016
  * ```typescript
3290
2017
  * const button = await aui.get().button().rightOf().icon().or().text().exec();
3291
2018
  * console.log(button);
@@ -3320,12 +2047,13 @@ class FluentFiltersOrRelationsGetter extends FluentFiltersGetter {
3320
2047
  * example scene:
3321
2048
  * --------------- ----------------
3322
2049
  * | icon user | | icon search |
3323
- * --------------- ---------------n```
2050
+ * --------------- ----------------
2051
+ * ```
3324
2052
  * ```typescript
3325
2053
  * const icons = await aui.get().icon().exec();
3326
2054
  * console.log(icons);
3327
2055
  * ```
3328
- * Using only the filter icon, the get command will return both icons
2056
+ * Using only the element-description icon, the get will return both icons
3329
2057
  * ```text
3330
2058
  * console output: [
3331
2059
  * DetectedElement {
@@ -3350,12 +2078,12 @@ class FluentFiltersOrRelationsGetter extends FluentFiltersGetter {
3350
2078
  * }
3351
2079
  * ]
3352
2080
  * ```
3353
- * You can combine filters with **the `and()` relation** and specify exactly which icon you want
2081
+ * You can combine element-descriptions with **the `and()` relation** and specify exactly which icon you want.
3354
2082
  * ```typescript
3355
2083
  * const icons = await aui.get().icon().and().withText('user').exec()
3356
2084
  * console.log(icons)
3357
2085
  * ```
3358
- * The get command returns only the user icon although both elements are icons
2086
+ * The get returns only the user icon although both elements are icons.
3359
2087
  * ```text
3360
2088
  * console output: [
3361
2089
  * DetectedElement {
@@ -3587,7 +2315,7 @@ class Getter extends FluentCommand {
3587
2315
  * xmax: 1178.8204241071428,
3588
2316
  * ymax: 180.83512834821428
3589
2317
  * }
3590
- * }
2318
+ * }
3591
2319
  * ]
3592
2320
  * ```
3593
2321
  *
@@ -3630,7 +2358,7 @@ class Getter extends FluentCommand {
3630
2358
  * ymax: 950.47812834821428
3631
2359
  * },
3632
2360
  * ... 381 more items
3633
- * }
2361
+ * }
3634
2362
  * ]
3635
2363
  * ```
3636
2364
  *