appium-android-driver 7.8.3 → 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.
Files changed (261) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/build/lib/commands/app-management.d.ts +129 -5
  3. package/build/lib/commands/app-management.d.ts.map +1 -1
  4. package/build/lib/commands/app-management.js +433 -128
  5. package/build/lib/commands/app-management.js.map +1 -1
  6. package/build/lib/commands/appearance.d.ts +17 -4
  7. package/build/lib/commands/appearance.d.ts.map +1 -1
  8. package/build/lib/commands/appearance.js +32 -33
  9. package/build/lib/commands/appearance.js.map +1 -1
  10. package/build/lib/commands/context/cache.d.ts +19 -0
  11. package/build/lib/commands/context/cache.d.ts.map +1 -0
  12. package/build/lib/commands/context/cache.js +32 -0
  13. package/build/lib/commands/context/cache.js.map +1 -0
  14. package/build/lib/commands/context/exports.d.ts +141 -0
  15. package/build/lib/commands/context/exports.d.ts.map +1 -0
  16. package/build/lib/commands/context/exports.js +351 -0
  17. package/build/lib/commands/context/exports.js.map +1 -0
  18. package/build/lib/commands/context/helpers.d.ts +98 -0
  19. package/build/lib/commands/context/helpers.d.ts.map +1 -0
  20. package/build/lib/commands/context/helpers.js +715 -0
  21. package/build/lib/commands/context/helpers.js.map +1 -0
  22. package/build/lib/commands/device/common.d.ts +23 -0
  23. package/build/lib/commands/device/common.d.ts.map +1 -0
  24. package/build/lib/commands/device/common.js +230 -0
  25. package/build/lib/commands/device/common.js.map +1 -0
  26. package/build/lib/commands/device/emulator-actions.d.ts +114 -0
  27. package/build/lib/commands/device/emulator-actions.d.ts.map +1 -0
  28. package/build/lib/commands/device/emulator-actions.js +197 -0
  29. package/build/lib/commands/device/emulator-actions.js.map +1 -0
  30. package/build/lib/commands/device/emulator-console.d.ts +7 -0
  31. package/build/lib/commands/device/emulator-console.d.ts.map +1 -0
  32. package/build/lib/commands/device/emulator-console.js +24 -0
  33. package/build/lib/commands/device/emulator-console.js.map +1 -0
  34. package/build/lib/commands/device/utils.d.ts +50 -0
  35. package/build/lib/commands/device/utils.d.ts.map +1 -0
  36. package/build/lib/commands/device/utils.js +238 -0
  37. package/build/lib/commands/device/utils.js.map +1 -0
  38. package/build/lib/commands/deviceidle.d.ts +8 -5
  39. package/build/lib/commands/deviceidle.d.ts.map +1 -1
  40. package/build/lib/commands/deviceidle.js +31 -37
  41. package/build/lib/commands/deviceidle.js.map +1 -1
  42. package/build/lib/commands/element.d.ts +99 -5
  43. package/build/lib/commands/element.d.ts.map +1 -1
  44. package/build/lib/commands/element.js +152 -116
  45. package/build/lib/commands/element.js.map +1 -1
  46. package/build/lib/commands/execute.d.ts +12 -4
  47. package/build/lib/commands/execute.d.ts.map +1 -1
  48. package/build/lib/commands/execute.js +83 -78
  49. package/build/lib/commands/execute.js.map +1 -1
  50. package/build/lib/commands/file-actions.d.ts +42 -5
  51. package/build/lib/commands/file-actions.d.ts.map +1 -1
  52. package/build/lib/commands/file-actions.js +230 -194
  53. package/build/lib/commands/file-actions.js.map +1 -1
  54. package/build/lib/commands/find.d.ts +5 -4
  55. package/build/lib/commands/find.d.ts.map +1 -1
  56. package/build/lib/commands/find.js +7 -10
  57. package/build/lib/commands/find.js.map +1 -1
  58. package/build/lib/commands/geolocation.d.ts +45 -0
  59. package/build/lib/commands/geolocation.d.ts.map +1 -0
  60. package/build/lib/commands/geolocation.js +182 -0
  61. package/build/lib/commands/geolocation.js.map +1 -0
  62. package/build/lib/commands/ime.d.ts +25 -5
  63. package/build/lib/commands/ime.d.ts.map +1 -1
  64. package/build/lib/commands/ime.js +59 -42
  65. package/build/lib/commands/ime.js.map +1 -1
  66. package/build/lib/commands/intent.d.ts +56 -5
  67. package/build/lib/commands/intent.d.ts.map +1 -1
  68. package/build/lib/commands/intent.js +135 -83
  69. package/build/lib/commands/intent.js.map +1 -1
  70. package/build/lib/commands/keyboard.d.ts +58 -4
  71. package/build/lib/commands/keyboard.d.ts.map +1 -1
  72. package/build/lib/commands/keyboard.js +119 -17
  73. package/build/lib/commands/keyboard.js.map +1 -1
  74. package/build/lib/commands/lock/exports.d.ts +301 -0
  75. package/build/lib/commands/lock/exports.d.ts.map +1 -0
  76. package/build/lib/commands/lock/exports.js +121 -0
  77. package/build/lib/commands/lock/exports.js.map +1 -0
  78. package/build/lib/commands/lock/helpers.d.ts +349 -0
  79. package/build/lib/commands/lock/helpers.d.ts.map +1 -0
  80. package/build/lib/commands/lock/helpers.js +375 -0
  81. package/build/lib/commands/lock/helpers.js.map +1 -0
  82. package/build/lib/commands/log.d.ts +59 -5
  83. package/build/lib/commands/log.d.ts.map +1 -1
  84. package/build/lib/commands/log.js +150 -140
  85. package/build/lib/commands/log.js.map +1 -1
  86. package/build/lib/commands/media-projection.d.ts +16 -5
  87. package/build/lib/commands/media-projection.d.ts.map +1 -1
  88. package/build/lib/commands/media-projection.js +69 -58
  89. package/build/lib/commands/media-projection.js.map +1 -1
  90. package/build/lib/commands/memory.d.ts +9 -5
  91. package/build/lib/commands/memory.d.ts.map +1 -1
  92. package/build/lib/commands/memory.js +19 -24
  93. package/build/lib/commands/memory.js.map +1 -1
  94. package/build/lib/commands/misc.d.ts +42 -0
  95. package/build/lib/commands/misc.d.ts.map +1 -0
  96. package/build/lib/commands/misc.js +100 -0
  97. package/build/lib/commands/misc.js.map +1 -0
  98. package/build/lib/commands/network.d.ts +61 -5
  99. package/build/lib/commands/network.d.ts.map +1 -1
  100. package/build/lib/commands/network.js +196 -189
  101. package/build/lib/commands/network.js.map +1 -1
  102. package/build/lib/commands/performance.d.ts +67 -27
  103. package/build/lib/commands/performance.d.ts.map +1 -1
  104. package/build/lib/commands/performance.js +105 -80
  105. package/build/lib/commands/performance.js.map +1 -1
  106. package/build/lib/commands/permissions.d.ts +12 -6
  107. package/build/lib/commands/permissions.d.ts.map +1 -1
  108. package/build/lib/commands/permissions.js +65 -62
  109. package/build/lib/commands/permissions.js.map +1 -1
  110. package/build/lib/commands/recordscreen.d.ts +44 -5
  111. package/build/lib/commands/recordscreen.d.ts.map +1 -1
  112. package/build/lib/commands/recordscreen.js +131 -126
  113. package/build/lib/commands/recordscreen.js.map +1 -1
  114. package/build/lib/commands/resources.d.ts +16 -0
  115. package/build/lib/commands/resources.d.ts.map +1 -0
  116. package/build/lib/commands/resources.js +91 -0
  117. package/build/lib/commands/resources.js.map +1 -0
  118. package/build/lib/commands/shell.d.ts +8 -5
  119. package/build/lib/commands/shell.d.ts.map +1 -1
  120. package/build/lib/commands/shell.js +29 -33
  121. package/build/lib/commands/shell.js.map +1 -1
  122. package/build/lib/commands/streamscreen.d.ts +34 -6
  123. package/build/lib/commands/streamscreen.d.ts.map +1 -1
  124. package/build/lib/commands/streamscreen.js +166 -162
  125. package/build/lib/commands/streamscreen.js.map +1 -1
  126. package/build/lib/commands/system-bars.d.ts +18 -13
  127. package/build/lib/commands/system-bars.d.ts.map +1 -1
  128. package/build/lib/commands/system-bars.js +68 -64
  129. package/build/lib/commands/system-bars.js.map +1 -1
  130. package/build/lib/commands/time.d.ts +14 -0
  131. package/build/lib/commands/time.d.ts.map +1 -0
  132. package/build/lib/commands/time.js +39 -0
  133. package/build/lib/commands/time.js.map +1 -0
  134. package/build/lib/commands/touch.d.ts +99 -6
  135. package/build/lib/commands/touch.d.ts.map +1 -1
  136. package/build/lib/commands/touch.js +399 -280
  137. package/build/lib/commands/touch.js.map +1 -1
  138. package/build/lib/commands/types.d.ts +110 -2
  139. package/build/lib/commands/types.d.ts.map +1 -1
  140. package/build/lib/doctor/checks.d.ts.map +1 -1
  141. package/build/lib/doctor/checks.js +4 -4
  142. package/build/lib/doctor/checks.js.map +1 -1
  143. package/build/lib/driver.d.ts +224 -27
  144. package/build/lib/driver.d.ts.map +1 -1
  145. package/build/lib/driver.js +232 -7
  146. package/build/lib/driver.js.map +1 -1
  147. package/build/lib/index.d.ts +1 -4
  148. package/build/lib/index.d.ts.map +1 -1
  149. package/build/lib/index.js +1 -13
  150. package/build/lib/index.js.map +1 -1
  151. package/build/lib/logger.js.map +1 -1
  152. package/build/lib/method-map.d.ts +0 -23
  153. package/build/lib/method-map.d.ts.map +1 -1
  154. package/build/lib/method-map.js +0 -11
  155. package/build/lib/method-map.js.map +1 -1
  156. package/build/lib/utils.d.ts +12 -0
  157. package/build/lib/utils.d.ts.map +1 -1
  158. package/build/lib/utils.js +38 -2
  159. package/build/lib/utils.js.map +1 -1
  160. package/lib/commands/app-management.js +470 -145
  161. package/lib/commands/appearance.js +29 -36
  162. package/lib/commands/context/cache.js +29 -0
  163. package/lib/commands/context/exports.js +379 -0
  164. package/lib/commands/context/helpers.js +802 -0
  165. package/lib/commands/device/common.js +264 -0
  166. package/lib/commands/device/emulator-actions.js +194 -0
  167. package/lib/commands/device/emulator-console.js +24 -0
  168. package/lib/commands/device/utils.js +285 -0
  169. package/lib/commands/deviceidle.js +31 -44
  170. package/lib/commands/element.js +149 -142
  171. package/lib/commands/execute.js +86 -87
  172. package/lib/commands/file-actions.js +249 -222
  173. package/lib/commands/find.ts +13 -19
  174. package/lib/commands/geolocation.js +179 -0
  175. package/lib/commands/ime.js +53 -45
  176. package/lib/commands/intent.js +149 -91
  177. package/lib/commands/keyboard.js +114 -17
  178. package/lib/commands/lock/exports.js +139 -0
  179. package/lib/commands/lock/helpers.js +379 -0
  180. package/lib/commands/log.js +170 -166
  181. package/lib/commands/media-projection.js +75 -70
  182. package/lib/commands/memory.js +17 -29
  183. package/lib/commands/misc.js +94 -0
  184. package/lib/commands/network.js +209 -223
  185. package/lib/commands/performance.js +88 -73
  186. package/lib/commands/permissions.js +83 -84
  187. package/lib/commands/recordscreen.js +171 -170
  188. package/lib/commands/resources.js +96 -0
  189. package/lib/commands/shell.js +28 -42
  190. package/lib/commands/streamscreen.js +207 -206
  191. package/lib/commands/system-bars.js +76 -77
  192. package/lib/commands/time.js +36 -0
  193. package/lib/commands/touch.js +442 -346
  194. package/lib/commands/types.ts +123 -2
  195. package/lib/doctor/checks.js +24 -16
  196. package/lib/driver.ts +454 -12
  197. package/lib/index.ts +1 -13
  198. package/lib/logger.js +1 -1
  199. package/lib/method-map.js +0 -11
  200. package/lib/utils.js +40 -3
  201. package/package.json +1 -1
  202. package/build/lib/commands/actions.d.ts +0 -8
  203. package/build/lib/commands/actions.d.ts.map +0 -1
  204. package/build/lib/commands/actions.js +0 -207
  205. package/build/lib/commands/actions.js.map +0 -1
  206. package/build/lib/commands/alert.d.ts +0 -8
  207. package/build/lib/commands/alert.d.ts.map +0 -1
  208. package/build/lib/commands/alert.js +0 -29
  209. package/build/lib/commands/alert.js.map +0 -1
  210. package/build/lib/commands/context.d.ts +0 -10
  211. package/build/lib/commands/context.d.ts.map +0 -1
  212. package/build/lib/commands/context.js +0 -431
  213. package/build/lib/commands/context.js.map +0 -1
  214. package/build/lib/commands/emu-console.d.ts +0 -7
  215. package/build/lib/commands/emu-console.d.ts.map +0 -1
  216. package/build/lib/commands/emu-console.js +0 -27
  217. package/build/lib/commands/emu-console.js.map +0 -1
  218. package/build/lib/commands/general.d.ts +0 -9
  219. package/build/lib/commands/general.d.ts.map +0 -1
  220. package/build/lib/commands/general.js +0 -293
  221. package/build/lib/commands/general.js.map +0 -1
  222. package/build/lib/commands/index.d.ts +0 -28
  223. package/build/lib/commands/index.d.ts.map +0 -1
  224. package/build/lib/commands/index.js +0 -57
  225. package/build/lib/commands/index.js.map +0 -1
  226. package/build/lib/commands/mixins.d.ts +0 -747
  227. package/build/lib/commands/mixins.d.ts.map +0 -1
  228. package/build/lib/commands/mixins.js +0 -19
  229. package/build/lib/commands/mixins.js.map +0 -1
  230. package/build/lib/helpers/android.d.ts +0 -163
  231. package/build/lib/helpers/android.d.ts.map +0 -1
  232. package/build/lib/helpers/android.js +0 -818
  233. package/build/lib/helpers/android.js.map +0 -1
  234. package/build/lib/helpers/index.d.ts +0 -7
  235. package/build/lib/helpers/index.d.ts.map +0 -1
  236. package/build/lib/helpers/index.js +0 -29
  237. package/build/lib/helpers/index.js.map +0 -1
  238. package/build/lib/helpers/types.d.ts +0 -122
  239. package/build/lib/helpers/types.d.ts.map +0 -1
  240. package/build/lib/helpers/types.js +0 -3
  241. package/build/lib/helpers/types.js.map +0 -1
  242. package/build/lib/helpers/unlock.d.ts +0 -32
  243. package/build/lib/helpers/unlock.d.ts.map +0 -1
  244. package/build/lib/helpers/unlock.js +0 -273
  245. package/build/lib/helpers/unlock.js.map +0 -1
  246. package/build/lib/helpers/webview.d.ts +0 -74
  247. package/build/lib/helpers/webview.d.ts.map +0 -1
  248. package/build/lib/helpers/webview.js +0 -448
  249. package/build/lib/helpers/webview.js.map +0 -1
  250. package/lib/commands/actions.js +0 -244
  251. package/lib/commands/alert.js +0 -34
  252. package/lib/commands/context.js +0 -507
  253. package/lib/commands/emu-console.js +0 -31
  254. package/lib/commands/general.js +0 -343
  255. package/lib/commands/index.ts +0 -54
  256. package/lib/commands/mixins.ts +0 -976
  257. package/lib/helpers/android.ts +0 -1153
  258. package/lib/helpers/index.ts +0 -6
  259. package/lib/helpers/types.ts +0 -136
  260. package/lib/helpers/unlock.ts +0 -329
  261. package/lib/helpers/webview.ts +0 -610
