appium-android-driver 12.4.8 → 12.4.10
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/element.d.ts +90 -66
- package/build/lib/commands/element.d.ts.map +1 -1
- package/build/lib/commands/element.js +74 -53
- package/build/lib/commands/element.js.map +1 -1
- package/build/lib/commands/geolocation.d.ts +44 -36
- package/build/lib/commands/geolocation.d.ts.map +1 -1
- package/build/lib/commands/geolocation.js +38 -32
- package/build/lib/commands/geolocation.js.map +1 -1
- package/build/lib/commands/log.d.ts +43 -47
- package/build/lib/commands/log.d.ts.map +1 -1
- package/build/lib/commands/log.js +30 -55
- package/build/lib/commands/log.js.map +1 -1
- package/build/lib/commands/media-projection.d.ts +32 -36
- package/build/lib/commands/media-projection.d.ts.map +1 -1
- package/build/lib/commands/media-projection.js +27 -54
- package/build/lib/commands/media-projection.js.map +1 -1
- package/build/lib/commands/network.d.ts +59 -39
- package/build/lib/commands/network.d.ts.map +1 -1
- package/build/lib/commands/network.js +65 -45
- package/build/lib/commands/network.js.map +1 -1
- package/build/lib/commands/permissions.d.ts +47 -19
- package/build/lib/commands/permissions.d.ts.map +1 -1
- package/build/lib/commands/permissions.js +21 -36
- package/build/lib/commands/permissions.js.map +1 -1
- package/build/lib/commands/system-bars.d.ts +27 -21
- package/build/lib/commands/system-bars.d.ts.map +1 -1
- package/build/lib/commands/system-bars.js +23 -40
- package/build/lib/commands/system-bars.js.map +1 -1
- package/build/lib/driver.d.ts +9 -9
- package/lib/commands/element.ts +234 -0
- package/lib/commands/{geolocation.js → geolocation.ts} +85 -54
- package/lib/commands/{log.js → log.ts} +66 -71
- package/lib/commands/{media-projection.js → media-projection.ts} +69 -68
- package/lib/commands/{network.js → network.ts} +106 -59
- package/lib/commands/{permissions.js → permissions.ts} +58 -50
- package/lib/commands/{system-bars.js → system-bars.ts} +59 -50
- package/package.json +1 -1
- package/lib/commands/element.js +0 -158
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## [12.4.10](https://github.com/appium/appium-android-driver/compare/v12.4.9...v12.4.10) (2025-12-20)
|
|
2
|
+
|
|
3
|
+
### Miscellaneous Chores
|
|
4
|
+
|
|
5
|
+
* Migrate more command modules to Typescript (part 4) ([#1041](https://github.com/appium/appium-android-driver/issues/1041)) ([ca117ac](https://github.com/appium/appium-android-driver/commit/ca117ac1a5781b94a2816028b5da04192ad146cf))
|
|
6
|
+
|
|
7
|
+
## [12.4.9](https://github.com/appium/appium-android-driver/compare/v12.4.8...v12.4.9) (2025-12-19)
|
|
8
|
+
|
|
9
|
+
### Miscellaneous Chores
|
|
10
|
+
|
|
11
|
+
* Migrate command modules to typescript (part3) ([#1040](https://github.com/appium/appium-android-driver/issues/1040)) ([ebc73ba](https://github.com/appium/appium-android-driver/commit/ebc73bac7433c552c41bc241bfec535c30b3b157))
|
|
12
|
+
|
|
1
13
|
## [12.4.8](https://github.com/appium/appium-android-driver/compare/v12.4.7...v12.4.8) (2025-12-19)
|
|
2
14
|
|
|
3
15
|
### Miscellaneous Chores
|
|
@@ -1,102 +1,126 @@
|
|
|
1
|
+
import type { Position, Size } from '@appium/types';
|
|
2
|
+
import type { AndroidDriver } from '../driver';
|
|
3
|
+
import type { DoSetElementValueOpts } from './types';
|
|
1
4
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* @param
|
|
5
|
-
* @
|
|
5
|
+
* Gets an attribute value from an element.
|
|
6
|
+
*
|
|
7
|
+
* @param attribute The name of the attribute to retrieve.
|
|
8
|
+
* @param elementId The element identifier.
|
|
9
|
+
* @returns Promise that resolves to the attribute value, or `null` if not found.
|
|
10
|
+
* @throws {errors.NotImplementedError} This method is not implemented.
|
|
6
11
|
*/
|
|
7
|
-
export function getAttribute(this:
|
|
12
|
+
export declare function getAttribute(this: AndroidDriver, attribute: string, elementId: string): Promise<string | null>;
|
|
8
13
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* @
|
|
14
|
+
* Clicks on an element.
|
|
15
|
+
*
|
|
16
|
+
* @param elementId The element identifier.
|
|
17
|
+
* @returns Promise that resolves when the click is performed.
|
|
18
|
+
* @throws {errors.NotImplementedError} This method is not implemented.
|
|
12
19
|
*/
|
|
13
|
-
export function click(this:
|
|
20
|
+
export declare function click(this: AndroidDriver, elementId: string): Promise<void>;
|
|
14
21
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* @
|
|
22
|
+
* Gets the text content of an element.
|
|
23
|
+
*
|
|
24
|
+
* @param elementId The element identifier.
|
|
25
|
+
* @returns Promise that resolves to the element's text content.
|
|
26
|
+
* @throws {errors.NotImplementedError} This method is not implemented.
|
|
18
27
|
*/
|
|
19
|
-
export function getText(this:
|
|
28
|
+
export declare function getText(this: AndroidDriver, elementId: string): Promise<string>;
|
|
20
29
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* @
|
|
30
|
+
* Gets the location of an element on the screen.
|
|
31
|
+
*
|
|
32
|
+
* @param elementId The element identifier.
|
|
33
|
+
* @returns Promise that resolves to the element's position (x, y coordinates).
|
|
34
|
+
* @throws {errors.NotImplementedError} This method is not implemented.
|
|
24
35
|
*/
|
|
25
|
-
export function getLocation(this:
|
|
36
|
+
export declare function getLocation(this: AndroidDriver, elementId: string): Promise<Position>;
|
|
26
37
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* @
|
|
38
|
+
* Gets the size of an element.
|
|
39
|
+
*
|
|
40
|
+
* @param elementId The element identifier.
|
|
41
|
+
* @returns Promise that resolves to the element's size (width, height).
|
|
42
|
+
* @throws {errors.NotImplementedError} This method is not implemented.
|
|
30
43
|
*/
|
|
31
|
-
export function getSize(this:
|
|
44
|
+
export declare function getSize(this: AndroidDriver, elementId: string): Promise<Size>;
|
|
32
45
|
/**
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* @
|
|
46
|
+
* Gets the class name of an element.
|
|
47
|
+
*
|
|
48
|
+
* @param elementId The element identifier.
|
|
49
|
+
* @returns Promise that resolves to the element's class name.
|
|
36
50
|
*/
|
|
37
|
-
export function getName(this:
|
|
51
|
+
export declare function getName(this: AndroidDriver, elementId: string): Promise<string>;
|
|
38
52
|
/**
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* @
|
|
53
|
+
* Checks if an element is displayed.
|
|
54
|
+
*
|
|
55
|
+
* @param elementId The element identifier.
|
|
56
|
+
* @returns Promise that resolves to `true` if the element is displayed, `false` otherwise.
|
|
42
57
|
*/
|
|
43
|
-
export function elementDisplayed(this:
|
|
58
|
+
export declare function elementDisplayed(this: AndroidDriver, elementId: string): Promise<boolean>;
|
|
44
59
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* @
|
|
60
|
+
* Checks if an element is enabled.
|
|
61
|
+
*
|
|
62
|
+
* @param elementId The element identifier.
|
|
63
|
+
* @returns Promise that resolves to `true` if the element is enabled, `false` otherwise.
|
|
48
64
|
*/
|
|
49
|
-
export function elementEnabled(this:
|
|
65
|
+
export declare function elementEnabled(this: AndroidDriver, elementId: string): Promise<boolean>;
|
|
50
66
|
/**
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
* @
|
|
67
|
+
* Checks if an element is selected.
|
|
68
|
+
*
|
|
69
|
+
* @param elementId The element identifier.
|
|
70
|
+
* @returns Promise that resolves to `true` if the element is selected, `false` otherwise.
|
|
54
71
|
*/
|
|
55
|
-
export function elementSelected(this:
|
|
72
|
+
export declare function elementSelected(this: AndroidDriver, elementId: string): Promise<boolean>;
|
|
56
73
|
/**
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* @param
|
|
60
|
-
* @param
|
|
61
|
-
* @
|
|
74
|
+
* Sets the value of an element.
|
|
75
|
+
*
|
|
76
|
+
* @param keys The text to set, either as a string or an array of strings (which will be joined).
|
|
77
|
+
* @param elementId The element identifier.
|
|
78
|
+
* @param replace If `true`, replaces the existing value. If `false`, appends to it. Defaults to `false`.
|
|
79
|
+
* @returns Promise that resolves when the value is set.
|
|
62
80
|
*/
|
|
63
|
-
export function setElementValue(this:
|
|
81
|
+
export declare function setElementValue(this: AndroidDriver, keys: string | string[], elementId: string, replace?: boolean): Promise<void>;
|
|
64
82
|
/**
|
|
83
|
+
* Sets the value of an element.
|
|
84
|
+
*
|
|
65
85
|
* Reason for isolating doSetElementValue from setElementValue is for reusing setElementValue
|
|
66
86
|
* across android-drivers (like appium-uiautomator2-driver) and to avoid code duplication.
|
|
67
87
|
* Other android-drivers (like appium-uiautomator2-driver) need to override doSetElementValue
|
|
68
88
|
* to facilitate setElementValue.
|
|
69
89
|
*
|
|
70
|
-
* @
|
|
71
|
-
* @
|
|
72
|
-
* @
|
|
90
|
+
* @param params The parameters for setting the element value.
|
|
91
|
+
* @returns Promise that resolves when the value is set.
|
|
92
|
+
* @throws {errors.NotImplementedError} This method is not implemented.
|
|
73
93
|
*/
|
|
74
|
-
export function doSetElementValue(this:
|
|
94
|
+
export declare function doSetElementValue(this: AndroidDriver, params: DoSetElementValueOpts): Promise<void>;
|
|
75
95
|
/**
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
* @param
|
|
79
|
-
* @
|
|
96
|
+
* Sets the value of an element (appends to existing value).
|
|
97
|
+
*
|
|
98
|
+
* @param keys The text to set, either as a string or an array of strings (which will be joined).
|
|
99
|
+
* @param elementId The element identifier.
|
|
100
|
+
* @returns Promise that resolves when the value is set.
|
|
80
101
|
*/
|
|
81
|
-
export function setValue(this:
|
|
102
|
+
export declare function setValue(this: AndroidDriver, keys: string | string[], elementId: string): Promise<void>;
|
|
82
103
|
/**
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
* @param
|
|
86
|
-
* @
|
|
104
|
+
* Replaces the value of an element.
|
|
105
|
+
*
|
|
106
|
+
* @param keys The text to set, either as a string or an array of strings (which will be joined).
|
|
107
|
+
* @param elementId The element identifier.
|
|
108
|
+
* @returns Promise that resolves when the value is replaced.
|
|
87
109
|
*/
|
|
88
|
-
export function replaceValue(this:
|
|
110
|
+
export declare function replaceValue(this: AndroidDriver, keys: string | string[], elementId: string): Promise<void>;
|
|
89
111
|
/**
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
* @param
|
|
93
|
-
* @
|
|
112
|
+
* Sets the value of an element immediately using ADB input.
|
|
113
|
+
*
|
|
114
|
+
* @param keys The text to set, either as a string or an array of strings (which will be joined).
|
|
115
|
+
* @param elementId The element identifier.
|
|
116
|
+
* @returns Promise that resolves when the value is set.
|
|
94
117
|
*/
|
|
95
|
-
export function setValueImmediate(this:
|
|
118
|
+
export declare function setValueImmediate(this: AndroidDriver, keys: string | string[], elementId: string): Promise<void>;
|
|
96
119
|
/**
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
* @
|
|
120
|
+
* Gets the location of an element relative to the view.
|
|
121
|
+
*
|
|
122
|
+
* @param elementId The element identifier.
|
|
123
|
+
* @returns Promise that resolves to the element's position (x, y coordinates).
|
|
100
124
|
*/
|
|
101
|
-
export function getLocationInView(this:
|
|
125
|
+
export declare function getLocationInView(this: AndroidDriver, elementId: string): Promise<Position>;
|
|
102
126
|
//# sourceMappingURL=element.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../../../lib/commands/element.
|
|
1
|
+
{"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../../../lib/commands/element.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,QAAQ,EAAE,IAAI,EAAC,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,SAAS,CAAC;AAEnD;;;;;;;GAOG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,aAAa,EACnB,SAAS,EAAE,MAAM,EACjB,SA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GAWG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,aAAa,EACnB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,IAAI,CAAC,CAEf;AAED;;;;;;GAMG;AACH,wBAAsB,QAAQ,CAC5B,IAAI,EAAE,aAAa,EACnB,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,EACvB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC,CAEf;AAED;;;;;;GAMG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,aAAa,EACnB,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,EACvB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC,CAEf;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,aAAa,EACnB,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,EACvB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC,CAMf;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,aAAa,EACnB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,QAAQ,CAAC,CAEnB"}
|
|
@@ -18,84 +18,99 @@ exports.setValueImmediate = setValueImmediate;
|
|
|
18
18
|
exports.getLocationInView = getLocationInView;
|
|
19
19
|
const driver_1 = require("appium/driver");
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* @param
|
|
24
|
-
* @
|
|
21
|
+
* Gets an attribute value from an element.
|
|
22
|
+
*
|
|
23
|
+
* @param attribute The name of the attribute to retrieve.
|
|
24
|
+
* @param elementId The element identifier.
|
|
25
|
+
* @returns Promise that resolves to the attribute value, or `null` if not found.
|
|
26
|
+
* @throws {errors.NotImplementedError} This method is not implemented.
|
|
25
27
|
*/
|
|
26
28
|
async function getAttribute(attribute, elementId) {
|
|
27
29
|
throw new driver_1.errors.NotImplementedError('Not implemented');
|
|
28
30
|
}
|
|
29
31
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* @
|
|
32
|
+
* Clicks on an element.
|
|
33
|
+
*
|
|
34
|
+
* @param elementId The element identifier.
|
|
35
|
+
* @returns Promise that resolves when the click is performed.
|
|
36
|
+
* @throws {errors.NotImplementedError} This method is not implemented.
|
|
33
37
|
*/
|
|
34
38
|
async function click(elementId) {
|
|
35
39
|
throw new driver_1.errors.NotImplementedError('Not implemented');
|
|
36
40
|
}
|
|
37
41
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* @
|
|
42
|
+
* Gets the text content of an element.
|
|
43
|
+
*
|
|
44
|
+
* @param elementId The element identifier.
|
|
45
|
+
* @returns Promise that resolves to the element's text content.
|
|
46
|
+
* @throws {errors.NotImplementedError} This method is not implemented.
|
|
41
47
|
*/
|
|
42
48
|
async function getText(elementId) {
|
|
43
49
|
throw new driver_1.errors.NotImplementedError('Not implemented');
|
|
44
50
|
}
|
|
45
51
|
/**
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
* @
|
|
52
|
+
* Gets the location of an element on the screen.
|
|
53
|
+
*
|
|
54
|
+
* @param elementId The element identifier.
|
|
55
|
+
* @returns Promise that resolves to the element's position (x, y coordinates).
|
|
56
|
+
* @throws {errors.NotImplementedError} This method is not implemented.
|
|
49
57
|
*/
|
|
50
58
|
async function getLocation(elementId) {
|
|
51
59
|
throw new driver_1.errors.NotImplementedError('Not implemented');
|
|
52
60
|
}
|
|
53
61
|
/**
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* @
|
|
62
|
+
* Gets the size of an element.
|
|
63
|
+
*
|
|
64
|
+
* @param elementId The element identifier.
|
|
65
|
+
* @returns Promise that resolves to the element's size (width, height).
|
|
66
|
+
* @throws {errors.NotImplementedError} This method is not implemented.
|
|
57
67
|
*/
|
|
58
68
|
async function getSize(elementId) {
|
|
59
69
|
throw new driver_1.errors.NotImplementedError('Not implemented');
|
|
60
70
|
}
|
|
61
71
|
/**
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
* @
|
|
72
|
+
* Gets the class name of an element.
|
|
73
|
+
*
|
|
74
|
+
* @param elementId The element identifier.
|
|
75
|
+
* @returns Promise that resolves to the element's class name.
|
|
65
76
|
*/
|
|
66
77
|
async function getName(elementId) {
|
|
67
|
-
return
|
|
78
|
+
return await this.getAttribute('className', elementId);
|
|
68
79
|
}
|
|
69
80
|
/**
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
* @
|
|
81
|
+
* Checks if an element is displayed.
|
|
82
|
+
*
|
|
83
|
+
* @param elementId The element identifier.
|
|
84
|
+
* @returns Promise that resolves to `true` if the element is displayed, `false` otherwise.
|
|
73
85
|
*/
|
|
74
86
|
async function elementDisplayed(elementId) {
|
|
75
87
|
return (await this.getAttribute('displayed', elementId)) === 'true';
|
|
76
88
|
}
|
|
77
89
|
/**
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
* @
|
|
90
|
+
* Checks if an element is enabled.
|
|
91
|
+
*
|
|
92
|
+
* @param elementId The element identifier.
|
|
93
|
+
* @returns Promise that resolves to `true` if the element is enabled, `false` otherwise.
|
|
81
94
|
*/
|
|
82
95
|
async function elementEnabled(elementId) {
|
|
83
96
|
return (await this.getAttribute('enabled', elementId)) === 'true';
|
|
84
97
|
}
|
|
85
98
|
/**
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
* @
|
|
99
|
+
* Checks if an element is selected.
|
|
100
|
+
*
|
|
101
|
+
* @param elementId The element identifier.
|
|
102
|
+
* @returns Promise that resolves to `true` if the element is selected, `false` otherwise.
|
|
89
103
|
*/
|
|
90
104
|
async function elementSelected(elementId) {
|
|
91
105
|
return (await this.getAttribute('selected', elementId)) === 'true';
|
|
92
106
|
}
|
|
93
107
|
/**
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
* @param
|
|
97
|
-
* @param
|
|
98
|
-
* @
|
|
108
|
+
* Sets the value of an element.
|
|
109
|
+
*
|
|
110
|
+
* @param keys The text to set, either as a string or an array of strings (which will be joined).
|
|
111
|
+
* @param elementId The element identifier.
|
|
112
|
+
* @param replace If `true`, replaces the existing value. If `false`, appends to it. Defaults to `false`.
|
|
113
|
+
* @returns Promise that resolves when the value is set.
|
|
99
114
|
*/
|
|
100
115
|
async function setElementValue(keys, elementId, replace = false) {
|
|
101
116
|
const text = keys instanceof Array ? keys.join('') : keys;
|
|
@@ -106,53 +121,59 @@ async function setElementValue(keys, elementId, replace = false) {
|
|
|
106
121
|
});
|
|
107
122
|
}
|
|
108
123
|
/**
|
|
124
|
+
* Sets the value of an element.
|
|
125
|
+
*
|
|
109
126
|
* Reason for isolating doSetElementValue from setElementValue is for reusing setElementValue
|
|
110
127
|
* across android-drivers (like appium-uiautomator2-driver) and to avoid code duplication.
|
|
111
128
|
* Other android-drivers (like appium-uiautomator2-driver) need to override doSetElementValue
|
|
112
129
|
* to facilitate setElementValue.
|
|
113
130
|
*
|
|
114
|
-
* @
|
|
115
|
-
* @
|
|
116
|
-
* @
|
|
131
|
+
* @param params The parameters for setting the element value.
|
|
132
|
+
* @returns Promise that resolves when the value is set.
|
|
133
|
+
* @throws {errors.NotImplementedError} This method is not implemented.
|
|
117
134
|
*/
|
|
118
135
|
async function doSetElementValue(params) {
|
|
119
136
|
throw new driver_1.errors.NotImplementedError('Not implemented');
|
|
120
137
|
}
|
|
121
138
|
/**
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
* @param
|
|
125
|
-
* @
|
|
139
|
+
* Sets the value of an element (appends to existing value).
|
|
140
|
+
*
|
|
141
|
+
* @param keys The text to set, either as a string or an array of strings (which will be joined).
|
|
142
|
+
* @param elementId The element identifier.
|
|
143
|
+
* @returns Promise that resolves when the value is set.
|
|
126
144
|
*/
|
|
127
145
|
async function setValue(keys, elementId) {
|
|
128
146
|
return await this.setElementValue(keys, elementId, false);
|
|
129
147
|
}
|
|
130
148
|
/**
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
* @param
|
|
134
|
-
* @
|
|
149
|
+
* Replaces the value of an element.
|
|
150
|
+
*
|
|
151
|
+
* @param keys The text to set, either as a string or an array of strings (which will be joined).
|
|
152
|
+
* @param elementId The element identifier.
|
|
153
|
+
* @returns Promise that resolves when the value is replaced.
|
|
135
154
|
*/
|
|
136
155
|
async function replaceValue(keys, elementId) {
|
|
137
156
|
return await this.setElementValue(keys, elementId, true);
|
|
138
157
|
}
|
|
139
158
|
/**
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
* @param
|
|
143
|
-
* @
|
|
159
|
+
* Sets the value of an element immediately using ADB input.
|
|
160
|
+
*
|
|
161
|
+
* @param keys The text to set, either as a string or an array of strings (which will be joined).
|
|
162
|
+
* @param elementId The element identifier.
|
|
163
|
+
* @returns Promise that resolves when the value is set.
|
|
144
164
|
*/
|
|
145
165
|
async function setValueImmediate(keys, elementId) {
|
|
146
166
|
const text = Array.isArray(keys) ? keys.join('') : keys;
|
|
147
167
|
// first, make sure we are focused on the element
|
|
148
168
|
await this.click(elementId);
|
|
149
169
|
// then send through adb
|
|
150
|
-
await this.adb.inputText(
|
|
170
|
+
await this.adb.inputText(text);
|
|
151
171
|
}
|
|
152
172
|
/**
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
* @
|
|
173
|
+
* Gets the location of an element relative to the view.
|
|
174
|
+
*
|
|
175
|
+
* @param elementId The element identifier.
|
|
176
|
+
* @returns Promise that resolves to the element's position (x, y coordinates).
|
|
156
177
|
*/
|
|
157
178
|
async function getLocationInView(elementId) {
|
|
158
179
|
return await this.getLocation(elementId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element.js","sourceRoot":"","sources":["../../../lib/commands/element.
|
|
1
|
+
{"version":3,"file":"element.js","sourceRoot":"","sources":["../../../lib/commands/element.ts"],"names":[],"mappings":";AAAA,sDAAsD;;AAetD,oCAMC;AASD,sBAKC;AASD,0BAKC;AASD,kCAKC;AASD,0B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EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACxD,iDAAiD;IACjD,MAAM,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAC5B,wBAAwB;IACxB,MAAM,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;AACjC,CAAC;AAED;;;;;GAKG;AACI,KAAK,UAAU,iBAAiB,CAErC,SAAiB;IAEjB,OAAO,MAAM,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;AAC3C,CAAC"}
|
|
@@ -1,26 +1,28 @@
|
|
|
1
|
+
import type { Location } from '@appium/types';
|
|
2
|
+
import type { AndroidDriver } from '../driver';
|
|
1
3
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* @
|
|
4
|
+
* Sets the device geolocation.
|
|
5
|
+
*
|
|
6
|
+
* @param location The geolocation object containing latitude, longitude, and altitude.
|
|
7
|
+
* @returns Promise that resolves to the current geolocation after setting it.
|
|
5
8
|
*/
|
|
6
|
-
export function setGeoLocation(this:
|
|
9
|
+
export declare function setGeoLocation(this: AndroidDriver, location: Location): Promise<Location>;
|
|
7
10
|
/**
|
|
8
11
|
* Set the device geolocation.
|
|
9
12
|
*
|
|
10
|
-
* @
|
|
11
|
-
* @param
|
|
12
|
-
* @param
|
|
13
|
-
* @param
|
|
14
|
-
* @param
|
|
15
|
-
* @param {number} [speed] Valid speed value.
|
|
13
|
+
* @param latitude Valid latitude value.
|
|
14
|
+
* @param longitude Valid longitude value.
|
|
15
|
+
* @param altitude Valid altitude value.
|
|
16
|
+
* @param satellites Number of satellites being tracked (1-12). Available for emulators.
|
|
17
|
+
* @param speed Valid speed value.
|
|
16
18
|
* https://developer.android.com/reference/android/location/Location#setSpeed(float)
|
|
17
|
-
* @param
|
|
19
|
+
* @param bearing Valid bearing value. Available for real devices.
|
|
18
20
|
* https://developer.android.com/reference/android/location/Location#setBearing(float)
|
|
19
|
-
* @param
|
|
21
|
+
* @param accuracy Valid accuracy value. Available for real devices.
|
|
20
22
|
* https://developer.android.com/reference/android/location/Location#setAccuracy(float),
|
|
21
23
|
* https://developer.android.com/reference/android/location/Criteria
|
|
22
24
|
*/
|
|
23
|
-
export function mobileSetGeolocation(this:
|
|
25
|
+
export declare function mobileSetGeolocation(this: AndroidDriver, latitude: number, longitude: number, altitude?: number, satellites?: number, speed?: number, bearing?: number, accuracy?: number): Promise<void>;
|
|
24
26
|
/**
|
|
25
27
|
* Sends an async request to refresh the GPS cache.
|
|
26
28
|
*
|
|
@@ -28,43 +30,49 @@ export function mobileSetGeolocation(this: import("../driver").AndroidDriver, la
|
|
|
28
30
|
* installed. In case the vanilla LocationManager is used the device API level
|
|
29
31
|
* must be at version 30 (Android R) or higher.
|
|
30
32
|
*
|
|
31
|
-
* @
|
|
32
|
-
* @param {number} [timeoutMs] The maximum number of milliseconds
|
|
33
|
+
* @param timeoutMs The maximum number of milliseconds
|
|
33
34
|
* to block until GPS cache is refreshed. Providing zero or a negative
|
|
34
35
|
* value to it skips waiting completely.
|
|
35
36
|
* 20000ms by default.
|
|
36
|
-
* @returns
|
|
37
|
+
* @returns Promise that resolves when the GPS cache refresh is initiated.
|
|
37
38
|
*/
|
|
38
|
-
export function mobileRefreshGpsCache(this:
|
|
39
|
+
export declare function mobileRefreshGpsCache(this: AndroidDriver, timeoutMs?: number): Promise<void>;
|
|
39
40
|
/**
|
|
40
|
-
*
|
|
41
|
-
*
|
|
41
|
+
* Gets the current device geolocation.
|
|
42
|
+
*
|
|
43
|
+
* @returns Promise that resolves to the current geolocation object.
|
|
42
44
|
*/
|
|
43
|
-
export function getGeoLocation(this:
|
|
45
|
+
export declare function getGeoLocation(this: AndroidDriver): Promise<Location>;
|
|
44
46
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
+
* Gets the current device geolocation.
|
|
48
|
+
*
|
|
49
|
+
* @returns Promise that resolves to the current geolocation object.
|
|
47
50
|
*/
|
|
48
|
-
export function mobileGetGeolocation(this:
|
|
51
|
+
export declare function mobileGetGeolocation(this: AndroidDriver): Promise<Location>;
|
|
49
52
|
/**
|
|
50
|
-
*
|
|
51
|
-
*
|
|
53
|
+
* Checks if location services are enabled.
|
|
54
|
+
*
|
|
55
|
+
* @returns Promise that resolves to `true` if location services are enabled, `false` otherwise.
|
|
52
56
|
*/
|
|
53
|
-
export function isLocationServicesEnabled(this:
|
|
57
|
+
export declare function isLocationServicesEnabled(this: AndroidDriver): Promise<boolean>;
|
|
54
58
|
/**
|
|
55
|
-
*
|
|
56
|
-
*
|
|
59
|
+
* Toggles the location services state.
|
|
60
|
+
*
|
|
61
|
+
* @returns Promise that resolves when the location services state is toggled.
|
|
57
62
|
*/
|
|
58
|
-
export function toggleLocationServices(this:
|
|
63
|
+
export declare function toggleLocationServices(this: AndroidDriver): Promise<void>;
|
|
59
64
|
/**
|
|
60
|
-
*
|
|
61
|
-
*
|
|
65
|
+
* Resets the geolocation to the default state.
|
|
66
|
+
*
|
|
67
|
+
* @returns Promise that resolves when the geolocation is reset.
|
|
68
|
+
* @throws {Error} If called on an emulator (geolocation reset does not work on emulators).
|
|
62
69
|
*/
|
|
63
|
-
export function mobileResetGeolocation(this:
|
|
70
|
+
export declare function mobileResetGeolocation(this: AndroidDriver): Promise<void>;
|
|
64
71
|
/**
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
* @
|
|
72
|
+
* Sets the mock location permission for a specific app.
|
|
73
|
+
*
|
|
74
|
+
* @param appId The application package identifier.
|
|
75
|
+
* @returns Promise that resolves when the mock location permission is set.
|
|
68
76
|
*/
|
|
69
|
-
export function setMockLocationApp(this:
|
|
77
|
+
export declare function setMockLocationApp(this: AndroidDriver, appId: string): Promise<void>;
|
|
70
78
|
//# sourceMappingURL=geolocation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geolocation.d.ts","sourceRoot":"","sources":["../../../lib/commands/geolocation.
|
|
1
|
+
{"version":3,"file":"geolocation.d.ts","source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