appium-android-driver 7.8.2 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -0
- package/build/lib/commands/app-management.d.ts +129 -5
- package/build/lib/commands/app-management.d.ts.map +1 -1
- package/build/lib/commands/app-management.js +433 -128
- package/build/lib/commands/app-management.js.map +1 -1
- package/build/lib/commands/appearance.d.ts +17 -4
- package/build/lib/commands/appearance.d.ts.map +1 -1
- package/build/lib/commands/appearance.js +32 -33
- package/build/lib/commands/appearance.js.map +1 -1
- package/build/lib/commands/context/cache.d.ts +19 -0
- package/build/lib/commands/context/cache.d.ts.map +1 -0
- package/build/lib/commands/context/cache.js +32 -0
- package/build/lib/commands/context/cache.js.map +1 -0
- package/build/lib/commands/context/exports.d.ts +141 -0
- package/build/lib/commands/context/exports.d.ts.map +1 -0
- package/build/lib/commands/context/exports.js +351 -0
- package/build/lib/commands/context/exports.js.map +1 -0
- package/build/lib/commands/context/helpers.d.ts +98 -0
- package/build/lib/commands/context/helpers.d.ts.map +1 -0
- package/build/lib/commands/context/helpers.js +715 -0
- package/build/lib/commands/context/helpers.js.map +1 -0
- package/build/lib/commands/device/common.d.ts +23 -0
- package/build/lib/commands/device/common.d.ts.map +1 -0
- package/build/lib/commands/device/common.js +230 -0
- package/build/lib/commands/device/common.js.map +1 -0
- package/build/lib/commands/device/emulator-actions.d.ts +114 -0
- package/build/lib/commands/device/emulator-actions.d.ts.map +1 -0
- package/build/lib/commands/device/emulator-actions.js +197 -0
- package/build/lib/commands/device/emulator-actions.js.map +1 -0
- package/build/lib/commands/device/emulator-console.d.ts +7 -0
- package/build/lib/commands/device/emulator-console.d.ts.map +1 -0
- package/build/lib/commands/device/emulator-console.js +24 -0
- package/build/lib/commands/device/emulator-console.js.map +1 -0
- package/build/lib/commands/device/utils.d.ts +50 -0
- package/build/lib/commands/device/utils.d.ts.map +1 -0
- package/build/lib/commands/device/utils.js +238 -0
- package/build/lib/commands/device/utils.js.map +1 -0
- package/build/lib/commands/deviceidle.d.ts +8 -5
- package/build/lib/commands/deviceidle.d.ts.map +1 -1
- package/build/lib/commands/deviceidle.js +31 -37
- package/build/lib/commands/deviceidle.js.map +1 -1
- package/build/lib/commands/element.d.ts +99 -5
- package/build/lib/commands/element.d.ts.map +1 -1
- package/build/lib/commands/element.js +152 -116
- package/build/lib/commands/element.js.map +1 -1
- package/build/lib/commands/execute.d.ts +12 -4
- package/build/lib/commands/execute.d.ts.map +1 -1
- package/build/lib/commands/execute.js +83 -78
- package/build/lib/commands/execute.js.map +1 -1
- package/build/lib/commands/file-actions.d.ts +42 -5
- package/build/lib/commands/file-actions.d.ts.map +1 -1
- package/build/lib/commands/file-actions.js +230 -194
- package/build/lib/commands/file-actions.js.map +1 -1
- package/build/lib/commands/find.d.ts +5 -4
- package/build/lib/commands/find.d.ts.map +1 -1
- package/build/lib/commands/find.js +7 -10
- package/build/lib/commands/find.js.map +1 -1
- package/build/lib/commands/geolocation.d.ts +45 -0
- package/build/lib/commands/geolocation.d.ts.map +1 -0
- package/build/lib/commands/geolocation.js +182 -0
- package/build/lib/commands/geolocation.js.map +1 -0
- package/build/lib/commands/ime.d.ts +25 -5
- package/build/lib/commands/ime.d.ts.map +1 -1
- package/build/lib/commands/ime.js +59 -42
- package/build/lib/commands/ime.js.map +1 -1
- package/build/lib/commands/intent.d.ts +56 -5
- package/build/lib/commands/intent.d.ts.map +1 -1
- package/build/lib/commands/intent.js +135 -83
- package/build/lib/commands/intent.js.map +1 -1
- package/build/lib/commands/keyboard.d.ts +58 -4
- package/build/lib/commands/keyboard.d.ts.map +1 -1
- package/build/lib/commands/keyboard.js +119 -17
- package/build/lib/commands/keyboard.js.map +1 -1
- package/build/lib/commands/lock/exports.d.ts +301 -0
- package/build/lib/commands/lock/exports.d.ts.map +1 -0
- package/build/lib/commands/lock/exports.js +121 -0
- package/build/lib/commands/lock/exports.js.map +1 -0
- package/build/lib/commands/lock/helpers.d.ts +349 -0
- package/build/lib/commands/lock/helpers.d.ts.map +1 -0
- package/build/lib/commands/lock/helpers.js +375 -0
- package/build/lib/commands/lock/helpers.js.map +1 -0
- package/build/lib/commands/log.d.ts +59 -5
- package/build/lib/commands/log.d.ts.map +1 -1
- package/build/lib/commands/log.js +150 -140
- package/build/lib/commands/log.js.map +1 -1
- package/build/lib/commands/media-projection.d.ts +16 -5
- package/build/lib/commands/media-projection.d.ts.map +1 -1
- package/build/lib/commands/media-projection.js +69 -58
- package/build/lib/commands/media-projection.js.map +1 -1
- package/build/lib/commands/memory.d.ts +9 -5
- package/build/lib/commands/memory.d.ts.map +1 -1
- package/build/lib/commands/memory.js +19 -24
- package/build/lib/commands/memory.js.map +1 -1
- package/build/lib/commands/misc.d.ts +42 -0
- package/build/lib/commands/misc.d.ts.map +1 -0
- package/build/lib/commands/misc.js +100 -0
- package/build/lib/commands/misc.js.map +1 -0
- package/build/lib/commands/network.d.ts +61 -5
- package/build/lib/commands/network.d.ts.map +1 -1
- package/build/lib/commands/network.js +196 -189
- package/build/lib/commands/network.js.map +1 -1
- package/build/lib/commands/performance.d.ts +67 -27
- package/build/lib/commands/performance.d.ts.map +1 -1
- package/build/lib/commands/performance.js +105 -80
- package/build/lib/commands/performance.js.map +1 -1
- package/build/lib/commands/permissions.d.ts +12 -6
- package/build/lib/commands/permissions.d.ts.map +1 -1
- package/build/lib/commands/permissions.js +65 -62
- package/build/lib/commands/permissions.js.map +1 -1
- package/build/lib/commands/recordscreen.d.ts +44 -5
- package/build/lib/commands/recordscreen.d.ts.map +1 -1
- package/build/lib/commands/recordscreen.js +131 -126
- package/build/lib/commands/recordscreen.js.map +1 -1
- package/build/lib/commands/resources.d.ts +16 -0
- package/build/lib/commands/resources.d.ts.map +1 -0
- package/build/lib/commands/resources.js +91 -0
- package/build/lib/commands/resources.js.map +1 -0
- package/build/lib/commands/shell.d.ts +8 -5
- package/build/lib/commands/shell.d.ts.map +1 -1
- package/build/lib/commands/shell.js +29 -33
- package/build/lib/commands/shell.js.map +1 -1
- package/build/lib/commands/streamscreen.d.ts +34 -6
- package/build/lib/commands/streamscreen.d.ts.map +1 -1
- package/build/lib/commands/streamscreen.js +166 -162
- package/build/lib/commands/streamscreen.js.map +1 -1
- package/build/lib/commands/system-bars.d.ts +18 -13
- package/build/lib/commands/system-bars.d.ts.map +1 -1
- package/build/lib/commands/system-bars.js +68 -64
- package/build/lib/commands/system-bars.js.map +1 -1
- package/build/lib/commands/time.d.ts +14 -0
- package/build/lib/commands/time.d.ts.map +1 -0
- package/build/lib/commands/time.js +39 -0
- package/build/lib/commands/time.js.map +1 -0
- package/build/lib/commands/touch.d.ts +99 -6
- package/build/lib/commands/touch.d.ts.map +1 -1
- package/build/lib/commands/touch.js +399 -280
- package/build/lib/commands/touch.js.map +1 -1
- package/build/lib/commands/types.d.ts +115 -3
- package/build/lib/commands/types.d.ts.map +1 -1
- package/build/lib/doctor/checks.d.ts.map +1 -1
- package/build/lib/doctor/checks.js +4 -4
- package/build/lib/doctor/checks.js.map +1 -1
- package/build/lib/driver.d.ts +224 -27
- package/build/lib/driver.d.ts.map +1 -1
- package/build/lib/driver.js +232 -7
- package/build/lib/driver.js.map +1 -1
- package/build/lib/index.d.ts +1 -4
- package/build/lib/index.d.ts.map +1 -1
- package/build/lib/index.js +1 -13
- package/build/lib/index.js.map +1 -1
- package/build/lib/logger.js.map +1 -1
- package/build/lib/method-map.d.ts +0 -23
- package/build/lib/method-map.d.ts.map +1 -1
- package/build/lib/method-map.js +0 -11
- package/build/lib/method-map.js.map +1 -1
- package/build/lib/utils.d.ts +12 -0
- package/build/lib/utils.d.ts.map +1 -1
- package/build/lib/utils.js +38 -2
- package/build/lib/utils.js.map +1 -1
- package/lib/commands/app-management.js +470 -145
- package/lib/commands/appearance.js +29 -36
- package/lib/commands/context/cache.js +29 -0
- package/lib/commands/context/exports.js +379 -0
- package/lib/commands/context/helpers.js +802 -0
- package/lib/commands/device/common.js +264 -0
- package/lib/commands/device/emulator-actions.js +194 -0
- package/lib/commands/device/emulator-console.js +24 -0
- package/lib/commands/device/utils.js +285 -0
- package/lib/commands/deviceidle.js +31 -44
- package/lib/commands/element.js +149 -142
- package/lib/commands/execute.js +86 -87
- package/lib/commands/file-actions.js +249 -222
- package/lib/commands/find.ts +13 -19
- package/lib/commands/geolocation.js +179 -0
- package/lib/commands/ime.js +53 -45
- package/lib/commands/intent.js +149 -91
- package/lib/commands/keyboard.js +114 -17
- package/lib/commands/lock/exports.js +139 -0
- package/lib/commands/lock/helpers.js +379 -0
- package/lib/commands/log.js +170 -166
- package/lib/commands/media-projection.js +75 -70
- package/lib/commands/memory.js +17 -29
- package/lib/commands/misc.js +94 -0
- package/lib/commands/network.js +209 -223
- package/lib/commands/performance.js +88 -73
- package/lib/commands/permissions.js +83 -84
- package/lib/commands/recordscreen.js +171 -170
- package/lib/commands/resources.js +96 -0
- package/lib/commands/shell.js +28 -42
- package/lib/commands/streamscreen.js +207 -206
- package/lib/commands/system-bars.js +76 -77
- package/lib/commands/time.js +36 -0
- package/lib/commands/touch.js +442 -346
- package/lib/commands/types.ts +142 -10
- package/lib/doctor/checks.js +24 -16
- package/lib/driver.ts +454 -12
- package/lib/index.ts +1 -13
- package/lib/logger.js +1 -1
- package/lib/method-map.js +0 -11
- package/lib/utils.js +40 -3
- package/package.json +1 -1
- package/build/lib/commands/actions.d.ts +0 -8
- package/build/lib/commands/actions.d.ts.map +0 -1
- package/build/lib/commands/actions.js +0 -207
- package/build/lib/commands/actions.js.map +0 -1
- package/build/lib/commands/alert.d.ts +0 -8
- package/build/lib/commands/alert.d.ts.map +0 -1
- package/build/lib/commands/alert.js +0 -29
- package/build/lib/commands/alert.js.map +0 -1
- package/build/lib/commands/context.d.ts +0 -10
- package/build/lib/commands/context.d.ts.map +0 -1
- package/build/lib/commands/context.js +0 -431
- package/build/lib/commands/context.js.map +0 -1
- package/build/lib/commands/emu-console.d.ts +0 -7
- package/build/lib/commands/emu-console.d.ts.map +0 -1
- package/build/lib/commands/emu-console.js +0 -27
- package/build/lib/commands/emu-console.js.map +0 -1
- package/build/lib/commands/general.d.ts +0 -9
- package/build/lib/commands/general.d.ts.map +0 -1
- package/build/lib/commands/general.js +0 -293
- package/build/lib/commands/general.js.map +0 -1
- package/build/lib/commands/index.d.ts +0 -28
- package/build/lib/commands/index.d.ts.map +0 -1
- package/build/lib/commands/index.js +0 -57
- package/build/lib/commands/index.js.map +0 -1
- package/build/lib/commands/mixins.d.ts +0 -747
- package/build/lib/commands/mixins.d.ts.map +0 -1
- package/build/lib/commands/mixins.js +0 -19
- package/build/lib/commands/mixins.js.map +0 -1
- package/build/lib/helpers/android.d.ts +0 -163
- package/build/lib/helpers/android.d.ts.map +0 -1
- package/build/lib/helpers/android.js +0 -818
- package/build/lib/helpers/android.js.map +0 -1
- package/build/lib/helpers/index.d.ts +0 -7
- package/build/lib/helpers/index.d.ts.map +0 -1
- package/build/lib/helpers/index.js +0 -29
- package/build/lib/helpers/index.js.map +0 -1
- package/build/lib/helpers/types.d.ts +0 -122
- package/build/lib/helpers/types.d.ts.map +0 -1
- package/build/lib/helpers/types.js +0 -3
- package/build/lib/helpers/types.js.map +0 -1
- package/build/lib/helpers/unlock.d.ts +0 -32
- package/build/lib/helpers/unlock.d.ts.map +0 -1
- package/build/lib/helpers/unlock.js +0 -273
- package/build/lib/helpers/unlock.js.map +0 -1
- package/build/lib/helpers/webview.d.ts +0 -74
- package/build/lib/helpers/webview.d.ts.map +0 -1
- package/build/lib/helpers/webview.js +0 -442
- package/build/lib/helpers/webview.js.map +0 -1
- package/lib/commands/actions.js +0 -244
- package/lib/commands/alert.js +0 -34
- package/lib/commands/context.js +0 -507
- package/lib/commands/emu-console.js +0 -31
- package/lib/commands/general.js +0 -343
- package/lib/commands/index.ts +0 -54
- package/lib/commands/mixins.ts +0 -976
- package/lib/helpers/android.ts +0 -1153
- package/lib/helpers/index.ts +0 -6
- package/lib/helpers/types.ts +0 -136
- package/lib/helpers/unlock.ts +0 -329
- package/lib/helpers/webview.ts +0 -604
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mobileExecEmuConsoleCommand = void 0;
|
|
4
|
+
const driver_1 = require("appium/driver");
|
|
5
|
+
const EMU_CONSOLE_FEATURE = 'emulator_console';
|
|
6
|
+
/**
|
|
7
|
+
* @this {import('../../driver').AndroidDriver}
|
|
8
|
+
* @param {import('../types').ExecOptions} opts
|
|
9
|
+
* @returns {Promise<string>}
|
|
10
|
+
*/
|
|
11
|
+
async function mobileExecEmuConsoleCommand(opts) {
|
|
12
|
+
this.ensureFeatureEnabled(EMU_CONSOLE_FEATURE);
|
|
13
|
+
const { command, execTimeout, connTimeout, initTimeout } = opts;
|
|
14
|
+
if (!command) {
|
|
15
|
+
throw new driver_1.errors.InvalidArgumentError(`The 'command' argument is mandatory`);
|
|
16
|
+
}
|
|
17
|
+
return await /** @type {import('appium-adb').ADB} */ (this.adb).execEmuConsoleCommand(command, {
|
|
18
|
+
execTimeout,
|
|
19
|
+
connTimeout,
|
|
20
|
+
initTimeout,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
exports.mobileExecEmuConsoleCommand = mobileExecEmuConsoleCommand;
|
|
24
|
+
//# sourceMappingURL=emulator-console.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emulator-console.js","sourceRoot":"","sources":["../../../../lib/commands/device/emulator-console.js"],"names":[],"mappings":";;;AAAA,0CAAqC;AAErC,MAAM,mBAAmB,GAAG,kBAAkB,CAAC;AAE/C;;;;GAIG;AACI,KAAK,UAAU,2BAA2B,CAAC,IAAI;IACpD,IAAI,CAAC,oBAAoB,CAAC,mBAAmB,CAAC,CAAC;IAE/C,MAAM,EAAC,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAC,GAAG,IAAI,CAAC;IAE9D,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,IAAI,eAAM,CAAC,oBAAoB,CAAC,qCAAqC,CAAC,CAAC;KAC9E;IAED,OAAO,MAAM,uCAAuC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,qBAAqB,CAAC,OAAO,EAAE;QAC7F,WAAW;QACX,WAAW;QACX,WAAW;KACZ,CAAC,CAAC;AACL,CAAC;AAdD,kEAcC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @this {import('../../driver').AndroidDriver}
|
|
3
|
+
* @param {string} errMsg
|
|
4
|
+
*/
|
|
5
|
+
export function requireEmulator(this: import("../../driver").AndroidDriver, errMsg: string): void;
|
|
6
|
+
/**
|
|
7
|
+
* @this {import('../../driver').AndroidDriver}
|
|
8
|
+
* @returns {void}
|
|
9
|
+
*/
|
|
10
|
+
export function validatePackageActivityNames(this: import("../../driver").AndroidDriver): void;
|
|
11
|
+
/**
|
|
12
|
+
* @this {import('../../driver').AndroidDriver}
|
|
13
|
+
* @param {string} networkSpeed
|
|
14
|
+
* @returns {string}
|
|
15
|
+
*/
|
|
16
|
+
export function ensureNetworkSpeed(this: import("../../driver").AndroidDriver, networkSpeed: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* @this {import('../../driver').AndroidDriver}
|
|
19
|
+
* @returns {string[]}
|
|
20
|
+
*/
|
|
21
|
+
export function prepareAvdArgs(this: import("../../driver").AndroidDriver): string[];
|
|
22
|
+
/**
|
|
23
|
+
* @this {import('../../driver').AndroidDriver}
|
|
24
|
+
* @returns {Promise<void>}
|
|
25
|
+
*/
|
|
26
|
+
export function prepareEmulator(this: import("../../driver").AndroidDriver): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* @param {import('../../driver').AndroidDriverOpts?} [opts=null]
|
|
29
|
+
* @returns {Promise<ADB>}
|
|
30
|
+
*/
|
|
31
|
+
export function createBaseADB(opts?: import("../../driver").AndroidDriverOpts | null | undefined): Promise<ADB>;
|
|
32
|
+
/**
|
|
33
|
+
* @this {import('../../driver').AndroidDriver}
|
|
34
|
+
* @param {boolean} throwIfError
|
|
35
|
+
* @returns {Promise<void>}
|
|
36
|
+
*/
|
|
37
|
+
export function pushSettingsApp(this: import("../../driver").AndroidDriver, throwIfError: boolean): Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* @deprecated
|
|
40
|
+
* @this {import('../../driver').AndroidDriver}
|
|
41
|
+
* @returns {Promise<string?>}
|
|
42
|
+
*/
|
|
43
|
+
export function initUnicodeKeyboard(this: import("../../driver").AndroidDriver): Promise<string | null>;
|
|
44
|
+
/**
|
|
45
|
+
* @this {import('../../driver').AndroidDriver}
|
|
46
|
+
* @returns {Promise<void>}
|
|
47
|
+
*/
|
|
48
|
+
export function hideKeyboardCompletely(this: import("../../driver").AndroidDriver): Promise<void>;
|
|
49
|
+
import ADB from 'appium-adb';
|
|
50
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../lib/commands/device/utils.js"],"names":[],"mappings":"AAeA;;;GAGG;AACH,oFAFW,MAAM,QAMhB;AAED;;;GAGG;AACH,0FAFa,IAAI,CAuBhB;AAED;;;;GAIG;AACH,6FAHW,MAAM,GACJ,MAAM,CAWlB;AAED;;;GAGG;AACH,4EAFa,MAAM,EAAE,CAmBpB;AAED;;;GAGG;AACH,6EAFa,QAAQ,IAAI,CAAC,CAyCzB;AAED;;;GAGG;AACH,mGAFa,QAAQ,GAAG,CAAC,CAqCxB;AAED;;;;GAIG;AACH,0FAHW,OAAO,GACL,QAAQ,IAAI,CAAC,CA4EzB;AAED;;;;GAIG;AACH,iFAFa,QAAQ,MAAM,QAAE,CAa5B;AAED;;;GAGG;AACH,oFAFa,QAAQ,IAAI,CAAC,CAMzB;gBA1Re,YAAY"}
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.hideKeyboardCompletely = exports.initUnicodeKeyboard = exports.pushSettingsApp = exports.createBaseADB = exports.prepareEmulator = exports.prepareAvdArgs = exports.ensureNetworkSpeed = exports.validatePackageActivityNames = exports.requireEmulator = void 0;
|
|
7
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
8
|
+
const support_1 = require("@appium/support");
|
|
9
|
+
const appium_adb_1 = __importDefault(require("appium-adb"));
|
|
10
|
+
const asyncbox_1 = require("asyncbox");
|
|
11
|
+
const io_appium_settings_1 = require("io.appium.settings");
|
|
12
|
+
const bluebird_1 = __importDefault(require("bluebird"));
|
|
13
|
+
const HELPER_APP_INSTALL_RETRIES = 3;
|
|
14
|
+
const HELPER_APP_INSTALL_RETRY_DELAY_MS = 5000;
|
|
15
|
+
/**
|
|
16
|
+
* @this {import('../../driver').AndroidDriver}
|
|
17
|
+
* @param {string} errMsg
|
|
18
|
+
*/
|
|
19
|
+
function requireEmulator(errMsg) {
|
|
20
|
+
if (!this.isEmulator()) {
|
|
21
|
+
this.log.errorAndThrow(errMsg);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.requireEmulator = requireEmulator;
|
|
25
|
+
/**
|
|
26
|
+
* @this {import('../../driver').AndroidDriver}
|
|
27
|
+
* @returns {void}
|
|
28
|
+
*/
|
|
29
|
+
function validatePackageActivityNames() {
|
|
30
|
+
for (const key of ['appPackage', 'appActivity', 'appWaitPackage', 'appWaitActivity']) {
|
|
31
|
+
const name = this.opts[key];
|
|
32
|
+
if (!name) {
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
const match = /([^\w.*,])+/.exec(String(name));
|
|
36
|
+
if (!match) {
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
this.log.warn(`Capability '${key}' is expected to only include latin letters, digits, underscore, dot, comma and asterisk characters.`);
|
|
40
|
+
this.log.warn(`Current value '${name}' has non-matching character at index ${match.index}: '${String(name).substring(0, match.index + 1)}'`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.validatePackageActivityNames = validatePackageActivityNames;
|
|
44
|
+
/**
|
|
45
|
+
* @this {import('../../driver').AndroidDriver}
|
|
46
|
+
* @param {string} networkSpeed
|
|
47
|
+
* @returns {string}
|
|
48
|
+
*/
|
|
49
|
+
function ensureNetworkSpeed(networkSpeed) {
|
|
50
|
+
if (networkSpeed.toUpperCase() in this.adb.NETWORK_SPEED) {
|
|
51
|
+
return networkSpeed;
|
|
52
|
+
}
|
|
53
|
+
this.log.warn(`Wrong network speed param '${networkSpeed}', using default: ${this.adb.NETWORK_SPEED.FULL}. ` +
|
|
54
|
+
`Supported values: ${lodash_1.default.values(this.adb.NETWORK_SPEED)}`);
|
|
55
|
+
return this.adb.NETWORK_SPEED.FULL;
|
|
56
|
+
}
|
|
57
|
+
exports.ensureNetworkSpeed = ensureNetworkSpeed;
|
|
58
|
+
/**
|
|
59
|
+
* @this {import('../../driver').AndroidDriver}
|
|
60
|
+
* @returns {string[]}
|
|
61
|
+
*/
|
|
62
|
+
function prepareAvdArgs() {
|
|
63
|
+
const { networkSpeed, isHeadless, avdArgs } = this.opts;
|
|
64
|
+
const result = [];
|
|
65
|
+
if (avdArgs) {
|
|
66
|
+
if (lodash_1.default.isArray(avdArgs)) {
|
|
67
|
+
result.push(...avdArgs);
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
result.push(...support_1.util.shellParse(`${avdArgs}`));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (networkSpeed) {
|
|
74
|
+
result.push('-netspeed', ensureNetworkSpeed.bind(this)(networkSpeed));
|
|
75
|
+
}
|
|
76
|
+
if (isHeadless) {
|
|
77
|
+
result.push('-no-window');
|
|
78
|
+
}
|
|
79
|
+
return result;
|
|
80
|
+
}
|
|
81
|
+
exports.prepareAvdArgs = prepareAvdArgs;
|
|
82
|
+
/**
|
|
83
|
+
* @this {import('../../driver').AndroidDriver}
|
|
84
|
+
* @returns {Promise<void>}
|
|
85
|
+
*/
|
|
86
|
+
async function prepareEmulator() {
|
|
87
|
+
const { avd, avdEnv: env, language, locale: country, avdLaunchTimeout: launchTimeout, avdReadyTimeout: readyTimeout, } = this.opts;
|
|
88
|
+
if (!avd) {
|
|
89
|
+
throw new Error('Cannot launch AVD without AVD name');
|
|
90
|
+
}
|
|
91
|
+
const avdName = avd.replace('@', '');
|
|
92
|
+
let isEmulatorRunning = true;
|
|
93
|
+
try {
|
|
94
|
+
await this.adb.getRunningAVDWithRetry(avdName, 5000);
|
|
95
|
+
}
|
|
96
|
+
catch (e) {
|
|
97
|
+
this.log.debug(`Emulator '${avdName}' is not running: ${e.message}`);
|
|
98
|
+
isEmulatorRunning = false;
|
|
99
|
+
}
|
|
100
|
+
const args = prepareAvdArgs.bind(this)();
|
|
101
|
+
if (isEmulatorRunning) {
|
|
102
|
+
if (args.includes('-wipe-data')) {
|
|
103
|
+
this.log.debug(`Killing '${avdName}' because it needs to be wiped at start.`);
|
|
104
|
+
await this.adb.killEmulator(avdName);
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
this.log.debug('Not launching AVD because it is already running.');
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
await this.adb.launchAVD(avd, {
|
|
112
|
+
args,
|
|
113
|
+
env,
|
|
114
|
+
language,
|
|
115
|
+
country,
|
|
116
|
+
launchTimeout,
|
|
117
|
+
readyTimeout,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
exports.prepareEmulator = prepareEmulator;
|
|
121
|
+
/**
|
|
122
|
+
* @param {import('../../driver').AndroidDriverOpts?} [opts=null]
|
|
123
|
+
* @returns {Promise<ADB>}
|
|
124
|
+
*/
|
|
125
|
+
async function createBaseADB(opts = null) {
|
|
126
|
+
// filter out any unwanted options sent in
|
|
127
|
+
// this list should be updated as ADB takes more arguments
|
|
128
|
+
const { adbPort, suppressKillServer, remoteAdbHost, clearDeviceLogsOnStart, adbExecTimeout, useKeystore, keystorePath, keystorePassword, keyAlias, keyPassword, remoteAppsCacheLimit, buildToolsVersion, allowOfflineDevices, allowDelayAdb, } = opts ?? {};
|
|
129
|
+
return await appium_adb_1.default.createADB({
|
|
130
|
+
adbPort,
|
|
131
|
+
suppressKillServer,
|
|
132
|
+
remoteAdbHost,
|
|
133
|
+
clearDeviceLogsOnStart,
|
|
134
|
+
adbExecTimeout,
|
|
135
|
+
useKeystore,
|
|
136
|
+
keystorePath,
|
|
137
|
+
keystorePassword,
|
|
138
|
+
keyAlias,
|
|
139
|
+
keyPassword,
|
|
140
|
+
remoteAppsCacheLimit,
|
|
141
|
+
buildToolsVersion,
|
|
142
|
+
allowOfflineDevices,
|
|
143
|
+
allowDelayAdb,
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
exports.createBaseADB = createBaseADB;
|
|
147
|
+
/**
|
|
148
|
+
* @this {import('../../driver').AndroidDriver}
|
|
149
|
+
* @param {boolean} throwIfError
|
|
150
|
+
* @returns {Promise<void>}
|
|
151
|
+
*/
|
|
152
|
+
async function pushSettingsApp(throwIfError) {
|
|
153
|
+
this.log.debug('Pushing settings apk to the device...');
|
|
154
|
+
try {
|
|
155
|
+
// Sometimes adb push or adb instal take more time than expected to install an app
|
|
156
|
+
// e.g. https://github.com/appium/io.appium.settings/issues/40#issuecomment-476593174
|
|
157
|
+
await (0, asyncbox_1.retryInterval)(HELPER_APP_INSTALL_RETRIES, HELPER_APP_INSTALL_RETRY_DELAY_MS, async () => await this.adb.installOrUpgrade(io_appium_settings_1.path, io_appium_settings_1.SETTINGS_HELPER_ID, {
|
|
158
|
+
grantPermissions: true,
|
|
159
|
+
}));
|
|
160
|
+
}
|
|
161
|
+
catch (err) {
|
|
162
|
+
if (throwIfError) {
|
|
163
|
+
throw err;
|
|
164
|
+
}
|
|
165
|
+
this.log.warn(`Ignored error while installing '${io_appium_settings_1.path}': ` +
|
|
166
|
+
`'${err.message}'. Features that rely on this helper ` +
|
|
167
|
+
'require the apk such as toggle WiFi and getting location ' +
|
|
168
|
+
'will raise an error if you try to use them.');
|
|
169
|
+
}
|
|
170
|
+
// Reinstall would stop the settings helper process anyway, so
|
|
171
|
+
// there is no need to continue if the application is still running
|
|
172
|
+
if (await this.settingsApp.isRunningInForeground()) {
|
|
173
|
+
this.log.debug(`${io_appium_settings_1.SETTINGS_HELPER_ID} is already running. ` + `There is no need to reset its permissions.`);
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
const fixSettingsAppPermissionsForLegacyApis = async () => {
|
|
177
|
+
if ((await this.adb.getApiLevel()) > 23) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
// Android 6- devices should have granted permissions
|
|
181
|
+
// https://github.com/appium/appium/pull/11640#issuecomment-438260477
|
|
182
|
+
const perms = ['SET_ANIMATION_SCALE', 'CHANGE_CONFIGURATION', 'ACCESS_FINE_LOCATION'];
|
|
183
|
+
this.log.info(`Granting permissions ${perms} to '${io_appium_settings_1.SETTINGS_HELPER_ID}'`);
|
|
184
|
+
await this.adb.grantPermissions(io_appium_settings_1.SETTINGS_HELPER_ID, perms.map((x) => `android.permission.${x}`));
|
|
185
|
+
};
|
|
186
|
+
try {
|
|
187
|
+
await bluebird_1.default.all([
|
|
188
|
+
this.settingsApp.adjustNotificationsPermissions(),
|
|
189
|
+
this.settingsApp.adjustMediaProjectionServicePermissions(),
|
|
190
|
+
fixSettingsAppPermissionsForLegacyApis(),
|
|
191
|
+
]);
|
|
192
|
+
}
|
|
193
|
+
catch (e) {
|
|
194
|
+
this.log.debug(e.stack);
|
|
195
|
+
}
|
|
196
|
+
// launch io.appium.settings app due to settings failing to be set
|
|
197
|
+
// if the app is not launched prior to start the session on android 7+
|
|
198
|
+
// see https://github.com/appium/appium/issues/8957
|
|
199
|
+
try {
|
|
200
|
+
await this.settingsApp.requireRunning({
|
|
201
|
+
timeout: this.isEmulator() ? 30000 : 5000,
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
catch (err) {
|
|
205
|
+
this.log.debug(err.stack);
|
|
206
|
+
if (throwIfError) {
|
|
207
|
+
throw err;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
exports.pushSettingsApp = pushSettingsApp;
|
|
212
|
+
/**
|
|
213
|
+
* @deprecated
|
|
214
|
+
* @this {import('../../driver').AndroidDriver}
|
|
215
|
+
* @returns {Promise<string?>}
|
|
216
|
+
*/
|
|
217
|
+
async function initUnicodeKeyboard() {
|
|
218
|
+
this.log.debug('Enabling Unicode keyboard support');
|
|
219
|
+
// get the default IME so we can return back to it later if we want
|
|
220
|
+
const defaultIME = await this.adb.defaultIME();
|
|
221
|
+
this.log.debug(`Unsetting previous IME ${defaultIME}`);
|
|
222
|
+
this.log.debug(`Setting IME to '${io_appium_settings_1.UNICODE_IME}'`);
|
|
223
|
+
await this.adb.enableIME(io_appium_settings_1.UNICODE_IME);
|
|
224
|
+
await this.adb.setIME(io_appium_settings_1.UNICODE_IME);
|
|
225
|
+
return defaultIME;
|
|
226
|
+
}
|
|
227
|
+
exports.initUnicodeKeyboard = initUnicodeKeyboard;
|
|
228
|
+
/**
|
|
229
|
+
* @this {import('../../driver').AndroidDriver}
|
|
230
|
+
* @returns {Promise<void>}
|
|
231
|
+
*/
|
|
232
|
+
async function hideKeyboardCompletely() {
|
|
233
|
+
this.log.debug(`Hiding the on-screen keyboard by setting IME to '${io_appium_settings_1.EMPTY_IME}'`);
|
|
234
|
+
await this.adb.enableIME(io_appium_settings_1.EMPTY_IME);
|
|
235
|
+
await this.adb.setIME(io_appium_settings_1.EMPTY_IME);
|
|
236
|
+
}
|
|
237
|
+
exports.hideKeyboardCompletely = hideKeyboardCompletely;
|
|
238
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../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AC;IAE/C,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,0BAA0B,UAAU,EAAE,CAAC,CAAC;IACvD,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,mBAAmB,gCAAW,GAAG,CAAC,CAAC;IAClD,MAAM,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,gCAAW,CAAC,CAAC;IACtC,MAAM,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,gCAAW,CAAC,CAAC;IACnC,OAAO,UAAU,CAAC;AACpB,CAAC;AAXD,kDAWC;AAED;;;GAGG;AACI,KAAK,UAAU,sBAAsB;IAC1C,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,oDAAoD,8BAAS,GAAG,CAAC,CAAC;IACjF,MAAM,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,8BAAS,CAAC,CAAC;IACpC,MAAM,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,8BAAS,CAAC,CAAC;AACnC,CAAC;AAJD,wDAIC"}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
export default DeviceidleMixin;
|
|
2
|
-
export type ADB = import('appium-adb').ADB;
|
|
3
1
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* This is a wrapper to 'adb shell dumpsys deviceidle' interface.
|
|
3
|
+
* Read https://www.protechtraining.com/blog/post/diving-into-android-m-doze-875
|
|
4
|
+
* for more details.
|
|
5
|
+
*
|
|
6
|
+
* @param {import('./types').DeviceidleOpts} opts
|
|
7
|
+
* @returns {Promise<void>}
|
|
6
8
|
*/
|
|
7
|
-
|
|
9
|
+
export function mobileDeviceidle(opts: import('./types').DeviceidleOpts): Promise<void>;
|
|
10
|
+
export type ADB = import('appium-adb').ADB;
|
|
8
11
|
//# sourceMappingURL=deviceidle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deviceidle.d.ts","sourceRoot":"","sources":["../../../lib/commands/deviceidle.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"deviceidle.d.ts","sourceRoot":"","sources":["../../../lib/commands/deviceidle.js"],"names":[],"mappings":"AAKA;;;;;;;GAOG;AACH,uCAHW,OAAO,SAAS,EAAE,cAAc,GAC9B,QAAQ,IAAI,CAAC,CA4BzB;kBAGY,OAAO,YAAY,EAAE,GAAG"}
|
|
@@ -3,48 +3,42 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.mobileDeviceidle = void 0;
|
|
6
7
|
const driver_1 = require("appium/driver");
|
|
7
8
|
const lodash_1 = __importDefault(require("lodash"));
|
|
8
|
-
const mixins_1 = require("./mixins");
|
|
9
9
|
const SUPPORTED_ACTIONS = ['whitelistAdd', 'whitelistRemove'];
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
11
|
+
* This is a wrapper to 'adb shell dumpsys deviceidle' interface.
|
|
12
|
+
* Read https://www.protechtraining.com/blog/post/diving-into-android-m-doze-875
|
|
13
|
+
* for more details.
|
|
14
|
+
*
|
|
15
|
+
* @param {import('./types').DeviceidleOpts} opts
|
|
16
|
+
* @returns {Promise<void>}
|
|
13
17
|
*/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
argsGenerator = (pkg) => [...commonArgs, `-${pkg}`];
|
|
39
|
-
break;
|
|
40
|
-
default:
|
|
41
|
-
throw new driver_1.errors.InvalidArgumentError(`action must be one of ${JSON.stringify(SUPPORTED_ACTIONS)}. Got '${action}' instead`);
|
|
42
|
-
}
|
|
43
|
-
await (this.adb).shellChunks(argsGenerator, packagesArr);
|
|
44
|
-
},
|
|
45
|
-
};
|
|
46
|
-
(0, mixins_1.mixin)(DeviceidleMixin);
|
|
47
|
-
exports.default = DeviceidleMixin;
|
|
18
|
+
async function mobileDeviceidle(opts) {
|
|
19
|
+
const { action, packages } = opts;
|
|
20
|
+
if (!(lodash_1.default.isString(packages) || lodash_1.default.isArray(packages))) {
|
|
21
|
+
throw new driver_1.errors.InvalidArgumentError(`packages argument must be a string or an array`);
|
|
22
|
+
}
|
|
23
|
+
/** @type {string[]} */
|
|
24
|
+
const packagesArr = lodash_1.default.isArray(packages) ? packages : [packages];
|
|
25
|
+
/** @type {string[]} */
|
|
26
|
+
const commonArgs = ['dumpsys', 'deviceidle', 'whitelist'];
|
|
27
|
+
/** @type {(x: string) => string[]} */
|
|
28
|
+
let argsGenerator;
|
|
29
|
+
switch (action) {
|
|
30
|
+
case SUPPORTED_ACTIONS[0]:
|
|
31
|
+
argsGenerator = (pkg) => [...commonArgs, `+${pkg}`];
|
|
32
|
+
break;
|
|
33
|
+
case SUPPORTED_ACTIONS[1]:
|
|
34
|
+
argsGenerator = (pkg) => [...commonArgs, `-${pkg}`];
|
|
35
|
+
break;
|
|
36
|
+
default:
|
|
37
|
+
throw new driver_1.errors.InvalidArgumentError(`action must be one of ${JSON.stringify(SUPPORTED_ACTIONS)}. Got '${action}' instead`);
|
|
38
|
+
}
|
|
39
|
+
await this.adb.shellChunks(argsGenerator, packagesArr);
|
|
40
|
+
}
|
|
41
|
+
exports.mobileDeviceidle = mobileDeviceidle;
|
|
48
42
|
/**
|
|
49
43
|
* @typedef {import('appium-adb').ADB} ADB
|
|
50
44
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deviceidle.js","sourceRoot":"","sources":["../../../lib/commands/deviceidle.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":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GAAG,CAAC,WAAW,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC;AACzD,CAAC;AA1BD,4CA0BC;AAED;;GAEG"}
|
|
@@ -1,8 +1,102 @@
|
|
|
1
|
-
export default ElementMixin;
|
|
2
|
-
export type ADB = import('appium-adb').ADB;
|
|
3
1
|
/**
|
|
4
|
-
* @
|
|
5
|
-
* @
|
|
2
|
+
* @this {import('../driver').AndroidDriver}
|
|
3
|
+
* @param {string} attribute
|
|
4
|
+
* @param {string} elementId
|
|
5
|
+
* @returns {Promise<string?>}
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
export function getAttribute(this: import("../driver").AndroidDriver, attribute: string, elementId: string): Promise<string | null>;
|
|
8
|
+
/**
|
|
9
|
+
* @this {import('../driver').AndroidDriver}
|
|
10
|
+
* @param {string} elementId
|
|
11
|
+
* @returns {Promise<void>}
|
|
12
|
+
*/
|
|
13
|
+
export function click(this: import("../driver").AndroidDriver, elementId: string): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* @this {import('../driver').AndroidDriver}
|
|
16
|
+
* @param {string} elementId
|
|
17
|
+
* @returns {Promise<string>}
|
|
18
|
+
*/
|
|
19
|
+
export function getText(this: import("../driver").AndroidDriver, elementId: string): Promise<string>;
|
|
20
|
+
/**
|
|
21
|
+
* @this {import('../driver').AndroidDriver}
|
|
22
|
+
* @param {string} elementId
|
|
23
|
+
* @returns {Promise<import('@appium/types').Position>}
|
|
24
|
+
*/
|
|
25
|
+
export function getLocation(this: import("../driver").AndroidDriver, elementId: string): Promise<import('@appium/types').Position>;
|
|
26
|
+
/**
|
|
27
|
+
* @this {import('../driver').AndroidDriver}
|
|
28
|
+
* @param {string} elementId
|
|
29
|
+
* @returns {Promise<import('@appium/types').Size>}
|
|
30
|
+
*/
|
|
31
|
+
export function getSize(this: import("../driver").AndroidDriver, elementId: string): Promise<import('@appium/types').Size>;
|
|
32
|
+
/**
|
|
33
|
+
* @this {import('../driver').AndroidDriver}
|
|
34
|
+
* @param {string} elementId
|
|
35
|
+
* @returns {Promise<string>}
|
|
36
|
+
*/
|
|
37
|
+
export function getName(this: import("../driver").AndroidDriver, elementId: string): Promise<string>;
|
|
38
|
+
/**
|
|
39
|
+
* @this {import('../driver').AndroidDriver}
|
|
40
|
+
* @param {string} elementId
|
|
41
|
+
* @returns {Promise<boolean>}
|
|
42
|
+
*/
|
|
43
|
+
export function elementDisplayed(this: import("../driver").AndroidDriver, elementId: string): Promise<boolean>;
|
|
44
|
+
/**
|
|
45
|
+
* @this {import('../driver').AndroidDriver}
|
|
46
|
+
* @param {string} elementId
|
|
47
|
+
* @returns {Promise<boolean>}
|
|
48
|
+
*/
|
|
49
|
+
export function elementEnabled(this: import("../driver").AndroidDriver, elementId: string): Promise<boolean>;
|
|
50
|
+
/**
|
|
51
|
+
* @this {import('../driver').AndroidDriver}
|
|
52
|
+
* @param {string} elementId
|
|
53
|
+
* @returns {Promise<boolean>}
|
|
54
|
+
*/
|
|
55
|
+
export function elementSelected(this: import("../driver").AndroidDriver, elementId: string): Promise<boolean>;
|
|
56
|
+
/**
|
|
57
|
+
* @this {import('../driver').AndroidDriver}
|
|
58
|
+
* @param {string|string[]} keys
|
|
59
|
+
* @param {string} elementId
|
|
60
|
+
* @param {boolean} [replace=false]
|
|
61
|
+
* @returns {Promise<void>}
|
|
62
|
+
*/
|
|
63
|
+
export function setElementValue(this: import("../driver").AndroidDriver, keys: string | string[], elementId: string, replace?: boolean | undefined): Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* Reason for isolating doSetElementValue from setElementValue is for reusing setElementValue
|
|
66
|
+
* across android-drivers (like appium-uiautomator2-driver) and to avoid code duplication.
|
|
67
|
+
* Other android-drivers (like appium-uiautomator2-driver) need to override doSetElementValue
|
|
68
|
+
* to facilitate setElementValue.
|
|
69
|
+
*
|
|
70
|
+
* @this {import('../driver').AndroidDriver}
|
|
71
|
+
* @param {import('./types').DoSetElementValueOpts} params
|
|
72
|
+
* @returns {Promise<void>}
|
|
73
|
+
*/
|
|
74
|
+
export function doSetElementValue(this: import("../driver").AndroidDriver, params: import('./types').DoSetElementValueOpts): Promise<void>;
|
|
75
|
+
/**
|
|
76
|
+
* @this {import('../driver').AndroidDriver}
|
|
77
|
+
* @param {string|string[]} keys
|
|
78
|
+
* @param {string} elementId
|
|
79
|
+
* @returns {Promise<void>}
|
|
80
|
+
*/
|
|
81
|
+
export function setValue(this: import("../driver").AndroidDriver, keys: string | string[], elementId: string): Promise<void>;
|
|
82
|
+
/**
|
|
83
|
+
* @this {import('../driver').AndroidDriver}
|
|
84
|
+
* @param {string|string[]} keys
|
|
85
|
+
* @param {string} elementId
|
|
86
|
+
* @returns {Promise<void>}
|
|
87
|
+
*/
|
|
88
|
+
export function replaceValue(this: import("../driver").AndroidDriver, keys: string | string[], elementId: string): Promise<void>;
|
|
89
|
+
/**
|
|
90
|
+
* @this {import('../driver').AndroidDriver}
|
|
91
|
+
* @param {string|string[]} keys
|
|
92
|
+
* @param {string} elementId
|
|
93
|
+
* @returns {Promise<void>}
|
|
94
|
+
*/
|
|
95
|
+
export function setValueImmediate(this: import("../driver").AndroidDriver, keys: string | string[], elementId: string): Promise<void>;
|
|
96
|
+
/**
|
|
97
|
+
* @this {import('../driver').AndroidDriver}
|
|
98
|
+
* @param {string} elementId
|
|
99
|
+
* @returns {Promise<import('@appium/types').Position>}
|
|
100
|
+
*/
|
|
101
|
+
export function getLocationInView(this: import("../driver").AndroidDriver, elementId: string): Promise<import('@appium/types').Position>;
|
|
8
102
|
//# sourceMappingURL=element.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../../../lib/commands/element.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../../../lib/commands/element.js"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,iFAJW,MAAM,aACN,MAAM,GACJ,QAAQ,MAAM,QAAE,CAI5B;AAED;;;;GAIG;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