appium-uiautomator2-driver 6.7.5 → 6.7.7
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/CHANGELOG.md +12 -0
- package/build/lib/commands/actions.d.ts +26 -29
- package/build/lib/commands/actions.d.ts.map +1 -1
- package/build/lib/commands/actions.js +19 -27
- package/build/lib/commands/actions.js.map +1 -1
- package/build/lib/commands/alert.d.ts +14 -22
- package/build/lib/commands/alert.d.ts.map +1 -1
- package/build/lib/commands/alert.js +8 -19
- package/build/lib/commands/alert.js.map +1 -1
- package/build/lib/commands/app-management.d.ts +7 -10
- package/build/lib/commands/app-management.d.ts.map +1 -1
- package/build/lib/commands/app-management.js +4 -14
- package/build/lib/commands/app-management.js.map +1 -1
- package/build/lib/commands/battery.d.ts +4 -5
- package/build/lib/commands/battery.d.ts.map +1 -1
- package/build/lib/commands/battery.js +4 -9
- package/build/lib/commands/battery.js.map +1 -1
- package/build/lib/commands/clipboard.d.ts +9 -13
- package/build/lib/commands/clipboard.d.ts.map +1 -1
- package/build/lib/commands/clipboard.js +7 -14
- package/build/lib/commands/clipboard.js.map +1 -1
- package/build/lib/commands/element.d.ts +64 -69
- package/build/lib/commands/element.d.ts.map +1 -1
- package/build/lib/commands/element.js +64 -84
- package/build/lib/commands/element.js.map +1 -1
- package/build/lib/commands/find.d.ts +13 -9
- package/build/lib/commands/find.d.ts.map +1 -1
- package/build/lib/commands/find.js +4 -16
- package/build/lib/commands/find.js.map +1 -1
- package/build/lib/commands/gestures.d.ts +87 -189
- package/build/lib/commands/gestures.d.ts.map +1 -1
- package/build/lib/commands/gestures.js +77 -204
- package/build/lib/commands/gestures.js.map +1 -1
- package/build/lib/commands/keyboard.d.ts +30 -41
- package/build/lib/commands/keyboard.d.ts.map +1 -1
- package/build/lib/commands/keyboard.js +22 -37
- package/build/lib/commands/keyboard.js.map +1 -1
- package/build/lib/commands/misc.d.ts +19 -35
- package/build/lib/commands/misc.d.ts.map +1 -1
- package/build/lib/commands/misc.js +15 -30
- package/build/lib/commands/misc.js.map +1 -1
- package/build/lib/commands/navigation.d.ts +11 -16
- package/build/lib/commands/navigation.d.ts.map +1 -1
- package/build/lib/commands/navigation.js +9 -17
- package/build/lib/commands/navigation.js.map +1 -1
- package/build/lib/commands/viewport.d.ts +23 -22
- package/build/lib/commands/viewport.d.ts.map +1 -1
- package/build/lib/commands/viewport.js +17 -24
- package/build/lib/commands/viewport.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/lib/commands/actions.ts +95 -0
- package/lib/commands/alert.ts +46 -0
- package/lib/commands/app-management.ts +25 -0
- package/lib/commands/battery.ts +19 -0
- package/lib/commands/clipboard.ts +29 -0
- package/lib/commands/element.ts +180 -0
- package/lib/commands/find.ts +48 -0
- package/lib/commands/gestures.ts +297 -0
- package/lib/commands/keyboard.ts +102 -0
- package/lib/commands/misc.ts +67 -0
- package/lib/commands/navigation.ts +32 -0
- package/lib/commands/viewport.ts +78 -0
- package/npm-shrinkwrap.json +16 -46
- package/package.json +1 -1
- package/lib/commands/actions.js +0 -107
- package/lib/commands/alert.js +0 -63
- package/lib/commands/app-management.js +0 -32
- package/lib/commands/battery.js +0 -23
- package/lib/commands/clipboard.js +0 -37
- package/lib/commands/element.js +0 -261
- package/lib/commands/find.js +0 -47
- package/lib/commands/gestures.js +0 -446
- package/lib/commands/keyboard.js +0 -108
- package/lib/commands/misc.js +0 -109
- package/lib/commands/navigation.js +0 -33
- package/lib/commands/viewport.js +0 -100
|
@@ -14,21 +14,14 @@ exports.mobileSwipeGesture = mobileSwipeGesture;
|
|
|
14
14
|
exports.mobileScrollGesture = mobileScrollGesture;
|
|
15
15
|
exports.mobileScrollBackTo = mobileScrollBackTo;
|
|
16
16
|
exports.mobileScroll = mobileScroll;
|
|
17
|
+
const driver_1 = require("appium/driver");
|
|
17
18
|
const support_1 = require("appium/support");
|
|
18
19
|
const lodash_1 = __importDefault(require("lodash"));
|
|
19
|
-
const driver_1 = require("appium/driver");
|
|
20
20
|
/**
|
|
21
|
-
* Performs a simple click/tap gesture
|
|
22
|
-
*
|
|
23
|
-
* @
|
|
24
|
-
* @param
|
|
25
|
-
* If the element is missing then both click offset coordinates must be provided.
|
|
26
|
-
* If both the element id and offset are provided then the coordinates are parsed
|
|
27
|
-
* as relative offsets from the top left corner of the element.
|
|
28
|
-
* @param {number} [x] The x coordinate to click on.
|
|
29
|
-
* @param {number} [y] The y coordinate to click on.
|
|
30
|
-
* @returns {Promise<void>}
|
|
31
|
-
* @throws {Error} if provided options are not valid
|
|
21
|
+
* Performs a simple click/tap gesture.
|
|
22
|
+
* @param elementId - Optional element to use as the origin for the click. If not provided, uses screen coordinates.
|
|
23
|
+
* @param x - Optional X offset from the element origin or screen.
|
|
24
|
+
* @param y - Optional Y offset from the element origin or screen.
|
|
32
25
|
*/
|
|
33
26
|
async function mobileClickGesture(elementId, x, y) {
|
|
34
27
|
await this.uiautomator2.jwproxy.command('/appium/gestures/click', 'POST', {
|
|
@@ -37,19 +30,11 @@ async function mobileClickGesture(elementId, x, y) {
|
|
|
37
30
|
});
|
|
38
31
|
}
|
|
39
32
|
/**
|
|
40
|
-
* Performs a click
|
|
41
|
-
*
|
|
42
|
-
* @
|
|
43
|
-
* @param
|
|
44
|
-
*
|
|
45
|
-
* If both the element id and offset are provided then the coordinates are parsed
|
|
46
|
-
* as relative offsets from the top left corner of the element.
|
|
47
|
-
* @param {number} [x] The x coordinate to click on.
|
|
48
|
-
* @param {number} [y] The y coordinate to click on.
|
|
49
|
-
* @param {number} [duration] Click duration in milliseconds. The value must not be negative.
|
|
50
|
-
* Default is 500.
|
|
51
|
-
* @returns {Promise<void>}
|
|
52
|
-
* @throws {Error} if provided options are not valid
|
|
33
|
+
* Performs a long click with an optional duration.
|
|
34
|
+
* @param elementId - Optional element to use as the origin for the long click.
|
|
35
|
+
* @param x - Optional X offset from the element origin or screen.
|
|
36
|
+
* @param y - Optional Y offset from the element origin or screen.
|
|
37
|
+
* @param duration - Optional duration of the long press in milliseconds.
|
|
53
38
|
*/
|
|
54
39
|
async function mobileLongClickGesture(elementId, x, y, duration) {
|
|
55
40
|
await this.uiautomator2.jwproxy.command('/appium/gestures/long_click', 'POST', {
|
|
@@ -59,16 +44,10 @@ async function mobileLongClickGesture(elementId, x, y, duration) {
|
|
|
59
44
|
});
|
|
60
45
|
}
|
|
61
46
|
/**
|
|
62
|
-
* Performs a click
|
|
63
|
-
* @
|
|
64
|
-
* @param
|
|
65
|
-
*
|
|
66
|
-
* If both the element id and offset are provided then the coordinates are parsed
|
|
67
|
-
* as relative offsets from the top left corner of the element.
|
|
68
|
-
* @param {number} [x] The x coordinate to click on.
|
|
69
|
-
* @param {number} [y] The y coordinate to click on.
|
|
70
|
-
* @returns {Promise<void>}
|
|
71
|
-
* @throws {Error} if provided options are not valid
|
|
47
|
+
* Performs a double-click gesture.
|
|
48
|
+
* @param elementId - Optional element to use as the origin for the double click.
|
|
49
|
+
* @param x - Optional X offset from the element origin or screen.
|
|
50
|
+
* @param y - Optional Y offset from the element origin or screen.
|
|
72
51
|
*/
|
|
73
52
|
async function mobileDoubleClickGesture(elementId, x, y) {
|
|
74
53
|
await this.uiautomator2.jwproxy.command('/appium/gestures/double_click', 'POST', {
|
|
@@ -77,21 +56,13 @@ async function mobileDoubleClickGesture(elementId, x, y) {
|
|
|
77
56
|
});
|
|
78
57
|
}
|
|
79
58
|
/**
|
|
80
|
-
* Drags
|
|
81
|
-
* @
|
|
82
|
-
* @param
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
* @param
|
|
87
|
-
* @param {number} [startY] The y coordinate where the dragging starts
|
|
88
|
-
* @param {number} [endX] The x coordinate where the dragging ends
|
|
89
|
-
* @param {number} [endY] The y coordinate where the dragging ends
|
|
90
|
-
* @param {number} [speed] The speed at which to perform this gesture in pixels per second.
|
|
91
|
-
* The value must not be negative.
|
|
92
|
-
* Default is 2500 * displayDensity.
|
|
93
|
-
* @returns {Promise<void>}
|
|
94
|
-
* @throws {Error} if provided options are not valid
|
|
59
|
+
* Drags from a start point to an end point.
|
|
60
|
+
* @param elementId - Optional element to use as the origin for the drag.
|
|
61
|
+
* @param startX - X coordinate of the drag start point.
|
|
62
|
+
* @param startY - Y coordinate of the drag start point.
|
|
63
|
+
* @param endX - X coordinate of the drag end point.
|
|
64
|
+
* @param endY - Y coordinate of the drag end point.
|
|
65
|
+
* @param speed - Optional speed of the drag gesture.
|
|
95
66
|
*/
|
|
96
67
|
async function mobileDragGesture(elementId, startX, startY, endX, endY, speed) {
|
|
97
68
|
await this.uiautomator2.jwproxy.command('/appium/gestures/drag', 'POST', {
|
|
@@ -102,27 +73,18 @@ async function mobileDragGesture(elementId, startX, startY, endX, endY, speed) {
|
|
|
102
73
|
});
|
|
103
74
|
}
|
|
104
75
|
/**
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
* @
|
|
108
|
-
* @
|
|
109
|
-
* @param
|
|
110
|
-
*
|
|
111
|
-
* @param
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
* area is effectively ignored.
|
|
115
|
-
* @param {number} [left] The left coordinate of the fling bounding area.
|
|
116
|
-
* @param {number} [top] The top coordinate of the fling bounding area.
|
|
117
|
-
* @param {number} [width] The width of the fling bounding area.
|
|
118
|
-
* @param {number} [height] The height of the fling bounding area.
|
|
119
|
-
* @param {number} [speed] The speed at which to perform this gesture in pixels per second.
|
|
120
|
-
* The value must be greater than the minimum fling velocity for the given view (50 by default).
|
|
121
|
-
* Default is 7500 * displayDensity.
|
|
122
|
-
* @returns {Promise<boolean>} True if the object can still scroll in the given direction.
|
|
76
|
+
* Performs a fling gesture and reports if further scrolling is possible.
|
|
77
|
+
* @param direction - Direction of the fling ('up', 'down', 'left', 'right').
|
|
78
|
+
* @param elementId - Optional element to use as the origin for the fling.
|
|
79
|
+
* @param left - Optional left coordinate of the fling area.
|
|
80
|
+
* @param top - Optional top coordinate of the fling area.
|
|
81
|
+
* @param width - Optional width of the fling area.
|
|
82
|
+
* @param height - Optional height of the fling area.
|
|
83
|
+
* @param speed - Optional speed of the fling gesture.
|
|
84
|
+
* @returns True if further scrolling is possible, false otherwise.
|
|
123
85
|
*/
|
|
124
86
|
async function mobileFlingGesture(direction, elementId, left, top, width, height, speed) {
|
|
125
|
-
return
|
|
87
|
+
return (await this.uiautomator2.jwproxy.command('/appium/gestures/fling', 'POST', {
|
|
126
88
|
origin: toOrigin(elementId),
|
|
127
89
|
area: toRect(left, top, width, height),
|
|
128
90
|
direction,
|
|
@@ -130,23 +92,14 @@ async function mobileFlingGesture(direction, elementId, left, top, width, height
|
|
|
130
92
|
}));
|
|
131
93
|
}
|
|
132
94
|
/**
|
|
133
|
-
* Performs a pinch
|
|
134
|
-
* @
|
|
135
|
-
* @param
|
|
136
|
-
*
|
|
137
|
-
* @param
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
* @param {number} [left] The left coordinate of the pinch bounding area.
|
|
142
|
-
* @param {number} [top] The top coordinate of the pinch bounding area.
|
|
143
|
-
* @param {number} [width] The width of the pinch bounding area.
|
|
144
|
-
* @param {number} [height] The height of the pinch bounding area.
|
|
145
|
-
* @param {number} [speed] The speed at which to perform this gesture in pixels per second.
|
|
146
|
-
* The value must not be negative.
|
|
147
|
-
* Default is 2500 * displayDensity.
|
|
148
|
-
* @returns {Promise<void>}
|
|
149
|
-
* @throws {Error} if provided options are not valid
|
|
95
|
+
* Performs a pinch-close gesture.
|
|
96
|
+
* @param percent - Percentage of the pinch (0-100).
|
|
97
|
+
* @param elementId - Optional element to use as the origin for the pinch.
|
|
98
|
+
* @param left - Optional left coordinate of the pinch area.
|
|
99
|
+
* @param top - Optional top coordinate of the pinch area.
|
|
100
|
+
* @param width - Optional width of the pinch area.
|
|
101
|
+
* @param height - Optional height of the pinch area.
|
|
102
|
+
* @param speed - Optional speed of the pinch gesture.
|
|
150
103
|
*/
|
|
151
104
|
async function mobilePinchCloseGesture(percent, elementId, left, top, width, height, speed) {
|
|
152
105
|
await this.uiautomator2.jwproxy.command('/appium/gestures/pinch_close', 'POST', {
|
|
@@ -157,23 +110,14 @@ async function mobilePinchCloseGesture(percent, elementId, left, top, width, hei
|
|
|
157
110
|
});
|
|
158
111
|
}
|
|
159
112
|
/**
|
|
160
|
-
* Performs a pinch
|
|
161
|
-
* @
|
|
162
|
-
* @param
|
|
163
|
-
*
|
|
164
|
-
* @param
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
* @param {number} [left] The left coordinate of the pinch bounding area.
|
|
169
|
-
* @param {number} [top] The top coordinate of the pinch bounding area.
|
|
170
|
-
* @param {number} [width] The width of the pinch bounding area.
|
|
171
|
-
* @param {number} [height] The height of the pinch bounding area.
|
|
172
|
-
* @param {number} [speed] The speed at which to perform this gesture in pixels per second.
|
|
173
|
-
* The value must not be negative.
|
|
174
|
-
* Default is 2500 * displayDensity.
|
|
175
|
-
* @returns {Promise<void>}
|
|
176
|
-
* @throws {Error} if provided options are not valid
|
|
113
|
+
* Performs a pinch-open gesture.
|
|
114
|
+
* @param percent - Percentage of the pinch (0-100).
|
|
115
|
+
* @param elementId - Optional element to use as the origin for the pinch.
|
|
116
|
+
* @param left - Optional left coordinate of the pinch area.
|
|
117
|
+
* @param top - Optional top coordinate of the pinch area.
|
|
118
|
+
* @param width - Optional width of the pinch area.
|
|
119
|
+
* @param height - Optional height of the pinch area.
|
|
120
|
+
* @param speed - Optional speed of the pinch gesture.
|
|
177
121
|
*/
|
|
178
122
|
async function mobilePinchOpenGesture(percent, elementId, left, top, width, height, speed) {
|
|
179
123
|
await this.uiautomator2.jwproxy.command('/appium/gestures/pinch_open', 'POST', {
|
|
@@ -184,25 +128,15 @@ async function mobilePinchOpenGesture(percent, elementId, left, top, width, heig
|
|
|
184
128
|
});
|
|
185
129
|
}
|
|
186
130
|
/**
|
|
187
|
-
* Performs a swipe gesture.
|
|
188
|
-
* @
|
|
189
|
-
* @param
|
|
190
|
-
*
|
|
191
|
-
* @param
|
|
192
|
-
*
|
|
193
|
-
* @param
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
-
* area is effectively ignored.
|
|
197
|
-
* @param {number} [left] The left coordinate of the swipe bounding area.
|
|
198
|
-
* @param {number} [top] The top coordinate of the swipe bounding area.
|
|
199
|
-
* @param {number} [width] The width of the swipe bounding area.
|
|
200
|
-
* @param {number} [height] The height of the swipe bounding area.
|
|
201
|
-
* @param {number} [speed] The speed at which to perform this gesture in pixels per second.
|
|
202
|
-
* The value must not be negative.
|
|
203
|
-
* Default is 5000 * displayDensity.
|
|
204
|
-
* @returns {Promise<void>}
|
|
205
|
-
* @throws {Error} if provided options are not valid
|
|
131
|
+
* Performs a swipe gesture for the given direction and percent.
|
|
132
|
+
* @param direction - Direction of the swipe ('up', 'down', 'left', 'right').
|
|
133
|
+
* @param percent - Percentage of the swipe distance (0-100).
|
|
134
|
+
* @param elementId - Optional element to use as the origin for the swipe.
|
|
135
|
+
* @param left - Optional left coordinate of the swipe area.
|
|
136
|
+
* @param top - Optional top coordinate of the swipe area.
|
|
137
|
+
* @param width - Optional width of the swipe area.
|
|
138
|
+
* @param height - Optional height of the swipe area.
|
|
139
|
+
* @param speed - Optional speed of the swipe gesture.
|
|
206
140
|
*/
|
|
207
141
|
async function mobileSwipeGesture(direction, percent, elementId, left, top, width, height, speed) {
|
|
208
142
|
await this.uiautomator2.jwproxy.command('/appium/gestures/swipe', 'POST', {
|
|
@@ -214,29 +148,19 @@ async function mobileSwipeGesture(direction, percent, elementId, left, top, widt
|
|
|
214
148
|
});
|
|
215
149
|
}
|
|
216
150
|
/**
|
|
217
|
-
* Performs a scroll gesture.
|
|
218
|
-
*
|
|
219
|
-
* @
|
|
220
|
-
* @
|
|
221
|
-
* @param
|
|
222
|
-
*
|
|
223
|
-
* @param
|
|
224
|
-
*
|
|
225
|
-
* @param
|
|
226
|
-
*
|
|
227
|
-
* If both the element id and the scroll bounding area are provided then this
|
|
228
|
-
* area is effectively ignored.
|
|
229
|
-
* @param {number} [left] The left coordinate of the scroll bounding area.
|
|
230
|
-
* @param {number} [top] The top coordinate of the scroll bounding area.
|
|
231
|
-
* @param {number} [width] The width of the scroll bounding area.
|
|
232
|
-
* @param {number} [height] The height of the scroll bounding area.
|
|
233
|
-
* @param {number} [speed] The speed at which to perform this gesture in pixels per second.
|
|
234
|
-
* The value must not be negative.
|
|
235
|
-
* Default is 5000 * displayDensity.
|
|
236
|
-
* @returns {Promise<boolean>} True if the object can still scroll in the given direction.
|
|
151
|
+
* Performs a scroll gesture and reports if further scrolling is possible.
|
|
152
|
+
* @param direction - Direction of the scroll ('up', 'down', 'left', 'right').
|
|
153
|
+
* @param percent - Percentage of the scroll distance (0-100).
|
|
154
|
+
* @param elementId - Optional element to use as the origin for the scroll.
|
|
155
|
+
* @param left - Optional left coordinate of the scroll area.
|
|
156
|
+
* @param top - Optional top coordinate of the scroll area.
|
|
157
|
+
* @param width - Optional width of the scroll area.
|
|
158
|
+
* @param height - Optional height of the scroll area.
|
|
159
|
+
* @param speed - Optional speed of the scroll gesture.
|
|
160
|
+
* @returns True if further scrolling is possible, false otherwise.
|
|
237
161
|
*/
|
|
238
162
|
async function mobileScrollGesture(direction, percent, elementId, left, top, width, height, speed) {
|
|
239
|
-
return
|
|
163
|
+
return (await this.uiautomator2.jwproxy.command('/appium/gestures/scroll', 'POST', {
|
|
240
164
|
origin: toOrigin(elementId),
|
|
241
165
|
area: toRect(left, top, width, height),
|
|
242
166
|
direction,
|
|
@@ -245,21 +169,10 @@ async function mobileScrollGesture(direction, percent, elementId, left, top, wid
|
|
|
245
169
|
}));
|
|
246
170
|
}
|
|
247
171
|
/**
|
|
248
|
-
* Scrolls
|
|
249
|
-
*
|
|
250
|
-
*
|
|
251
|
-
*
|
|
252
|
-
* by scrolling its parent to the end step by step. The scroll direction (vertical or horizontal)
|
|
253
|
-
* is detected automatically.
|
|
254
|
-
* @this {AndroidUiautomator2Driver}
|
|
255
|
-
* @param {string} elementId The identifier of the scrollable element, which is going to be scrolled.
|
|
256
|
-
* It is required this element is a valid scrollable container and it was located
|
|
257
|
-
* by `-android uiautomator` strategy.
|
|
258
|
-
* @param {string} elementToId The identifier of the item, which belongs to the scrollable element above,
|
|
259
|
-
* and which should become visible after the scrolling operation is finished.
|
|
260
|
-
* It is required this element was located by `-android uiautomator` strategy.
|
|
261
|
-
* @returns {Promise<void>}
|
|
262
|
-
* @throws {Error} if the scrolling operation cannot be performed
|
|
172
|
+
* Scrolls a scrollable element until a target element becomes visible.
|
|
173
|
+
* @param elementId - ID of the scrollable element.
|
|
174
|
+
* @param elementToId - ID of the target element to scroll to.
|
|
175
|
+
* @throws {errors.InvalidArgumentError} If either elementId or elementToId is not provided.
|
|
263
176
|
*/
|
|
264
177
|
async function mobileScrollBackTo(elementId, elementToId) {
|
|
265
178
|
if (!elementId || !elementToId) {
|
|
@@ -268,28 +181,12 @@ async function mobileScrollBackTo(elementId, elementToId) {
|
|
|
268
181
|
await this.uiautomator2.jwproxy.command(`/appium/element/${support_1.util.unwrapElement(elementId)}/scroll_to/${support_1.util.unwrapElement(elementToId)}`, 'POST', {});
|
|
269
182
|
}
|
|
270
183
|
/**
|
|
271
|
-
* Scrolls
|
|
272
|
-
*
|
|
273
|
-
*
|
|
274
|
-
*
|
|
275
|
-
*
|
|
276
|
-
* is
|
|
277
|
-
*
|
|
278
|
-
* @this {AndroidUiautomator2Driver}
|
|
279
|
-
* @param {string} strategy The following strategies are supported:
|
|
280
|
-
* - `accessibility id` (UiSelector().description)
|
|
281
|
-
* - `class name` (UiSelector().className)
|
|
282
|
-
* - `-android uiautomator` (UiSelector)
|
|
283
|
-
* @param {string} selector The corresponding lookup value for the given strategy.
|
|
284
|
-
* @param {string} [elementId] The identifier of an element. It is required this element is a valid scrollable container
|
|
285
|
-
* and it was located by `-android uiautomator` strategy.
|
|
286
|
-
* If this property is not provided then the first currently available scrollable view
|
|
287
|
-
* is selected for the interaction.
|
|
288
|
-
* @param {number} [maxSwipes] The maximum number of swipes to perform on the target scrollable view in order to reach
|
|
289
|
-
* the destination element. In case this value is unset then it would be retrieved from the
|
|
290
|
-
* scrollable element itself (via `getMaxSearchSwipes()` property).
|
|
291
|
-
* @returns {Promise<void>}
|
|
292
|
-
* @throws {Error} if the scrolling operation cannot be performed
|
|
184
|
+
* Scrolls until an element located by the given strategy is visible.
|
|
185
|
+
* @param strategy - Locator strategy to use (e.g., 'id', 'xpath', 'class name').
|
|
186
|
+
* @param selector - Selector string for the element to find.
|
|
187
|
+
* @param elementId - Optional element to use as the origin for scrolling.
|
|
188
|
+
* @param maxSwipes - Optional maximum number of swipes to perform.
|
|
189
|
+
* @throws {errors.InvalidArgumentError} If either strategy or selector is not provided.
|
|
293
190
|
*/
|
|
294
191
|
async function mobileScroll(strategy, selector, elementId, maxSwipes) {
|
|
295
192
|
if (!strategy || !selector) {
|
|
@@ -300,39 +197,15 @@ async function mobileScroll(strategy, selector, elementId, maxSwipes) {
|
|
|
300
197
|
params: { strategy, selector, maxSwipes },
|
|
301
198
|
});
|
|
302
199
|
}
|
|
303
|
-
// #region Internal Helpers
|
|
304
|
-
/**
|
|
305
|
-
*
|
|
306
|
-
* @param {import('@appium/types').Element|string} [element]
|
|
307
|
-
* @returns {import('@appium/types').Element|undefined}
|
|
308
|
-
*/
|
|
309
200
|
function toOrigin(element) {
|
|
310
201
|
return element ? support_1.util.wrapElement(support_1.util.unwrapElement(element)) : undefined;
|
|
311
202
|
}
|
|
312
|
-
/**
|
|
313
|
-
*
|
|
314
|
-
* @param {number} [x]
|
|
315
|
-
* @param {number} [y]
|
|
316
|
-
* @returns {Partial<import('@appium/types').Position>|undefined}
|
|
317
|
-
*/
|
|
318
203
|
function toPoint(x, y) {
|
|
319
204
|
return lodash_1.default.isFinite(x) && lodash_1.default.isFinite(y) ? { x, y } : undefined;
|
|
320
205
|
}
|
|
321
|
-
/**
|
|
322
|
-
*
|
|
323
|
-
* @param {number} [left]
|
|
324
|
-
* @param {number} [top]
|
|
325
|
-
* @param {number} [width]
|
|
326
|
-
* @param {number} [height]
|
|
327
|
-
* @returns {Partial<import('./types').RelativeRect>|undefined}
|
|
328
|
-
*/
|
|
329
206
|
function toRect(left, top, width, height) {
|
|
330
207
|
return [left, top, width, height].some((v) => !lodash_1.default.isFinite(v))
|
|
331
208
|
? undefined
|
|
332
209
|
: { left, top, width, height };
|
|
333
210
|
}
|
|
334
|
-
// #endregion
|
|
335
|
-
/**
|
|
336
|
-
* @typedef {import('../driver').AndroidUiautomator2Driver} AndroidUiautomator2Driver
|
|
337
|
-
*/
|
|
338
211
|
//# sourceMappingURL=gestures.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gestures.js","sourceRoot":"","sources":["../../../lib/commands/gestures.
|
|
1
|
+
{"version":3,"file":"gestures.js","sourceRoot":"","sources":["../../../lib/commands/gestures.ts"],"names":[],"mappings":";;;;;AAaA,gDAUC;AASD,wDAYC;AAQD,4DAUC;AAWD,8CAeC;AAaD,gDAgBC;AAYD,0DAgBC;AAYD,wDAgBC;AAaD,gDAkBC;AAcD,kDAkBC;AAQD,gDAaC;AAUD,oCAcC;AAzRD,0CAAqC;AACrC,4CAAoC;AACpC,oDAAuB;AAKvB;;;;;GAKG;AACI,KAAK,UAAU,kBAAkB,CAEtC,SAAkC,EAClC,CAAU,EACV,CAAU;IAEV,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,wBAAwB,EAAE,MAAM,EAAE;QACxE,MAAM,EAAE,QAAQ,CAAC,SAAS,CAAC;QAC3B,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;KACtB,CAAC,CAAC;AACL,CAAC;AAED;;;;;;GAMG;AACI,KAAK,UAAU,sBAAsB,CAE1C,SAAkC,EAClC,CAAU,EACV,CAAU,EACV,QAAiB;IAEjB,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,6BAA6B,EAAE,MAAM,EAAE;QAC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AACL,CAAC;AAED,SAAS,QAAQ,CAAC,OAAgC;IAChD,OAAO,OAAO,CAAC,CAAC,CAAE,cAAI,CAAC,WAAW,CAAC,cAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAmB,CAAC,CAAC,CAAC,SAAS,CAAC;AAChG,CAAC;AAED,SAAS,OAAO,CAAC,CAAU,EAAE,CAAU;IACrC,OAAO,gBAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,gBAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAC,CAAC,EAAE,CAAC,EAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC7D,CAAC;AAED,SAAS,MAAM,CAAC,IAAa,EAAE,GAAY,EAAE,KAAc,EAAE,MAAe;IAC1E,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,gBAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAC3D,CAAC,CAAC,SAAS;QACX,CAAC,CAAE,EAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAkB,CAAC;AACnD,CAAC"}
|
|
@@ -1,54 +1,43 @@
|
|
|
1
|
+
import type { AndroidUiautomator2Driver } from '../driver';
|
|
2
|
+
import type { SendKeysOpts } from 'appium-android-driver';
|
|
1
3
|
/**
|
|
2
|
-
*
|
|
3
|
-
* @param
|
|
4
|
-
* @param
|
|
5
|
-
* @param
|
|
6
|
-
* @returns {Promise<void>}
|
|
4
|
+
* Presses a key code with optional metastate and flags.
|
|
5
|
+
* @param keycode - Android key code to press.
|
|
6
|
+
* @param metastate - Optional meta state modifier keys.
|
|
7
|
+
* @param flags - Optional flags for the key event.
|
|
7
8
|
*/
|
|
8
|
-
export function pressKeyCode(this:
|
|
9
|
+
export declare function pressKeyCode(this: AndroidUiautomator2Driver, keycode: string | number, metastate?: number, flags?: number): Promise<void>;
|
|
9
10
|
/**
|
|
10
|
-
*
|
|
11
|
-
* @param
|
|
12
|
-
* @param
|
|
13
|
-
* @param
|
|
14
|
-
* @returns {Promise<void>}
|
|
11
|
+
* Long presses a key code with optional metastate and flags.
|
|
12
|
+
* @param keycode - Android key code to long press.
|
|
13
|
+
* @param metastate - Meta state modifier keys.
|
|
14
|
+
* @param flags - Optional flags for the key event.
|
|
15
15
|
*/
|
|
16
|
-
export function longPressKeyCode(this:
|
|
16
|
+
export declare function longPressKeyCode(this: AndroidUiautomator2Driver, keycode: string | number, metastate: number, flags?: number): Promise<void>;
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
19
|
-
* @param
|
|
20
|
-
*
|
|
21
|
-
* @param
|
|
22
|
-
*
|
|
23
|
-
* @param {string} [flags] Flags for the particular key event. See
|
|
24
|
-
* https://developer.android.com/reference/android/view/KeyEvent for more details.
|
|
25
|
-
* @param {boolean} [isLongPress=false] Whether to emulate long key press
|
|
26
|
-
* @returns {Promise<void>}
|
|
18
|
+
* Presses a key code with optional metastate, flags, and long press support.
|
|
19
|
+
* @param keycode - Android key code to press.
|
|
20
|
+
* @param metastate - Optional meta state modifier keys.
|
|
21
|
+
* @param flags - Optional flags for the key event.
|
|
22
|
+
* @param isLongPress - Whether to perform a long press. Defaults to false.
|
|
27
23
|
*/
|
|
28
|
-
export function mobilePressKey(this:
|
|
24
|
+
export declare function mobilePressKey(this: AndroidUiautomator2Driver, keycode: number, metastate?: number, flags?: string, isLongPress?: boolean): Promise<void>;
|
|
29
25
|
/**
|
|
30
|
-
* Types the given Unicode string.
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* @this {AndroidUiautomator2Driver}
|
|
35
|
-
* @param {string | number | boolean} text The text to type. Can be a string, number or boolean.
|
|
36
|
-
* @returns {Promise<boolean>} `true` if the input text has been successfully sent to adb
|
|
37
|
-
* @throws {Error} if `text` property has not been provided
|
|
26
|
+
* Types the given Unicode string. The focus should already be on the destination input field.
|
|
27
|
+
* @param text - Text to type. Can be a string, number, or boolean.
|
|
28
|
+
* @returns True if the input text has been successfully sent to adb.
|
|
29
|
+
* @throws {errors.InvalidArgumentError} If the text argument is not provided.
|
|
38
30
|
*/
|
|
39
|
-
export function mobileType(this:
|
|
31
|
+
export declare function mobileType(this: AndroidUiautomator2Driver, text: string | number | boolean): Promise<boolean>;
|
|
40
32
|
/**
|
|
41
|
-
*
|
|
42
|
-
* @param
|
|
43
|
-
* @returns {Promise<void>}
|
|
33
|
+
* Sends keys to the current element.
|
|
34
|
+
* @param params - Options containing the text to send and optional replace flag.
|
|
44
35
|
*/
|
|
45
|
-
export function doSendKeys(this:
|
|
36
|
+
export declare function doSendKeys(this: AndroidUiautomator2Driver, params: SendKeysOpts): Promise<void>;
|
|
46
37
|
/**
|
|
47
|
-
*
|
|
48
|
-
* @param
|
|
49
|
-
* @param
|
|
50
|
-
* @returns {Promise<void>}
|
|
38
|
+
* Sends a key event to the device.
|
|
39
|
+
* @param keycode - Android key code to send.
|
|
40
|
+
* @param metastate - Optional meta state (ignored in this implementation).
|
|
51
41
|
*/
|
|
52
|
-
export function keyevent(this:
|
|
53
|
-
export type AndroidUiautomator2Driver = import("../driver").AndroidUiautomator2Driver;
|
|
42
|
+
export declare function keyevent(this: AndroidUiautomator2Driver, keycode: string | number, metastate?: number): Promise<void>;
|
|
54
43
|
//# sourceMappingURL=keyboard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyboard.d.ts","sourceRoot":"","sources":["../../../lib/commands/keyboard.
|
|
1
|
+
{"version":3,"file":"keyboard.d.ts","sourceRoot":"","sources":["../../../lib/commands/keyboard.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,yBAAyB,EAAC,MAAM,WAAW,CAAC;AACzD,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,uBAAuB,CAAC;AAExD;;;;;GAKG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,yBAAyB,EAC/B,OAAO,EAAE,MAAM,GAAG,MAAM,EACxB,SAAS,CAAC,EAAE,MAAM,EAClB,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC,CAMf;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,yBAAyB,EAC/B,OAAO,EAAE,MAAM,GAAG,MAAM,EACxB,SAAS,EAAE,MAAM,EACjB,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC,CAMf;AAED;;;;;;GAMG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,yBAAyB,EAC/B,OAAO,EAAE,MAAM,EACf,SAAS,CAAC,EAAE,MAAM,EAClB,KAAK,CAAC,EAAE,MAAM,EACd,WAAW,GAAE,OAAe,GAC3B,OAAO,CAAC,IAAI,CAAC,CAMf;AAED;;;;;GAKG;AACH,wBAAsB,UAAU,CAC9B,IAAI,EAAE,yBAAyB,EAC/B,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAC9B,OAAO,CAAC,OAAO,CAAC,CAKlB;AAED;;;GAGG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE,yBAAyB,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAErG;AAED;;;;GAIG;AACH,wBAAsB,QAAQ,CAC5B,IAAI,EAAE,yBAAyB,EAC/B,OAAO,EAAE,MAAM,GAAG,MAAM,EACxB,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,IAAI,CAAC,CAGf"}
|
|
@@ -12,11 +12,10 @@ exports.keyevent = keyevent;
|
|
|
12
12
|
const driver_1 = require("appium/driver");
|
|
13
13
|
const lodash_1 = __importDefault(require("lodash"));
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
16
|
-
* @param
|
|
17
|
-
* @param
|
|
18
|
-
* @param
|
|
19
|
-
* @returns {Promise<void>}
|
|
15
|
+
* Presses a key code with optional metastate and flags.
|
|
16
|
+
* @param keycode - Android key code to press.
|
|
17
|
+
* @param metastate - Optional meta state modifier keys.
|
|
18
|
+
* @param flags - Optional flags for the key event.
|
|
20
19
|
*/
|
|
21
20
|
async function pressKeyCode(keycode, metastate, flags) {
|
|
22
21
|
await this.uiautomator2.jwproxy.command('/appium/device/press_keycode', 'POST', {
|
|
@@ -26,11 +25,10 @@ async function pressKeyCode(keycode, metastate, flags) {
|
|
|
26
25
|
});
|
|
27
26
|
}
|
|
28
27
|
/**
|
|
29
|
-
*
|
|
30
|
-
* @param
|
|
31
|
-
* @param
|
|
32
|
-
* @param
|
|
33
|
-
* @returns {Promise<void>}
|
|
28
|
+
* Long presses a key code with optional metastate and flags.
|
|
29
|
+
* @param keycode - Android key code to long press.
|
|
30
|
+
* @param metastate - Meta state modifier keys.
|
|
31
|
+
* @param flags - Optional flags for the key event.
|
|
34
32
|
*/
|
|
35
33
|
async function longPressKeyCode(keycode, metastate, flags) {
|
|
36
34
|
await this.uiautomator2.jwproxy.command('/appium/device/long_press_keycode', 'POST', {
|
|
@@ -40,15 +38,11 @@ async function longPressKeyCode(keycode, metastate, flags) {
|
|
|
40
38
|
});
|
|
41
39
|
}
|
|
42
40
|
/**
|
|
43
|
-
*
|
|
44
|
-
* @param
|
|
45
|
-
*
|
|
46
|
-
* @param
|
|
47
|
-
*
|
|
48
|
-
* @param {string} [flags] Flags for the particular key event. See
|
|
49
|
-
* https://developer.android.com/reference/android/view/KeyEvent for more details.
|
|
50
|
-
* @param {boolean} [isLongPress=false] Whether to emulate long key press
|
|
51
|
-
* @returns {Promise<void>}
|
|
41
|
+
* Presses a key code with optional metastate, flags, and long press support.
|
|
42
|
+
* @param keycode - Android key code to press.
|
|
43
|
+
* @param metastate - Optional meta state modifier keys.
|
|
44
|
+
* @param flags - Optional flags for the key event.
|
|
45
|
+
* @param isLongPress - Whether to perform a long press. Defaults to false.
|
|
52
46
|
*/
|
|
53
47
|
async function mobilePressKey(keycode, metastate, flags, isLongPress = false) {
|
|
54
48
|
await this.uiautomator2.jwproxy.command(`/appium/device/${isLongPress ? 'long_' : ''}press_keycode`, 'POST', {
|
|
@@ -58,14 +52,10 @@ async function mobilePressKey(keycode, metastate, flags, isLongPress = false) {
|
|
|
58
52
|
});
|
|
59
53
|
}
|
|
60
54
|
/**
|
|
61
|
-
* Types the given Unicode string.
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
* @this {AndroidUiautomator2Driver}
|
|
66
|
-
* @param {string | number | boolean} text The text to type. Can be a string, number or boolean.
|
|
67
|
-
* @returns {Promise<boolean>} `true` if the input text has been successfully sent to adb
|
|
68
|
-
* @throws {Error} if `text` property has not been provided
|
|
55
|
+
* Types the given Unicode string. The focus should already be on the destination input field.
|
|
56
|
+
* @param text - Text to type. Can be a string, number, or boolean.
|
|
57
|
+
* @returns True if the input text has been successfully sent to adb.
|
|
58
|
+
* @throws {errors.InvalidArgumentError} If the text argument is not provided.
|
|
69
59
|
*/
|
|
70
60
|
async function mobileType(text) {
|
|
71
61
|
if (lodash_1.default.isUndefined(text)) {
|
|
@@ -74,24 +64,19 @@ async function mobileType(text) {
|
|
|
74
64
|
return await this.settingsApp.typeUnicode(String(text));
|
|
75
65
|
}
|
|
76
66
|
/**
|
|
77
|
-
*
|
|
78
|
-
* @param
|
|
79
|
-
* @returns {Promise<void>}
|
|
67
|
+
* Sends keys to the current element.
|
|
68
|
+
* @param params - Options containing the text to send and optional replace flag.
|
|
80
69
|
*/
|
|
81
70
|
async function doSendKeys(params) {
|
|
82
71
|
await this.uiautomator2.jwproxy.command('/keys', 'POST', params);
|
|
83
72
|
}
|
|
84
73
|
/**
|
|
85
|
-
*
|
|
86
|
-
* @param
|
|
87
|
-
* @param
|
|
88
|
-
* @returns {Promise<void>}
|
|
74
|
+
* Sends a key event to the device.
|
|
75
|
+
* @param keycode - Android key code to send.
|
|
76
|
+
* @param metastate - Optional meta state (ignored in this implementation).
|
|
89
77
|
*/
|
|
90
78
|
async function keyevent(keycode, metastate) {
|
|
91
79
|
this.log.debug(`Ignoring metastate ${metastate}`);
|
|
92
80
|
await this.adb.keyevent(keycode);
|
|
93
81
|
}
|
|
94
|
-
/**
|
|
95
|
-
* @typedef {import('../driver').AndroidUiautomator2Driver} AndroidUiautomator2Driver
|
|
96
|
-
*/
|
|
97
82
|
//# sourceMappingURL=keyboard.js.map
|