@@ -1,431 +0,0 @@
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.setupNewChromedriver = void 0;
7
- /* eslint-disable require-await */
8
- // @ts-check
9
- const support_1 = require("@appium/support");
10
- const appium_chromedriver_1 = __importDefault(require("appium-chromedriver"));
11
- const driver_1 = require("appium/driver");
12
- const lodash_1 = __importDefault(require("lodash"));
13
- const helpers_1 = require("../helpers");
14
- const mixins_1 = require("./mixins");
15
- const node_net_1 = __importDefault(require("node:net"));
16
- const portscanner_1 = require("portscanner");
17
- const CHROMEDRIVER_AUTODOWNLOAD_FEATURE = 'chromedriver_autodownload';
18
- /**
19
- * @returns {Promise<number>}
20
- */
21
- async function getFreePort() {
22
- return await new Promise((resolve, reject) => {
23
- const srv = node_net_1.default.createServer();
24
- srv.listen(0, () => {
25
- const address = srv.address();
26
- let port;
27
- if (lodash_1.default.has(address, 'port')) {
28
- // @ts-ignore The above condition covers possible errors
29
- port = address.port;
30
- }
31
- else {
32
- reject(new Error('Cannot determine any free port number'));
33
- }
34
- srv.close(() => resolve(port));
35
- });
36
- });
37
- }
38
- /**
39
- * @type {import('./mixins').ContextMixin & ThisType<import('../driver').AndroidDriver>}
40
- * @satisfies {import('@appium/types').ExternalDriver}
41
- */
42
- const ContextMixin = {
43
- /* -------------------------------
44
- * Actual MJSONWP command handlers
45
- * ------------------------------- */
46
- async getCurrentContext() {
47
- // if the current context is `null`, indicating no context
48
- // explicitly set, it is the default context
49
- return this.curContext || this.defaultContextName();
50
- },
51
- async getContexts() {
52
- const webviewsMapping = await helpers_1.WebviewHelpers.getWebViewsMapping(this.adb, this.opts);
53
- return this.assignContexts(webviewsMapping);
54
- },
55
- async setContext(name) {
56
- if (!support_1.util.hasValue(name)) {
57
- name = this.defaultContextName();
58
- }
59
- else if (name === helpers_1.WEBVIEW_WIN) {
60
- // handle setContext "WEBVIEW"
61
- name = this.defaultWebviewName();
62
- }
63
- // if we're already in the context we want, do nothing
64
- if (name === this.curContext) {
65
- return;
66
- }
67
- const webviewsMapping = await helpers_1.WebviewHelpers.getWebViewsMapping(this.adb, this.opts);
68
- const contexts = this.assignContexts(webviewsMapping);
69
- // if the context we want doesn't exist, fail
70
- if (!lodash_1.default.includes(contexts, name)) {
71
- throw new driver_1.errors.NoSuchContextError();
72
- }
73
- await this.switchContext(name, webviewsMapping);
74
- this.curContext = name;
75
- },
76
- async mobileGetContexts(opts = {}) {
77
- const _opts = {
78
- androidDeviceSocket: this.opts.androidDeviceSocket,
79
- ensureWebviewsHavePages: true,
80
- webviewDevtoolsPort: this.opts.webviewDevtoolsPort,
81
- enableWebviewDetailsCollection: true,
82
- waitForWebviewMs: opts.waitForWebviewMs || 0,
83
- };
84
- return await helpers_1.WebviewHelpers.getWebViewsMapping(/** @type {ADB} */ (this.adb), _opts);
85
- },
86
- assignContexts(webviewsMapping) {
87
- const opts = Object.assign({ isChromeSession: this.isChromeSession }, this.opts);
88
- const webviews = helpers_1.WebviewHelpers.parseWebviewNames(webviewsMapping, opts);
89
- this.contexts = [helpers_1.NATIVE_WIN, ...webviews];
90
- this.log.debug(`Available contexts: ${JSON.stringify(this.contexts)}`);
91
- return this.contexts;
92
- },
93
- async switchContext(name, webviewsMapping) {
94
- // We have some options when it comes to webviews. If we want a
95
- // Chromedriver webview, we can only control one at a time.
96
- if (this.isChromedriverContext(name)) {
97
- // start proxying commands directly to chromedriver
98
- await this.startChromedriverProxy(name, webviewsMapping);
99
- }
100
- else if (this.isChromedriverContext(this.curContext)) {
101
- // if we're moving to a non-chromedriver webview, and our current context
102
- // _is_ a chromedriver webview, if caps recreateChromeDriverSessions is set
103
- // to true then kill chromedriver session using stopChromedriverProxies or
104
- // else simply suspend proxying to the latter
105
- if (this.opts.recreateChromeDriverSessions) {
106
- this.log.debug('recreateChromeDriverSessions set to true; killing existing chromedrivers');
107
- await this.stopChromedriverProxies();
108
- }
109
- else {
110
- this.suspendChromedriverProxy();
111
- }
112
- }
113
- else {
114
- throw new Error(`Didn't know how to handle switching to context '${name}'`);
115
- }
116
- },
117
- /* ---------------------------------
118
- * On-object context-related helpers
119
- * --------------------------------- */
120
- // The reason this is a function and not just a constant is that both android-
121
- // driver and selendroid-driver use this logic, and each one returns
122
- // a different default context name
123
- defaultContextName() {
124
- return helpers_1.NATIVE_WIN;
125
- },
126
- defaultWebviewName() {
127
- return helpers_1.WEBVIEW_BASE + (this.opts.autoWebviewName || this.opts.appPackage);
128
- },
129
- isWebContext() {
130
- return this.curContext !== null && this.curContext !== helpers_1.NATIVE_WIN;
131
- },
132
- // Turn on proxying to an existing Chromedriver session or a new one
133
- async startChromedriverProxy(context, webviewsMapping) {
134
- this.log.debug(`Connecting to chrome-backed webview context '${context}'`);
135
- let cd;
136
- if (this.sessionChromedrivers[context]) {
137
- // in the case where we've already set up a chromedriver for a context,
138
- // we want to reconnect to it, not create a whole new one
139
- this.log.debug(`Found existing Chromedriver for context '${context}'. Using it.`);
140
- cd = this.sessionChromedrivers[context];
141
- await this.setupExistingChromedriver(this.log, cd);
142
- }
143
- else {
144
- // XXX: this suppresses errors about putting arbitrary stuff on opts
145
- const opts = /** @type {any} */ (lodash_1.default.cloneDeep(this.opts));
146
- opts.chromeUseRunningApp = true;
147
- // if requested, tell chromedriver to attach to the android package we have
148
- // associated with the context name, rather than the package of the AUT.
149
- // And turn this on by default for chrome--if chrome pops up with a webview
150
- // and someone wants to switch to it, we should let chromedriver connect to
151
- // chrome rather than staying stuck on the AUT
152
- if (opts.extractChromeAndroidPackageFromContextName || context === `${helpers_1.WEBVIEW_BASE}chrome`) {
153
- let androidPackage = context.match(`${helpers_1.WEBVIEW_BASE}(.+)`);
154
- if (androidPackage && androidPackage.length > 0) {
155
- opts.chromeAndroidPackage = androidPackage[1];
156
- }
157
- if (!opts.extractChromeAndroidPackageFromContextName) {
158
- if (lodash_1.default.has(this.opts, 'enableWebviewDetailsCollection') &&
159
- !this.opts.enableWebviewDetailsCollection) {
160
- // When enableWebviewDetailsCollection capability is explicitly disabled, try to identify
161
- // chromeAndroidPackage based on contexts, known chrome variant packages and queryAppState result
162
- // since webviewsMapping does not have info object
163
- const contexts = webviewsMapping.map((wm) => wm.webviewName);
164
- for (const knownPackage of helpers_1.KNOWN_CHROME_PACKAGE_NAMES) {
165
- if (lodash_1.default.includes(contexts, `${helpers_1.WEBVIEW_BASE}${knownPackage}`)) {
166
- continue;
167
- }
168
- const appState = await this.queryAppState(knownPackage);
169
- if (lodash_1.default.includes([helpers_1.APP_STATE.RUNNING_IN_BACKGROUND, helpers_1.APP_STATE.RUNNING_IN_FOREGROUND], appState)) {
170
- opts.chromeAndroidPackage = knownPackage;
171
- this.log.debug(`Identified chromeAndroidPackage as '${opts.chromeAndroidPackage}' ` +
172
- `for context '${context}' by querying states of Chrome app packages`);
173
- break;
174
- }
175
- }
176
- }
177
- else {
178
- for (const wm of webviewsMapping) {
179
- if (wm.webviewName === context && lodash_1.default.has(wm?.info, 'Android-Package')) {
180
- // XXX: should be a type guard here
181
- opts.chromeAndroidPackage =
182
- /** @type {NonNullable<import('./types').WebviewsMapping['info']>} */ (wm.info)['Android-Package'];
183
- this.log.debug(`Identified chromeAndroidPackage as '${opts.chromeAndroidPackage}' ` +
184
- `for context '${context}' by CDP`);
185
- break;
186
- }
187
- }
188
- }
189
- }
190
- }
191
- cd = await this.setupNewChromedriver(opts,
192
- /** @type {string} */ (this.adb.curDeviceId), this.adb, context);
193
- // bind our stop/exit handler, passing in context so we know which
194
- // one stopped unexpectedly
195
- cd.on(appium_chromedriver_1.default.EVENT_CHANGED, (msg) => {
196
- if (msg.state === appium_chromedriver_1.default.STATE_STOPPED) {
197
- this.onChromedriverStop(context);
198
- }
199
- });
200
- // save the chromedriver object under the context
201
- this.sessionChromedrivers[context] = cd;
202
- }
203
- // hook up the local variables so we can proxy this biz
204
- this.chromedriver = cd;
205
- this.proxyReqRes = this.chromedriver.proxyReq.bind(this.chromedriver);
206
- this.proxyCommand = /** @type {import('@appium/types').ExternalDriver['proxyCommand']} */ (this.chromedriver.jwproxy.command.bind(this.chromedriver.jwproxy));
207
- this.jwpProxyActive = true;
208
- },
209
- // Stop proxying to any Chromedriver
210
- suspendChromedriverProxy() {
211
- this.chromedriver = undefined;
212
- this.proxyReqRes = undefined;
213
- this.proxyCommand = undefined;
214
- this.jwpProxyActive = false;
215
- },
216
- // Handle an out-of-band Chromedriver stop event
217
- async onChromedriverStop(context) {
218
- this.log.warn(`Chromedriver for context ${context} stopped unexpectedly`);
219
- if (context === this.curContext) {
220
- // we exited unexpectedly while automating the current context and so want
221
- // to shut down the session and respond with an error
222
- let err = new Error('Chromedriver quit unexpectedly during session');
223
- await this.startUnexpectedShutdown(err);
224
- }
225
- else {
226
- // if a Chromedriver in the non-active context barfs, we don't really
227
- // care, we'll just make a new one next time we need the context.
228
- this.log.warn("Chromedriver quit unexpectedly, but it wasn't the active " + 'context, ignoring');
229
- delete this.sessionChromedrivers[context];
230
- }
231
- },
232
- // Intentionally stop all the chromedrivers currently active, and ignore
233
- // their exit events
234
- async stopChromedriverProxies() {
235
- this.suspendChromedriverProxy(); // make sure we turn off the proxy flag
236
- for (let context of lodash_1.default.keys(this.sessionChromedrivers)) {
237
- let cd = this.sessionChromedrivers[context];
238
- this.log.debug(`Stopping chromedriver for context ${context}`);
239
- // stop listening for the stopped state event
240
- cd.removeAllListeners(appium_chromedriver_1.default.EVENT_CHANGED);
241
- try {
242
- await cd.stop();
243
- }
244
- catch (err) {
245
- this.log.warn(`Error stopping Chromedriver: ${ /** @type {Error} */(err).message}`);
246
- }
247
- delete this.sessionChromedrivers[context];
248
- }
249
- },
250
- isChromedriverContext(viewName) {
251
- return lodash_1.default.includes(viewName, helpers_1.WEBVIEW_WIN) || viewName === helpers_1.CHROMIUM_WIN;
252
- },
253
- shouldDismissChromeWelcome() {
254
- return (!!this.opts.chromeOptions &&
255
- lodash_1.default.isArray(this.opts.chromeOptions.args) &&
256
- this.opts.chromeOptions.args.includes('--no-first-run'));
257
- },
258
- async dismissChromeWelcome() {
259
- this.log.info('Trying to dismiss Chrome welcome');
260
- let activity = await this.getCurrentActivity();
261
- if (activity !== 'org.chromium.chrome.browser.firstrun.FirstRunActivity') {
262
- this.log.info('Chrome welcome dialog never showed up! Continuing');
263
- return;
264
- }
265
- let el = await this.findElOrEls('id', 'com.android.chrome:id/terms_accept', false);
266
- await this.click(/** @type {string} */ (el.ELEMENT));
267
- try {
268
- let el = await this.findElOrEls('id', 'com.android.chrome:id/negative_button', false);
269
- await this.click(/** @type {string} */ (el.ELEMENT));
270
- }
271
- catch (e) {
272
- // DO NOTHING, THIS DEVICE DIDNT LAUNCH THE SIGNIN DIALOG
273
- // IT MUST BE A NON GMS DEVICE
274
- this.log.warn(`This device did not show Chrome SignIn dialog, ${ /** @type {Error} */(e).message}`);
275
- }
276
- },
277
- async startChromeSession() {
278
- this.log.info('Starting a chrome-based browser session');
279
- // XXX: this suppresses errors about putting arbitrary stuff on opts
280
- const opts = /** @type {any} */ (lodash_1.default.cloneDeep(this.opts));
281
- const knownPackages = [
282
- 'org.chromium.chrome.shell',
283
- 'com.android.chrome',
284
- 'com.chrome.beta',
285
- 'org.chromium.chrome',
286
- 'org.chromium.webview_shell',
287
- ];
288
- if (lodash_1.default.includes(knownPackages, this.opts.appPackage)) {
289
- opts.chromeBundleId = this.opts.appPackage;
290
- }
291
- else {
292
- opts.chromeAndroidActivity = this.opts.appActivity;
293
- }
294
- this.chromedriver = await this.setupNewChromedriver(opts,
295
- /** @type {string} */ (this.adb.curDeviceId), this.adb);
296
- this.chromedriver.on(appium_chromedriver_1.default.EVENT_CHANGED, (msg) => {
297
- if (msg.state === appium_chromedriver_1.default.STATE_STOPPED) {
298
- this.onChromedriverStop(helpers_1.CHROMIUM_WIN);
299
- }
300
- });
301
- // Now that we have a Chrome session, we ensure that the context is
302
- // appropriately set and that this chromedriver is added to the list
303
- // of session chromedrivers so we can switch back and forth
304
- this.curContext = helpers_1.CHROMIUM_WIN;
305
- this.sessionChromedrivers[helpers_1.CHROMIUM_WIN] = this.chromedriver;
306
- this.proxyReqRes = this.chromedriver.proxyReq.bind(this.chromedriver);
307
- this.proxyCommand = /** @type {import('@appium/types').ExternalDriver['proxyCommand']} */ (this.chromedriver.jwproxy.command.bind(this.chromedriver.jwproxy));
308
- this.jwpProxyActive = true;
309
- if (this.shouldDismissChromeWelcome()) {
310
- // dismiss Chrome welcome dialog
311
- await this.dismissChromeWelcome();
312
- }
313
- },
314
- /* --------------------------
315
- * Internal library functions
316
- * -------------------------- */
317
- async setupExistingChromedriver(log, chromedriver) {
318
- // check the status by sending a simple window-based command to ChromeDriver
319
- // if there is an error, we want to recreate the ChromeDriver session
320
- if (!(await chromedriver.hasWorkingWebview())) {
321
- log.debug('ChromeDriver is not associated with a window. ' + 'Re-initializing the session.');
322
- await chromedriver.restart();
323
- }
324
- return chromedriver;
325
- },
326
- async getChromedriverPort(portSpec, log) {
327
- // if the user didn't give us any specific information about chromedriver
328
- // port ranges, just find any free port
329
- if (!portSpec) {
330
- const port = await getFreePort();
331
- log?.debug(`A port was not given, using random free port: ${port}`);
332
- return port;
333
- }
334
- // otherwise find the free port based on a list or range provided by the user
335
- log?.debug(`Finding a free port for chromedriver using spec ${JSON.stringify(portSpec)}`);
336
- let foundPort = null;
337
- for (const potentialPort of portSpec) {
338
- /** @type {number} */
339
- let port;
340
- /** @type {number} */
341
- let stopPort;
342
- if (lodash_1.default.isArray(potentialPort)) {
343
- [port, stopPort] = potentialPort.map((p) => parseInt(String(p), 10));
344
- }
345
- else {
346
- port = parseInt(String(potentialPort), 10); // ensure we have a number and not a string
347
- stopPort = port;
348
- }
349
- log?.debug(`Checking port range ${port}:${stopPort}`);
350
- try {
351
- foundPort = await (0, portscanner_1.findAPortNotInUse)(port, stopPort);
352
- break;
353
- }
354
- catch (e) {
355
- log?.debug(`Nothing in port range ${port}:${stopPort} was available`);
356
- }
357
- }
358
- if (foundPort === null) {
359
- throw new Error(`Could not find a free port for chromedriver using ` +
360
- `chromedriverPorts spec ${JSON.stringify(portSpec)}`);
361
- }
362
- log?.debug(`Using free port ${foundPort} for chromedriver`);
363
- return foundPort;
364
- },
365
- isChromedriverAutodownloadEnabled() {
366
- if (this.isFeatureEnabled(CHROMEDRIVER_AUTODOWNLOAD_FEATURE)) {
367
- return true;
368
- }
369
- this?.log?.debug(`Automated Chromedriver download is disabled. ` +
370
- `Use '${CHROMEDRIVER_AUTODOWNLOAD_FEATURE}' server feature to enable it`);
371
- return false;
372
- },
373
- async setupNewChromedriver(opts, curDeviceId, adb, context) {
374
- // @ts-ignore TODO: Remove the legacy
375
- if (opts.chromeDriverPort) {
376
- this?.log?.warn(`The 'chromeDriverPort' capability is deprecated. Please use 'chromedriverPort' instead`);
377
- // @ts-ignore TODO: Remove the legacy
378
- opts.chromedriverPort = opts.chromeDriverPort;
379
- }
380
- if (opts.chromedriverPort) {
381
- this?.log?.debug(`Using user-specified port ${opts.chromedriverPort} for chromedriver`);
382
- }
383
- else {
384
- // if a single port wasn't given, we'll look for a free one
385
- opts.chromedriverPort = await this.getChromedriverPort(opts.chromedriverPorts, this?.log);
386
- }
387
- const details = context ? helpers_1.WebviewHelpers.getWebviewDetails(adb, context) : undefined;
388
- if (!lodash_1.default.isEmpty(details)) {
389
- this?.log?.debug('Passing web view details to the Chromedriver constructor: ' +
390
- JSON.stringify(details, null, 2));
391
- }
392
- const chromedriver = new appium_chromedriver_1.default({
393
- port: String(opts.chromedriverPort),
394
- executable: opts.chromedriverExecutable,
395
- // eslint-disable-next-line object-shorthand
396
- adb: /** @type {any} */ (adb),
397
- cmdArgs: /** @type {string[]} */ (opts.chromedriverArgs),
398
- verbose: !!opts.showChromedriverLog,
399
- executableDir: opts.chromedriverExecutableDir,
400
- mappingPath: opts.chromedriverChromeMappingFile,
401
- // @ts-expect-error arbitrary value on opts?
402
- bundleId: opts.chromeBundleId,
403
- useSystemExecutable: opts.chromedriverUseSystemExecutable,
404
- disableBuildCheck: opts.chromedriverDisableBuildCheck,
405
- // @ts-expect-error FIXME: chromedriver typing are probably too strict
406
- details,
407
- isAutodownloadEnabled: this?.isChromedriverAutodownloadEnabled?.(),
408
- });
409
- // make sure there are chromeOptions
410
- opts.chromeOptions = opts.chromeOptions || {};
411
- // try out any prefixed chromeOptions,
412
- // and strip the prefix
413
- for (const opt of lodash_1.default.keys(opts)) {
414
- if (opt.endsWith(':chromeOptions')) {
415
- this?.log?.warn(`Merging '${opt}' into 'chromeOptions'. This may cause unexpected behavior`);
416
- lodash_1.default.merge(opts.chromeOptions, opts[opt]);
417
- }
418
- }
419
- const caps = /** @type {any} */ (helpers_1.WebviewHelpers.createChromedriverCaps(opts, curDeviceId, details));
420
- this?.log?.debug(`Before starting chromedriver, androidPackage is '${caps.chromeOptions.androidPackage}'`);
421
- await chromedriver.start(caps);
422
- return chromedriver;
423
- },
424
- };
425
- (0, mixins_1.mixin)(ContextMixin);
426
- exports.default = ContextMixin;
427
- exports.setupNewChromedriver = ContextMixin.setupNewChromedriver;
428
- /**
429
- * @typedef {import('appium-adb').ADB} ADB
430
- */
431
- //# sourceMappingURL=context.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"context.js","sourceRoot":"","sources":["../../../lib/commands/context.js"],"names":[],"mappings":";;;;;;AAAA,kCAAkC;AAClC,YAAY;AACZ,6CAAqC;AACrC,8EAA+C;AAC/C,0CAAqC;AACrC,oDAAuB;AACvB,wCAQoB;AACpB,qCAA+B;AAC/B,wDAA2B;AAC3B,6CAA8C;AAE9C,MAAM,iCAAiC,GAAG,2BAA2B,CAAC;AAEtE;;GAEG;AACH,KAAK,UAAU,WAAW;IACxB,OAAO,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC3C,MAAM,GAAG,GAAG,kBAAG,CAAC,YAAY,EAAE,CAAC;QAC/B,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE;YACjB,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;YAC9B,IAAI,IAAI,CAAC;YACT,IAAI,gBAAC,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE;gBAC1B,wDAAwD;gBACxD,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;aACrB;iBAAM;gBACL,MAAM,CAAC,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC,CAAC;aAC5D;YACD,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QACjC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,MAAM,YAAY,GAAG;IACnB;;yCAEqC;IACrC,KAAK,CAAC,iBAAiB;QACrB,0DAA0D;QAC1D,4CAA4C;QAC5C,OAAO,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,kBAAkB,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mulatorConsoleMixin;
2
- /**
3
- * @type {import('./mixins').EmulatorConsoleMixin & ThisType<import('../driver').AndroidDriver>}
4
- * @satisfies {import('@appium/types').ExternalDriver}
5
- */
6
- declare const EmulatorConsoleMixin: import('./mixins').EmulatorConsoleMixin & ThisType<import('../driver').AndroidDriver>;
7
- //# sourceMappingURL=emu-console.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"emu-console.d.ts","sourceRoot":"","sources":["../../../lib/commands/emu-console.js"],"names":[],"mappings":";AAMA;;;GAGG;AACH,oCAHU,OAAO,UAAU,EAAE,oBAAoB,GAAG,SAAS,OAAO,WAAW,EAAE,aAAa,CAAC,CAmB7F"}
@@ -1,27 +0,0 @@
1
- "use strict";
2
- // @ts-check
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- const mixins_1 = require("./mixins");
5
- const driver_1 = require("appium/driver");
6
- const EMU_CONSOLE_FEATURE = 'emulator_console';
7
- /**
8
- * @type {import('./mixins').EmulatorConsoleMixin & ThisType<import('../driver').AndroidDriver>}
9
- * @satisfies {import('@appium/types').ExternalDriver}
10
- */
11
- const EmulatorConsoleMixin = {
12
- async mobileExecEmuConsoleCommand(opts) {
13
- this.ensureFeatureEnabled(EMU_CONSOLE_FEATURE);
14
- const { command, execTimeout, connTimeout, initTimeout } = opts;
15
- if (!command) {
16
- throw new driver_1.errors.InvalidArgumentError(`The 'command' argument is mandatory`);
17
- }
18
- return await /** @type {import('appium-adb').ADB} */ (this.adb).execEmuConsoleCommand(command, {
19
- execTimeout,
20
- connTimeout,
21
- initTimeout,
22
- });
23
- },
24
- };
25
- (0, mixins_1.mixin)(EmulatorConsoleMixin);
26
- exports.default = EmulatorConsoleMixin;
27
- //# sourceMappingURL=emu-console.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"emu-console.js","sourceRoot":"","sources":["../../../lib/commands/emu-console.js"],"names":[],"mappings":";AAAA,YAAY;;AAEZ,qCAA+B;AAC/B,0CAAqC;AAErC,MAAM,mBAAmB,GAAG,kBAAkB,CAAC;AAC/C;;;GAGG;AACH,MAAM,oBAAoB,GAAG;IAC3B,KAAK,CAAC,2BAA2B,CAAC,IAAI;QACpC,IAAI,CAAC,oBAAoB,CAAC,mBAAmB,CAAC,CAAC;QAE/C,MAAM,EAAC,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAC,GAAG,IAAI,CAAC;QAE9D,IAAI,CAAC,OAAO,EAAE;YACZ,MAAM,IAAI,eAAM,CAAC,oBAAoB,CAAC,qCAAqC,CAAC,CAAC;SAC9E;QAED,OAAO,MAAM,uCAAuC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,qBAAqB,CAAC,OAAO,EAAE;YAC7F,WAAW;YACX,WAAW;YACX,WAAW;SACZ,CAAC,CAAC;IACL,CAAC;CACF,CAAC;AAEF,IAAA,cAAK,EAAC,oBAAoB,CAAC,CAAC;AAE5B,kBAAe,oBAAoB,CAAC"}
@@ -1,9 +0,0 @@
1
- export default GeneralMixin;
2
- export type ADB = import('appium-adb').ADB;
3
- export type StringRecord = import('@appium/types').StringRecord;
4
- /**
5
- * @type {import('./mixins').GeneralMixin & ThisType<import('../driver').AndroidDriver>}
6
- * @satisfies {import('@appium/types').ExternalDriver}
7
- */
8
- declare const GeneralMixin: import('./mixins').GeneralMixin & ThisType<import('../driver').AndroidDriver>;
9
- //# sourceMappingURL=general.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"general.d.ts","sourceRoot":"","sources":["../../../lib/commands/general.js"],"names":[],"mappings":";kBAoVa,OAAO,YAAY,EAAE,GAAG;2BACxB,OAAO,eAAe,EAAE,YAAY;AAzUjD;;;GAGG;AACH,4BAHU,OAAO,UAAU,EAAE,YAAY,GAAG,SAAS,OAAO,WAAW,EAAE,aAAa,CAAC,CAgUrF"}