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