appium-uiautomator2-driver 6.7.5 → 6.7.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## [6.7.6](https://github.com/appium/appium-uiautomator2-driver/compare/v6.7.5...v6.7.6) (2025-12-23)
2
+
3
+ ### Miscellaneous Chores
4
+
5
+ * Migrate various command modules to typescript (part 2) ([#970](https://github.com/appium/appium-uiautomator2-driver/issues/970)) ([976d79d](https://github.com/appium/appium-uiautomator2-driver/commit/976d79dcb122f5ba28128d16c7b90a5d37dc868f))
6
+
1
7
  ## [6.7.5](https://github.com/appium/appium-uiautomator2-driver/compare/v6.7.4...v6.7.5) (2025-12-22)
2
8
 
3
9
  ### Miscellaneous Chores
@@ -1,102 +1,68 @@
1
+ import type { DoSetElementValueOpts } from 'appium-android-driver';
2
+ import type { Element as AppiumElement, Position, Rect, Size } from '@appium/types';
3
+ import type { AndroidUiautomator2Driver } from '../driver';
1
4
  /**
2
- * @this {AndroidUiautomator2Driver}
3
- * @returns {Promise<import('@appium/types').Element>}
5
+ * Gets the currently active element.
4
6
  */
5
- export function active(this: import("../driver").AndroidUiautomator2Driver): Promise<import("@appium/types").Element>;
7
+ export declare function active(this: AndroidUiautomator2Driver): Promise<AppiumElement>;
6
8
  /**
7
- * @this {AndroidUiautomator2Driver}
8
- * @param {string} attribute
9
- * @param {string} elementId
10
- * @returns {Promise<string?>}
9
+ * Gets an element attribute value.
11
10
  */
12
- export function getAttribute(this: import("../driver").AndroidUiautomator2Driver, attribute: string, elementId: string): Promise<string | null>;
11
+ export declare function getAttribute(this: AndroidUiautomator2Driver, attribute: string, elementId: string): Promise<string>;
13
12
  /**
14
- * @this {AndroidUiautomator2Driver}
15
- * @param {string} elementId
16
- * @returns {Promise<boolean>}
13
+ * Returns whether the element is displayed.
17
14
  */
18
- export function elementDisplayed(this: import("../driver").AndroidUiautomator2Driver, elementId: string): Promise<boolean>;
15
+ export declare function elementDisplayed(this: AndroidUiautomator2Driver, elementId: string): Promise<boolean>;
19
16
  /**
20
- * @this {AndroidUiautomator2Driver}
21
- * @param {string} elementId
22
- * @returns {Promise<boolean>}
17
+ * Returns whether the element is enabled.
23
18
  */
24
- export function elementEnabled(this: import("../driver").AndroidUiautomator2Driver, elementId: string): Promise<boolean>;
19
+ export declare function elementEnabled(this: AndroidUiautomator2Driver, elementId: string): Promise<boolean>;
25
20
  /**
26
- * @this {AndroidUiautomator2Driver}
27
- * @param {string} elementId
28
- * @returns {Promise<boolean>}
21
+ * Returns whether the element is selected.
29
22
  */
30
- export function elementSelected(this: import("../driver").AndroidUiautomator2Driver, elementId: string): Promise<boolean>;
23
+ export declare function elementSelected(this: AndroidUiautomator2Driver, elementId: string): Promise<boolean>;
31
24
  /**
32
- * @this {AndroidUiautomator2Driver}
33
- * @param {string} elementId
34
- * @returns {Promise<string>}
25
+ * Gets the element tag name.
35
26
  */
36
- export function getName(this: import("../driver").AndroidUiautomator2Driver, elementId: string): Promise<string>;
27
+ export declare function getName(this: AndroidUiautomator2Driver, elementId: string): Promise<string>;
37
28
  /**
38
- * @this {AndroidUiautomator2Driver}
39
- * @param {string} elementId
40
- * @returns {Promise<import('@appium/types').Position>}
29
+ * Gets the element location.
41
30
  */
42
- export function getLocation(this: import("../driver").AndroidUiautomator2Driver, elementId: string): Promise<import("@appium/types").Position>;
31
+ export declare function getLocation(this: AndroidUiautomator2Driver, elementId: string): Promise<Position>;
43
32
  /**
44
- * @this {AndroidUiautomator2Driver}
45
- * @param {string} elementId
46
- * @returns {Promise<import('@appium/types').Size>}
33
+ * Gets the element size.
47
34
  */
48
- export function getSize(this: import("../driver").AndroidUiautomator2Driver, elementId: string): Promise<import("@appium/types").Size>;
35
+ export declare function getSize(this: AndroidUiautomator2Driver, elementId: string): Promise<Size>;
49
36
  /**
50
- * @this {AndroidUiautomator2Driver}
51
- * @param {import('appium-android-driver').DoSetElementValueOpts} params
52
- * @returns {Promise<void>}
37
+ * Sets the value of an element using the upstream driver API.
53
38
  */
54
- export function doSetElementValue(this: import("../driver").AndroidUiautomator2Driver, params: import("appium-android-driver").DoSetElementValueOpts): Promise<void>;
39
+ export declare function doSetElementValue(this: AndroidUiautomator2Driver, params: DoSetElementValueOpts): Promise<void>;
55
40
  /**
56
- * @this {AndroidUiautomator2Driver}
57
- * @param {string|string[]} keys
58
- * @param {string} elementId
59
- * @returns {Promise<void>}
41
+ * Sends text to an element without replacement.
60
42
  */
61
- export function setValueImmediate(this: import("../driver").AndroidUiautomator2Driver, keys: string | string[], elementId: string): Promise<void>;
43
+ export declare function setValueImmediate(this: AndroidUiautomator2Driver, keys: string | string[], elementId: string): Promise<void>;
62
44
  /**
63
- * @this {AndroidUiautomator2Driver}
64
- * @param {string} elementId
65
- * @returns {Promise<string>}
45
+ * Gets the element text.
66
46
  */
67
- export function getText(this: import("../driver").AndroidUiautomator2Driver, elementId: string): Promise<string>;
47
+ export declare function getText(this: AndroidUiautomator2Driver, elementId: string): Promise<string>;
68
48
  /**
69
- * @this {AndroidUiautomator2Driver}
70
- * @param {string} element
71
- * @returns {Promise<void>}
49
+ * Clicks the given element.
72
50
  */
73
- export function click(this: import("../driver").AndroidUiautomator2Driver, element: string): Promise<void>;
51
+ export declare function click(this: AndroidUiautomator2Driver, element: string): Promise<void>;
74
52
  /**
75
- * @this {AndroidUiautomator2Driver}
76
- * @param {string} element
77
- * @returns {Promise<string>}
53
+ * Takes a screenshot of the element.
78
54
  */
79
- export function getElementScreenshot(this: import("../driver").AndroidUiautomator2Driver, element: string): Promise<string>;
55
+ export declare function getElementScreenshot(this: AndroidUiautomator2Driver, element: string): Promise<string>;
80
56
  /**
81
- * @this {AndroidUiautomator2Driver}
82
- * @param {string} elementId
83
- * @returns {Promise<void>}
57
+ * Clears the element text.
84
58
  */
85
- export function clear(this: import("../driver").AndroidUiautomator2Driver, elementId: string): Promise<void>;
59
+ export declare function clear(this: AndroidUiautomator2Driver, elementId: string): Promise<void>;
86
60
  /**
87
- * @this {AndroidUiautomator2Driver}
88
- * @param {string} elementId
89
- * @returns {Promise<import('@appium/types').Rect>}
61
+ * Gets the element rectangle.
90
62
  */
91
- export function getElementRect(this: import("../driver").AndroidUiautomator2Driver, elementId: string): Promise<import("@appium/types").Rect>;
63
+ export declare function getElementRect(this: AndroidUiautomator2Driver, elementId: string): Promise<Rect>;
92
64
  /**
93
- * Sends text to the given element by replacing its previous content
94
- * @this {AndroidUiautomator2Driver}
95
- * @param {string} elementId The id of the element whose content will be replaced.
96
- * @param {string} text The actual text to set.
97
- * @throws {Error} If there was a faulre while setting the text
98
- * @returns {Promise<void>}
65
+ * Replaces the element text.
99
66
  */
100
- export function mobileReplaceElementValue(this: import("../driver").AndroidUiautomator2Driver, elementId: string, text: string): Promise<void>;
101
- export type AndroidUiautomator2Driver = import("../driver").AndroidUiautomator2Driver;
67
+ export declare function mobileReplaceElementValue(this: AndroidUiautomator2Driver, elementId: string, text: string): Promise<void>;
102
68
  //# sourceMappingURL=element.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../../../lib/commands/element.js"],"names":[],"mappings":"AAIA;;;GAGG;AACH,6EAFa,OAAO,CAAC,OAAO,eAAe,EAAE,OAAO,CAAC,CASpD;AAED;;;;;GAKG;AACH,6FAJW,MAAM,aACN,MAAM,GACJ,OAAO,CAAC,MAAM,OAAC,CAAC,CAU5B;AAED;;;;GAIG;AACH,iGAHW,MAAM,GACJ,OAAO,CAAC,OAAO,CAAC,CAI5B;AAED;;;;GAIG;AACH,+FAHW,MAAM,GACJ,OAAO,CAAC,OAAO,CAAC,CAI5B;AAED;;;;GAIG;AACH,gGAHW,MAAM,GACJ,OAAO,CAAC,OAAO,CAAC,CAI5B;AAED;;;;GAIG;AACH,wFAHW,MAAM,GACJ,OAAO,CAAC,MAAM,CAAC,CAU3B;AAED;;;;GAIG;AACH,4FAHW,MAAM,GACJ,OAAO,CAAC,OAAO,eAAe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AACH,wBAAsB,KAAK,CAAC,IAAI,EAAE,yBAAyB,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE3F;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,yBAAyB,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAE5G;AAED;;GAEG;AACH,wBAAsB,KAAK,CAAC,IAAI,EAAE,yBAAyB,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE7F;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,yBAAyB,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CActG;AAED;;GAEG;AACH,wBAAsB,yBAAyB,CAC7C,IAAI,EAAE,yBAAyB,EAC/B,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,IAAI,CAAC,CAKf"}
@@ -19,86 +19,65 @@ exports.getElementScreenshot = getElementScreenshot;
19
19
  exports.clear = clear;
20
20
  exports.getElementRect = getElementRect;
21
21
  exports.mobileReplaceElementValue = mobileReplaceElementValue;
22
+ const driver_1 = require("appium/driver");
22
23
  const bluebird_1 = __importDefault(require("bluebird"));
23
24
  const lodash_1 = __importDefault(require("lodash"));
24
- const driver_1 = require("appium/driver");
25
25
  /**
26
- * @this {AndroidUiautomator2Driver}
27
- * @returns {Promise<import('@appium/types').Element>}
26
+ * Gets the currently active element.
28
27
  */
29
28
  async function active() {
30
- return /** @type {import('@appium/types').Element} */ (await this.uiautomator2.jwproxy.command('/element/active', 'GET'));
29
+ return (await this.uiautomator2.jwproxy.command('/element/active', 'GET'));
31
30
  }
32
31
  /**
33
- * @this {AndroidUiautomator2Driver}
34
- * @param {string} attribute
35
- * @param {string} elementId
36
- * @returns {Promise<string?>}
32
+ * Gets an element attribute value.
37
33
  */
38
34
  async function getAttribute(attribute, elementId) {
39
35
  return String(await this.uiautomator2.jwproxy.command(`/element/${elementId}/attribute/${attribute}`, 'GET', {}));
40
36
  }
41
37
  /**
42
- * @this {AndroidUiautomator2Driver}
43
- * @param {string} elementId
44
- * @returns {Promise<boolean>}
38
+ * Returns whether the element is displayed.
45
39
  */
46
40
  async function elementDisplayed(elementId) {
47
41
  return toBool(await this.getAttribute('displayed', elementId));
48
42
  }
49
43
  /**
50
- * @this {AndroidUiautomator2Driver}
51
- * @param {string} elementId
52
- * @returns {Promise<boolean>}
44
+ * Returns whether the element is enabled.
53
45
  */
54
46
  async function elementEnabled(elementId) {
55
47
  return toBool(await this.getAttribute('enabled', elementId));
56
48
  }
57
49
  /**
58
- * @this {AndroidUiautomator2Driver}
59
- * @param {string} elementId
60
- * @returns {Promise<boolean>}
50
+ * Returns whether the element is selected.
61
51
  */
62
52
  async function elementSelected(elementId) {
63
53
  return toBool(await this.getAttribute('selected', elementId));
64
54
  }
65
55
  /**
66
- * @this {AndroidUiautomator2Driver}
67
- * @param {string} elementId
68
- * @returns {Promise<string>}
56
+ * Gets the element tag name.
69
57
  */
70
58
  async function getName(elementId) {
71
- return /** @type {string} */ (await this.uiautomator2.jwproxy.command(`/element/${elementId}/name`, 'GET', {}));
59
+ return (await this.uiautomator2.jwproxy.command(`/element/${elementId}/name`, 'GET', {}));
72
60
  }
73
61
  /**
74
- * @this {AndroidUiautomator2Driver}
75
- * @param {string} elementId
76
- * @returns {Promise<import('@appium/types').Position>}
62
+ * Gets the element location.
77
63
  */
78
64
  async function getLocation(elementId) {
79
- return /** @type {import('@appium/types').Position} */ (await this.uiautomator2.jwproxy.command(`/element/${elementId}/location`, 'GET', {}));
65
+ return (await this.uiautomator2.jwproxy.command(`/element/${elementId}/location`, 'GET', {}));
80
66
  }
81
67
  /**
82
- * @this {AndroidUiautomator2Driver}
83
- * @param {string} elementId
84
- * @returns {Promise<import('@appium/types').Size>}
68
+ * Gets the element size.
85
69
  */
86
70
  async function getSize(elementId) {
87
- return /** @type {import('@appium/types').Size} */ (await this.uiautomator2.jwproxy.command(`/element/${elementId}/size`, 'GET', {}));
71
+ return (await this.uiautomator2.jwproxy.command(`/element/${elementId}/size`, 'GET', {}));
88
72
  }
89
73
  /**
90
- * @this {AndroidUiautomator2Driver}
91
- * @param {import('appium-android-driver').DoSetElementValueOpts} params
92
- * @returns {Promise<void>}
74
+ * Sets the value of an element using the upstream driver API.
93
75
  */
94
76
  async function doSetElementValue(params) {
95
77
  await this.uiautomator2.jwproxy.command(`/element/${params.elementId}/value`, 'POST', params);
96
78
  }
97
79
  /**
98
- * @this {AndroidUiautomator2Driver}
99
- * @param {string|string[]} keys
100
- * @param {string} elementId
101
- * @returns {Promise<void>}
80
+ * Sends text to an element without replacement.
102
81
  */
103
82
  async function setValueImmediate(keys, elementId) {
104
83
  await this.uiautomator2.jwproxy.command(`/element/${elementId}/value`, 'POST', {
@@ -108,67 +87,48 @@ async function setValueImmediate(keys, elementId) {
108
87
  });
109
88
  }
110
89
  /**
111
- * @this {AndroidUiautomator2Driver}
112
- * @param {string} elementId
113
- * @returns {Promise<string>}
90
+ * Gets the element text.
114
91
  */
115
92
  async function getText(elementId) {
116
93
  return String(await this.uiautomator2.jwproxy.command(`/element/${elementId}/text`, 'GET', {}));
117
94
  }
118
95
  /**
119
- * @this {AndroidUiautomator2Driver}
120
- * @param {string} element
121
- * @returns {Promise<void>}
96
+ * Clicks the given element.
122
97
  */
123
98
  async function click(element) {
124
99
  await this.uiautomator2.jwproxy.command(`/element/${element}/click`, 'POST', { element });
125
100
  }
126
101
  /**
127
- * @this {AndroidUiautomator2Driver}
128
- * @param {string} element
129
- * @returns {Promise<string>}
102
+ * Takes a screenshot of the element.
130
103
  */
131
104
  async function getElementScreenshot(element) {
132
105
  return String(await this.uiautomator2.jwproxy.command(`/element/${element}/screenshot`, 'GET', {}));
133
106
  }
134
107
  /**
135
- * @this {AndroidUiautomator2Driver}
136
- * @param {string} elementId
137
- * @returns {Promise<void>}
108
+ * Clears the element text.
138
109
  */
139
110
  async function clear(elementId) {
140
- await this.uiautomator2.jwproxy.command(`/element/${elementId}/clear`, 'POST', {
141
- elementId,
142
- });
111
+ await this.uiautomator2.jwproxy.command(`/element/${elementId}/clear`, 'POST', { elementId });
143
112
  }
144
113
  /**
145
- * @this {AndroidUiautomator2Driver}
146
- * @param {string} elementId
147
- * @returns {Promise<import('@appium/types').Rect>}
114
+ * Gets the element rectangle.
148
115
  */
149
116
  async function getElementRect(elementId) {
150
- const chromedriver = /** @type {import('appium-chromedriver').default} */ (this.chromedriver);
151
- if (this.isWebContext()) {
152
- this.log.debug(`Detected downstream chromedriver protocol: ${chromedriver.jwproxy.downstreamProtocol}`);
153
- if (chromedriver.jwproxy.downstreamProtocol === driver_1.PROTOCOLS.MJSONWP) {
154
- const [{ x, y }, { width, height }] =
155
- /** @type {[import('@appium/types').Position, import('@appium/types').Size]} */ (await bluebird_1.default.all([
156
- chromedriver.jwproxy.command(`/element/${elementId}/location`, 'GET'),
157
- chromedriver.jwproxy.command(`/element/${elementId}/size`, 'GET'),
158
- ]));
159
- return { x, y, width, height };
160
- }
161
- return /** @type {import('@appium/types').Rect} */ (await chromedriver.jwproxy.command(`/element/${elementId}/rect`, 'GET'));
117
+ if (!this.isWebContext()) {
118
+ return (await this.uiautomator2.jwproxy.command(`/element/${elementId}/rect`, 'GET'));
119
+ }
120
+ const chromedriver = this.chromedriver;
121
+ if (chromedriver.jwproxy.downstreamProtocol === driver_1.PROTOCOLS.MJSONWP) {
122
+ const [{ x, y }, { width, height }] = (await bluebird_1.default.all([
123
+ chromedriver.jwproxy.command(`/element/${elementId}/location`, 'GET'),
124
+ chromedriver.jwproxy.command(`/element/${elementId}/size`, 'GET'),
125
+ ]));
126
+ return { x, y, width, height };
162
127
  }
163
- return /** @type {import('@appium/types').Rect} */ (await this.uiautomator2.jwproxy.command(`/element/${elementId}/rect`, 'GET'));
128
+ return (await chromedriver.jwproxy.command(`/element/${elementId}/rect`, 'GET'));
164
129
  }
165
130
  /**
166
- * Sends text to the given element by replacing its previous content
167
- * @this {AndroidUiautomator2Driver}
168
- * @param {string} elementId The id of the element whose content will be replaced.
169
- * @param {string} text The actual text to set.
170
- * @throws {Error} If there was a faulre while setting the text
171
- * @returns {Promise<void>}
131
+ * Replaces the element text.
172
132
  */
173
133
  async function mobileReplaceElementValue(elementId, text) {
174
134
  await this.uiautomator2.jwproxy.command(`/element/${elementId}/value`, 'POST', {
@@ -176,16 +136,7 @@ async function mobileReplaceElementValue(elementId, text) {
176
136
  replace: true,
177
137
  });
178
138
  }
179
- // #region Internal Helpers
180
- /**
181
- * @param {any} s
182
- * @returns {boolean}
183
- */
184
- function toBool(s) {
185
- return lodash_1.default.isString(s) ? s.toLowerCase() === 'true' : !!s;
139
+ function toBool(value) {
140
+ return lodash_1.default.isString(value) ? value.toLowerCase() === 'true' : !!value;
186
141
  }
187
- // #endregion
188
- /**
189
- * @typedef {import('../driver').AndroidUiautomator2Driver} AndroidUiautomator2Driver
190
- */
191
142
  //# sourceMappingURL=element.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"element.js","sourceRoot":"","sources":["../../../lib/commands/element.js"],"names":[],"mappings":";;;;;AAQA,wBAOC;AAQD,oCAQC;AAOD,4CAEC;AAOD,wCAEC;AAOD,0CAEC;AAOD,0BAQC;AAOD,kCAQC;AAOD,0BAQC;AAOD,8CAMC;AAQD,8CAUC;AAOD,0BAQC;AAOD,sBAMC;AAOD,oDAQC;AAOD,sBAQC;AAOD,wCA0BC;AAUD,8DASC;AApPD,wDAAyB;AACzB,oDAAuB;AACvB,0CAAwC;AAExC;;;GAGG;AACI,KAAK,UAAU,MAAM;IAC1B,OAAO,8CAA8C,CAAC,CACpD,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CACrC,iBAAiB,EACjB,KAAK,CACN,CACF,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACI,KAAK,UAAU,YAAY,CAAC,SAAS,EAAE,SAAS;IACrD,OAAO,MAAM,CACX,MAAM,IA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GAAG,IAAI,CAAC,YAA4B,CAAC;IACvD,IAAI,YAAY,CAAC,OAAO,CAAC,kBAAkB,KAAK,kBAAS,CAAC,OAAO,EAAE,CAAC;QAClE,MAAM,CAAC,EAAC,CAAC,EAAE,CAAC,EAAC,EAAE,EAAC,KAAK,EAAE,MAAM,EAAC,CAAC,GAAG,CAAC,MAAM,kBAAC,CAAC,GAAG,CAAC;YAC7C,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,SAAS,WAAW,EAAE,KAAK,CAAC;YACrE,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,SAAS,OAAO,EAAE,KAAK,CAAC;SAClE,CAAC,CAAqB,CAAC;QACxB,OAAO,EAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAC,CAAC;IAC/B,CAAC;IACD,OAAO,CAAC,MAAM,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,SAAS,OAAO,EAAE,KAAK,CAAC,CAAS,CAAC;AAC3F,CAAC;AAED;;GAEG;AACI,KAAK,UAAU,yBAAyB,CAE7C,SAAiB,EACjB,IAAY;IAEZ,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,SAAS,QAAQ,EAAE,MAAM,EAAE;QAC7E,IAAI;QACJ,OAAO,EAAE,IAAI;KACd,CAAC,CAAC;AACL,CAAC;AAED,SAAS,MAAM,CAAC,KAAU;IACxB,OAAO,gBAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AACtE,CAAC"}
@@ -1,212 +1,47 @@
1
+ import type { Element as AppiumElement } from '@appium/types';
2
+ import type { AndroidUiautomator2Driver } from '../driver';
1
3
  /**
2
- * Performs a simple click/tap gesture
3
- *
4
- * @this {AndroidUiautomator2Driver}
5
- * @param {string} [elementId] The id of the element to be clicked.
6
- * If the element is missing then both click offset coordinates must be provided.
7
- * If both the element id and offset are provided then the coordinates are parsed
8
- * as relative offsets from the top left corner of the element.
9
- * @param {number} [x] The x coordinate to click on.
10
- * @param {number} [y] The y coordinate to click on.
11
- * @returns {Promise<void>}
12
- * @throws {Error} if provided options are not valid
4
+ * Performs a simple click/tap gesture.
13
5
  */
14
- export function mobileClickGesture(this: import("../driver").AndroidUiautomator2Driver, elementId?: string, x?: number, y?: number): Promise<void>;
6
+ export declare function mobileClickGesture(this: AndroidUiautomator2Driver, elementId?: AppiumElement | string, x?: number, y?: number): Promise<void>;
15
7
  /**
16
- * Performs a click that lasts for the given duration
17
- *
18
- * @this {AndroidUiautomator2Driver}
19
- * @param {string} [elementId] The id of the element to be clicked.
20
- * If the element is missing then both click offset coordinates must be provided.
21
- * If both the element id and offset are provided then the coordinates are parsed
22
- * as relative offsets from the top left corner of the element.
23
- * @param {number} [x] The x coordinate to click on.
24
- * @param {number} [y] The y coordinate to click on.
25
- * @param {number} [duration] Click duration in milliseconds. The value must not be negative.
26
- * Default is 500.
27
- * @returns {Promise<void>}
28
- * @throws {Error} if provided options are not valid
8
+ * Performs a long click with an optional duration.
29
9
  */
30
- export function mobileLongClickGesture(this: import("../driver").AndroidUiautomator2Driver, elementId?: string, x?: number, y?: number, duration?: number): Promise<void>;
10
+ export declare function mobileLongClickGesture(this: AndroidUiautomator2Driver, elementId?: AppiumElement | string, x?: number, y?: number, duration?: number): Promise<void>;
31
11
  /**
32
- * Performs a click that lasts for the given duration
33
- * @this {AndroidUiautomator2Driver}
34
- * @param {string} [elementId] The id of the element to be clicked.
35
- * If the element is missing then both click offset coordinates must be provided.
36
- * If both the element id and offset are provided then the coordinates are parsed
37
- * as relative offsets from the top left corner of the element.
38
- * @param {number} [x] The x coordinate to click on.
39
- * @param {number} [y] The y coordinate to click on.
40
- * @returns {Promise<void>}
41
- * @throws {Error} if provided options are not valid
12
+ * Performs a double-click gesture.
42
13
  */
43
- export function mobileDoubleClickGesture(this: import("../driver").AndroidUiautomator2Driver, elementId?: string, x?: number, y?: number): Promise<void>;
14
+ export declare function mobileDoubleClickGesture(this: AndroidUiautomator2Driver, elementId?: AppiumElement | string, x?: number, y?: number): Promise<void>;
44
15
  /**
45
- * Drags this object to the specified location.
46
- * @this {AndroidUiautomator2Driver}
47
- * @param {string} [elementId] The id of the element to be dragged.
48
- * If the element id is missing then the start coordinates must be provided.
49
- * If both the element id and the start coordinates are provided then these
50
- * coordinates are considered as offsets from the top left element corner.
51
- * @param {number} [startX] The x coordinate where the dragging starts
52
- * @param {number} [startY] The y coordinate where the dragging starts
53
- * @param {number} [endX] The x coordinate where the dragging ends
54
- * @param {number} [endY] The y coordinate where the dragging ends
55
- * @param {number} [speed] The speed at which to perform this gesture in pixels per second.
56
- * The value must not be negative.
57
- * Default is 2500 * displayDensity.
58
- * @returns {Promise<void>}
59
- * @throws {Error} if provided options are not valid
16
+ * Drags from a start point to an end point.
60
17
  */
61
- export function mobileDragGesture(this: import("../driver").AndroidUiautomator2Driver, elementId?: string, startX?: number, startY?: number, endX?: number, endY?: number, speed?: number): Promise<void>;
18
+ export declare function mobileDragGesture(this: AndroidUiautomator2Driver, elementId?: AppiumElement | string, startX?: number, startY?: number, endX?: number, endY?: number, speed?: number): Promise<void>;
62
19
  /**
63
- * Drags to the specified location.
64
- *
65
- * @throws {Error} if provided options are not valid
66
- * @this {AndroidUiautomator2Driver}
67
- * @param {string} direction Direction of the fling.
68
- * Acceptable values are: `up`, `down`, `left` and `right` (case insensitive).
69
- * @param {string} [elementId] The id of the element to be flinged.
70
- * If the element id is missing then fling bounding area must be provided.
71
- * If both the element id and the fling bounding area are provided then this
72
- * area is effectively ignored.
73
- * @param {number} [left] The left coordinate of the fling bounding area.
74
- * @param {number} [top] The top coordinate of the fling bounding area.
75
- * @param {number} [width] The width of the fling bounding area.
76
- * @param {number} [height] The height of the fling bounding area.
77
- * @param {number} [speed] The speed at which to perform this gesture in pixels per second.
78
- * The value must be greater than the minimum fling velocity for the given view (50 by default).
79
- * Default is 7500 * displayDensity.
80
- * @returns {Promise<boolean>} True if the object can still scroll in the given direction.
20
+ * Performs a fling gesture and reports if further scrolling is possible.
81
21
  */
82
- export function mobileFlingGesture(this: import("../driver").AndroidUiautomator2Driver, direction: string, elementId?: string, left?: number, top?: number, width?: number, height?: number, speed?: number): Promise<boolean>;
22
+ export declare function mobileFlingGesture(this: AndroidUiautomator2Driver, direction: string, elementId?: AppiumElement | string, left?: number, top?: number, width?: number, height?: number, speed?: number): Promise<boolean>;
83
23
  /**
84
- * Performs a pinch close gesture.
85
- * @this {AndroidUiautomator2Driver}
86
- * @param {number} percent The size of the pinch as a percentage of the pinch area size.
87
- * Valid values must be float numbers in range 0..1, where 1.0 is 100%
88
- * @param {string} [elementId] The id of the element to be pinched.
89
- * If the element id is missing then pinch bounding area must be provided.
90
- * If both the element id and the pinch bounding area are provided then the
91
- * area is effectively ignored.
92
- * @param {number} [left] The left coordinate of the pinch bounding area.
93
- * @param {number} [top] The top coordinate of the pinch bounding area.
94
- * @param {number} [width] The width of the pinch bounding area.
95
- * @param {number} [height] The height of the pinch bounding area.
96
- * @param {number} [speed] The speed at which to perform this gesture in pixels per second.
97
- * The value must not be negative.
98
- * Default is 2500 * displayDensity.
99
- * @returns {Promise<void>}
100
- * @throws {Error} if provided options are not valid
24
+ * Performs a pinch-close gesture.
101
25
  */
102
- export function mobilePinchCloseGesture(this: import("../driver").AndroidUiautomator2Driver, percent: number, elementId?: string, left?: number, top?: number, width?: number, height?: number, speed?: number): Promise<void>;
26
+ export declare function mobilePinchCloseGesture(this: AndroidUiautomator2Driver, percent: number, elementId?: AppiumElement | string, left?: number, top?: number, width?: number, height?: number, speed?: number): Promise<void>;
103
27
  /**
104
- * Performs a pinch open gesture.
105
- * @this {AndroidUiautomator2Driver}
106
- * @param {number} percent The size of the pinch as a percentage of the pinch area size.
107
- * Valid values must be float numbers in range 0..1, where 1.0 is 100%
108
- * @param {string} [elementId] The id of the element to be pinched.
109
- * If the element id is missing then pinch bounding area must be provided.
110
- * If both the element id and the pinch bounding area are provided then the
111
- * area is effectively ignored.
112
- * @param {number} [left] The left coordinate of the pinch bounding area.
113
- * @param {number} [top] The top coordinate of the pinch bounding area.
114
- * @param {number} [width] The width of the pinch bounding area.
115
- * @param {number} [height] The height of the pinch bounding area.
116
- * @param {number} [speed] The speed at which to perform this gesture in pixels per second.
117
- * The value must not be negative.
118
- * Default is 2500 * displayDensity.
119
- * @returns {Promise<void>}
120
- * @throws {Error} if provided options are not valid
28
+ * Performs a pinch-open gesture.
121
29
  */
122
- export function mobilePinchOpenGesture(this: import("../driver").AndroidUiautomator2Driver, percent: number, elementId?: string, left?: number, top?: number, width?: number, height?: number, speed?: number): Promise<void>;
30
+ export declare function mobilePinchOpenGesture(this: AndroidUiautomator2Driver, percent: number, elementId?: AppiumElement | string, left?: number, top?: number, width?: number, height?: number, speed?: number): Promise<void>;
123
31
  /**
124
- * Performs a swipe gesture.
125
- * @this {AndroidUiautomator2Driver}
126
- * @param {string} direction Direction of the swipe.
127
- * Acceptable values are: `up`, `down`, `left` and `right` (case insensitive).
128
- * @param {number} percent The size of the swipe as a percentage of the swipe area size.
129
- * Valid values must be float numbers in range 0..1, where 1.0 is 100%.
130
- * @param {string} [elementId] The id of the element to be swiped.
131
- * If the element id is missing then swipe bounding area must be provided.
132
- * If both the element id and the swipe bounding area are provided then the
133
- * area is effectively ignored.
134
- * @param {number} [left] The left coordinate of the swipe bounding area.
135
- * @param {number} [top] The top coordinate of the swipe bounding area.
136
- * @param {number} [width] The width of the swipe bounding area.
137
- * @param {number} [height] The height of the swipe bounding area.
138
- * @param {number} [speed] The speed at which to perform this gesture in pixels per second.
139
- * The value must not be negative.
140
- * Default is 5000 * displayDensity.
141
- * @returns {Promise<void>}
142
- * @throws {Error} if provided options are not valid
32
+ * Performs a swipe gesture for the given direction and percent.
143
33
  */
144
- export function mobileSwipeGesture(this: import("../driver").AndroidUiautomator2Driver, direction: string, percent: number, elementId?: string, left?: number, top?: number, width?: number, height?: number, speed?: number): Promise<void>;
34
+ export declare function mobileSwipeGesture(this: AndroidUiautomator2Driver, direction: string, percent: number, elementId?: AppiumElement | string, left?: number, top?: number, width?: number, height?: number, speed?: number): Promise<void>;
145
35
  /**
146
- * Performs a scroll gesture.
147
- *
148
- * @throws {Error} if provided options are not valid
149
- * @this {AndroidUiautomator2Driver}
150
- * @param {string} direction Direction of the scroll.
151
- * Acceptable values are: `up`, `down`, `left` and `right` (case insensitive).
152
- * @param {number} percent The size of the scroll as a percentage of the scrolling area size.
153
- * Valid values must be float numbers greater than zero, where 1.0 is 100%.
154
- * @param {string} [elementId] The id of the element to be scrolled.
155
- * If the element id is missing then scroll bounding area must be provided.
156
- * If both the element id and the scroll bounding area are provided then this
157
- * area is effectively ignored.
158
- * @param {number} [left] The left coordinate of the scroll bounding area.
159
- * @param {number} [top] The top coordinate of the scroll bounding area.
160
- * @param {number} [width] The width of the scroll bounding area.
161
- * @param {number} [height] The height of the scroll bounding area.
162
- * @param {number} [speed] The speed at which to perform this gesture in pixels per second.
163
- * The value must not be negative.
164
- * Default is 5000 * displayDensity.
165
- * @returns {Promise<boolean>} True if the object can still scroll in the given direction.
36
+ * Performs a scroll gesture and reports if further scrolling is possible.
166
37
  */
167
- export function mobileScrollGesture(this: import("../driver").AndroidUiautomator2Driver, direction: string, percent: number, elementId?: string, left?: number, top?: number, width?: number, height?: number, speed?: number): Promise<boolean>;
38
+ export declare function mobileScrollGesture(this: AndroidUiautomator2Driver, direction: string, percent: number, elementId?: AppiumElement | string, left?: number, top?: number, width?: number, height?: number, speed?: number): Promise<boolean>;
168
39
  /**
169
- * Scrolls the given scrollable element `elementId` until `elementToId`
170
- * becomes visible. This function returns immediately if the `elementToId`
171
- * is already visible in the view port. Otherwise it would scroll
172
- * to the very beginning of the scrollable control and tries to reach the destination element
173
- * by scrolling its parent to the end step by step. The scroll direction (vertical or horizontal)
174
- * is detected automatically.
175
- * @this {AndroidUiautomator2Driver}
176
- * @param {string} elementId The identifier of the scrollable element, which is going to be scrolled.
177
- * It is required this element is a valid scrollable container and it was located
178
- * by `-android uiautomator` strategy.
179
- * @param {string} elementToId The identifier of the item, which belongs to the scrollable element above,
180
- * and which should become visible after the scrolling operation is finished.
181
- * It is required this element was located by `-android uiautomator` strategy.
182
- * @returns {Promise<void>}
183
- * @throws {Error} if the scrolling operation cannot be performed
40
+ * Scrolls a scrollable element until a target element becomes visible.
184
41
  */
185
- export function mobileScrollBackTo(this: import("../driver").AndroidUiautomator2Driver, elementId: string, elementToId: string): Promise<void>;
42
+ export declare function mobileScrollBackTo(this: AndroidUiautomator2Driver, elementId?: string, elementToId?: string): Promise<void>;
186
43
  /**
187
- * Scrolls the given scrollable element until the element identified
188
- * by `strategy` and `selector` becomes visible. This function returns immediately if the
189
- * destination element is already visible in the view port. Otherwise it would scroll
190
- * to the very beginning of the scrollable control and tries to reach the destination element
191
- * by scrolling its parent to the end step by step. The scroll direction (vertical or horizontal)
192
- * is detected automatically.
193
- *
194
- * @this {AndroidUiautomator2Driver}
195
- * @param {string} strategy The following strategies are supported:
196
- * - `accessibility id` (UiSelector().description)
197
- * - `class name` (UiSelector().className)
198
- * - `-android uiautomator` (UiSelector)
199
- * @param {string} selector The corresponding lookup value for the given strategy.
200
- * @param {string} [elementId] The identifier of an element. It is required this element is a valid scrollable container
201
- * and it was located by `-android uiautomator` strategy.
202
- * If this property is not provided then the first currently available scrollable view
203
- * is selected for the interaction.
204
- * @param {number} [maxSwipes] The maximum number of swipes to perform on the target scrollable view in order to reach
205
- * the destination element. In case this value is unset then it would be retrieved from the
206
- * scrollable element itself (via `getMaxSearchSwipes()` property).
207
- * @returns {Promise<void>}
208
- * @throws {Error} if the scrolling operation cannot be performed
44
+ * Scrolls until an element located by the given strategy is visible.
209
45
  */
210
- export function mobileScroll(this: import("../driver").AndroidUiautomator2Driver, strategy: string, selector: string, elementId?: string, maxSwipes?: number): Promise<void>;
211
- export type AndroidUiautomator2Driver = import("../driver").AndroidUiautomator2Driver;
46
+ export declare function mobileScroll(this: AndroidUiautomator2Driver, strategy: string, selector: string, elementId?: AppiumElement | string, maxSwipes?: number): Promise<void>;
212
47
  //# sourceMappingURL=gestures.d.ts.map