appium-mcp 0.0.1 → 1.1.4

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 (585) hide show
  1. package/.github/workflows/ci.yml +37 -0
  2. package/.github/workflows/pr-title.yml +15 -0
  3. package/.github/workflows/publish.yml +31 -0
  4. package/.gitmodules +9 -0
  5. package/.prettierignore +29 -0
  6. package/.prettierrc +10 -0
  7. package/.releaserc +37 -0
  8. package/CHANGELOG.md +37 -0
  9. package/LICENSE +21 -0
  10. package/README.md +153 -0
  11. package/dist/devicemanager/adb-manager.d.ts +71 -0
  12. package/dist/devicemanager/adb-manager.js +140 -0
  13. package/dist/devicemanager/adb-manager.js.map +1 -0
  14. package/dist/devicemanager/ios-manager.d.ts +58 -0
  15. package/dist/devicemanager/ios-manager.js +122 -0
  16. package/dist/devicemanager/ios-manager.js.map +1 -0
  17. package/dist/index.d.ts +2 -0
  18. package/dist/index.js +40 -0
  19. package/dist/index.js.map +1 -0
  20. package/dist/locators/element-filter.d.ts +13 -0
  21. package/dist/locators/element-filter.js +79 -0
  22. package/dist/locators/element-filter.js.map +1 -0
  23. package/dist/locators/generate-all-locators.d.ts +21 -0
  24. package/dist/locators/generate-all-locators.js +72 -0
  25. package/dist/locators/generate-all-locators.js.map +1 -0
  26. package/dist/locators/locator-generation.d.ts +36 -0
  27. package/dist/locators/locator-generation.js +501 -0
  28. package/dist/locators/locator-generation.js.map +1 -0
  29. package/dist/locators/logger.d.ts +5 -0
  30. package/dist/locators/logger.js +9 -0
  31. package/dist/locators/logger.js.map +1 -0
  32. package/dist/locators/source-parsing.d.ts +43 -0
  33. package/dist/locators/source-parsing.js +100 -0
  34. package/dist/locators/source-parsing.js.map +1 -0
  35. package/dist/resources/index.d.ts +1 -0
  36. package/dist/resources/index.js +7 -0
  37. package/dist/resources/index.js.map +1 -0
  38. package/dist/resources/java/template.d.ts +4 -0
  39. package/dist/resources/java/template.js +82 -0
  40. package/dist/resources/java/template.js.map +1 -0
  41. package/dist/schema.d.ts +2 -0
  42. package/dist/schema.js +5 -0
  43. package/dist/schema.js.map +1 -0
  44. package/dist/scripts/simple-index-documentation.d.ts +20 -0
  45. package/dist/scripts/simple-index-documentation.js +77 -0
  46. package/dist/scripts/simple-index-documentation.js.map +1 -0
  47. package/dist/scripts/simple-query-documentation.d.ts +12 -0
  48. package/dist/scripts/simple-query-documentation.js +52 -0
  49. package/dist/scripts/simple-query-documentation.js.map +1 -0
  50. package/dist/server.d.ts +3 -0
  51. package/dist/server.js +37 -0
  52. package/dist/server.js.map +1 -0
  53. package/dist/tests/__mocks__/@appium/support.d.ts +21 -0
  54. package/dist/tests/__mocks__/@appium/support.js +30 -0
  55. package/dist/tests/__mocks__/@appium/support.js.map +1 -0
  56. package/dist/tests/generate-all-locators.test.d.ts +1 -0
  57. package/dist/tests/generate-all-locators.test.js +140 -0
  58. package/dist/tests/generate-all-locators.test.js.map +1 -0
  59. package/dist/tests/test-setup-wda.d.ts +1 -0
  60. package/dist/tests/test-setup-wda.js +202 -0
  61. package/dist/tests/test-setup-wda.js.map +1 -0
  62. package/dist/tools/answer-appium.d.ts +1 -0
  63. package/dist/tools/answer-appium.js +71 -0
  64. package/dist/tools/answer-appium.js.map +1 -0
  65. package/dist/tools/boot-simulator.d.ts +1 -0
  66. package/dist/tools/boot-simulator.js +71 -0
  67. package/dist/tools/boot-simulator.js.map +1 -0
  68. package/dist/tools/create-session.d.ts +1 -0
  69. package/dist/tools/create-session.js +192 -0
  70. package/dist/tools/create-session.js.map +1 -0
  71. package/dist/tools/delete-session.d.ts +1 -0
  72. package/dist/tools/delete-session.js +47 -0
  73. package/dist/tools/delete-session.js.map +1 -0
  74. package/dist/tools/documentation/index.d.ts +28 -0
  75. package/dist/tools/documentation/index.js +63 -0
  76. package/dist/tools/documentation/index.js.map +1 -0
  77. package/dist/tools/documentation/reasoning-rag.d.ts +88 -0
  78. package/dist/tools/documentation/reasoning-rag.js +281 -0
  79. package/dist/tools/documentation/reasoning-rag.js.map +1 -0
  80. package/dist/tools/documentation/sentence-transformers-embeddings.d.ts +34 -0
  81. package/dist/tools/documentation/sentence-transformers-embeddings.js +111 -0
  82. package/dist/tools/documentation/sentence-transformers-embeddings.js.map +1 -0
  83. package/dist/tools/documentation/simple-pdf-indexer.d.ts +45 -0
  84. package/dist/tools/documentation/simple-pdf-indexer.js +402 -0
  85. package/dist/tools/documentation/simple-pdf-indexer.js.map +1 -0
  86. package/dist/tools/documentation/uploads/documents.json +1 -0
  87. package/dist/tools/generate-tests.d.ts +2 -0
  88. package/dist/tools/generate-tests.js +46 -0
  89. package/dist/tools/generate-tests.js.map +1 -0
  90. package/dist/tools/index.d.ts +16 -0
  91. package/dist/tools/index.js +112 -0
  92. package/dist/tools/index.js.map +1 -0
  93. package/dist/tools/install-wda.d.ts +1 -0
  94. package/dist/tools/install-wda.js +219 -0
  95. package/dist/tools/install-wda.js.map +1 -0
  96. package/dist/tools/interactions/activate-app.d.ts +2 -0
  97. package/dist/tools/interactions/activate-app.js +44 -0
  98. package/dist/tools/interactions/activate-app.js.map +1 -0
  99. package/dist/tools/interactions/click.d.ts +2 -0
  100. package/dist/tools/interactions/click.js +45 -0
  101. package/dist/tools/interactions/click.js.map +1 -0
  102. package/dist/tools/interactions/double-tap.d.ts +2 -0
  103. package/dist/tools/interactions/double-tap.js +81 -0
  104. package/dist/tools/interactions/double-tap.js.map +1 -0
  105. package/dist/tools/interactions/find.d.ts +13 -0
  106. package/dist/tools/interactions/find.js +55 -0
  107. package/dist/tools/interactions/find.js.map +1 -0
  108. package/dist/tools/interactions/get-text.d.ts +2 -0
  109. package/dist/tools/interactions/get-text.js +45 -0
  110. package/dist/tools/interactions/get-text.js.map +1 -0
  111. package/dist/tools/interactions/install-app.d.ts +2 -0
  112. package/dist/tools/interactions/install-app.js +43 -0
  113. package/dist/tools/interactions/install-app.js.map +1 -0
  114. package/dist/tools/interactions/list-apps.d.ts +2 -0
  115. package/dist/tools/interactions/list-apps.js +59 -0
  116. package/dist/tools/interactions/list-apps.js.map +1 -0
  117. package/dist/tools/interactions/screenshot.d.ts +2 -0
  118. package/dist/tools/interactions/screenshot.js +49 -0
  119. package/dist/tools/interactions/screenshot.js.map +1 -0
  120. package/dist/tools/interactions/set-value.d.ts +2 -0
  121. package/dist/tools/interactions/set-value.js +46 -0
  122. package/dist/tools/interactions/set-value.js.map +1 -0
  123. package/dist/tools/interactions/terminate-app.d.ts +2 -0
  124. package/dist/tools/interactions/terminate-app.js +45 -0
  125. package/dist/tools/interactions/terminate-app.js.map +1 -0
  126. package/dist/tools/interactions/uninstall-app.d.ts +2 -0
  127. package/dist/tools/interactions/uninstall-app.js +45 -0
  128. package/dist/tools/interactions/uninstall-app.js.map +1 -0
  129. package/dist/tools/locators.d.ts +1 -0
  130. package/dist/tools/locators.js +71 -0
  131. package/dist/tools/locators.js.map +1 -0
  132. package/dist/tools/scroll-to-element.d.ts +1 -0
  133. package/dist/tools/scroll-to-element.js +155 -0
  134. package/dist/tools/scroll-to-element.js.map +1 -0
  135. package/dist/tools/scroll.d.ts +1 -0
  136. package/dist/tools/scroll.js +91 -0
  137. package/dist/tools/scroll.js.map +1 -0
  138. package/dist/tools/select-device.d.ts +5 -0
  139. package/dist/tools/select-device.js +222 -0
  140. package/dist/tools/select-device.js.map +1 -0
  141. package/dist/tools/select-platform.d.ts +1 -0
  142. package/dist/tools/select-platform.js +195 -0
  143. package/dist/tools/select-platform.js.map +1 -0
  144. package/dist/tools/session-store.d.ts +7 -0
  145. package/dist/tools/session-store.js +64 -0
  146. package/dist/tools/session-store.js.map +1 -0
  147. package/dist/tools/setup-wda.d.ts +1 -0
  148. package/dist/tools/setup-wda.js +177 -0
  149. package/dist/tools/setup-wda.js.map +1 -0
  150. package/docs/CONTRIBUTING.md +424 -0
  151. package/eslint.config.js +49 -0
  152. package/examples/android-gmail.md +7 -0
  153. package/examples/android-todo-app.md +9 -0
  154. package/jest.config.js +23 -0
  155. package/package.json +71 -6
  156. package/scripts/setup-submodules-sparse.sh +53 -0
  157. package/scripts/update-submodules.sh +14 -0
  158. package/src/devicemanager/adb-manager.ts +164 -0
  159. package/src/devicemanager/ios-manager.ts +145 -0
  160. package/src/index.ts +47 -0
  161. package/src/locators/element-filter.ts +134 -0
  162. package/src/locators/generate-all-locators.ts +149 -0
  163. package/src/locators/locator-generation.ts +657 -0
  164. package/src/locators/logger.ts +11 -0
  165. package/src/locators/source-parsing.ts +149 -0
  166. package/src/resources/caps.json +697 -0
  167. package/src/resources/index.ts +7 -0
  168. package/src/resources/java/template.ts +83 -0
  169. package/src/resources/submodules/appium/.github/PULL_REQUEST_TEMPLATE.md +28 -0
  170. package/src/resources/submodules/appium/CHANGELOG.md +45 -0
  171. package/src/resources/submodules/appium/CONDUCT.md +48 -0
  172. package/src/resources/submodules/appium/GOVERNANCE.md +185 -0
  173. package/src/resources/submodules/appium/IDEAS.md +16 -0
  174. package/src/resources/submodules/appium/README.md +221 -0
  175. package/src/resources/submodules/appium/ROADMAP.md +30 -0
  176. package/src/resources/submodules/appium/SPONSORS.md +3 -0
  177. package/src/resources/submodules/appium/docs/README.md +6 -0
  178. package/src/resources/submodules/appium/docs/payout.md +35 -0
  179. package/src/resources/submodules/appium/packages/appium/CHANGELOG.md +1437 -0
  180. package/src/resources/submodules/appium/packages/appium/README.md +221 -0
  181. package/src/resources/submodules/appium/packages/appium/docs/en/blog/index.md +2 -0
  182. package/src/resources/submodules/appium/packages/appium/docs/en/blog/posts/announcing-appiumconf2024.md +45 -0
  183. package/src/resources/submodules/appium/packages/appium/docs/en/blog/posts/announcing-browserstack-as-strategic-partner.md +46 -0
  184. package/src/resources/submodules/appium/packages/appium/docs/en/blog/posts/announcing-headspin-as-development-partner.md +47 -0
  185. package/src/resources/submodules/appium/packages/appium/docs/en/blog/posts/announcing-lambdatest-as-strategic-partner.md +42 -0
  186. package/src/resources/submodules/appium/packages/appium/docs/en/blog/posts/announcing-sauce-labs-as-strategic-partner.md +36 -0
  187. package/src/resources/submodules/appium/packages/appium/docs/en/blog/posts/announcing-sponsorship-program.md +48 -0
  188. package/src/resources/submodules/appium/packages/appium/docs/en/blog/posts/appium3.md +40 -0
  189. package/src/resources/submodules/appium/packages/appium/docs/en/blog/posts/hello-world.md +15 -0
  190. package/src/resources/submodules/appium/packages/appium/docs/en/contributing/index.md +150 -0
  191. package/src/resources/submodules/appium/packages/appium/docs/en/developing/build-docs.md +86 -0
  192. package/src/resources/submodules/appium/packages/appium/docs/en/developing/build-doctor-checks.md +141 -0
  193. package/src/resources/submodules/appium/packages/appium/docs/en/developing/build-drivers.md +860 -0
  194. package/src/resources/submodules/appium/packages/appium/docs/en/developing/build-plugins.md +514 -0
  195. package/src/resources/submodules/appium/packages/appium/docs/en/developing/config-system.md +451 -0
  196. package/src/resources/submodules/appium/packages/appium/docs/en/developing/index.md +18 -0
  197. package/src/resources/submodules/appium/packages/appium/docs/en/developing/sensitive.md +49 -0
  198. package/src/resources/submodules/appium/packages/appium/docs/en/ecosystem/clients.md +132 -0
  199. package/src/resources/submodules/appium/packages/appium/docs/en/ecosystem/drivers.md +207 -0
  200. package/src/resources/submodules/appium/packages/appium/docs/en/ecosystem/index.md +45 -0
  201. package/src/resources/submodules/appium/packages/appium/docs/en/ecosystem/plugins.md +138 -0
  202. package/src/resources/submodules/appium/packages/appium/docs/en/ecosystem/tools.md +83 -0
  203. package/src/resources/submodules/appium/packages/appium/docs/en/guides/branch-testing.md +57 -0
  204. package/src/resources/submodules/appium/packages/appium/docs/en/guides/caching.md +76 -0
  205. package/src/resources/submodules/appium/packages/appium/docs/en/guides/caps.md +275 -0
  206. package/src/resources/submodules/appium/packages/appium/docs/en/guides/config.md +98 -0
  207. package/src/resources/submodules/appium/packages/appium/docs/en/guides/context.md +44 -0
  208. package/src/resources/submodules/appium/packages/appium/docs/en/guides/event-timing.md +73 -0
  209. package/src/resources/submodules/appium/packages/appium/docs/en/guides/execute-methods.md +122 -0
  210. package/src/resources/submodules/appium/packages/appium/docs/en/guides/grid.md +166 -0
  211. package/src/resources/submodules/appium/packages/appium/docs/en/guides/headers.md +17 -0
  212. package/src/resources/submodules/appium/packages/appium/docs/en/guides/log-filters.md +86 -0
  213. package/src/resources/submodules/appium/packages/appium/docs/en/guides/managing-exts.md +87 -0
  214. package/src/resources/submodules/appium/packages/appium/docs/en/guides/migrating-1-to-2.md +368 -0
  215. package/src/resources/submodules/appium/packages/appium/docs/en/guides/migrating-2-to-3.md +464 -0
  216. package/src/resources/submodules/appium/packages/appium/docs/en/guides/security.md +89 -0
  217. package/src/resources/submodules/appium/packages/appium/docs/en/guides/settings.md +68 -0
  218. package/src/resources/submodules/appium/packages/appium/docs/en/guides/tls.md +42 -0
  219. package/src/resources/submodules/appium/packages/appium/docs/en/index.md +59 -0
  220. package/src/resources/submodules/appium/packages/appium/docs/en/intro/appium.md +202 -0
  221. package/src/resources/submodules/appium/packages/appium/docs/en/intro/clients.md +127 -0
  222. package/src/resources/submodules/appium/packages/appium/docs/en/intro/drivers.md +188 -0
  223. package/src/resources/submodules/appium/packages/appium/docs/en/intro/history.md +196 -0
  224. package/src/resources/submodules/appium/packages/appium/docs/en/intro/index.md +39 -0
  225. package/src/resources/submodules/appium/packages/appium/docs/en/quickstart/index.md +29 -0
  226. package/src/resources/submodules/appium/packages/appium/docs/en/quickstart/install.md +50 -0
  227. package/src/resources/submodules/appium/packages/appium/docs/en/quickstart/next-steps.md +23 -0
  228. package/src/resources/submodules/appium/packages/appium/docs/en/quickstart/requirements.md +29 -0
  229. package/src/resources/submodules/appium/packages/appium/docs/en/quickstart/test-dotnet.md +105 -0
  230. package/src/resources/submodules/appium/packages/appium/docs/en/quickstart/test-java.md +23 -0
  231. package/src/resources/submodules/appium/packages/appium/docs/en/quickstart/test-js.md +75 -0
  232. package/src/resources/submodules/appium/packages/appium/docs/en/quickstart/test-py.md +60 -0
  233. package/src/resources/submodules/appium/packages/appium/docs/en/quickstart/test-rb.md +83 -0
  234. package/src/resources/submodules/appium/packages/appium/docs/en/quickstart/uiauto2-driver.md +144 -0
  235. package/src/resources/submodules/appium/packages/appium/docs/en/reference/api/appium.md +394 -0
  236. package/src/resources/submodules/appium/packages/appium/docs/en/reference/api/bidi.md +70 -0
  237. package/src/resources/submodules/appium/packages/appium/docs/en/reference/api/index.md +30 -0
  238. package/src/resources/submodules/appium/packages/appium/docs/en/reference/api/jsonwp.md +214 -0
  239. package/src/resources/submodules/appium/packages/appium/docs/en/reference/api/mjsonwp.md +151 -0
  240. package/src/resources/submodules/appium/packages/appium/docs/en/reference/api/others.md +671 -0
  241. package/src/resources/submodules/appium/packages/appium/docs/en/reference/api/plugins.md +289 -0
  242. package/src/resources/submodules/appium/packages/appium/docs/en/reference/api/webdriver.md +1114 -0
  243. package/src/resources/submodules/appium/packages/appium/docs/en/reference/cli/env-vars.md +31 -0
  244. package/src/resources/submodules/appium/packages/appium/docs/en/reference/cli/extensions.md +239 -0
  245. package/src/resources/submodules/appium/packages/appium/docs/en/reference/cli/index.md +35 -0
  246. package/src/resources/submodules/appium/packages/appium/docs/en/reference/cli/server.md +76 -0
  247. package/src/resources/submodules/appium/packages/appium/docs/en/reference/cli/setup.md +76 -0
  248. package/src/resources/submodules/appium/packages/appium/docs/en/reference/index.md +25 -0
  249. package/src/resources/submodules/appium/packages/appium/docs/en/resources/index.md +28 -0
  250. package/src/resources/submodules/appium/packages/appium/docs/en/sponsors/index.md +64 -0
  251. package/src/resources/submodules/appium/packages/appium/docs/ja/blog/index.md +2 -0
  252. package/src/resources/submodules/appium/packages/appium/docs/ja/blog/posts/announcing-appiumconf2024.md +45 -0
  253. package/src/resources/submodules/appium/packages/appium/docs/ja/blog/posts/announcing-browserstack-as-strategic-partner.md +46 -0
  254. package/src/resources/submodules/appium/packages/appium/docs/ja/blog/posts/announcing-headspin-as-development-partner.md +47 -0
  255. package/src/resources/submodules/appium/packages/appium/docs/ja/blog/posts/announcing-lambdatest-as-strategic-partner.md +41 -0
  256. package/src/resources/submodules/appium/packages/appium/docs/ja/blog/posts/announcing-sauce-labs-as-strategic-partner.md +36 -0
  257. package/src/resources/submodules/appium/packages/appium/docs/ja/blog/posts/announcing-sponsorship-program.md +48 -0
  258. package/src/resources/submodules/appium/packages/appium/docs/ja/blog/posts/appium3.md +40 -0
  259. package/src/resources/submodules/appium/packages/appium/docs/ja/blog/posts/hello-world.md +15 -0
  260. package/src/resources/submodules/appium/packages/appium/docs/ja/contributing/index.md +158 -0
  261. package/src/resources/submodules/appium/packages/appium/docs/ja/developing/build-docs.md +86 -0
  262. package/src/resources/submodules/appium/packages/appium/docs/ja/developing/build-doctor-checks.md +141 -0
  263. package/src/resources/submodules/appium/packages/appium/docs/ja/developing/build-drivers.md +866 -0
  264. package/src/resources/submodules/appium/packages/appium/docs/ja/developing/build-plugins.md +520 -0
  265. package/src/resources/submodules/appium/packages/appium/docs/ja/developing/config-system.md +468 -0
  266. package/src/resources/submodules/appium/packages/appium/docs/ja/developing/index.md +18 -0
  267. package/src/resources/submodules/appium/packages/appium/docs/ja/developing/sensitive.md +49 -0
  268. package/src/resources/submodules/appium/packages/appium/docs/ja/ecosystem/clients.md +143 -0
  269. package/src/resources/submodules/appium/packages/appium/docs/ja/ecosystem/drivers.md +219 -0
  270. package/src/resources/submodules/appium/packages/appium/docs/ja/ecosystem/index.md +45 -0
  271. package/src/resources/submodules/appium/packages/appium/docs/ja/ecosystem/plugins.md +140 -0
  272. package/src/resources/submodules/appium/packages/appium/docs/ja/ecosystem/tools.md +87 -0
  273. package/src/resources/submodules/appium/packages/appium/docs/ja/guides/branch-testing.md +57 -0
  274. package/src/resources/submodules/appium/packages/appium/docs/ja/guides/caching.md +78 -0
  275. package/src/resources/submodules/appium/packages/appium/docs/ja/guides/caps.md +259 -0
  276. package/src/resources/submodules/appium/packages/appium/docs/ja/guides/config.md +102 -0
  277. package/src/resources/submodules/appium/packages/appium/docs/ja/guides/context.md +44 -0
  278. package/src/resources/submodules/appium/packages/appium/docs/ja/guides/event-timing.md +75 -0
  279. package/src/resources/submodules/appium/packages/appium/docs/ja/guides/execute-methods.md +142 -0
  280. package/src/resources/submodules/appium/packages/appium/docs/ja/guides/grid.md +166 -0
  281. package/src/resources/submodules/appium/packages/appium/docs/ja/guides/headers.md +17 -0
  282. package/src/resources/submodules/appium/packages/appium/docs/ja/guides/log-filters.md +86 -0
  283. package/src/resources/submodules/appium/packages/appium/docs/ja/guides/managing-exts.md +89 -0
  284. package/src/resources/submodules/appium/packages/appium/docs/ja/guides/migrating-1-to-2.md +402 -0
  285. package/src/resources/submodules/appium/packages/appium/docs/ja/guides/migrating-2-to-3.md +458 -0
  286. package/src/resources/submodules/appium/packages/appium/docs/ja/guides/security.md +89 -0
  287. package/src/resources/submodules/appium/packages/appium/docs/ja/guides/settings.md +70 -0
  288. package/src/resources/submodules/appium/packages/appium/docs/ja/guides/tls.md +43 -0
  289. package/src/resources/submodules/appium/packages/appium/docs/ja/index.md +55 -0
  290. package/src/resources/submodules/appium/packages/appium/docs/ja/intro/appium.md +191 -0
  291. package/src/resources/submodules/appium/packages/appium/docs/ja/intro/clients.md +139 -0
  292. package/src/resources/submodules/appium/packages/appium/docs/ja/intro/drivers.md +188 -0
  293. package/src/resources/submodules/appium/packages/appium/docs/ja/intro/history.md +196 -0
  294. package/src/resources/submodules/appium/packages/appium/docs/ja/intro/index.md +39 -0
  295. package/src/resources/submodules/appium/packages/appium/docs/ja/quickstart/index.md +23 -0
  296. package/src/resources/submodules/appium/packages/appium/docs/ja/quickstart/install.md +47 -0
  297. package/src/resources/submodules/appium/packages/appium/docs/ja/quickstart/next-steps.md +19 -0
  298. package/src/resources/submodules/appium/packages/appium/docs/ja/quickstart/requirements.md +29 -0
  299. package/src/resources/submodules/appium/packages/appium/docs/ja/quickstart/test-dotnet.md +107 -0
  300. package/src/resources/submodules/appium/packages/appium/docs/ja/quickstart/test-java.md +23 -0
  301. package/src/resources/submodules/appium/packages/appium/docs/ja/quickstart/test-js.md +77 -0
  302. package/src/resources/submodules/appium/packages/appium/docs/ja/quickstart/test-py.md +63 -0
  303. package/src/resources/submodules/appium/packages/appium/docs/ja/quickstart/test-rb.md +85 -0
  304. package/src/resources/submodules/appium/packages/appium/docs/ja/quickstart/uiauto2-driver.md +148 -0
  305. package/src/resources/submodules/appium/packages/appium/docs/ja/reference/api/appium.md +395 -0
  306. package/src/resources/submodules/appium/packages/appium/docs/ja/reference/api/bidi.md +71 -0
  307. package/src/resources/submodules/appium/packages/appium/docs/ja/reference/api/index.md +30 -0
  308. package/src/resources/submodules/appium/packages/appium/docs/ja/reference/api/jsonwp.md +215 -0
  309. package/src/resources/submodules/appium/packages/appium/docs/ja/reference/api/mjsonwp.md +152 -0
  310. package/src/resources/submodules/appium/packages/appium/docs/ja/reference/api/others.md +672 -0
  311. package/src/resources/submodules/appium/packages/appium/docs/ja/reference/api/plugins.md +291 -0
  312. package/src/resources/submodules/appium/packages/appium/docs/ja/reference/api/webdriver.md +1114 -0
  313. package/src/resources/submodules/appium/packages/appium/docs/ja/reference/cli/env-vars.md +31 -0
  314. package/src/resources/submodules/appium/packages/appium/docs/ja/reference/cli/extensions.md +240 -0
  315. package/src/resources/submodules/appium/packages/appium/docs/ja/reference/cli/index.md +35 -0
  316. package/src/resources/submodules/appium/packages/appium/docs/ja/reference/cli/server.md +76 -0
  317. package/src/resources/submodules/appium/packages/appium/docs/ja/reference/cli/setup.md +78 -0
  318. package/src/resources/submodules/appium/packages/appium/docs/ja/reference/index.md +25 -0
  319. package/src/resources/submodules/appium/packages/appium/docs/ja/resources/index.md +28 -0
  320. package/src/resources/submodules/appium/packages/appium/docs/ja/sponsors/index.md +61 -0
  321. package/src/resources/submodules/appium/packages/appium/docs/overrides/assets/images/appium-logo-horiz-white.png +0 -0
  322. package/src/resources/submodules/appium/packages/appium/docs/overrides/assets/images/appium-logo-horiz.png +0 -0
  323. package/src/resources/submodules/appium/packages/appium/docs/overrides/assets/images/appium-logo-white.png +0 -0
  324. package/src/resources/submodules/appium/packages/appium/docs/overrides/assets/images/appium-logo.png +0 -0
  325. package/src/resources/submodules/appium/packages/appium/docs/overrides/assets/images/sponsor-logo-browserstack-dark.png +0 -0
  326. package/src/resources/submodules/appium/packages/appium/docs/overrides/assets/images/sponsor-logo-browserstack-light.png +0 -0
  327. package/src/resources/submodules/appium/packages/appium/docs/overrides/assets/images/sponsor-logo-lambdatest-dark.png +0 -0
  328. package/src/resources/submodules/appium/packages/appium/docs/overrides/assets/images/sponsor-logo-lambdatest-light.png +0 -0
  329. package/src/resources/submodules/appium/packages/appium/docs/overrides/assets/images/sponsor-logo-sauce.png +0 -0
  330. package/src/resources/submodules/appium/packages/appium/docs/zh/blog/index.md +2 -0
  331. package/src/resources/submodules/appium/packages/appium/docs/zh/blog/posts/announcing-appiumconf2024.md +45 -0
  332. package/src/resources/submodules/appium/packages/appium/docs/zh/blog/posts/announcing-browserstack-as-strategic-partner.md +46 -0
  333. package/src/resources/submodules/appium/packages/appium/docs/zh/blog/posts/announcing-headspin-as-development-partner.md +47 -0
  334. package/src/resources/submodules/appium/packages/appium/docs/zh/blog/posts/announcing-lambdatest-as-strategic-partner.md +41 -0
  335. package/src/resources/submodules/appium/packages/appium/docs/zh/blog/posts/announcing-sauce-labs-as-strategic-partner.md +36 -0
  336. package/src/resources/submodules/appium/packages/appium/docs/zh/blog/posts/announcing-sponsorship-program.md +48 -0
  337. package/src/resources/submodules/appium/packages/appium/docs/zh/blog/posts/appium3.md +40 -0
  338. package/src/resources/submodules/appium/packages/appium/docs/zh/blog/posts/hello-world.md +15 -0
  339. package/src/resources/submodules/appium/packages/appium/docs/zh/contributing/index.md +132 -0
  340. package/src/resources/submodules/appium/packages/appium/docs/zh/developing/build-docs.md +86 -0
  341. package/src/resources/submodules/appium/packages/appium/docs/zh/developing/build-doctor-checks.md +141 -0
  342. package/src/resources/submodules/appium/packages/appium/docs/zh/developing/build-drivers.md +866 -0
  343. package/src/resources/submodules/appium/packages/appium/docs/zh/developing/build-plugins.md +520 -0
  344. package/src/resources/submodules/appium/packages/appium/docs/zh/developing/config-system.md +468 -0
  345. package/src/resources/submodules/appium/packages/appium/docs/zh/developing/index.md +18 -0
  346. package/src/resources/submodules/appium/packages/appium/docs/zh/developing/sensitive.md +49 -0
  347. package/src/resources/submodules/appium/packages/appium/docs/zh/ecosystem/clients.md +143 -0
  348. package/src/resources/submodules/appium/packages/appium/docs/zh/ecosystem/drivers.md +219 -0
  349. package/src/resources/submodules/appium/packages/appium/docs/zh/ecosystem/index.md +45 -0
  350. package/src/resources/submodules/appium/packages/appium/docs/zh/ecosystem/plugins.md +140 -0
  351. package/src/resources/submodules/appium/packages/appium/docs/zh/ecosystem/tools.md +87 -0
  352. package/src/resources/submodules/appium/packages/appium/docs/zh/guides/branch-testing.md +57 -0
  353. package/src/resources/submodules/appium/packages/appium/docs/zh/guides/caching.md +78 -0
  354. package/src/resources/submodules/appium/packages/appium/docs/zh/guides/caps.md +284 -0
  355. package/src/resources/submodules/appium/packages/appium/docs/zh/guides/config.md +102 -0
  356. package/src/resources/submodules/appium/packages/appium/docs/zh/guides/context.md +44 -0
  357. package/src/resources/submodules/appium/packages/appium/docs/zh/guides/event-timing.md +75 -0
  358. package/src/resources/submodules/appium/packages/appium/docs/zh/guides/execute-methods.md +142 -0
  359. package/src/resources/submodules/appium/packages/appium/docs/zh/guides/grid.md +166 -0
  360. package/src/resources/submodules/appium/packages/appium/docs/zh/guides/headers.md +17 -0
  361. package/src/resources/submodules/appium/packages/appium/docs/zh/guides/log-filters.md +86 -0
  362. package/src/resources/submodules/appium/packages/appium/docs/zh/guides/managing-exts.md +89 -0
  363. package/src/resources/submodules/appium/packages/appium/docs/zh/guides/migrating-1-to-2.md +410 -0
  364. package/src/resources/submodules/appium/packages/appium/docs/zh/guides/migrating-2-to-3.md +459 -0
  365. package/src/resources/submodules/appium/packages/appium/docs/zh/guides/security.md +89 -0
  366. package/src/resources/submodules/appium/packages/appium/docs/zh/guides/settings.md +70 -0
  367. package/src/resources/submodules/appium/packages/appium/docs/zh/guides/tls.md +43 -0
  368. package/src/resources/submodules/appium/packages/appium/docs/zh/index.md +54 -0
  369. package/src/resources/submodules/appium/packages/appium/docs/zh/intro/appium.md +200 -0
  370. package/src/resources/submodules/appium/packages/appium/docs/zh/intro/clients.md +139 -0
  371. package/src/resources/submodules/appium/packages/appium/docs/zh/intro/drivers.md +188 -0
  372. package/src/resources/submodules/appium/packages/appium/docs/zh/intro/history.md +196 -0
  373. package/src/resources/submodules/appium/packages/appium/docs/zh/intro/index.md +39 -0
  374. package/src/resources/submodules/appium/packages/appium/docs/zh/quickstart/index.md +23 -0
  375. package/src/resources/submodules/appium/packages/appium/docs/zh/quickstart/install.md +47 -0
  376. package/src/resources/submodules/appium/packages/appium/docs/zh/quickstart/next-steps.md +19 -0
  377. package/src/resources/submodules/appium/packages/appium/docs/zh/quickstart/requirements.md +21 -0
  378. package/src/resources/submodules/appium/packages/appium/docs/zh/quickstart/test-dotnet.md +99 -0
  379. package/src/resources/submodules/appium/packages/appium/docs/zh/quickstart/test-java.md +20 -0
  380. package/src/resources/submodules/appium/packages/appium/docs/zh/quickstart/test-js.md +62 -0
  381. package/src/resources/submodules/appium/packages/appium/docs/zh/quickstart/test-py.md +57 -0
  382. package/src/resources/submodules/appium/packages/appium/docs/zh/quickstart/test-rb.md +80 -0
  383. package/src/resources/submodules/appium/packages/appium/docs/zh/quickstart/uiauto2-driver.md +148 -0
  384. package/src/resources/submodules/appium/packages/appium/docs/zh/reference/api/appium.md +395 -0
  385. package/src/resources/submodules/appium/packages/appium/docs/zh/reference/api/bidi.md +71 -0
  386. package/src/resources/submodules/appium/packages/appium/docs/zh/reference/api/index.md +30 -0
  387. package/src/resources/submodules/appium/packages/appium/docs/zh/reference/api/jsonwp.md +215 -0
  388. package/src/resources/submodules/appium/packages/appium/docs/zh/reference/api/mjsonwp.md +152 -0
  389. package/src/resources/submodules/appium/packages/appium/docs/zh/reference/api/others.md +672 -0
  390. package/src/resources/submodules/appium/packages/appium/docs/zh/reference/api/plugins.md +291 -0
  391. package/src/resources/submodules/appium/packages/appium/docs/zh/reference/api/webdriver.md +1114 -0
  392. package/src/resources/submodules/appium/packages/appium/docs/zh/reference/cli/env-vars.md +31 -0
  393. package/src/resources/submodules/appium/packages/appium/docs/zh/reference/cli/extensions.md +240 -0
  394. package/src/resources/submodules/appium/packages/appium/docs/zh/reference/cli/index.md +35 -0
  395. package/src/resources/submodules/appium/packages/appium/docs/zh/reference/cli/server.md +76 -0
  396. package/src/resources/submodules/appium/packages/appium/docs/zh/reference/cli/setup.md +78 -0
  397. package/src/resources/submodules/appium/packages/appium/docs/zh/reference/index.md +25 -0
  398. package/src/resources/submodules/appium/packages/appium/docs/zh/resources/index.md +28 -0
  399. package/src/resources/submodules/appium/packages/appium/docs/zh/sponsors/index.md +61 -0
  400. package/src/resources/submodules/appium/packages/appium/types/manifest/README.md +30 -0
  401. package/src/resources/submodules/appium/packages/base-driver/CHANGELOG.md +1131 -0
  402. package/src/resources/submodules/appium/packages/base-driver/README.md +15 -0
  403. package/src/resources/submodules/appium/packages/base-driver/docs/mjsonwp/errors.md +82 -0
  404. package/src/resources/submodules/appium/packages/base-driver/docs/mjsonwp/protocol-methods.md +182 -0
  405. package/src/resources/submodules/appium/packages/base-driver/static/appium.png +0 -0
  406. package/src/resources/submodules/appium/packages/base-plugin/CHANGELOG.md +672 -0
  407. package/src/resources/submodules/appium/packages/base-plugin/README.md +15 -0
  408. package/src/resources/submodules/appium/packages/docutils/CHANGELOG.md +948 -0
  409. package/src/resources/submodules/appium/packages/docutils/README.md +27 -0
  410. package/src/resources/submodules/appium/packages/driver-test-support/CHANGELOG.md +717 -0
  411. package/src/resources/submodules/appium/packages/driver-test-support/README.md +112 -0
  412. package/src/resources/submodules/appium/packages/eslint-config-appium-ts/CHANGELOG.md +168 -0
  413. package/src/resources/submodules/appium/packages/eslint-config-appium-ts/README.md +33 -0
  414. package/src/resources/submodules/appium/packages/execute-driver-plugin/CHANGELOG.md +603 -0
  415. package/src/resources/submodules/appium/packages/execute-driver-plugin/README.md +42 -0
  416. package/src/resources/submodules/appium/packages/fake-driver/CHANGELOG.md +545 -0
  417. package/src/resources/submodules/appium/packages/fake-driver/README.md +7 -0
  418. package/src/resources/submodules/appium/packages/fake-driver/lib/screen.png +0 -0
  419. package/src/resources/submodules/appium/packages/fake-plugin/CHANGELOG.md +683 -0
  420. package/src/resources/submodules/appium/packages/fake-plugin/README.md +7 -0
  421. package/src/resources/submodules/appium/packages/images-plugin/CHANGELOG.md +602 -0
  422. package/src/resources/submodules/appium/packages/images-plugin/README.md +27 -0
  423. package/src/resources/submodules/appium/packages/images-plugin/docs/find-by-image.md +65 -0
  424. package/src/resources/submodules/appium/packages/images-plugin/docs/image-comparison.md +203 -0
  425. package/src/resources/submodules/appium/packages/images-plugin/test/fixtures/appstore.png +0 -0
  426. package/src/resources/submodules/appium/packages/images-plugin/test/fixtures/img1.png +0 -0
  427. package/src/resources/submodules/appium/packages/images-plugin/test/fixtures/img2.png +0 -0
  428. package/src/resources/submodules/appium/packages/images-plugin/test/fixtures/img2_part.png +0 -0
  429. package/src/resources/submodules/appium/packages/logger/CHANGELOG.md +162 -0
  430. package/src/resources/submodules/appium/packages/logger/README.md +31 -0
  431. package/src/resources/submodules/appium/packages/opencv/CHANGELOG.md +384 -0
  432. package/src/resources/submodules/appium/packages/opencv/README.md +68 -0
  433. package/src/resources/submodules/appium/packages/opencv/test/e2e/images/appium-diagram.jpg +0 -0
  434. package/src/resources/submodules/appium/packages/opencv/test/e2e/images/cc1.png +0 -0
  435. package/src/resources/submodules/appium/packages/opencv/test/e2e/images/cc2.png +0 -0
  436. package/src/resources/submodules/appium/packages/opencv/test/e2e/images/cc_rotated.png +0 -0
  437. package/src/resources/submodules/appium/packages/opencv/test/e2e/images/findwaldo.jpg +0 -0
  438. package/src/resources/submodules/appium/packages/opencv/test/e2e/images/number5.png +0 -0
  439. package/src/resources/submodules/appium/packages/opencv/test/e2e/images/waldo.jpg +0 -0
  440. package/src/resources/submodules/appium/packages/plugin-test-support/CHANGELOG.md +539 -0
  441. package/src/resources/submodules/appium/packages/plugin-test-support/README.md +49 -0
  442. package/src/resources/submodules/appium/packages/relaxed-caps-plugin/CHANGELOG.md +154 -0
  443. package/src/resources/submodules/appium/packages/relaxed-caps-plugin/README.md +35 -0
  444. package/src/resources/submodules/appium/packages/schema/CHANGELOG.md +271 -0
  445. package/src/resources/submodules/appium/packages/schema/README.md +50 -0
  446. package/src/resources/submodules/appium/packages/storage-plugin/CHANGELOG.md +73 -0
  447. package/src/resources/submodules/appium/packages/storage-plugin/README.md +83 -0
  448. package/src/resources/submodules/appium/packages/strongbox/CHANGELOG.md +94 -0
  449. package/src/resources/submodules/appium/packages/strongbox/README.md +96 -0
  450. package/src/resources/submodules/appium/packages/support/CHANGELOG.md +1054 -0
  451. package/src/resources/submodules/appium/packages/support/README.md +161 -0
  452. package/src/resources/submodules/appium/packages/test-support/CHANGELOG.md +712 -0
  453. package/src/resources/submodules/appium/packages/test-support/README.md +61 -0
  454. package/src/resources/submodules/appium/packages/tsconfig/CHANGELOG.md +131 -0
  455. package/src/resources/submodules/appium/packages/tsconfig/README.md +19 -0
  456. package/src/resources/submodules/appium/packages/types/CHANGELOG.md +793 -0
  457. package/src/resources/submodules/appium/packages/types/README.md +21 -0
  458. package/src/resources/submodules/appium/packages/universal-xml-plugin/CHANGELOG.md +435 -0
  459. package/src/resources/submodules/appium/packages/universal-xml-plugin/README.md +53 -0
  460. package/src/resources/submodules/appium/renovate/README.md +63 -0
  461. package/src/resources/submodules/appium-uiautomator2-driver/CHANGELOG.md +1204 -0
  462. package/src/resources/submodules/appium-uiautomator2-driver/README.md +2077 -0
  463. package/src/resources/submodules/appium-uiautomator2-driver/docs/actions.md +72 -0
  464. package/src/resources/submodules/appium-uiautomator2-driver/docs/activity-startup.md +47 -0
  465. package/src/resources/submodules/appium-uiautomator2-driver/docs/android-appbundle.md +69 -0
  466. package/src/resources/submodules/appium-uiautomator2-driver/docs/android-mobile-gestures.md +352 -0
  467. package/src/resources/submodules/appium-uiautomator2-driver/docs/bidi.md +50 -0
  468. package/src/resources/submodules/appium-uiautomator2-driver/docs/capability-sets.md +136 -0
  469. package/src/resources/submodules/appium-uiautomator2-driver/docs/scheduled-actions.md +155 -0
  470. package/src/resources/submodules/appium-uiautomator2-driver/docs/uiautomator-uiselector.md +51 -0
  471. package/src/resources/submodules/appium-uiautomator2-driver/docs/unlock/main.md +95 -0
  472. package/src/resources/submodules/appium-uiautomator2-driver/docs/unlock/screen1.png +0 -0
  473. package/src/resources/submodules/appium-uiautomator2-driver/docs/unlock/screen2.png +0 -0
  474. package/src/resources/submodules/appium-uiautomator2-driver/test/functional/assets/checkered-squares.png +0 -0
  475. package/src/resources/submodules/appium-uiautomator2-driver/test/functional/assets/start-button.png +0 -0
  476. package/src/resources/submodules/appium-uiautomator2-driver/test/functional/assets/stop-button.png +0 -0
  477. package/src/resources/submodules/appium-xcuitest-driver/.github/ISSUE_TEMPLATE.md +4 -0
  478. package/src/resources/submodules/appium-xcuitest-driver/CHANGELOG.md +2594 -0
  479. package/src/resources/submodules/appium-xcuitest-driver/README.md +55 -0
  480. package/src/resources/submodules/appium-xcuitest-driver/docs/assets/images/appium-logo-white.png +0 -0
  481. package/src/resources/submodules/appium-xcuitest-driver/docs/assets/images/appium-logo.png +0 -0
  482. package/src/resources/submodules/appium-xcuitest-driver/docs/assets/images/appium-plus-xctest.png +0 -0
  483. package/src/resources/submodules/appium-xcuitest-driver/docs/contributing.md +45 -0
  484. package/src/resources/submodules/appium-xcuitest-driver/docs/endpoints-wda.md +61 -0
  485. package/src/resources/submodules/appium-xcuitest-driver/docs/endpoints.md +98 -0
  486. package/src/resources/submodules/appium-xcuitest-driver/docs/guides/assets/images/ios-xctest-file-movement/keynote.png +0 -0
  487. package/src/resources/submodules/appium-xcuitest-driver/docs/guides/assets/images/ios-xctest-file-movement/on_my_iphone.png +0 -0
  488. package/src/resources/submodules/appium-xcuitest-driver/docs/guides/assets/images/ios-xctest-file-movement/top_files.png +0 -0
  489. package/src/resources/submodules/appium-xcuitest-driver/docs/guides/attach-to-running-wda.md +43 -0
  490. package/src/resources/submodules/appium-xcuitest-driver/docs/guides/audio-capture.md +78 -0
  491. package/src/resources/submodules/appium-xcuitest-driver/docs/guides/capability-sets.md +169 -0
  492. package/src/resources/submodules/appium-xcuitest-driver/docs/guides/ci-setup.md +47 -0
  493. package/src/resources/submodules/appium-xcuitest-driver/docs/guides/clipboard.md +47 -0
  494. package/src/resources/submodules/appium-xcuitest-driver/docs/guides/elements-lookup-troubleshooting.md +158 -0
  495. package/src/resources/submodules/appium-xcuitest-driver/docs/guides/file-transfer.md +147 -0
  496. package/src/resources/submodules/appium-xcuitest-driver/docs/guides/gestures.md +52 -0
  497. package/src/resources/submodules/appium-xcuitest-driver/docs/guides/hybrid.md +137 -0
  498. package/src/resources/submodules/appium-xcuitest-driver/docs/guides/input-events.md +67 -0
  499. package/src/resources/submodules/appium-xcuitest-driver/docs/guides/install-certificate.md +19 -0
  500. package/src/resources/submodules/appium-xcuitest-driver/docs/guides/multiple-xcode-versions.md +37 -0
  501. package/src/resources/submodules/appium-xcuitest-driver/docs/guides/parallel-tests.md +39 -0
  502. package/src/resources/submodules/appium-xcuitest-driver/docs/guides/run-prebuilt-wda.md +135 -0
  503. package/src/resources/submodules/appium-xcuitest-driver/docs/guides/run-preinstalled-wda.md +178 -0
  504. package/src/resources/submodules/appium-xcuitest-driver/docs/guides/touch-id.md +33 -0
  505. package/src/resources/submodules/appium-xcuitest-driver/docs/guides/troubleshooting.md +191 -0
  506. package/src/resources/submodules/appium-xcuitest-driver/docs/guides/tvos.md +114 -0
  507. package/src/resources/submodules/appium-xcuitest-driver/docs/guides/wda-custom-server.md +283 -0
  508. package/src/resources/submodules/appium-xcuitest-driver/docs/guides/wda-slowness.md +231 -0
  509. package/src/resources/submodules/appium-xcuitest-driver/docs/index.md +36 -0
  510. package/src/resources/submodules/appium-xcuitest-driver/docs/installation/index.md +137 -0
  511. package/src/resources/submodules/appium-xcuitest-driver/docs/overview.md +19 -0
  512. package/src/resources/submodules/appium-xcuitest-driver/docs/preparation/assets/images/check-prov-prof.png +0 -0
  513. package/src/resources/submodules/appium-xcuitest-driver/docs/preparation/assets/images/create-new-project.png +0 -0
  514. package/src/resources/submodules/appium-xcuitest-driver/docs/preparation/assets/images/create-single-page.png +0 -0
  515. package/src/resources/submodules/appium-xcuitest-driver/docs/preparation/assets/images/no-prov-prof.png +0 -0
  516. package/src/resources/submodules/appium-xcuitest-driver/docs/preparation/assets/images/project-prov-prof.png +0 -0
  517. package/src/resources/submodules/appium-xcuitest-driver/docs/preparation/assets/images/set-up-bundle.png +0 -0
  518. package/src/resources/submodules/appium-xcuitest-driver/docs/preparation/assets/images/untrusted-dev.png +0 -0
  519. package/src/resources/submodules/appium-xcuitest-driver/docs/preparation/assets/images/xcode-bundle-id.png +0 -0
  520. package/src/resources/submodules/appium-xcuitest-driver/docs/preparation/assets/images/xcode-config.png +0 -0
  521. package/src/resources/submodules/appium-xcuitest-driver/docs/preparation/assets/images/xcode-facebook-fail.png +0 -0
  522. package/src/resources/submodules/appium-xcuitest-driver/docs/preparation/assets/images/xcode-facebook-succeed.png +0 -0
  523. package/src/resources/submodules/appium-xcuitest-driver/docs/preparation/index.md +51 -0
  524. package/src/resources/submodules/appium-xcuitest-driver/docs/preparation/prov-profile-basic-auto.md +49 -0
  525. package/src/resources/submodules/appium-xcuitest-driver/docs/preparation/prov-profile-basic-manual.md +40 -0
  526. package/src/resources/submodules/appium-xcuitest-driver/docs/preparation/prov-profile-full-manual.md +50 -0
  527. package/src/resources/submodules/appium-xcuitest-driver/docs/preparation/prov-profile-generic-manual.md +49 -0
  528. package/src/resources/submodules/appium-xcuitest-driver/docs/preparation/real-device-config.md +100 -0
  529. package/src/resources/submodules/appium-xcuitest-driver/docs/reference/assets/images/useXctestrunFile.png +0 -0
  530. package/src/resources/submodules/appium-xcuitest-driver/docs/reference/bidi.md +75 -0
  531. package/src/resources/submodules/appium-xcuitest-driver/docs/reference/capabilities.md +165 -0
  532. package/src/resources/submodules/appium-xcuitest-driver/docs/reference/commands.md +490 -0
  533. package/src/resources/submodules/appium-xcuitest-driver/docs/reference/element-attributes.md +27 -0
  534. package/src/resources/submodules/appium-xcuitest-driver/docs/reference/execute-methods.md +2206 -0
  535. package/src/resources/submodules/appium-xcuitest-driver/docs/reference/ios-predicate.md +196 -0
  536. package/src/resources/submodules/appium-xcuitest-driver/docs/reference/locator-strategies.md +19 -0
  537. package/src/resources/submodules/appium-xcuitest-driver/docs/reference/scripts.md +29 -0
  538. package/src/resources/submodules/appium-xcuitest-driver/docs/reference/security-flags.md +22 -0
  539. package/src/resources/submodules/appium-xcuitest-driver/docs/reference/server-args.md +16 -0
  540. package/src/resources/submodules/appium-xcuitest-driver/docs/reference/settings.md +49 -0
  541. package/src/resources/submodules/appium-xcuitest-driver/test/assets/TestApp-iphonesimulator.app/Default-568h@2x.png +0 -0
  542. package/src/resources/submodules/appium-xcuitest-driver/test/assets/test.png +0 -0
  543. package/src/schema.ts +5 -0
  544. package/src/scripts/simple-index-documentation.ts +93 -0
  545. package/src/scripts/simple-query-documentation.ts +61 -0
  546. package/src/server.ts +40 -0
  547. package/src/tests/README.md +83 -0
  548. package/src/tests/__mocks__/@appium/support.ts +31 -0
  549. package/src/tests/generate-all-locators.test.ts +179 -0
  550. package/src/tests/test-setup-wda.ts +247 -0
  551. package/src/tools/README.md +170 -0
  552. package/src/tools/answer-appium.ts +75 -0
  553. package/src/tools/boot-simulator.ts +87 -0
  554. package/src/tools/create-session.ts +270 -0
  555. package/src/tools/delete-session.ts +46 -0
  556. package/src/tools/documentation/index.ts +97 -0
  557. package/src/tools/documentation/reasoning-rag.ts +434 -0
  558. package/src/tools/documentation/sentence-transformers-embeddings.ts +142 -0
  559. package/src/tools/documentation/simple-pdf-indexer.ts +509 -0
  560. package/src/tools/documentation/uploads/documents.json +1 -0
  561. package/src/tools/generate-tests.ts +50 -0
  562. package/src/tools/index.ts +133 -0
  563. package/src/tools/install-wda.ts +277 -0
  564. package/src/tools/interactions/activate-app.ts +46 -0
  565. package/src/tools/interactions/click.ts +47 -0
  566. package/src/tools/interactions/double-tap.ts +87 -0
  567. package/src/tools/interactions/find.ts +58 -0
  568. package/src/tools/interactions/get-text.ts +47 -0
  569. package/src/tools/interactions/install-app.ts +45 -0
  570. package/src/tools/interactions/list-apps.ts +65 -0
  571. package/src/tools/interactions/screenshot.ts +56 -0
  572. package/src/tools/interactions/set-value.ts +48 -0
  573. package/src/tools/interactions/terminate-app.ts +47 -0
  574. package/src/tools/interactions/uninstall-app.ts +47 -0
  575. package/src/tools/locators.ts +83 -0
  576. package/src/tools/scroll-to-element.ts +188 -0
  577. package/src/tools/scroll.ts +97 -0
  578. package/src/tools/select-device.ts +298 -0
  579. package/src/tools/select-platform.ts +243 -0
  580. package/src/tools/session-store.ts +72 -0
  581. package/src/tools/setup-wda.ts +218 -0
  582. package/src/types/appium-ios-device.d.ts +8 -0
  583. package/src/types/appium-xcuitest-driver.d.ts +5 -0
  584. package/tsconfig.json +23 -0
  585. package/index.js +0 -0
@@ -0,0 +1,2077 @@
1
+ # Appium UiAutomator2 Driver
2
+
3
+ [![NPM version](http://img.shields.io/npm/v/appium-uiautomator2-driver.svg)](https://npmjs.org/package/appium-uiautomator2-driver)
4
+ [![Downloads](http://img.shields.io/npm/dm/appium-uiautomator2-driver.svg)](https://npmjs.org/package/appium-uiautomator2-driver)
5
+
6
+ [![Release](https://github.com/appium/appium-uiautomator2-driver/actions/workflows/publish.js.yml/badge.svg)](https://github.com/appium/appium-uiautomator2-driver/actions/workflows/publish.js.yml)
7
+
8
+
9
+ Appium UiAutomator2 Driver is a test automation framework for Android devices. Appium UiAutomator2 Driver automates native, hybrid and mobile web apps, tested on emulators and real devices. Appium UiAutomator2 Driver is part of the [Appium](https://github.com/appium/appium) mobile test automation tool. The driver operates in scope of [W3C WebDriver protocol](https://www.w3.org/TR/webdriver/) with several custom extensions to cover operating-system specific scenarios.
10
+
11
+ UiAutomator2 Driver proxies most of the commands to [UiAutomator2 server](https://github.com/appium/appium-uiautomator2-server), which uses Google's [UiAutomator](https://developer.android.com/training/testing/ui-automator) framework under the hood. Some commands are proxied directly to [appium-adb](https://github.com/appium/appium-adb) and other helpers built on top of Android platform tools.
12
+
13
+ > [!IMPORTANT]
14
+ > Since major version *5.0.0*, this driver is only compatible with Appium 3. Use the `appium driver install uiautomator2`
15
+ > command to add it to your distribution.
16
+
17
+
18
+ ## Requirements
19
+
20
+ On top of standard Appium requirements UiAutomator2 driver also expects the following prerequisites:
21
+
22
+ - Windows, Linux and macOS are supported as hosts
23
+ - [Android SDK Platform tools](https://developer.android.com/studio/releases/platform-tools) must be installed. [Android Studio IDE](https://developer.android.com/studio) also provides a convenient UI to install and manage the tools.
24
+ - ANDROID_HOME or ANDROID_SDK_ROOT [environment variable](https://developer.android.com/studio/command-line/variables) must be set
25
+ - Java JDK must be installed and [JAVA_HOME](https://www.baeldung.com/java-home-on-windows-7-8-10-mac-os-x-linux) environment variable must be set. Android SDK below API 30 requires Java 8. Android SDK 30 and above requires Java 9 or newer.
26
+ - [Emulator](https://developer.android.com/studio/run/managing-avds) platform image must be installed if you plan to run your tests on it. [Android Studio IDE](https://developer.android.com/studio) also provides a convenient UI to install and manage emulators.
27
+ - Real Android devices must have [USB debugging enabled](https://developer.android.com/studio/debug/dev-options) and should be visible as `online` in `adb devices -l` output.
28
+ - Since driver version 6.0.0 the minimum supported version of Android API is 8/Oreo (API level 26).
29
+ Before version 6.0.0 the minimum supported version of Android API is 5 (API level 21).
30
+ 6.0 is recommended as version 5 has some known compatibility issues.
31
+
32
+ ### Doctor
33
+
34
+ Since driver version 2.39.0 you can automate the validation for the most of the above
35
+ requirements as well as various optional ones needed by driver extensions by running the
36
+ `appium driver doctor uiautomator2` server command.
37
+
38
+ ## Capabilities
39
+
40
+ ### General
41
+
42
+ Capability Name | Description
43
+ --- | ---
44
+ platformName | Could be set to `android`. Appium itself is not strict about this capability value if `automationName` is provided, so feel free to assign it to any supported platform name if this is needed, for example, to make Selenium Grid working.
45
+ appium:automationName | Must always be set to `uiautomator2`. Values of `automationName` are compared case-insensitively.
46
+ appium:deviceName | The name of the device under test (actually, it is not used to select a device under test). Consider setting `udid` for real devices and `avd` for emulators instead
47
+ appium:platformVersion | The platform version of an emulator or a real device. This capability is used for device autodetection if `udid` is not provided
48
+ appium:udid | UDID of the device to be tested. Could be retrieved from `adb devices -l` output. If unset then the driver will try to use the first connected device. Always set this capability if you run parallel tests.
49
+ appium:noReset | Prevents the device to be reset before the session startup if set to `true`. This means that the application under test is not going to be terminated neither its data cleaned. `false` by default
50
+ appium:fullReset | Being set to `true` always enforces the application under test to be fully uninstalled before starting a new session. `false` by default
51
+ appium:printPageSourceOnFindFailure | Enforces the server to dump the actual XML page source into the log if any error happens. `false` by default.
52
+
53
+ ### Driver/Server
54
+
55
+ Capability Name | Description
56
+ --- | ---
57
+ appium:systemPort | The number of the port on the host machine used for the UiAutomator2 server. By default the first free port from 8200..8299 range is selected. It is recommended to set this value if you are running [parallel tests](#parallel-tests) on the same machine.
58
+ appium:skipServerInstallation | Skip the UiAutomator2 Server component installation on the device under test and all the related checks if set to `true`. This could help to speed up the session startup if you know for sure the correct server version is installed on the device. In case the server is not installed or an incorrect version of it is installed then you may get an unexpected error later. `false` by default
59
+ appium:uiautomator2ServerLaunchTimeout | The maximum number of milliseconds to wait util UiAutomator2Server is listening on the device. `30000` ms by default
60
+ appium:uiautomator2ServerInstallTimeout | The maximum number of milliseconds to wait util UiAutomator2Server is installed on the device. `20000` ms by default
61
+ appium:uiautomator2ServerReadTimeout | The maximum number of milliseconds to wait for a HTTP response from UiAutomator2Server. Only values greater than zero are accepted. If the given value is too low then expect driver commands to fail with `timeout of Xms exceeded` error. `240000` ms by default
62
+ appium:disableWindowAnimation | Whether to disable window animations when starting the instrumentation process. The animation scale will be restored automatically after the instrumentation process ends for API level 26 and higher. The animation scale could remain if the session ends unexpectedly for API level 25 and lower. `false` by default
63
+ appium:skipDeviceInitialization | If set to `true` then device startup checks (whether it is ready and whether Settings app is installed) will be canceled on session creation. Could speed up the session creation if you know what you are doing. `false` by default
64
+
65
+ ### App
66
+
67
+ Capability Name | Description
68
+ --- | ---
69
+ appium:app | Full path to the application to be tested (the app must be located on the same machine where the server is running). Both `.apk` and `.apks` application extensions are supported. Could also be an URL to a remote location. If neither of the `app`, `appPackage` or `browserName` capabilities are provided then the driver starts from the Dashboard and expects the test knows what to do next. Do not provide both `app` and `browserName` capabilities at once.
70
+ browserName | The name of the browser to run the test on. If this capability is provided then the driver will try to start the test in Web context mode (Native mode is applied by default). Read [Automating hybrid apps](#hybrid-mode) for more details. Usually equals to `chrome`.
71
+ appium:appPackage | Application package identifier to be started. If not provided then UiAutomator2 will try to detect it automatically from the package provided by the `app` capability. Read [How To Troubleshoot Activities Startup](docs/activity-startup.md) for more details
72
+ appium:appActivity | Main application activity identifier. If not provided then UiAutomator2 will try to detect it automatically from the package provided by the `app` capability. Read [How To Troubleshoot Activities Startup](docs/activity-startup.md) for more details
73
+ appium:appWaitActivity | Identifier of the first activity that the application invokes. If not provided then equals to `appium:appActivity`. Read [How To Troubleshoot Activities Startup](docs/activity-startup.md) for more details
74
+ appium:appWaitPackage | Identifier of the first package that is invoked first. If not provided then equals to `appium:appPackage`. Read [How To Troubleshoot Activities Startup](docs/activity-startup.md) for more details
75
+ appium:appWaitDuration | Maximum amount of milliseconds to wait until the application under test is started (e. g. an activity returns the control to the caller). `20000` ms by default. Read [How To Troubleshoot Activities Startup](docs/activity-startup.md) for more details
76
+ appium:androidInstallTimeout | Maximum amount of milliseconds to wait until the application under test is installed. `90000` ms by default
77
+ appium:appWaitForLaunch | Whether to block until the app under test returns the control to the caller after its activity has been started by Activity Manager (`true`, the default value) or to continue the test without waiting for that (`false`).
78
+ appium:intentCategory | Set an optional intent category to be applied when starting the given appActivity by [Activity Manager](https://developer.android.com/studio/command-line/adb#am). Defaults to `android.intent.category.LAUNCHER`. Please use [mobile:startActivity](#mobile-startactivity) in case you don't set an explicit value.
79
+ appium:intentAction | Set an optional intent action to be applied when starting the given appActivity by [Activity Manager](https://developer.android.com/studio/command-line/adb#am). Dfaults to `android.intent.action.MAIN`. Please use [mobile:startActivity](#mobile-startactivity) in case you don't set an explicit value.
80
+ appium:intentFlags | Set an optional intent flags to be applied when starting the given appActivity by [Activity Manager](https://developer.android.com/studio/command-line/adb#am). Defaults to `0x10200000` (FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_RESET_TASK_IF_NEEDED flags). Please use [mobile:startActivity](#mobile-startactivity) in case you don't set an explicit value.
81
+ appium:optionalIntentArguments | Set an optional intent arguments to be applied when starting the given appActivity by [Activity Manager](https://developer.android.com/studio/command-line/adb#am)
82
+ appium:dontStopAppOnReset | Set it to `true` if you don't want the application to be restarted if it was already running. If `appium:noReset` is falsy, then the app under test is going to be restarted if either this capability is falsy (the default behavior) or `appium:forceAppLaunch` is set to `true`. `false` by default
83
+ appium:forceAppLaunch | Set it to `true` if you want the application under test to be always forcefully restarted on session startup even if `appium:noReset` is `true`, and the app was already running. If `noReset` is falsy, then the app under test is going to be restarted if either this capability set to `true` or `appium:dontStopAppOnReset` is falsy (the default behavior). `false` by default. Available since driver version 2.12
84
+ appium:shouldTerminateApp | Set it to `true` if you want the application under test to be always terminated on session end even if `appium:noReset` is `true`. If `noReset` is falsy, then the app under test is going to be terminated if `appium:dontStopAppOnReset` is also falsy (the default behavior). `false` by default
85
+ appium:autoLaunch | Whether to launch the application under test automatically (`true`, the default value) after a test starts
86
+ appium:autoGrantPermissions | Whether to grant all the requested application permissions automatically when a test starts(`true`). The targetSdkVersion in the application manifest must be greater or equal to 23 and the Android version on the device under test must be greater or equal to Android 6 (API level 23) to grant permissions. Applications whose targetSdkVersion is lower than or equal to 22 must be reinstalled to grant permissions, for example, by setting the `appium:fullReset` capability as `true` for Android 6+ devices. If your app needs some special security permissions, like access to notifications or media recording, consider using [mobile: changePermissions](#mobile-changepermissions) extension with `appops` target. `false` by default
87
+ appium:otherApps | Allows to set one or more comma-separated paths to Android packages that are going to be installed along with the main application under test. This might be useful if the tested app has dependencies
88
+ appium:uninstallOtherPackages | Allows to set one or more comma-separated package identifiers to be uninstalled from the device before a test starts
89
+ appium:allowTestPackages | If set to `true` then it would be possible to use packages built with the test flag for the automated testing (literally adds `-t` flag to the `adb install` command). `false` by default
90
+ appium:remoteAppsCacheLimit | Sets the maximum amount of application packages to be cached on the device under test. This is needed for devices that don't support streamed installs (Android 7 and below), because ADB must push app packages to the device first in order to install them, which takes some time. Setting this capability to zero disables apps caching. `10` by default.
91
+ appium:enforceAppInstall | If set to `true` then the application under test is always reinstalled even if a newer version of it already exists on the device under test. This capability has no effect if `appium:noReset` is set to `true`. `false` by default
92
+
93
+ ### App Localization
94
+
95
+ Capability Name | Description
96
+ --- | ---
97
+ appium:localeScript | Canonical name of the locale to be set for the app under test, for example `Hans` in `zh-Hans-CN`. See https://developer.android.com/reference/java/util/Locale.html for more details.
98
+ appium:language | Name of the language to extract application strings for. Strings are extracted for the current system language by default. Also sets the language for the app under test. See https://developer.android.com/reference/java/util/Locale.html for more details. If `language` is provided then `locale` is also required to be set. The combination of both capability values must be a known locale and should be present in the list of available locales returned by the ICU's [getAvailableULocales()](https://unicode-org.github.io/icu/userguide/locale/#usage-retrieving-locales) method. The full list of supported locales is also dumped into the logcat output on failure. Example: `en`, `ja`
99
+ appium:locale | Sets the locale for the app under test. See https://developer.android.com/reference/java/util/Locale.html for more details. If `locale` is provided then `language` is also required to be set. The combination of both capability values must be a known locale and should be present in the list of available locales returned by the ICU's [getAvailableULocales()](https://unicode-org.github.io/icu/userguide/locale/#usage-retrieving-locales) method. The full list of supported locales is also dumped into the logcat output on failure. Example: `US`, `JP`
100
+
101
+ ### ADB
102
+
103
+ Capability Name | Description
104
+ --- | ---
105
+ appium:adbPort | Number of the port on the host machine where ADB is running. `5037` by default
106
+ appium:remoteAdbHost | Address of the host where ADB is running (the value of `-H` ADB command line option). Unset by default
107
+ appium:adbExecTimeout | Maximum number of milliseconds to wait until single ADB command is executed. `20000` ms by default
108
+ appium:clearDeviceLogsOnStart | If set to `true` then UiAutomator2 deletes all the existing logs in the device buffer before starting a new test
109
+ appium:buildToolsVersion | The version of Android build tools to use. By default UiAutomator2 driver uses the most recent version of build tools installed on the machine, but sometimes it might be necessary to give it a hint (let say if there is a known bug in the most recent tools version). Example: `28.0.3`
110
+ appium:skipLogcatCapture | Being set to `true` disables automatic logcat output collection during the test run. `false` by default
111
+ appium:suppressKillServer | Being set to `true` prevents the driver from ever killing the ADB server explicitly. Could be useful if ADB is connected wirelessly. `false` by default
112
+ appium:ignoreHiddenApiPolicyError | Being set to `true` ignores a failure while changing hidden API access policies to [enable access to non-SDK interfaces](https://developer.android.com/guide/app-compatibility/restrictions-non-sdk-interfaces#how_can_i_enable_access_to_non-sdk_interfaces). Could be useful on some devices, where access to these policies has been locked by its vendor. `false` by default.
113
+ appium:hideKeyboard | Being set to `true` hides the on-screen keyboard while the session is running. Use it instead of the legacy `appium:unicodeKeyboard` one (which will be dropped in the future). This effect is achieved by assigning a custom "artificial" [input method](https://developer.android.com/develop/ui/views/touch-and-input/creating-input-method). Only use this feature for special/exploratory cases as it violates the way your application under test is normally interacted with by a human. Setting this capability explicitly to `false` enforces `adb shell ime reset` call on session startup, which resets the currently selected/enabled IMEs to the default ones as if the device is initially booted with the current locale. `undefined` by default.
114
+ appium:mockLocationApp | Sets the package identifier of the app, which is used as a system mock location provider since Appium 1.18.0+. This capability has no effect on emulators. If the value is set to `null` or an empty string, then the driver will reset the mocked location provider, e.g. the location won't be mocked anymore. Defaults to Appium Setting package identifier (`io.appium.settings`). Termination of a mock location provider application resets the mocked location data.
115
+ appium:logcatFormat | The log print format, where `format` is one of: `brief` `process` `tag` `thread` `raw` `time` `threadtime` `long`. `threadtime` is the default value.
116
+ appium:logcatFilterSpecs | Series of `tag[:priority]` where `tag` is a log component tag (or * for all) and priority is: `V Verbose`, `D Debug`, `I Info`, `W Warn`, `E Error`, `F Fatal`, `S Silent (supress all output)`. '*' means '*:d' and `tag` by itself means `tag:v`. If not specified on the commandline, filterspec is set from ANDROID_LOG_TAGS. If no filterspec is found, filter defaults to '*:I'.
117
+ appium:allowDelayAdb | Being set to `false` prevents emulator to use `-delay-adb` feature to detect its startup. See https://github.com/appium/appium/issues/14773 for more details.
118
+
119
+ ### Emulator (Android Virtual Device)
120
+
121
+ Capability Name | Description
122
+ --- | ---
123
+ appium:avd | The name of Android emulator to run the test on. The names of currently installed emulators could be listed using `avdmanager list avd` command. If the emulator with the given name is not running then it is going to be launched on automated session startup.
124
+ appium:avdLaunchTimeout | Maximum number of milliseconds to wait until Android Emulator is started. `60000` ms by default
125
+ appium:avdReadyTimeout | Maximum number of milliseconds to wait until Android Emulator is fully booted and is ready for usage. `60000` ms by default
126
+ appium:avdArgs | Either a string or an array of emulator [command line arguments](https://developer.android.com/studio/run/emulator-commandline). If arguments contain the `-wipe-data` one then the emulator is going to be killed on automated session startup in order to wipe its data.
127
+ appium:avdEnv | Mapping of emulator [environment variables](https://developer.android.com/studio/command-line/variables).
128
+ appium:networkSpeed | Sets the desired network speed limit for the emulator. It is only applied if the emulator is not running before the test starts. See emulator [command line arguments](https://developer.android.com/studio/run/emulator-commandline) description for more details.
129
+ appium:gpsEnabled | Sets whether to enable (`true`) or disable (`false`) GPS service in the Emulator. Unset by default, which means to not change the current value
130
+ appium:isHeadless | If set to `true` then emulator starts in headless mode (e.g. no UI is shown). It is only applied if the emulator is not running before the test starts. `false` by default.
131
+ appium:injectedImageProperties | Allows adjusting of injected image properties, like size, position or rotation. The image itself is expected to be injected by [mobile: injectEmulatorCameraImage](#mobile-injectemulatorcameraimage) extension. It is also mandatory to provide this capability if you are going to use the injection feature on a newly created/resetted emulator as it __enforces emulator restart__, so it could properly reload the modified image properties. The value itself is a map, where possible keys are `size`, `position` and `rotation`. All of them are optional. If any of values is not provided then the following defaults are used: `{size: {scaleX: 1, scaleY: 1}, position: {x: 0, y: 0, z: -1.5}, rotation: {x: 0, y: 0, z: 0}}`. The `size` value contains scale multipliers for X and Y axes. The `position` contains normalized coefficients for X/Y/Z axes, where `0` means it should be centered in the viewport. Values in the `rotation` are measured in degrees respectively for X, Y and Z axis. The capability is available since the driver version 3.6.0.
132
+
133
+ ### App Signing
134
+
135
+ Capability Name | Description
136
+ --- | ---
137
+ appium:useKeystore | Whether to use a custom keystore to sign the app under test. `false` by default, which means apps are always signed with the default Appium debug certificate (unless canceled by `noSign` capability). This capability is used in combination with `keystorePath`, `keystorePassword`, `keyAlias` and `keyPassword` capabilities.
138
+ appium:keystorePath | The full path to the keystore file on the server filesystem. This capability is used in combination with `useKeystore`, `keystorePath`, `keystorePassword`, `keyAlias` and `keyPassword` capabilities. Unset by default
139
+ appium:keystorePassword | The password to the keystore file provided in `keystorePath` capability. This capability is used in combination with `useKeystore`, `keystorePath`, `keystorePassword`, `keyAlias` and `keyPassword` capabilities. Unset by default
140
+ appium:keyAlias | The alias of the key in the keystore file provided in `keystorePath` capability. This capability is used in combination with `useKeystore`, `keystorePath`, `keystorePassword`, `keyAlias` and `keyPassword` capabilities. Unset by default
141
+ appium:keyPassword | The password of the key in the keystore file provided in `keystorePath` capability. This capability is used in combination with `useKeystore`, `keystorePath`, `keystorePassword`, `keyAlias` and `keyPassword` capabilities. Unset by default
142
+ appium:noSign | Set it to `true` in order to skip application signing. By default all apps are always signed with the default Appium debug signature if they don't have any. This capability cancels all the signing checks and makes the driver to use the application package as is. This capability does not affect `.apks` packages as these are expected to be already signed.
143
+
144
+ ### Device Locking
145
+
146
+ Capability Name | Description
147
+ --- | ---
148
+ appium:skipUnlock | Whether to skip the check for lock screen presence (`true`). The default driver behaviour is to verify the presence of the screen lock (e.g. 'false' value of the capability) before starting the test and to unlock that (which sometimes might be unstable). Note, that this operation takes some time, so it is highly recommended to set this capability to `true` and disable screen locking on device(s) under test. Read the [Unlock tutorial](./docs/unlock/main.md) for more details.
149
+ appium:unlockType | Set one of the possible types of Android lock screens to unlock. Read the [Unlock tutorial](./docs/unlock/main.md) for more details.
150
+ appium:unlockKey | Allows to set an unlock key. Read the [Unlock tutorial](./docs/unlock/main.md) for more details.
151
+ appium:unlockStrategy | Either 'locksettings' (default) or 'uiautomator'. Read the [Unlock tutorial](./docs/unlock/main.md) for more details.
152
+ appium:unlockSuccessTimeout | Maximum number of milliseconds to wait until the device is unlocked. `2000` ms by default. Read the [Unlock tutorial](./docs/unlock/main.md) for more details.
153
+
154
+ ### MJPEG
155
+
156
+ Capability Name | Description
157
+ --- | ---
158
+ appium:mjpegServerPort | The number of the port on the host machine that UiAutomator2 server starts the MJPEG server on. If not provided then the screenshots broadcasting service on the remote device does not get exposed to a local port (e.g. no adb port forwarding is happening)
159
+ appium:mjpegScreenshotUrl | The URL of a service that provides realtime device screenshots in MJPEG format. If provided then the actual command to retrieve a screenshot will be requesting pictures from this service rather than directly from the server
160
+
161
+ ### Web Context
162
+
163
+ Capability Name | Description
164
+ --- | ---
165
+ appium:autoWebview | If set to `true` then UiAutomator2 driver will try to switch to the web view with name `WEBVIEW_ + appium:appPackage` after the session is started. For example, if `appium:appPackage` capability is set to `com.mypackage` then `WEBVIEW_com.mypackage` will be used. `false` by default.
166
+ appium:autoWebviewName | Set the name of webview context in which UiAutomator2 driver will try to switch if `autoWebview` capability is set to `true` (available since driver version 2.9.1). Has priority over using the `appium:appPackage` value in webview name. For example, if `appium:autoWebviewName` capability is set to `myWebviewName` then `WEBVIEW_myWebviewName` will be used. Unset by default.
167
+ appium:autoWebviewTimeout | Set the maximum number of milliseconds to wait until a web view is available if `autoWebview` capability is set to `true`. `2000` ms by default.
168
+ appium:webviewDevtoolsPort | The local port number to use for devtools communication. By default the first free port from 10900..11000 range is selected. Consider setting the custom value if you are running parallel tests.
169
+ appium:ensureWebviewsHavePages | Whether to skip web views that have no pages from being shown in `getContexts` output. The driver uses devtools connection to retrieve the information about existing pages. `true` by default since Appium 1.19.0, `false` if lower than 1.19.0.
170
+ appium:enableWebviewDetailsCollection | Whether to retrieve extended web views information using devtools protocol. Enabling this capability helps to detect the necessary chromedriver version more precisely. `true` by default since Appium 1.22.0, `false` if lower than 1.22.0.
171
+ appium:chromedriverPort | The port number to use for Chromedriver communication. Any free port number is selected by default if unset.
172
+ appium:chromedriverPorts | Array of possible port numbers to assign for Chromedriver communication. If none of the port in this array is free then an error is thrown.
173
+ appium:chromedriverArgs | Array of chromedriver command line arguments, listed with `chromedriver --help`. Note that not all command line arguments available for the desktop browser are also available for the mobile one.
174
+ appium:chromedriverExecutable | Full path to the chromedriver executable on the server file system.
175
+ appium:chromedriverExecutableDir | Full path to the folder where chromedriver executables are located. This folder is used then to store the downloaded chromedriver executables if automatic download is enabled. Read [Automatic Chromedriver Discovery article](#automatic-discovery-of-compatible-chromedriver) for more details.
176
+ appium:chromedriverChromeMappingFile | Full path to the chromedrivers mapping file. This file is used to statically map webview/browser versions to the chromedriver versions that are capable of automating them. Read [Automatic Chromedriver Discovery article](#automatic-discovery-of-compatible-chromedriver) for more details.
177
+ appium:chromedriverUseSystemExecutable | Set it to `true` in order to enforce the usage of chromedriver, which gets downloaded by Appium automatically upon installation. This driver might not be compatible with the destination browser or a web view. `false` by default.
178
+ appium:chromedriverDisableBuildCheck | Being set to `true` disables the compatibility validation between the current chromedriver and the destination browser/web view. Use it with care.
179
+ appium:recreateChromeDriverSessions | If this capability is set to `true` then chromedriver session is always going to be killed and then recreated instead of just suspending it on context switching. `false` by default
180
+ appium:nativeWebScreenshot | Whether to use screenshoting endpoint provided by UiAutomator framework (`true`) rather than the one provided by chromedriver (`false`, the default value). Use it when you experience issues with the latter.
181
+ appium:extractChromeAndroidPackageFromContextName | If set to `true`, tell chromedriver to attach to the android package we have associated with the context name, rather than the package of the application under test. `false` by default.
182
+ appium:showChromedriverLog | If set to `true` then all the output from chromedriver binary will be forwarded to the Appium server log. `false` by default.
183
+ pageLoadStrategy | One of the available page load strategies. See https://www.w3.org/TR/webdriver/#capabilities
184
+ appium:chromeOptions | A mapping, that allows to customize chromedriver options. See https://chromedriver.chromium.org/capabilities for the list of available entries.
185
+ appium:chromeLoggingPrefs | Chrome logging preferences mapping. Basically the same as [goog:loggingPrefs](https://newbedev.com/getting-console-log-output-from-chrome-with-selenium-python-api-bindings). It is set to `{"browser": "ALL"}` by default.
186
+ appium:chromedriverForwardBiDi | Being set to `true` enables automated forwarding of chromedriver BiDi web socket to UIA2 driver web socket. This allows to send browser-specific BiDi commands being in a web view context. The web socket connection is terminated as soon as the session context is changed (by default all [BiDi commands](./docs/bidi.md) are handled by the UIA2 driver). It is required that session capabilities have the `webDriverUrl` capability set to `true`. Also note, that older chromedrivers may not support BiDi specification fully, or may not support it at all.
187
+
188
+ ### Other
189
+
190
+ Capability Name | Description
191
+ --- | ---
192
+ appium:disableSuppressAccessibilityService | Being set to `true` tells the instrumentation process to not suppress accessibility services during the automated test. This might be useful if your automated test needs these services. `false` by default
193
+ appium:userProfile | Integer identifier of a [user profile](https://source.android.com/devices/tech/admin/multi-user). By default the app under test is installed for the currently active user, but in case it is necessary to test how the app performs while being installed for a user profile, which is different from the current one, then this capability might come in handy.
194
+ appium:newCommandTimeout | How long (in seconds) the driver should wait for a new command from the client before assuming the client has stopped sending requests. After the timeout the session is going to be deleted. `60` seconds by default. Setting it to zero disables the timer.
195
+ appium:skipLogcatCapture | Skips to start capturing logs such as logcat. It might improve network performance. Log-related commands won't work if the capability is enabled. Defaults to `false`.
196
+ appium:timeZone | Overrides the current device's time zone since the driver version 3.1.0. This change is preserved until the next override. The time zone identifier must be a valid name from the list of [available time zone identifiers](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones), for example `Europe/Kyiv`
197
+
198
+
199
+ ## Element Attributes
200
+
201
+ UiAutomator2 driver supports the following element attributes:
202
+
203
+ Name | Description | Example
204
+ --- | --- | ---
205
+ checkable | Whether the element is checkable or not | 'true'
206
+ checked | Whether the element is checked. Always `false` if the element is not checkable | 'false'
207
+ class or className | The full name of the element's class. Could be `null` for some elements | 'android.view.View'
208
+ clickable | Whether the element could be clicked | 'false'
209
+ content-desc or contentDescription | The content-description attribute of the accessible element | 'foo'
210
+ enabled | Whether the element could be clicked | 'true'
211
+ focusable | Whether the element could be focused | 'true'
212
+ focused | Whether the element could is focused. Always `false` if the element is not focusable | 'false'
213
+ long-clickable or longClickable | Whether the element accepts long clicks | 'false'
214
+ package | Identifier of the package the element belongs to | 'com.mycompany'
215
+ password | Whether the element is a password input field | 'true'
216
+ resource-id or resourceId | Element's resource identifier. Could be `null` | 'com.mycompany:id/resId'
217
+ scrollable | Whether the element is scrollable | 'true'
218
+ selection-start | Contains the index of the char where the selection starts. Could be `null` if the element provides no range info | '5'
219
+ selection-end | Contains the index of the char where the selection ends. Could be `null` if the element provides no range info | '8'
220
+ selected | Whether the element is selected | 'false'
221
+ text or name | The element's text. It never equals to null | 'my text'
222
+ hint | Element's hint text. On Android versions below Oreo it always equals to `null`. | 'my hint text'
223
+ bounds | The element's visible frame (`[left, top][right, bottom]`) | `[0,0][100,100]`
224
+ displayed | Whether the element is visible to the user | 'true'
225
+ contentSize | The dimensions of the element's content area | `{"left": 0, "top":0, "width": 100, "height": 100, "scrollableOffset": 10, "touchPadding": 0}`
226
+ extras | The result of [getExtras](https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo#getExtras()). The value includes all key-value pairs as `key=value` separated by a semicolon (`;`). If the value is empty, then only key part ending with the equal sign will be present. Available only if `includeExtrasInPageSource` setting is turned on. | Part of extras in chrome browser:<br> `AccessibilityNodeInfo.roleDescription=;`<br>`AccessibilityNodeInfo.chromeRole=rootWebArea;`<br> `ACTION_ARGUMENT_HTML_ELEMENT_STRING_VALUES=`<br> `ARTICLE,BLOCKQUOTE,BUTTON,CHECKBOX`
227
+ a11y-important | Whether the element originates from a view considered important for accessibility. Available for API 24+ | 'true'
228
+ screen-reader-focusable | Whether the element is explicitly marked as a focusable unit by a screen reader. Available for API 28+ | 'true'
229
+ input-type | Bitmask, input type of the editable text element, defined by [InputType](https://developer.android.com/reference/android/text/InputType). Available only for text input fields. | '1'
230
+ drawing-order | The drawing position of the view corresponding to this element relative to its siblings. Available for API 24+ | '3'
231
+ showing-hint | Whether the element's text represents a hint for the user to enter text. Available for API 26+ | 'true'
232
+ text-entry-key | Whether the element represents a text entry key that is part of a keyboard or keypad. Available for API 29+ | 'true'
233
+ multiline | If the element is a multi line editable text. Available only for text input fields. | 'true'
234
+ dismissable | If the element can be dismissed | 'true'
235
+ a11y-focused | Whether this element is accessibility focused | 'true'
236
+ heading | Whether element represents a heading. Available for API 28+ | 'true'
237
+ live-region | Bitmask, live region mode value for the element, like '1' for [ACCESSIBILITY_LIVE_REGION_POLITE](https://developer.android.com/reference/android/view/View#ACCESSIBILITY_LIVE_REGION_POLITE) | '1'
238
+ context-clickable | Whether this element is context clickable. Available for API 23+ | 'true'
239
+ max-text-length | The maximum text length for the editable text element. Available only for text input fields. | '300'
240
+ content-invalid | If the content of this element is invalid. For example, a date is not well-formed. | 'true'
241
+ error | The error text of the element. | 'text string'
242
+ pane-title | Title of the pane represented by this element. Available for API 28+ | 'text string'
243
+ actions | The comma-separated id names of the available accessibility actions for the element from [getActionList](https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo#getActionList()). Available only if `includeA11yActionsInPageSource` setting is turned on. | 'ACTION_FOCUS,ACTION_SELECT,ACTION_CLEAR_SELECTION,ACTION_CLICK,ACTION_ACCESSIBILITY_FOCUS,ACTION_NEXT_AT_MOVEMENT_GRANULARITY,ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY,ACTION_SET_SELECTION,ACTION_SHOW_ON_SCREEN'
244
+ tooltip-text | The result of [getTooltipText](https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo#getTooltipText()). Could be `null`, available for API 28+ | 'Paste'
245
+ text-has-clickable-span | Indicates whether the `TextView` content contains `ClickableSpan` or `URLSpan` elements, `null` in all other cases. | 'true'
246
+
247
+
248
+ ## Element Location
249
+
250
+ UiAutomator2 driver supports the following location strategies:
251
+
252
+ Name | Description | Speed Ranking | Example
253
+ --- | --- | --- | ---
254
+ id | This strategy is mapped to the native UiAutomator's `By.res` [locator](https://developer.android.com/reference/androidx/test/uiautomator/BySelector#res(java.lang.String)) (exact match of element's resource name). Package identifier prefix is added automatically if unset and is equal to the identifier of the current application under test. | `⭐⭐⭐⭐⭐` | 'com.mycompany:id/resourceId'
255
+ accessibilityId | This strategy is mapped to the native UiAutomator's `By.desc` [locator](https://developer.android.com/reference/androidx/test/uiautomator/BySelector#desc(java.lang.String)) (exact match of element's content description). In applications written using [ReactNative](https://reactnative.dev/) framework this attribute reflects the value of the `accessibilityLabel` property. | `⭐⭐⭐⭐⭐` | 'my description'
256
+ className | This strategy is mapped to the native UiAutomator's `By.clazz` [locator](https://developer.android.com/reference/androidx/test/uiautomator/BySelector#clazz(java.lang.String)) (exact match of element's class). | `⭐⭐⭐⭐⭐` | 'android.view.View'
257
+ -android uiautomator | This strategy is mapped to the native UiAutomator's `UiSelector` [locator](https://developer.android.com/reference/androidx/test/uiautomator/UiSelector)). It is even possible to perform some advanced operations, like scrolling, with this locator type. Check [Guide on UiAutomator Locator Types](docs/uiautomator-uiselector.md) | `⭐⭐⭐⭐` | new UiScrollable(new UiSelector().resourceId(\"android:id/list\")).scrollIntoView(new UiSelector().text(\"Radio Group\"))
258
+ xpath | For elements lookup Xpath strategy the driver uses the same XML tree that is generated by page source API. Only Xpath 1.0 is supported for appium-uiatomator2-server versions below 4.25.0. All server versions starting from 4.25.0 support both Xpath 1.0 and 2.0 | `⭐⭐⭐` | By.xpath("//android.view.View[@text=\"Regular\" and @checkable=\"true\"]")
259
+
260
+ > [!WARNING]
261
+ > Google is going to [deprecate](https://developer.android.com/training/testing/other-components/ui-automator#ui-automator)
262
+ > and remove `UiCollection`, `UiObject`, `UiScrollable`, and `UiSelector` support from the UiAutomator framework.
263
+ > This will render all `-android uiautomator`-based locators invalid, so please keep it in mind while
264
+ > using them or plan to use them in the future.
265
+
266
+
267
+ ## BiDi Protocol Support
268
+
269
+ UIAutomator2 driver has partial support of the [BiDi Protocol](https://w3c.github.io/webdriver-bidi/) since version 3.7.10. Check the [Supported BiDi Commands And Events](./docs/bidi.md) document for more details.
270
+
271
+
272
+ ## Parallel Tests
273
+
274
+ It is possible to execute tests in parallel using UiAutomator2 driver.
275
+ Appium allows to do this on per-process (multiple server processes running on different ports managing single session)
276
+ or per-request basis (single server process managing multiple sessions, more preferable, uses less resources and ensures better control over running sessions).
277
+
278
+ _Note_: If you are not going to run your tests in parallel then consider enabling the `--session-override` Appium server argument.
279
+ It forces the server to close all pending sessions before a new one could be opened,
280
+ which allows you to avoid possible issues with such sessions silently running/expiring in the background.
281
+
282
+ ### Important Real Device Capabilities
283
+
284
+ - `udid`: The unique device id.
285
+ - `systemPort`: Set a unique system port number for each parallel session. Otherwise you might get a port conflict such as in [this issue](https://github.com/appium/appium/issues/7745).
286
+ - `chromedriverPort`: The unique chromedriver port if testing web views or Chrome.
287
+ - `mjpegServerPort`: Set a unique MJPEG server port for each parallel session if you are going to record a video.
288
+
289
+ ### Important Emulator Capabilities
290
+
291
+ - `avd`: The unique emulator name.
292
+ - `systemPort`: Set a unique system port number for each parallel session.
293
+ - `chromedriverPort`: The unique chromedriver port (if testing web views or Chrome).
294
+ - `mjpegServerPort`: Set a unique MJPEG server port for each parallel session if you are going to record a video.
295
+
296
+
297
+ ## Settings API
298
+
299
+ UiAutomator2 driver supports Appium [Settings API](https://appium.io/docs/en/latest/guides/settings/).
300
+ Along with the common settings the following driver-specific settings are currently available:
301
+
302
+ Name | Type | Description
303
+ --- | --- | ---
304
+ actionAcknowledgmentTimeout | long | Maximum number of milliseconds to wait for an acknowledgment of generic uiautomator actions, such as clicks, text setting, and menu presses. The acknowledgment is an [AccessibilityEvent](http://developer.android.com/reference/android/view/accessibility/AccessibilityEvent.html) corresponding to an action, that lets the framework determine if the action was successful. Generally, this timeout should not be modified. `3000` ms by default
305
+ allowInvisibleElements | boolean | Whether to include elements that are not visible to the user (e. g. whose `displayed` attribute is `false`) to the XML source tree. `false` by default
306
+ ignoreUnimportantViews | boolean | Enables or disables layout hierarchy compression. If compression is enabled, the layout hierarchy derived from the Acessibility framework will only contain nodes that are important for uiautomator testing. Any unnecessary surrounding layout nodes that make viewing and searching the hierarchy inefficient are removed. `false` by default
307
+ elementResponseAttributes | string | Comma-separated list of element attribute names to be included into findElement response. By default only element UUID is present there, but it is also possible to add the following items: `name`, `text`, `rect`, `enabled`, `displayed`, `selected`, `attribute/<element_attribute_name>`. It is required that `shouldUseCompactResponses` setting is set to `false` in order for this one to apply.
308
+ enableMultiWindows | boolean | Whether to include all windows that the user can interact with (for example an on-screen keyboard) while building the XML page source (`true`). By default it is `false` and only the single active application window is included to the page source.
309
+ enableTopmostWindowFromActivePackage | boolean | Whether to limit the window with the highest Z-order from the active package for interactions and page source retrieval. By default it is `false` and the active application window, which may not necessarily have this order, is included to the page source.
310
+ enableNotificationListener | boolean | Whether to enable (`true`) toast notifications listener to listen for new toast notifications. By default this listener is enabled and UiAutomator2 server includes the text of toast messages to the generated XML page source, but not for longer than `3500` ms after the corresponding notification expires.
311
+ keyInjectionDelay | long | Delay in milliseconds between key presses when injecting text input. 0 ms by default
312
+ scrollAcknowledgmentTimeout | long | Timeout for waiting for an acknowledgement of an uiautomator scroll swipe action. The acknowledgment is an [AccessibilityEvent](http://developer.android.com/reference/android/view/accessibility/AccessibilityEvent.html), corresponding to the scroll action, that lets the framework determine if the scroll action was successful. Generally, this timeout should not be modified. `200` ms by default
313
+ shouldUseCompactResponses | boolean | Used in combination with `elementResponseAttributes` setting. If set to `false` then the findElement response is going to include the items enumerated in `elementResponseAttributes` setting. `true` by default
314
+ waitForIdleTimeout | long | Timeout used for waiting for the user interface to go into an idle state. By default, all core uiautomator objects except UiDevice will perform this wait before starting to search for the widget specified by the object's locator. Once the idle state is detected or the timeout elapses (whichever occurs first), the object will start to wait for the selector to find a match. Consider lowering the value of this setting if you experience long delays while interacting with accessibility elements in your test. `10000` ms by default.
315
+ waitForSelectorTimeout | long | Timeout for waiting for a widget to become visible in the user interface so that it can be matched by a selector. Because user interface content is dynamic, sometimes a widget may not be visible immediately and won't be detected by a selector. This timeout allows the uiautomator framework to wait for a match to be found, up until the timeout elapses. This timeout is only applied to `android uiautomator` location strategy. `10000` ms by default
316
+ normalizeTagNames | boolean | Being set to `true` applies unicode-to-ascii normalization of element class names used as tag names in the page source XML document. This is necessary if the application under test has some Unicode class names, which cannot be used as XML tag names by default due to known bugs in Android's XML DOM parser implementation. `false` by default
317
+ shutdownOnPowerDisconnect | boolean | Whether to shutdown the server if the device under test is disconnected from a power source (e. g. stays on battery power). `true` by default.
318
+ simpleBoundsCalculation | boolean | Whether to calculate element bounds as absolute values (`true`) or check if the element is covered by other elements and thus partially hidden (`false`, the default behaviour). Setting this setting to `true` helps to improve the performance of XML page source generation, but decreases bounds preciseness. Use with care.
319
+ trackScrollEvents | boolean | Whether to apply scroll events tracking (`true`, the default value), so the server could calculate the value of `contentSize` attribute. Having this setting enabled may add delays to all scrolling actions.
320
+ wakeLockTimeout | long | The timeout in milliseconds of wake lock that UiAutomator2 server acquires by default to prevent the device under test going to sleep while an automated test is running. By default the server acquires the lock for 24 hours. Setting this value to zero forces the server to release the wake lock.
321
+ serverPort | int | The number of the port on the remote device to start UiAutomator2 server on. Do not mix this with `systemPort`, which is acquired on the host machine. Must be in range 1024..65535. `6790` by default
322
+ mjpegServerPort | int | The number of the port on the remote device to start MJPEG screenshots broadcaster on. Must be in range 1024..65535. `7810` by default
323
+ mjpegServerFramerate | int | The maximum count of screenshots per second taken by the MJPEG screenshots broadcaster. Must be in range 1..60. `10` by default
324
+ mjpegScalingFactor | int | The percentage value used to apply downscaling on the screenshots generated by the MJPEG screenshots broadcaster. Must be in range 1..100. `50` is by default, which means that screenshots are downscaled to the half of their original size keeping their original proportions.
325
+ mjpegServerScreenshotQuality | int | The percentage value used to apply lossy JPEG compression on the screenshots generated by the MJPEG screenshots broadcaster. Must be in range 1..100. `50` is by default, which means that screenshots are compressed to the half of their original quality.
326
+ mjpegBilinearFiltering | boolean | Controls whether (`true`) or not (`false`, the default value) to apply bilinear filtering to MJPEG screenshots broadcaster resize algorithm. Enabling this flag may improve the quality of the resulting scaled bitmap, but may introduce a small performance hit.
327
+ useResourcesForOrientationDetection | boolean | Defines the strategy used by UiAutomator2 server to detect the original device orientation. By default (`false` value) the server uses device rotation value for this purpose. Although, this approach may not work for some devices and a portrait orientation may erroneously be detected as the landscape one (and vice versa). In such case it makes sense to play with this setting.
328
+ enforceXPath1 | boolean | Since UiAutomator2 driver version `4.25.0` XPath2 is set as the default and the recommended interpreter for the corresponding element locators. This interpreter is based on [Psychopath XPath2](https://wiki.eclipse.org/PsychoPathXPathProcessor) implementation, which is now a part of the Eclipse foundation. In most of the cases XPath1 locators are also valid XPath2 locators, so there should be no issues while locating elements. Although, since the XPath2 standard is much more advanced in comparison to the previous version, some [issues](https://github.com/appium/appium/issues/16142) are possible for more sophisticated locators, which cannot be fixed easily, as we depend on the third-party library mentioned above. Then try to workaround such issues by enforcing XPath1 usage (whose implementation is a part of the Android platform itself) and assigning this setting to `true`. Note, this setting is actually applied at the time when the element lookup by XPath is executed, so you could switch it on or off whenever needed throughout your automated testing session.
329
+ limitXPathContextScope | boolean | Due to historical reasons UiAutomator2 driver limits scopes of element context-based searches to the parent element. This means a request like `findElement(By.xpath, "//root").findElement(By.xpath, "./..")` would always fail, because the driver only collects descendants of the `root` element for the destination XML source. The `limitXPathContextScope` setting being set to `false` changes that default behavior, so the collected page source includes the whole page source XML where `root` node is set as the search context. With that setting disabled the search query above should not fail anymore. Although, you must still be careful while building XPath requests for context-based searches with the `limitXPathContextScope` setting set to `false`. A request like `findElement(By.xpath, "//root").findElement(By.xpath, "//element")` would ignore the current context and search for `element` trough the whole page source. Use `.` notation to correct that behavior and only find `element` nodes which are descendants of the `root` node: `findElement(By.xpath, "//root").findElement(By.xpath, ".//element")`.
330
+ disableIdLocatorAutocompletion | boolean | According to internal Android standards it is expected that each resource identifier is prefixed with `<packageName>:id/` string. This should guarantee uniqueness of each identifier. Although some application development frameworks ignore this rule and don't add such prefix automatically or, rather, let it up to the developer to decide how to represent their application identifiers. For example, [testTag modifier attribute in the Jetpack Compose](https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/package-summary#(androidx.compose.ui.Modifier).testTag(kotlin.String)) with [testTagsAsResourceId](https://developer.android.com/reference/kotlin/androidx/compose/ui/semantics/package-summary#(androidx.compose.ui.semantics.SemanticsPropertyReceiver).testTagsAsResourceId()) allows developers to set an arbitrary string without the prefix rule. [Interoperability with UiAutomator](https://developer.android.com/jetpack/compose/testing) also explains how to set it. By default UIA2 driver adds the above prefixes automatically to all resource id locators if they are not prefixed, but in case of such "special" apps this feature might be disabled by assigning the setting to `true`.
331
+ includeExtrasInPageSource | boolean | Whether to include `extras` element attribute in the XML page source result. Then, XPath locator can find the element by the extras. Its value consists of combined [getExtras](https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo#getExtras()) as `keys=value` pair separated by a semicolon (`;`), thus you may need to find the element with partial matching like `contains` e.g. `driver.find_element :xpath, '//*[contains(@extras, "AccessibilityNodeInfo.roleDescription=")]'`. The value could be huge if elements in the XML page source have large `extras`. It could affect the performance of XML page source generation.
332
+ includeA11yActionsInPageSource | boolean | Whether to include `actions` element attribute in the XML page source result. Its value consists of names of available accessibility actions from [getActionList](https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo#getActionList()), separated by a comma. The value could be huge if elements in the XML page source have a lot of actions and could affect the performance of XML page source generation.
333
+ snapshotMaxDepth | int | The number of maximum depth for the source tree snapshot. The default value is `70`. This number should be in range [1, 500]. A part of the elements source tree might be lost if the value is too low. Also, StackOverflowError might be caused if the value is too high (Issues [12545](https://github.com/appium/appium/issues/12545), [12892](https://github.com/appium/appium/issues/12892)). The available driver version is `2.27.0` or higher.
334
+ currentDisplayId | int | The id of the display that should be used when finding elements, taking screenshots, etc. It can be found in the output of `adb shell dumpsys display` (search for `mDisplayId`). The default value is [Display.DEFAULT_DISPLAY](https://developer.android.com/reference/android/view/Display#DEFAULT_DISPLAY). **Please note that it is different from the physical display id, reported by `adb shell dumpsys SurfaceFlinger --display-id`**. **Additionally, please note that `-android uiautomator` (e.g., `UiSelector`) doesn't work predictably with multiple displays, as this is an Android limitation.** **Multi-display support is only available since Android R (30 API level).**
335
+ alwaysTraversableViewClasses | string | Allows to continue the tree traversal for user defined classes even though the node itself is invisible. The default logic for the UI tree traversal (controlled by the `allowInvisibleElements` setting) is to stop recursing when an invisible node is found. However, with certain Jetpack Compose classes (e.g. androidx.compose.ui.viewinterop.ViewFactoryHolder), it is possible that invisible parent nodes have visible child nodes. See [Google issue \#354958193](https://issuetracker.google.com/issues/354958193) and [UIA2 server issue \#709](https://github.com/appium/appium-uiautomator2-server/issues/709) for more details. This setting only affects the XPath lookup and the page source buildup. You can provide a comma separated list of glob patterns, that will be used as an exemption list: `androidx.compose.ui.viewinterop.*,android.widget.ImageButton`.
336
+
337
+
338
+ ## Platform-Specific Extensions
339
+
340
+ Beside of standard W3C APIs the driver provides the below custom command extensions to execute platform specific scenarios. Use the following source code examples in order to invoke them from your client code:
341
+
342
+ ```java
343
+ // Java 11+
344
+ var result = driver.executeScript("mobile: <methodName>", Map.ofEntries(
345
+ Map.entry("arg1", "value1"),
346
+ Map.entry("arg2", "value2")
347
+ // you may add more pairs if needed or skip providing the map completely
348
+ // if all arguments are defined as optional
349
+ ));
350
+ ```
351
+
352
+ ```js
353
+ // WebdriverIO
354
+ const result = await driver.executeScript('mobile: <methodName>', [{
355
+ arg1: "value1",
356
+ arg2: "value2",
357
+ }]);
358
+ ```
359
+
360
+ ```python
361
+ # Python
362
+ result = driver.execute_script('mobile: <methodName>', {
363
+ 'arg1': 'value1',
364
+ 'arg2': 'value2',
365
+ })
366
+ ```
367
+
368
+ ```ruby
369
+ # Ruby
370
+ result = @driver.execute_script 'mobile: <methodName>', {
371
+ arg1: 'value1',
372
+ arg2: 'value2',
373
+ }
374
+ ```
375
+
376
+ ```csharp
377
+ // Dotnet
378
+ object result = driver.ExecuteScript("mobile: <methodName>", new Dictionary<string, object>() {
379
+ {"arg1", "value1"},
380
+ {"arg2", "value2"}
381
+ });
382
+ ```
383
+
384
+ ### mobile: shell
385
+
386
+ Executes the given shell command on the device under test via ADB connection. This extension exposes a potential security risk and thus is only enabled when explicitly activated by the `adb_shell` server command line feature specifier.
387
+
388
+ #### Arguments
389
+
390
+ Name | Type | Required | Description | Example
391
+ --- | --- | --- | --- | ---
392
+ command | string | yes | Shell command name to execute, for example `echo` or `rm` | echo
393
+ args | Array&lt;string&gt; | no | Array of command arguments | `['-f', '/sdcard/myfile.txt']`
394
+ timeout | number | no | Command timeout in milliseconds. If the command blocks for longer than this timeout then an exception is going to be thrown. The default timeout is `20000` ms | 100000
395
+ includeStderr | boolean | no | Whether to include stderr stream into the returned result. `false` by default | true
396
+
397
+ #### Returned Result
398
+
399
+ Depending on the `includeStderr` value this API could either return a string, which is equal to the `stdout` stream content of the given command or a dictionary whose elements are `stdout` and `stderr` and values are contents of the corresponding outgoing streams. If the command exits with a non-zero return code then an exception is going to be thrown. The exception message will be equal to the command stderr.
400
+
401
+ ### mobile: execEmuConsoleCommand
402
+
403
+ Executes a command through emulator telnet console interface and returns its output.
404
+ The `emulator_console` server feature must be enabled in order to use this method.
405
+
406
+ #### Arguments
407
+
408
+ Name | Type | Required | Description | Example
409
+ --- | --- | --- | --- | ---
410
+ command | string | yes | The actual command to execute. See [Android Emulator Console Guide](https://developer.android.com/studio/run/emulator-console) for more details on available commands | help-verbose
411
+ execTimeout | number | no | Timeout used to wait for a server reply to the given command in milliseconds. `60000` ms by default | 100000
412
+ connTimeout | boolean | no | Console connection timeout in milliseconds. `5000` ms by default | 10000
413
+ initTimeout | boolean | no | Telnet console initialization timeout in milliseconds (the time between the connection happens and the command prompt). `5000` ms by default | 10000
414
+
415
+ #### Returned Result
416
+
417
+ The actual command output. An error is thrown if command execution fails.
418
+
419
+ ### Mobile Gesture Commands
420
+
421
+ UiAutomator2 provides several extensions that allow to automate popular mobile gesture shortcuts:
422
+
423
+ - mobile: dragGesture
424
+ - mobile: flingGesture
425
+ - mobile: doubleClickGesture
426
+ - mobile: clickGesture
427
+ - mobile: longClickGesture
428
+ - mobile: pinchCloseGesture
429
+ - mobile: pinchOpenGesture
430
+ - mobile: swipeGesture
431
+ - mobile: scrollGesture
432
+
433
+ These gestures are documented in the [Automating Mobile Gestures](docs/android-mobile-gestures.md) tutorial. Check [W3C Actions API](https://appiumpro.com/editions/29-automating-complex-gestures-with-the-w3c-actions-api) and
434
+ [Low-Level Insights on Android Input Events](docs/actions.md) if you need to automate more complicated gestures.
435
+
436
+ ### mobile: scroll
437
+
438
+ Scrolls the given scrollable element until an element identified by `strategy` and `selector` becomes visible. This function returns immediately if the destination element is already visible in the view port. Otherwise it would scroll to the very beginning of the scrollable control and tries to reach the destination element by scrolling its parent to the end step by step. The scroll direction (vertical or horizontal) is detected automatically.
439
+
440
+ #### Arguments
441
+
442
+ Name | Type | Required | Description | Example
443
+ --- | --- | --- | --- | ---
444
+ elementId | string | no | The identifier of the scrollable element. It is required this element is a valid scrollable container and it was located by `-android uiautomator` strategy. If this property is not provided then the first currently available scrollable view is selected for the interaction. | 123456-3456-3435-3453453
445
+ strategy | string | yes | The following strategies are supported: `accessibility id` (UiSelector().description), `class name` (UiSelector().className), `-android uiautomator` (UiSelector) | 'accessibility id'
446
+ selector | string | yes | The corresponding lookup value for the selected strategy. | 'com.mycompany:id/table'
447
+ maxSwipes | number | no | The maximum number of swipes to perform on the target scrollable view in order to reach the destination element. In case this value is unset then it would be retrieved from the scrollable element itself (vua `getMaxSearchSwipes()` property). | 10
448
+
449
+ ### mobile: deepLink
450
+
451
+ Start URI that may take users directly to the specific content in the app. Read [Reliably Opening Deep Links Across Platforms and Devices](https://appiumpro.com/editions/84-reliably-opening-deep-links-across-platforms-and-devices) for more details.
452
+
453
+ #### Arguments
454
+
455
+ Name | Type | Required | Description | Example
456
+ --- | --- | --- | --- | ---
457
+ url | string | yes | The URL to start | theapp://login/
458
+ package | string | no | The name of the package to start the URI with. This argument was required previously but became optional since version 3.9.3 | 'com.mycompany'
459
+ waitForLaunch | boolean | no | If `false` then ADB won't wait for the started activity to return the control. `true` by default | false
460
+
461
+ ### mobile: startLogsBroadcast
462
+
463
+ Starts Android logcat broadcast websocket on the same host and port where Appium server is running at `/ws/session/:sessionId:/appium/device/logcat` endpoint. The method will return immediately if the web socket is already listening. Each connected websocket listener will receive logcat log lines as soon as they are visible to Appium. Read [Using Mobile Execution Commands to Continuously Stream Device Logs with Appium](https://appiumpro.com/editions/55-using-mobile-execution-commands-to-continuously-stream-device-logs-with-appium) for more details.
464
+
465
+ Consider using [logs broadcast via BiDi](./docs/bidi.md#logentryadded) over this extension.
466
+
467
+ ### mobile: stopLogsBroadcast
468
+
469
+ Stops the previously started logcat broadcasting websocket server. This method will return immediately if no server is running. Read [Using Mobile Execution Commands to Continuously Stream Device Logs with Appium](https://appiumpro.com/editions/55-using-mobile-execution-commands-to-continuously-stream-device-logs-with-appium) for more details.
470
+
471
+ Consider using [logs broadcast via BiDi](./docs/bidi.md#logentryadded) over this extension.
472
+
473
+ ### mobile: deviceidle
474
+
475
+ This is a wrapper to 'adb shell dumpsys deviceidle' interface.
476
+ Read [Diving Into Android 'M' Doze](https://www.protechtraining.com/blog/post/diving-into-android-m-doze-875) for more details.
477
+ This API only exists since Android 6.
478
+
479
+ #### Arguments
480
+
481
+ Name | Type | Required | Description | Example
482
+ --- | --- | --- | --- | ---
483
+ action | whitelistAdd or whitelistRemove | yes | The name of the action to perform | whitelistAdd
484
+ packages | string or string[] | yes | One or more package names to perfom the above action on | 'com.mycompany'
485
+
486
+ ### mobile: acceptAlert
487
+
488
+ Tries to accept an Android alert. This method might not always be reliable as there is no single standard for how Android alerts should look like within the Accessibility representation.
489
+
490
+ #### Arguments
491
+
492
+ Name | Type | Required | Description | Example
493
+ --- | --- | --- | --- | ---
494
+ buttonLabel | string | no | The name/text of the alert button to click in order to accept it. If not provided then the driver will try to autodetect it | Accept
495
+
496
+ ### mobile: dismissAlert
497
+
498
+ Tries to dismiss an Android alert. This method might not always be reliable as there is no single standard for how Android alerts should look like within the Accessibility representation.
499
+
500
+ #### Arguments
501
+
502
+ Name | Type | Required | Description | Example
503
+ --- | --- | --- | --- | ---
504
+ buttonLabel | string | no | The name/text of the alert button to click in order to dismiss it. If not provided then the driver will try to autodetect it | Dismiss
505
+
506
+ ### mobile: batteryInfo
507
+
508
+ Retrieves the battery information from the device under test.
509
+
510
+ #### Returned Result
511
+
512
+ The extension returns a dictionary whose entries are:
513
+
514
+ Name | Type | Description | Example
515
+ --- | --- | --- | ---
516
+ level | number | Battery level in range [0.0, 1.0], where 1.0 means 100% charge. -1 is returned if the actual value cannot be retrieved from the system. | 0.5
517
+ state | number| Battery state. The following values are possible: BATTERY_STATUS_UNKNOWN = 1; BATTERY_STATUS_CHARGING = 2; BATTERY_STATUS_DISCHARGING = 3; BATTERY_STATUS_NOT_CHARGING = 4; BATTERY_STATUS_FULL = 5. -1 is returned if the actual value cannot be retrieved from the system. | 4
518
+
519
+ ### mobile: deviceInfo
520
+
521
+ Retrieves the information about the device under test, like the device model, serial number, network connectivity info, etc.
522
+
523
+ #### Returned Result
524
+
525
+ The extension returns a dictionary whose entries are the device properties. Check https://github.com/appium/appium-uiautomator2-server/blob/master/app/src/main/java/io/appium/uiautomator2/handler/GetDeviceInfo.java to get the full list of returned keys and their corresponding values.
526
+
527
+ ### mobile: getDeviceTime
528
+
529
+ Retrieves the current device's timestamp.
530
+
531
+ #### Arguments
532
+
533
+ Name | Type | Required | Description | Example
534
+ --- | --- | --- | --- | ---
535
+ format | string | no | The set of format specifiers. Read https://momentjs.com/docs/ to get the full list of supported datetime format specifiers. The default format is `YYYY-MM-DDTHH:mm:ssZ`, which complies to ISO-8601 | YYYY-MM-DDTHH:mm:ssZ
536
+
537
+ #### Returned Result
538
+
539
+ The device timestamp string formatted according to the given specifiers
540
+
541
+ ### mobile: changePermissions
542
+
543
+ Changes package permissions in runtime.
544
+
545
+ #### Arguments
546
+
547
+ Name | Type | Required | Description | Example
548
+ --- | --- | --- | --- | ---
549
+ permissions | string or Array&lt;string&gt; | yes | The full name of the permission to be changed or a list of permissions. Consider checking [the full list](https://developer.android.com/reference/android/Manifest.permission) of standard Android permission names. If `all` magic string is passed (available since driver version 2.8.0) and `target` equals `pm` (the default value) then the chosen action is going to be applied to all permissions requested/granted by the 'appPackage'. If `target` is set to `appops` (available since v2.11.0) then check [AppOpsManager.java](https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/app/AppOpsManager.java) sources to get the full list of supported appops permission names for the given Android platform. The `all` magic string is unsupported for the `appops` target. | `['android.permission.ACCESS_FINE_LOCATION', 'android.permission.BROADCAST_SMS']` `all` `['READ_SMS', 'ACCESS_NOTIFICATIONS']`
550
+ appPackage | string | no | The application package to set change permissions on. Defaults to the package name under test | com.mycompany.myapp
551
+ action | string | no | Either `grant` (the default action) or `revoke` if `target` is set to `pm`, otherwise one of: `allow` (default), `deny`, `ignore`, `default`. | allow
552
+ target | string | no | Either `pm` (default) or `appops` (available since v2.11.0). The `appops` one requires *adb_shell* server security option to be enabled | appops
553
+
554
+ ### mobile: getPermissions
555
+
556
+ Gets runtime permissions list for the given application package.
557
+
558
+ #### Arguments
559
+
560
+ Name | Type | Required | Description | Example
561
+ --- | --- | --- | --- | ---
562
+ type | string | no | One of possible permission types to get. Can be one of: `denied`, `granted` or `requested` (the default value). | granted
563
+ appPackage | string | no | The application package to get permissions from. Defaults to the package name under test | com.mycompany.myapp
564
+
565
+ #### Returned Result
566
+
567
+ Array of strings, where each string is a permission name. the array could be empty.
568
+
569
+ ### mobile: performEditorAction
570
+
571
+ Performs IME action on the _currently focused_ edit element.
572
+
573
+ Very often Android developers use [onEditorAction](https://developer.android.com/reference/android/widget/TextView.OnEditorActionListener.html#onEditorAction(android.widget.TextView,%20int,%20android.view.KeyEvent)) callback with `actionId` argument to implement actions handling, for example, when `Search` or `Done` button is pressed on the on-screen keyboard. This mobile extension is supposed to emulate the invokation of such callback on the focused element.
574
+
575
+ #### Arguments
576
+
577
+ Name | Type | Required | Description | Example
578
+ --- | --- | --- | --- | ---
579
+ action | string | yes | The name or an integer code of the editor action to be executed. The following action names are supported: `normal, unspecified, none, go, search, send, next, done, previous`. Read [EditorInfo](https://developer.android.com/reference/android/view/inputmethod/EditorInfo) for more details on this topic. | search
580
+
581
+ ### mobile: startScreenStreaming
582
+
583
+ Starts device screen broadcast by creating MJPEG server. Multiple calls to this method have no effect unless the previous streaming session is stopped. This method only works if the `adb_screen_streaming` feature is enabled on the server side. It is also required that [GStreamer](https://gstreamer.freedesktop.org/) with `gst-plugins-base`, `gst-plugins-good` and `gst-plugins-bad` packages are installed and available in PATH on the server machine.
584
+
585
+ #### Arguments
586
+
587
+ Name | Type | Required | Description | Example
588
+ --- | --- | --- | --- | ---
589
+ width | number | no | The scaled width of the device's screen. If unset then the script will assign it to the actual screen width measured in pixels. | 768
590
+ height | number | no | The scaled height of the device's screen. If unset then the script will assign it to the actual screen height measured in pixels. | 1024
591
+ bitRate | number | no | The video bit rate for the video, in bits per second. The default value is 4000000 (4 Mb/s). You can increase the bit rate to improve video quality, but doing so results in larger movie files. | 1024000
592
+ host | string | no | The IP address/host name to start the MJPEG server on. You can set it to `0.0.0.0` to trigger the broadcast on all available network interfaces. `127.0.0.1` by default | 0.0.0.0
593
+ pathname | string | no | The HTTP request path the MJPEG server should be available on. If unset then any pathname on the given `host`/`port` combination will work. Note that the value should always start with a single slash: `/` | /myserver
594
+ tcpPort | number | no | The port number to start the internal TCP MJPEG broadcast on. This type of broadcast always starts on the loopback interface (`127.0.0.1`). `8094` by default | 5024
595
+ port | number | no | The port number to start the MJPEG server on. `8093` by default | 5023
596
+ quality | number | no | The quality value for the streamed JPEG images. This number should be in range [1, 100], where 100 is the best quality. `70` by default | 80
597
+ considerRotation | boolean | no | If set to `true` then GStreamer pipeline will increase the dimensions of the resulting images to properly fit images in both landscape and portrait orientations. Set it to `true` if the device rotation is not going to be the same during the broadcasting session. `false` by default | false
598
+ logPipelineDetails | boolean | no | Whether to log GStreamer pipeline events into the standard log output. Might be useful for debugging purposes. `false` by default | true
599
+
600
+ ### mobile: stopScreenStreaming
601
+
602
+ Stop the previously started screen streaming. If no screen streaming server has been started then nothing is done.
603
+
604
+ ### mobile: getNotifications
605
+
606
+ Retrieves Android notifications via Appium Settings helper. Appium Settings app itself must be *manually* granted to access notifications under device Settings in order to make this feature working. Different vendors [might](https://github.com/appium/io.appium.settings/issues/147#issue-2130780990) require more than just the normal Notification permissions at the usual Apps menu. Try to look in places like Privacy menus if you are getting zero items retrieved while expecting some results.
607
+
608
+ Appium Settings helper keeps all the active notifications plus notifications that appeared while it was running in the internal buffer, but no more than 100 items altogether. Newly appeared notifications are always added to the head of the notifications array. The `isRemoved` flag is set to `true` for notifications that have been removed.
609
+ See https://developer.android.com/reference/android/service/notification/StatusBarNotification and https://developer.android.com/reference/android/app/Notification.html for more information on available notification properties and their values.
610
+
611
+ #### Returned Result
612
+
613
+ The example output is:
614
+ ```json
615
+ {
616
+ "statusBarNotifications":[
617
+ {
618
+ "isGroup":false,
619
+ "packageName":"io.appium.settings",
620
+ "isClearable":false,
621
+ "isOngoing":true,
622
+ "id":1,
623
+ "tag":null,
624
+ "notification":{
625
+ "title":null,
626
+ "bigTitle":"Appium Settings",
627
+ "text":null,
628
+ "bigText":"Keep this service running, so Appium for Android can properly interact with several system APIs",
629
+ "tickerText":null,
630
+ "subText":null,
631
+ "infoText":null,
632
+ "template":"android.app.Notification$BigTextStyle"
633
+ },
634
+ "userHandle":0,
635
+ "groupKey":"0|io.appium.settings|1|null|10133",
636
+ "overrideGroupKey":null,
637
+ "postTime":1576853518850,
638
+ "key":"0|io.appium.settings|1|null|10133",
639
+ "isRemoved":false
640
+ }
641
+ ]
642
+ }
643
+ ```
644
+
645
+ ### mobile: openNotifications
646
+
647
+ Opens notifications drawer on the device under test. Does nothing if the drawer is already opened. Available since driver version 2.23
648
+
649
+ ### mobile: listSms
650
+
651
+ Retrieves the list of the most recent SMS properties list via Appium Settings helper. Messages are sorted by date in descending order.
652
+
653
+ #### Arguments
654
+
655
+ Name | Type | Required | Description | Example
656
+ --- | --- | --- | --- | ---
657
+ max | number | no | The maximum count of recent messages to retrieve. `100` by default | 10
658
+
659
+ #### Returned Result
660
+
661
+ The example output is:
662
+ ```json
663
+ {
664
+ "items":[
665
+ {
666
+ "id":"2",
667
+ "address":"+123456789",
668
+ "person":null,
669
+ "date":"1581936422203",
670
+ "read":"0",
671
+ "status":"-1",
672
+ "type":"1",
673
+ "subject":null,
674
+ "body":"\"text message2\"",
675
+ "serviceCenter":null
676
+ },
677
+ {
678
+ "id":"1",
679
+ "address":"+123456789",
680
+ "person":null,
681
+ "date":"1581936382740",
682
+ "read":"0",
683
+ "status":"-1",
684
+ "type":"1",
685
+ "subject":null,
686
+ "body":"\"text message\"",
687
+ "serviceCenter":null
688
+ }
689
+ ],
690
+ "total":2
691
+ }
692
+ ```
693
+
694
+ ### mobile: type
695
+
696
+ Types the given Unicode string. It is expected that the focus is already put to the destination input field before this method is called. The main difference between this method and the sendKeys one is that it emulates `true` typing like it was done from an on-screen keyboard. It also properly supports Unicode input characters.
697
+
698
+ #### Arguments
699
+
700
+ Name | Type | Required | Description | Example
701
+ --- | --- | --- | --- | ---
702
+ text | string | yes | The text to type | testing
703
+
704
+ ### mobile: sensorSet
705
+
706
+ Emulate changing of sensor values on the connected emulator.
707
+ This extension does not work on real devices.
708
+
709
+ #### Arguments
710
+
711
+ Name | Type | Required | Description | Example
712
+ --- | --- | --- | --- | ---
713
+ sensorType | string | yes | The set of all supported sensor types could be found in [adb-emu-commands.js](https://github.com/appium/appium-adb/blob/master/lib/tools/adb-emu-commands.js) (look for *SENSORS* object values). Check the output of `sensor status` command in the [emulator console](https://developer.android.com/studio/run/emulator-console) to see more details on the available sensor types | light
714
+ value | string | yes | Check the output of `sensor get <sensorType>` command in the [emulator console](https://developer.android.com/studio/run/emulator-console) to see the acceptable value format for the given sensor type | 50
715
+
716
+ ### mobile: pullFile
717
+
718
+ Pulls a remote file from the device.
719
+
720
+ #### Arguments
721
+
722
+ Name | Type | Required | Description | Example
723
+ --- | --- | --- | --- | ---
724
+ remotePath | string | yes | The full path to the remote file or a specially formatted path, which points to an item inside an app bundle, for example `@my.app.id/my/path`. It is mandatory for the app bundle to have [debugging enabled](https://developer.android.com/studio/debug) in order to use the latter remotePath format. If the file with the given name does not exist then an exception will be thrown. | /sdcard/foo.bar
725
+
726
+ #### Returned Result
727
+
728
+ Base64-encoded string, which represents the content of the remote file.
729
+
730
+ ### mobile: pushFile
731
+
732
+ Pushes a local file to the device.
733
+
734
+ #### Arguments
735
+
736
+ Name | Type | Required | Description | Example
737
+ --- | --- | --- | --- | ---
738
+ remotePath | string | yes | The path on the device to where the payload should be written. The value format is similar to the one used in [pullFile](#mobile-pullfile) extension. If the file with the same name already exists then it will be silently overridden. | /sdcard/foo.bar
739
+ payload | string | yes | Base64-encoded content of the file to be pushed. | QXBwaXVt
740
+
741
+ ### mobile: pullFolder
742
+
743
+ Pulls a remote folder from the device.
744
+
745
+ #### Arguments
746
+
747
+ Name | Type | Required | Description | Example
748
+ --- | --- | --- | --- | ---
749
+ remotePath | string | yes | Same as for [pullFile](#mobile-pullfile) extension, but should be pointing to a remote folder | /sdcard/yolo/
750
+
751
+ #### Returned Result
752
+
753
+ Base64-encoded string, which represents the zipped content of the remote folder.
754
+
755
+ ### mobile: deleteFile
756
+
757
+ Deletes a file on the remote device.
758
+
759
+ #### Arguments
760
+
761
+ Name | Type | Required | Description | Example
762
+ --- | --- | --- | --- | ---
763
+ remotePath | string | yes | The full path to the remote file or a file inside an application bundle | `/sdcard/myfile.txt` or `@my.app.id/path/in/bundle`
764
+
765
+ ### mobile: isAppInstalled
766
+
767
+ Verify whether an application is installed on the device under test.
768
+
769
+ #### Arguments
770
+
771
+ Name | Type | Required | Description | Example
772
+ --- | --- | --- | --- | ---
773
+ appId | string | yes | The identifier of the application package to be checked | `my.app.id`
774
+ user | number or string | no | The user ID for which the package is installed.. The `current` user is used by default | 1006
775
+
776
+ #### Returned Result
777
+
778
+ True or false
779
+
780
+ ### mobile: queryAppState
781
+
782
+ Queries the current state of the app.
783
+
784
+ #### Arguments
785
+
786
+ Name | Type | Required | Description | Example
787
+ --- | --- | --- | --- | ---
788
+ appId | string | yes | The identifier of the application package to be checked | `my.app.id`
789
+
790
+ #### Returned Result
791
+
792
+ The following numbers could returned:
793
+ - The app is not installed: `0`
794
+ - The app is installed and is not running: `1`
795
+ - The app is running in background: `3`
796
+ - The app is running in foreground: `4`
797
+
798
+ ### mobile: activateApp
799
+
800
+ Activates the given application or launches it if necessary.
801
+ The action literally simulates
802
+ clicking the corresponding application icon on the dashboard.
803
+
804
+ #### Arguments
805
+
806
+ Name | Type | Required | Description | Example
807
+ --- | --- | --- | --- | ---
808
+ appId | string | yes | The identifier of the application package to be activated | `my.app.id`
809
+
810
+ ### mobile: removeApp
811
+
812
+ Remove the corresponding application if is installed.
813
+ The call is ignored if the app is not installed.
814
+
815
+ #### Arguments
816
+
817
+ Name | Type | Required | Description | Example
818
+ --- | --- | --- | --- | ---
819
+ appId | string | yes | The identifier of the application package to be removed | `my.app.id`
820
+ timeout | number | no | The count of milliseconds to wait until the app is terminated. 20000ms by default. | 1500, 0
821
+ keepData | boolean | no | Set to true in order to keep the application data and cache folders after uninstall. | true
822
+
823
+ #### Returned Result
824
+
825
+ True is the app has been found on the device and successfully removed. Otherwise false.
826
+
827
+ ### mobile: terminateApp
828
+
829
+ Terminates the app and waits until the app is terminated up to the given timeout
830
+ by checking the app state to ensure if the app process is actually stopped.
831
+
832
+ The app state check can be skipped if the given timeout is lower or equal to zero since UIAutomator driver 2.9.0.
833
+ The skip helps when you want to terminate the app process but do not want to check the process existence
834
+ because the app under test may, for example, restart it automatically.
835
+
836
+ #### Arguments
837
+
838
+ Name | Type | Required | Description | Example
839
+ --- | --- | --- | --- | ---
840
+ appId | string | yes | The identifier of the application package to be terminated | `my.app.id`
841
+ timeout | number | no | The count of milliseconds to wait until the app is terminated. 500ms by default. | 1500, 0
842
+
843
+ #### Returned Result
844
+
845
+ True if the app has been successfully terminated.
846
+
847
+ ### mobile: installApp
848
+
849
+ Installs the given application package to the device under test.
850
+ It might raise the `INSTALL_FAILED_VERSION_DOWNGRADE` error if the installation was a version downgrade.
851
+
852
+ #### Arguments
853
+
854
+ Name | Type | Required | Description | Example
855
+ --- | --- | --- | --- | ---
856
+ appPath | string | yes | The local .apk(s) path on the server filesystem or a remote url. | `/app/path.apk`
857
+ timeout | number | no | The count of milliseconds to wait until the app is installed.. 6000ms by default. | 120000
858
+ allowTestPackages | boolean | no | Set to true in order to allow test packages installation. false by default | true
859
+ useSdcard | boolean | no | Set to true to install the app on sdcard instead of the device memory. false by default | true
860
+ grantPermissions | boolean | no | Set to true in order to grant all the permissions requested in the application's manifest automatically after the installation is completed under Android 6+. The targetSdkVersion in the application manifest must be greater or equal to 23 and the Android version on the device under test must be greater or equal to Android 6 (API level 23) to grant permissions. Applications whose targetSdkVersion is lower than or equal to 22 must be reisntalled to grant permissions for Android 6+ devices. false by default | true
861
+ replace | boolean | no | Set it to false if you don't want the application to be upgraded/reinstalled if it is already present on the device, but throw an error instead. true by default | false
862
+ checkVersion | boolean | no | Set to true, in order to skip the application installation if the device under test has a greater or equal to the application version. It may help to avoid `INSTALL_FAILED_VERSION_DOWNGRADE` error and unnecessary installation. | true
863
+
864
+ ### mobile: clearApp
865
+
866
+ Deletes all data associated with a package. Calls `adb shell pm clear` under the hood.
867
+ The app should be accessible, should not be running,
868
+ and should exist on the device under test for this extension to work properly.
869
+
870
+ #### Arguments
871
+
872
+ Name | Type | Required | Description | Example
873
+ --- | --- | --- | --- | ---
874
+ appId | string | yes | The identifier of the application package to be cleared | `my.app.id`
875
+
876
+ #### Returned Result
877
+
878
+ Stdout of the corresponding adb command.
879
+
880
+ ### mobile: startActivity
881
+
882
+ Starts the given activity intent. Invokes `am start`/`am start-activity` command under the hood.
883
+ This method extends the functionality of the [Start Activity](#applications-management) app management API.
884
+
885
+ #### Arguments
886
+
887
+ Name | Type | Required | Description | Example
888
+ --- | --- | --- | --- | ---
889
+ intent | string | yes | The full name of the activity intent to start | `com.some.package.name/.YourActivityClassName`
890
+ user | number or string | no | The user ID for which the service is started. The `current` user is used by default | 1006
891
+ wait | boolean | no | Set it to `true` if you want to block the method call until the Activity Manager's process returns the control to the system. | false
892
+ stop | boolean | no | Set it to `true` to force stop the target app before starting the activity. | false
893
+ windowingMode | integer | no | The windowing mode to launch the activity into. Check [WindowConfiguration.java](https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/app/WindowConfiguration.java) for more details on possible windowing modes (constants starting with `WINDOWING_MODE_`). | 1
894
+ activityType | integer | no | The activity type to launch the activity as. Check [WindowConfiguration.java](https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/app/WindowConfiguration.java) for more details on possible activity types (constants starting with `ACTIVITY_TYPE_`). | 1
895
+ action | string | no | Action name. The actual value for the Activity Manager's `-a` argument. | android.intent.action.MAIN
896
+ uri | string | no | Unified resource identifier. The actual value for the Activity Manager's `-d` argument. | https://appium.io
897
+ mimeType | string | no | Mime type. The actual value for the Activity Manager's `-t` argument. | application/json
898
+ identifier | string | no | Optional identifier. The actual value for the Activity Manager's `-i` argument. | my_identifier
899
+ categories | string or Array&lt;string&gt; | no | One or more category names. The actual value(s) for the Activity Manager's `-c` argument. | android.intent.category.LAUNCHER
900
+ component | string | no | Component name. The actual value for the Activity Manager's `-n` argument. | com.myapp/com.myapp.SplashActivity
901
+ package | string | no | Package name. The actual value for the Activity Manager's `-p` argument. | com.myapp
902
+ extras | Array&lt;Array&lt;string&gt;&gt; | no | Optional intent arguments. Must be represented as an array of arrays, where each subarray item contains two (only in case it no value is required for the given type) or three string items: value type, key (variable name) and the value itself. Supported value types are: `s`: string. Value must be a valid string; `sn`: null. Value is ignored for this type; `z`: boolean. Value must be either `true` or `false`; `i`: integer. Value must be a valid 4-byte integer number; `l`: long. Value must be a valid 8-byte long number; `f`: float: Value must be a valid float number; `u`: uri. Value must be a valid uniform resource identifier string; `cn`: component name. Value must be a valid component name string; `ia`: Integer[]. Value must be a string of comma-separated integers; `ial`: List&lt;Integer&gt;. Value must be a string of comma-separated integers; `la`: Long[]. Value must be a string of comma-separated long numbers; `lal`: List&lt;Long&gt;. Value must be a string of comma-separated long numbers; `fa`: Float[]. Value must be a string of comma-separated float numbers; `fal`: List&lt;Float&gt;. Value must be a string of comma-separated float numbers; `sa`: String[]. Value must be comma-separated strings. To embed a comma into a string escape it using "\,"; `sal`: List&lt;String&gt;. Value must be comma-separated strings. To embed a comma into a string, escape it using "\," | [['s', 'varName1', 'My String1'], ['s', 'varName2', 'My String2'], ['ia', 'arrName', '1,2,3,4']]
903
+ flags | string | no | Intent startup-specific flags as a hexadecimal string. Check [Intent documentation](https://developer.android.com/reference/android/content/Intent.html) for the list of available flag values (constants starting with `FLAG_ACTIVITY_`). Flag values could be merged using the logical 'or' operation. | 0x10200000 is the combination of two flags: 0x10000000 `FLAG_ACTIVITY_NEW_TASK` `|` 0x00200000 `FLAG_ACTIVITY_RESET_TASK_IF_NEEDED`
904
+
905
+ #### Returned Result
906
+
907
+ The actual stdout of the downstream `am` command.
908
+
909
+ #### Example
910
+
911
+ Use the code snippet below to represent the following shell command: `shell am start-activity -W -n io.appium.android.apis/io.appium.android.apis.ApiDemos -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000'`, which is usually similar to what is called in a new session request.
912
+ If you replace `'io.appium.android.apis/io.appium.android.apis.ApiDemos'` with your expected launchable activity, it would be the alternative method to start the activity in session.
913
+
914
+ Please check [how appium adds flags](https://github.com/appium/appium-android-driver/blob/master/lib/commands/intent.js) for more details to understand how Appium builds flags.
915
+
916
+ ```ruby
917
+ # Ruby
918
+ driver.execute_script 'mobile: startActivity', {
919
+ wait: true,
920
+ stop: true,
921
+ action: 'android.intent.action.MAIN',
922
+ component: 'io.appium.android.apis/io.appium.android.apis.ApiDemos',
923
+ categories: ['android.intent.category.LAUNCHER'],
924
+ flags: '0x10200000'
925
+ }
926
+ ```
927
+
928
+ ### mobile: startService
929
+
930
+ Starts the given service intent. Invokes `am startservice` or `am start-service` command under the hood.
931
+
932
+ #### Arguments
933
+
934
+ Name | Type | Required | Description | Example
935
+ --- | --- | --- | --- | ---
936
+ intent | string | no | The full name of the service intent to start | `com.some.package.name/.YourServiceSubClassName`
937
+ user | number or string | no | The user ID for which the service is started. The `current` user id is used by default | 1006
938
+ foreground | boolean | no | Set it to `true` if your service must be started as a foreground service. The argument only works for Android 8 and above. | false
939
+ action | string | no | See the documentation for [startActivity extension](#mobile-startactivity) | android.intent.action.MAIN
940
+ uri | string | no | See the documentation for [startActivity extension](#mobile-startactivity) | https://appium.io
941
+ mimeType | string | no | See the documentation for [startActivity extension](#mobile-startactivity) | application/json
942
+ identifier | string | no | See the documentation for [startActivity extension](#mobile-startactivity) | my_identifier
943
+ categories | string or Array&lt;string&gt; | no | See the documentation for [startActivity extension](#mobile-startactivity) | com.myapp/com.myapp.SplashActivity
944
+ component | string | no | See the documentation for [startActivity extension](#mobile-startactivity) | android.intent.category.LAUNCHER
945
+ package | string | no | See the documentation for [startActivity extension](#mobile-startactivity) | com.myapp
946
+ extras | Array&lt;Array&lt;string&gt;&gt; | no | See the documentation for [startActivity extension](#mobile-startactivity) | [['s', 'varName1', 'My String1'], ['s', 'varName2', 'My String2'], ['ia', 'arrName', '1,2,3,4']]
947
+ flags | string | no | See the documentation for [startActivity extension](#mobile-startactivity) | 0x10200000 is the combination of two flags: 0x10000000 `FLAG_ACTIVITY_NEW_TASK` `|` 0x00200000 `FLAG_ACTIVITY_RESET_TASK_IF_NEEDED`
948
+
949
+ #### Returned Result
950
+
951
+ The actual stdout of the downstream `am` command.
952
+
953
+ ### mobile: stopService
954
+
955
+ Stops the given service intent. Invokes `am stopservice` or `am stop-service` command under the hood.
956
+
957
+ #### Arguments
958
+
959
+ Name | Type | Required | Description | Example
960
+ --- | --- | --- | --- | ---
961
+ intent | string | no | The full name of the service intent to stop | `com.some.package.name/.YourServiceSubClassName`
962
+ user | number or string | no | The user ID for which the service is started. The `current` user id is used by default | 1006
963
+ action | string | no | See the documentation for [startActivity extension](#mobile-startactivity) | android.intent.action.MAIN
964
+ uri | string | no | See the documentation for [startActivity extension](#mobile-startactivity) | https://appium.io
965
+ mimeType | string | no | See the documentation for [startActivity extension](#mobile-startactivity) | application/json
966
+ identifier | string | no | See the documentation for [startActivity extension](#mobile-startactivity) | my_identifier
967
+ categories | string or Array&lt;string&gt; | no | See the documentation for [startActivity extension](#mobile-startactivity) | com.myapp/com.myapp.SplashActivity
968
+ component | string | no | See the documentation for [startActivity extension](#mobile-startactivity) | android.intent.category.LAUNCHER
969
+ package | string | no | See the documentation for [startActivity extension](#mobile-startactivity) | com.myapp
970
+ extras | Array&lt;Array&lt;string&gt;&gt; | no | See the documentation for [startActivity extension](#mobile-startactivity) | [['s', 'varName1', 'My String1'], ['s', 'varName2', 'My String2'], ['ia', 'arrName', '1,2,3,4']]
971
+ flags | string | no | See the documentation for [startActivity extension](#mobile-startactivity) | 0x10200000 is the combination of two flags: 0x10000000 `FLAG_ACTIVITY_NEW_TASK` `|` 0x00200000 `FLAG_ACTIVITY_RESET_TASK_IF_NEEDED`
972
+
973
+ ### mobile: broadcast
974
+
975
+ Send a broadcast Intent. Invokes `am broadcast` command under the hood.
976
+
977
+ #### Arguments
978
+
979
+ Name | Type | Required | Description | Example
980
+ --- | --- | --- | --- | ---
981
+ intent | string | no | The full name of the intent to broadcast | `com.some.package.name/.YourIntentClassName`
982
+ user | number or string | no | Specify which user to send to; if not specified then send to all users. Possible values are `all`/`current`/`<numeric user id>` | current
983
+ receiverPermission | string | no | Require receiver to hold the given permission | android.permission.READ_PROFILE
984
+ allowBackgroundActivityStarts | boolean | no | The receiver may start activities even if in the background if set to `true` | false
985
+ action | string | no | See the documentation for [startActivity extension](#mobile-startactivity) | android.intent.action.MAIN
986
+ uri | string | no | See the documentation for [startActivity extension](#mobile-startactivity) | https://appium.io
987
+ mimeType | string | no | See the documentation for [startActivity extension](#mobile-startactivity) | application/json
988
+ identifier | string | no | See the documentation for [startActivity extension](#mobile-startactivity) | my_identifier
989
+ categories | string or Array&lt;string&gt; | no | See the documentation for [startActivity extension](#mobile-startactivity) | com.myapp/com.myapp.SplashActivity
990
+ component | string | no | See the documentation for [startActivity extension](#mobile-startactivity) | android.intent.category.LAUNCHER
991
+ package | string | no | See the documentation for [startActivity extension](#mobile-startactivity) | com.myapp
992
+ extras | Array&lt;Array&lt;string&gt;&gt; | no | See the documentation for [startActivity extension](#mobile-startactivity) | [['s', 'varName1', 'My String1'], ['s', 'varName2', 'My String2'], ['ia', 'arrName', '1,2,3,4']]
993
+ flags | string | no | See the documentation for [startActivity extension](#mobile-startactivity) | 0x10200000 is the combination of two flags: 0x10000000 `FLAG_ACTIVITY_NEW_TASK` `|` 0x00200000 `FLAG_ACTIVITY_RESET_TASK_IF_NEEDED`
994
+
995
+ #### Returned Result
996
+
997
+ The actual stdout of the downstream `am` command.
998
+
999
+ ### mobile: getContexts
1000
+
1001
+ Retrieves a WebViews mapping based on CDP endpoints
1002
+
1003
+ #### Arguments
1004
+
1005
+ Name | Type | Required | Description | Example
1006
+ --- | --- | --- | --- | ---
1007
+ waitForWebviewMs | number | no | Tells UiAutomator2 driver for how long (in milliseconds) to wait for web view(s) to appear since UiAutomator2 driver v2.53.0. If a Chrome process running on the device under test fails to create a connection to the devtools socket, then the chromedriver will rise an error similar to `failed to connect to socket 'localabstract:chrome_devtools_remote'` in UiAutomator2 driver. It could cause no WebViews found result, although a couple of retrials may fix it. This argument helps to keep trying to get WebView(s) up to the given time milliseconds as one command call. This issue tends to occur Chrome v115 and over so far. [issues#19251](https://github.com/appium/appium/issues/19251) contains more details. If set to `0`ms (the default value), then UiAutomator2 driver only checks the WebView(s) availability once. | 10000
1008
+
1009
+ #### Returned Result
1010
+
1011
+ The following json demonstrates the example of WebviewsMapping object.
1012
+ Note that `description` in `page` can be an empty string most likely when it comes to Mobile Chrome)
1013
+
1014
+ ```json
1015
+ {
1016
+ "proc": "@webview_devtools_remote_22138",
1017
+ "webview": "WEBVIEW_22138",
1018
+ "info": {
1019
+ "Android-Package": "io.appium.settings",
1020
+ "Browser": "Chrome/74.0.3729.185",
1021
+ "Protocol-Version": "1.3",
1022
+ "User-Agent": "Mozilla/5.0 (Linux; Android 10; Android SDK built for x86 Build/QSR1.190920.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/74.0.3729.185 Mobile Safari/537.36",
1023
+ "V8-Version": "7.4.288.28",
1024
+ "WebKit-Version": "537.36 (@22955682f94ce09336197bfb8dffea991fa32f0d)",
1025
+ "webSocketDebuggerUrl": "ws://127.0.0.1:10900/devtools/browser"
1026
+ },
1027
+ "pages": [
1028
+ {
1029
+ "description": "{\"attached\":true,\"empty\":false,\"height\":1458,\"screenX\":0,\"screenY\":336,\"visible\":true,\"width\":1080}",
1030
+ "devtoolsFrontendUrl": "http://chrome-devtools-frontend.appspot.com/serve_rev/@22955682f94ce09336197bfb8dffea991fa32f0d/inspector.html?ws=127.0.0.1:10900/devtools/page/27325CC50B600D31B233F45E09487B1F",
1031
+ "id": "27325CC50B600D31B233F45E09487B1F",
1032
+ "title": "Releases · appium/appium · GitHub",
1033
+ "type": "page",
1034
+ "url": "https://github.com/appium/appium/releases",
1035
+ "webSocketDebuggerUrl": "ws://127.0.0.1:10900/devtools/page/27325CC50B600D31B233F45E09487B1F"
1036
+ }
1037
+ ],
1038
+ "webviewName": "WEBVIEW_com.io.appium.setting"
1039
+ }
1040
+ ```
1041
+
1042
+ ### mobile: installMultipleApks
1043
+
1044
+ Install applications via `install-multiple` option.
1045
+ Please read more details in the corresponding section of the `adb --help` command output.
1046
+
1047
+ #### Arguments
1048
+
1049
+ Name | Type | Required | Description | Example
1050
+ --- | --- | --- | --- | ---
1051
+ apks | Array&lt;string&gt; | yes | The path to APKs. Each path should be the full path to the apk to be installed, or an URL to a remote location. | `['/path/to/local.apk', 'https://github.com/appium/ruby_lib_core/blob/master/test/functional/app/api.apk.zip?raw=true']`
1052
+ options | object | no | Installation options. If you want enable `-g` option, you could specify that `{grantPermissions: true}`. `allowTestPackages` corresponds `-t`, `useSdcard` corresponds `-s`, `replace` corresponds `-r` (`-r` is enabled by default), `partialInstall` corresponds `-p`. | `{grantPermissions: true, partialInstall: true}`
1053
+
1054
+ ### mobile: lock
1055
+
1056
+ Lock the device (and optionally unlock it after a certain amount of time). Only simple (e.g. without a password) locks are supported.
1057
+
1058
+ #### Arguments
1059
+
1060
+ Name | Type | Required | Description | Example
1061
+ --- | --- | --- | --- | ---
1062
+ seconds | number|string | no | The number of seconds after which to unlock the device. Set to `0` or leave it empty to require manual unlock (e.g. do not block and automatically unlock afterwards). | 5
1063
+
1064
+ ### mobile: unlock
1065
+
1066
+ Unlocks the device if it is locked. Noop if the device's screen is not locked.
1067
+
1068
+ #### Arguments
1069
+
1070
+ Name | Type | Required | Description | Example
1071
+ --- | --- | --- | --- | ---
1072
+ key | string | yes | The unlock key. See the documentation on [appium:unlockKey](#device-locking) capability for more details | 12345
1073
+ type | string | yes | The unlock type. See the documentation on [appium:unlockType](#device-locking) capability for more details | password
1074
+ strategy | string | no | Unlock strategy. See the documentation on [appium:unlockStrategy](#device-locking) capability for more details | uiautomator
1075
+ timeoutMs | number | no | Unlock timeout. See the documentation on [appium:unlockSuccessTimeout](#device-locking) capability for more details | 5000
1076
+
1077
+ ### mobile: isLocked
1078
+
1079
+ Determine whether the device is locked.
1080
+
1081
+ #### Returned Result
1082
+
1083
+ Either `true` or `false`
1084
+
1085
+ ### mobile: setGeolocation
1086
+
1087
+ Sets emulated geolocation coordinates on the device under test.
1088
+
1089
+ #### Arguments
1090
+
1091
+ Name | Type | Required | Description | Example
1092
+ --- | --- | --- | --- | ---
1093
+ latitude | number | yes | [Latitude](https://en.wikipedia.org/wiki/Latitude) value | 32.456
1094
+ longitude | number | yes | [longitude](https://en.wikipedia.org/wiki/Longitude) value | 32.456
1095
+ altitude | number | no | [Altitude](https://en.wikipedia.org/wiki/Altitude) value. Zero by default | 5.678
1096
+ satellites | number | no | Number of satellites being tracked (1-12). Available for emulators. | 2
1097
+ speed | number | no | [Set the speed](https://developer.android.com/reference/android/location/Location#setSpeed(float)) in meters per second. Valid value is `0.0` or greater. | 30.0
1098
+ bearing | number | no | [Set the bearing](https://developer.android.com/reference/android/location/Location#setBearing(float)) at the time of this location, in degrees. Available for real devices. Valid values should be in range `[0, 360)`. | 10
1099
+ accuracy | number | no | [Set the horizontal accuracy](https://developer.android.com/reference/android/location/Location#setAccuracy(float)) in meters of this location. Available for real devices. Valid value is `0.0` or greater. | 10.0
1100
+
1101
+ ### mobile: getGeolocation
1102
+
1103
+ Retrieves current geolocation coordinates from the device under test. If coordinates are mocked/emulated
1104
+ then these coordinates would be returned.
1105
+
1106
+ #### Returned Result
1107
+
1108
+ A map with the following entries:
1109
+
1110
+ Name | Type | Description | Example
1111
+ --- | --- | --- | ---
1112
+ latitude | number | [Latitude](https://en.wikipedia.org/wiki/Latitude) value | 32.456
1113
+ longitude | number | [longitude](https://en.wikipedia.org/wiki/Longitude) value | 32.456
1114
+ altitude | number | [Altitude](https://en.wikipedia.org/wiki/Altitude) value | 5.678
1115
+
1116
+ ### mobile: resetGeolocation
1117
+
1118
+ Resets mocked geolocation provider to the default/system one. Only works for real devices.
1119
+
1120
+ ### mobile: refreshGpsCache
1121
+
1122
+ Sends a request to refresh the GPS cache on the device under test.
1123
+ By default the location tracking is configured for
1124
+ [low battery consumption](https://github.com/appium/io.appium.settings/blob/master/app/src/main/java/io/appium/settings/LocationTracker.java),
1125
+ so you might need to call this extension periodically to get the updated geo
1126
+ location if the actual (or mocked) device location is changed too frequently.
1127
+ The feature only works if the device under test has Google Play Services installed.
1128
+ In case the vanilla
1129
+ [LocationManager](https://developer.android.com/reference/android/location/LocationManager)
1130
+ is used the device API level must be at version 30 (Android R) or higher.
1131
+
1132
+ #### Arguments
1133
+
1134
+ Name | Type | Required | Description | Example
1135
+ --- | --- | --- | --- | ---
1136
+ timeoutMs | number | no | The maximum number of milliseconds to block until GPS cache is refreshed. If the API call does not receive a confirmation about successful cache refresh within this timeout then an error is thrown. Providing zero or a negative value to it skips waiting completely and does not check for any errors. 20000 ms by default. | 60000
1137
+
1138
+ ### mobile: startMediaProjectionRecording
1139
+
1140
+ Starts a new recording of the device activity using [Media Projection](https://developer.android.com/reference/android/media/projection/MediaProjection) API. This API is available since Android 10 (API level 29) and allows to record device screen and audio in high quality. Video and audio encoding is done by Android itself.
1141
+ The recording is done by [Appium Settings helper](https://github.com/appium/io.appium.settings#internal-audio--video-recording).
1142
+
1143
+ #### Arguments
1144
+
1145
+ Name | Type | Required | Description | Example
1146
+ --- | --- | --- | --- | ---
1147
+ resolution | string | no | The resolution of the resulting video, which usually equals to Full HD 1920x1080 on most phones, however you could change it to one of the following supported resolutions: "1920x1080", "1280x720", "720x480", "320x240", "176x144" | 1280x720
1148
+ maxDurationSec | number | no | The maximum number of seconds allowed for the recording to run. 900 seconds by default (15 minutes) | 300
1149
+ priority | string | no | Recording thread priority is set to maximum (`high`) by default. However if you face performance drops during testing with recording enabled, you could reduce the recording priority to `normal` or `low`. | low
1150
+ filename | string | no | You can type recording video file name as you want, but recording currently supports only "mp4" format so your filename must end with ".mp4". An invalid file name will fail to start the recording. If not provided then the current timestamp will be used as file name. | screen.mp4
1151
+
1152
+ #### Returned Result
1153
+
1154
+ `true` if a new recording has successfully started. `false` if another recording is currently running.
1155
+
1156
+ ### mobile: isMediaProjectionRecordingRunning
1157
+
1158
+ Check if a media projection recording is currently running
1159
+
1160
+ #### Returned Result
1161
+
1162
+ `true` if a recording is running.
1163
+
1164
+ ### mobile: stopMediaProjectionRecording
1165
+
1166
+ Stops a recording and retrieves the recently recorded media. If no recording has been started before then an error is thrown. If the recording has been already finished before this API has been called then the most recent recorded media is returned.
1167
+
1168
+ #### Arguments
1169
+
1170
+ Name | Type | Required | Description | Example
1171
+ --- | --- | --- | --- | ---
1172
+ remotePath | string | no | The path to the remote location, where the resulting video should be uploaded. The following protocols are supported: http/https, ftp. Null or empty string value (the default setting) means the content of resulting file should be encoded as Base64 and passed as the endpoont response value. An exception will be thrown if the generated media file is too big to fit into the available process memory. | https://myserver.com/upload
1173
+ user | string | no | The name of the user for the remote authentication. | admin
1174
+ pass | string | no | The password for the remote authentication. | pa$$w0rd
1175
+ method | string | no | The http multipart upload method name. The 'PUT' one is used by default. | POST
1176
+ headers | Map&lt;string, string&gt; | no | Additional headers mapping for multipart http(s) uploads | {'Agent': '007'}
1177
+ fileFieldName | string | no | The name of the form field, where the file content BLOB should be stored for http(s) uploads. `file` by default | blob
1178
+ formFields | Map&lt;string, string&gt; or Array&lt;Pair&gt; | no | Additional form fields for multipart http(s) uploads. | {'name': 'yolo.mp4'}
1179
+ uploadTimeout | number | no | The maximum number of milliseconds to wait until the media file is uploaded to the remote location. 240000 ms by default. | 30000
1180
+
1181
+ #### Returned Result
1182
+
1183
+ Base64-encoded content of the recorded media file if `remotePath` argument is falsy or an empty string.
1184
+
1185
+ ### mobile: getConnectivity
1186
+
1187
+ Returns connectivity states for different services
1188
+
1189
+ #### Arguments
1190
+
1191
+ Name | Type | Required | Description | Example
1192
+ --- | --- | --- | --- | ---
1193
+ services | string or string[] | no | One or more services to get the connectivity for. Supported service names are: wifi, data, airplaneMode. If no service names are provided then all supported names are assumed by default. | [wifi, data]
1194
+
1195
+ #### Returned Result
1196
+
1197
+ A map is returned containing the following possible items (depending on which values have been passed to `services` argument):
1198
+
1199
+ Name | Type | Description
1200
+ --- | --- | ---
1201
+ wifi | boolean | True if wifi is enabled
1202
+ data | boolean | True if mobile data connection is enabled
1203
+ airplaneMode | boolean | True if Airplane Mode is enabled
1204
+
1205
+ ### mobile: setConnectivity
1206
+
1207
+ Set the connectivity state for different services. At least one valid service name must be provided in arguments.
1208
+ Missing values tell the driver to not change the corresponding service's state.
1209
+
1210
+ > [!Note]
1211
+ >
1212
+ > Switching Wi-Fi and mobile data states reliably work on emulators for all Android versions.
1213
+ > Real devices support proper state switching only since Android 11.
1214
+
1215
+ > [!Note]
1216
+ >
1217
+ > UiAutomator2 REST server app is running on the device under test and might be terminated/disconnected by Android
1218
+ > thus failing the driver session as a result of using this API. The only way to restore the session would be to quit it
1219
+ > after the network state is changed and then reopen it with `noReset` capability being set to `true` when the connectivity
1220
+ > is restored.
1221
+
1222
+ #### Arguments
1223
+
1224
+ Name | Type | Required | Description | Example
1225
+ --- | --- | --- | --- | ---
1226
+ wifi | booolean | no | Either to enable or disable Wi-Fi. | false
1227
+ data | booolean | no | Either to enable or disable mobile data. | false
1228
+ airplaneMode | booolean | no | Either to enable or disable Airplane Mode. | false
1229
+
1230
+ ### mobile: getAppStrings
1231
+
1232
+ Retrieves string resources for the given app language. An error is thrown if strings cannot be fetched or no strings exist
1233
+ for the given language abbreviation. Available since driver version 2.15.0
1234
+
1235
+ #### Arguments
1236
+
1237
+ Name | Type | Required | Description | Example
1238
+ --- | --- | --- | --- | ---
1239
+ language | string | no | The language abbreviation to fetch app strings mapping for. If no language is provided then strings for the default language on the device under test would be returned | fr
1240
+
1241
+ #### Returned Result
1242
+
1243
+ App strings map, where keys are resource identifiers.
1244
+
1245
+ ### mobile: hideKeyboard
1246
+
1247
+ Tries to hide the on-screen keyboard. Throws an exception if the keyboard cannot be hidden.
1248
+ Does nothing if the keyboard is already hidden.
1249
+
1250
+ #### Returned Result
1251
+
1252
+ `true` if the keyboard was successfully hidden or `false` if it was already invisible.
1253
+
1254
+ ### mobile: isKeyboardShown
1255
+
1256
+ Checks if the system on-screen keyboard is visible.
1257
+
1258
+ #### Returned Result
1259
+
1260
+ `true` if the keyboard is visible
1261
+
1262
+ ### mobile: pressKey
1263
+
1264
+ Emulates single key press on the key with the given code. Available since driver version 2.17.0
1265
+
1266
+ #### Arguments
1267
+
1268
+ Name | Type | Required | Description | Example
1269
+ --- | --- | --- | --- | ---
1270
+ keycode | number | yes | A valid Android key code. See [KeyEvent documentation](https://developer.android.com/reference/android/view/KeyEvent) for the list of available key codes | 0x00000099 (which is KEYCODE_NUMPAD_9)
1271
+ metastate | number | no | An integer in which each bit set to 1 represents a pressed meta key. See [KeyEvent documentation](https://developer.android.com/reference/android/view/KeyEvent) for more details. | 0x00000010 (which is META_ALT_LEFT_ON)
1272
+ flags | number | no | Flags for the particular key event. See [KeyEvent documentation](https://developer.android.com/reference/android/view/KeyEvent) for more details. | 0x00000001 (which is FLAG_WOKE_HERE)
1273
+ isLongPress | boolean | no | Whether to emulate long key press. `false` by default. | true
1274
+
1275
+ ### mobile: backgroundApp
1276
+
1277
+ Puts the app to the background and waits the given number of seconds. Then restores the app
1278
+ if necessary. The call is blocking. Available since driver version 2.19.0
1279
+
1280
+ #### Arguments
1281
+
1282
+ Name | Type | Required | Description | Example
1283
+ --- | --- | --- | --- | ---
1284
+ seconds | number | no | The amount of seconds to wait between putting the app to background and restoring it. Any negative value means to not restore the app after putting it to background (the default behavior). | 5
1285
+
1286
+ ### mobile: getCurrentActivity
1287
+
1288
+ Returns the name of the currently focused app activity. Available since driver version 2.20
1289
+
1290
+ #### Returned Result
1291
+
1292
+ The activity class name. Could be `null`
1293
+
1294
+ ### mobile: getCurrentPackage
1295
+
1296
+ Returns the name of the currently focused app package identifier. Available since driver version 2.20
1297
+
1298
+ #### Returned Result
1299
+
1300
+ The package class name. Could be `null`
1301
+
1302
+ ### mobile: getDisplayDensity
1303
+
1304
+ Returns the display density value measured in DPI. Available since driver version 2.21
1305
+
1306
+ #### Returned Result
1307
+
1308
+ The actual DPI value as integer number
1309
+
1310
+ ### mobile: getSystemBars
1311
+
1312
+ Returns properties of various system bars. Available since driver version 2.21
1313
+
1314
+ #### Returned Result
1315
+
1316
+ A dictionary whose entries are:
1317
+ - `statusBar`
1318
+ - `navigationBar`
1319
+
1320
+ Values are dictionaries with the following properties:
1321
+ - `visible`: Whether the bar is visible (equals to `false` if the bar is not present in the system info output)
1322
+ - `x`: Bar x coordinate (might be zero if the bar is not present in the system info output)
1323
+ - `y`: Bar y coordinate (might be zero if the bar is not present in the system info output)
1324
+ - `width`: Bar width (might be zero if the bar is not present in the system info output)
1325
+ - `height`: Bar height (might be zero if the bar is not present in the system info output)
1326
+
1327
+ ### mobile: fingerprint
1328
+
1329
+ Emulate [fingerprint](https://learn.microsoft.com/en-us/xamarin/android/platform/fingerprint-authentication/enrolling-fingerprint) on Android Emulator. Only works on API 23+. Available since driver version 2.22
1330
+
1331
+ #### Arguments
1332
+
1333
+ Name | Type | Required | Description | Example
1334
+ --- | --- | --- | --- | ---
1335
+ fingerprintId | number | yes | The value is the id for the finger that was "scanned". It is a unique integer that you assign for each virtual fingerprint. When the app is running you can run this same command each time the emulator prompts you for a fingerprint, you can run the adb command and pass it the fingerprintId to simulate the fingerprint scan. | 1
1336
+
1337
+ ### mobile: sendSms
1338
+
1339
+ Emulate sending an SMS to the given phone number. Only works on emulators. Available since driver version 2.22
1340
+
1341
+ #### Arguments
1342
+
1343
+ Name | Type | Required | Description | Example
1344
+ --- | --- | --- | --- | ---
1345
+ phoneNumber | string | yes | The phone number to send SMS to | 0123456789
1346
+ message | string | yes | The SMS message payload | Hello
1347
+
1348
+ ### mobile: gsmCall
1349
+
1350
+ Emulate a GSM call to the given phone number. Only works on emulators. Available since driver version 2.22
1351
+
1352
+ #### Arguments
1353
+
1354
+ Name | Type | Required | Description | Example
1355
+ --- | --- | --- | --- | ---
1356
+ phoneNumber | string | yes | The phone number to call to | 0123456789
1357
+ action | call or accept or cancel or hold | yes | One of possible actions to take | accept
1358
+
1359
+ ### mobile: gsmSignal
1360
+
1361
+ Emulate GSM signal strength change event. Only works on emulators. Available since driver version 2.22
1362
+
1363
+ #### Arguments
1364
+
1365
+ Name | Type | Required | Description | Example
1366
+ --- | --- | --- | --- | ---
1367
+ strength | 0 or 1 or 2 or 3 or 4 | yes | One of possible signal strength values, where 4 is the best signal. | 3
1368
+
1369
+ ### mobile: gsmVoice
1370
+
1371
+ Emulate GSM voice state change event. Only works on emulators. Available since driver version 2.22
1372
+
1373
+ #### Arguments
1374
+
1375
+ Name | Type | Required | Description | Example
1376
+ --- | --- | --- | --- | ---
1377
+ state | on or off or denied or searching or roaming or home or unregistered | yes | Voice state | off
1378
+
1379
+ ### mobile: powerAC
1380
+
1381
+ Emulate AC power state change. Only works on emulators. Available since driver version 2.22
1382
+
1383
+ #### Arguments
1384
+
1385
+ Name | Type | Required | Description | Example
1386
+ --- | --- | --- | --- | ---
1387
+ state | on or off | yes | AC Power state | off
1388
+
1389
+ ### mobile: powerCapacity
1390
+
1391
+ Emulate power capacity change. Only works on emulators. Available since driver version 2.22
1392
+
1393
+ #### Arguments
1394
+
1395
+ Name | Type | Required | Description | Example
1396
+ --- | --- | --- | --- | ---
1397
+ percent | 0 to 100 | yes | Percentage value in range [0, 100] | 50
1398
+
1399
+ ### mobile: networkSpeed
1400
+
1401
+ Emulate different network connection speed modes. Only works on emulators. Available since driver version 2.22
1402
+
1403
+ #### Arguments
1404
+
1405
+ Name | Type | Required | Description | Example
1406
+ --- | --- | --- | --- | ---
1407
+ speed | gsm or scsd or gprs or edge or umts or hsdpa or lte or evdo or full | yes | Mobile network speed mode name | edge
1408
+
1409
+ ### mobile: replaceElementValue
1410
+
1411
+ Sends a text to the given element by replacing its previous content. Available since driver version 2.22
1412
+
1413
+ #### Arguments
1414
+
1415
+ Name | Type | Required | Description | Example
1416
+ --- | --- | --- | --- | ---
1417
+ elementId | string | yes | Hexadecimal identifier of the destination text input | 123456-3456-3435-3453453
1418
+ text | string | yes | The text to enter. It could also contain Unicode characters. If the text ends with `\\n` (the backslash must be escaped, so the char is NOT translated into `0x0A`) then the Enter key press is going to be emulated after it is entered (the `\\n` substring itself will be cut off from the typed text). | yolo
1419
+
1420
+ ### mobile: toggleGps
1421
+
1422
+ Switches GPS setting state. This API only works reliably since Android 12 (API 31). Available since driver version 2.23
1423
+
1424
+ ### mobile: isGpsEnabled
1425
+
1426
+ Returns `true` if GPS is enabled on the device under test. Available since driver version 2.23
1427
+
1428
+ ### mobile: getPerformanceDataTypes
1429
+
1430
+ Fetches the list of supported performance data types that could be used as `dataType` argument value to [mobile: getPerformanceData](#mobile-getperformancedata) extension. Available since driver version 2.24
1431
+
1432
+ #### Returned Result
1433
+
1434
+ List of strings, where each item is data type name.
1435
+
1436
+ ### mobile: getClipboard
1437
+
1438
+ Retrieves the plaintext content of the device's clipboard. Available since driver version 3.7
1439
+
1440
+ #### Returned Result
1441
+
1442
+ Base64-encoded content of the clipboard or an empty string if the clipboard is empty.
1443
+
1444
+ ### mobile: setClipboard
1445
+
1446
+ Allows to set the plain text content of the device's clipboard. Available since driver version 3.7
1447
+
1448
+ #### Arguments
1449
+
1450
+ Name | Type | Required | Description | Example
1451
+ --- | --- | --- | --- | ---
1452
+ content | string | yes | Base64-encoded clipboard payload. | YXBwaXVt
1453
+ contentType | string | no | The only supported and the default value is `plaintext` | plaintext
1454
+ lable | string | no | Optinal label to identify the current clipboard payload. | yolo
1455
+
1456
+ ### mobile: getPerformanceData
1457
+
1458
+ Retrieves performance data about the given Android subsystem. The data is parsed from the output of the dumpsys utility. Available since driver version 2.24
1459
+
1460
+ #### Arguments
1461
+
1462
+ Name | Type | Required | Description | Example
1463
+ --- | --- | --- | --- | ---
1464
+ packageName | string | yes | The name of the package identifier to fetch the data for | com.myapp
1465
+ dataType | string | yes | One of supported subsystem names. The full list of supported values is returned by [mobile: getPerformanceDataTypes](#mobile-getperformancedatatypes) extension. | batteryinfo or cpuinfo or memoryinfo or networkinfo
1466
+
1467
+ #### Returned Result
1468
+
1469
+ The output depends on the selected subsystem. It is organized into a table, where the first row represents column names and the following rows represent the sampled data for each column.
1470
+ Example output for different data types:
1471
+
1472
+ - batteryinfo:
1473
+ ```
1474
+ [
1475
+ [power],
1476
+ [23]
1477
+ ]
1478
+ ```
1479
+ - memoryinfo:
1480
+ ```
1481
+ [
1482
+ [totalPrivateDirty, nativePrivateDirty, dalvikPrivateDirty, eglPrivateDirty, glPrivateDirty, totalPss, nativePss, dalvikPss, eglPss, glPss, nativeHeapAllocatedSize, nativeHeapSize],
1483
+ [18360, 8296, 6132, null, null, 42588, 8406, 7024, null, null, 26519, 10344]
1484
+ ]
1485
+ ```
1486
+ - networkinfo:
1487
+ ```
1488
+ // emulator
1489
+ [
1490
+ [bucketStart, activeTime, rxBytes, rxPackets, txBytes, txPackets, operations, bucketDuration],
1491
+ [1478091600000, null, 1099075, 610947, 928, 114362, 769, 0, 3600000],
1492
+ [1478095200000, null, 1306300, 405997, 509, 46359, 370, 0, 3600000]
1493
+ ]
1494
+ // real devices
1495
+ [
1496
+ [st, activeTime, rb, rp, tb, tp, op, bucketDuration],
1497
+ [1478088000, null, null, 32115296, 34291, 2956805, 25705, 0, 3600],
1498
+ [1478091600, null, null, 2714683, 11821, 1420564, 12650, 0, 3600],
1499
+ [1478095200, null, null, 10079213, 19962, 2487705, 20015, 0, 3600],
1500
+ [1478098800, null, null, 4444433, 10227, 1430356, 10493, 0, 3600]
1501
+ ]
1502
+ ```
1503
+ - cpuinfo:
1504
+ ```
1505
+ [
1506
+ [user, kernel],
1507
+ [0.9, 1.3]
1508
+ ]
1509
+ ```
1510
+
1511
+ ### mobile: statusBar
1512
+
1513
+ Performs commands on the system status bar. A thin wrapper over `adb shell cmd statusbar` CLI. Works on Android 8 (Oreo) and newer. Available since driver version 2.25
1514
+
1515
+ #### Arguments
1516
+
1517
+ Name | Type | Required | Description | Example
1518
+ --- | --- | --- | --- | ---
1519
+ command | string | yes | One of [supported status bar commands](#status-bar-commands). | expandNotifications
1520
+ component | string | no | The name of the tile component. It is only required for (add\|remove\|click)Tile commands. | com.package.name/.service.QuickSettingsTileComponent
1521
+
1522
+ #### Status Bar Commands
1523
+
1524
+ - expandNotifications: Open the notifications panel.
1525
+ - expandSettings: Open the notifications panel and expand quick settings if present.
1526
+ - collapse: Collapse the notifications and settings panel.
1527
+ - addTile: Add a TileService of the specified component.
1528
+ - removeTile: Remove a TileService of the specified component.
1529
+ - clickTile: Click on a TileService of the specified component.
1530
+ - getStatusIcons: Returns the list of status bar icons and the order they appear in. Each list item is separated with a new line character.
1531
+
1532
+ #### Returned Result
1533
+
1534
+ The actual downstream command output. It depends on the selected command and might be empty.
1535
+
1536
+ ### mobile: scheduleAction
1537
+ ### mobile: unscheduleAction
1538
+ ### mobile: getActionHistory
1539
+
1540
+ These extensions allow to deal with short-living UI elements. Read [the documentation on Scheduled Actions](docs/scheduled-actions.md) for more details and code examples.
1541
+
1542
+ ### mobile: screenshots
1543
+
1544
+ Retrieves a screenshot of each display available to Android.
1545
+ This functionality is only supported since Android 10.
1546
+
1547
+ #### Arguments
1548
+
1549
+ Name | Type | Required | Description | Example
1550
+ --- | --- | --- | --- | ---
1551
+ displayId | number or string | no | Display identifier to take a screenshot for. If not provided then all display screenshots are going to be returned. If no matches were found then an error is thrown. Actual display identifiers could be retrived from the `adb shell dumpsys SurfaceFlinger --display-id` command output. | 1
1552
+
1553
+ #### Returns
1554
+
1555
+ A dictionary where each key is the display identifier and the value has the following keys:
1556
+ - `id`: The same display identifier
1557
+ - `name`: Display name
1558
+ - `isDefault`: Whether this display is the default one
1559
+ - `payload`: The actual PNG screenshot data encoded to base64 string
1560
+
1561
+ ### mobile: setUiMode
1562
+
1563
+ Set the device UI appearance. A thin wrapper over `adb shell cmd uimode` CLI.
1564
+ Works on Android 10 and newer. Available since driver version 2.34
1565
+
1566
+ #### Arguments
1567
+
1568
+ Name | Type | Required | Description | Example
1569
+ --- | --- | --- | --- | ---
1570
+ mode | string | yes | One of the supported UI mode names: `night` or `car`. | night
1571
+ value | string | yes | The actual mode value to set. Supported values for different UI modes are: `night`: yes,no,auto,custom_schedule,custom_bedtime, `car`: yes,no. For example, to switch the device UI to the dark mode you should set `mode` to `night` and `value` to `yes`, or to `no` in order to switch back to the light mode. | yes
1572
+
1573
+ ### mobile: getUiMode
1574
+
1575
+ Gets the device UI appearance for the given mode. A thin wrapper over `adb shell cmd uimode` CLI. Works on Android 10 and newer. Available since driver version 2.34
1576
+
1577
+ #### Arguments
1578
+
1579
+ Name | Type | Required | Description | Example
1580
+ --- | --- | --- | --- | ---
1581
+ mode | string | yes | One of the supported UI mode names: `night` or `car`. | night
1582
+
1583
+ #### Returned Result
1584
+
1585
+ The actual mode value. Supported values for different UI modes are:
1586
+
1587
+ - `night`: yes,no,auto,custom_schedule,custom_bedtime
1588
+ - `car`: yes,no
1589
+
1590
+ ### mobile: sendTrimMemory
1591
+
1592
+ Simulates the [onTrimMemory()](https://developer.android.com/reference/android/content/ComponentCallbacks2#onTrimMemory(int)) event for the given package, which allows to verify the app functinality under different RAM-related circumstances.
1593
+ Read [Manage your app's memory](https://developer.android.com/topic/performance/memory) for more details.
1594
+ Available since driver version 2.41
1595
+
1596
+ #### Arguments
1597
+
1598
+ Name | Type | Required | Description | Example
1599
+ --- | --- | --- | --- | ---
1600
+ pkg | string | yes | The package name to send the `trimMemory` event to. | com.my.company
1601
+ level | 'COMPLETE' or 'MODERATE' or 'BACKGROUND' or 'UI_HIDDEN' or 'RUNNING_CRITICAL' or 'RUNNING_LOW' or 'RUNNING_MODERATE' | yes | The actual memory trim level to simulate | RUNNING_CRITICAL
1602
+
1603
+ ### mobile: injectEmulatorCameraImage
1604
+
1605
+ Simulates an image injection into the VirtualScene emulator camera background.
1606
+ Calls to this extension should seamlessly change the foreground picture
1607
+ in the VirtualScene emulator camera view to the supplied one.
1608
+ This extension could, for example, be useful if you need to verify QR codes scanning
1609
+ by the application under test.
1610
+ Available since driver version 3.2.0
1611
+
1612
+ #### Arguments
1613
+
1614
+ Name | Type | Required | Description | Example
1615
+ --- | --- | --- | --- | ---
1616
+ payload | string | yes | A valid base64-encoded .PNG image payload. Other image formats are not supported. This image will be shown on the virtual scene foreground as soon as you open a camera client app. | iVBORw0KGgoAAAANSUh...
1617
+
1618
+ #### Required Preconditions
1619
+
1620
+ This feature only works on Android emulators.
1621
+ It is mandatory to provide a value (it could also be an empty map to use defaults) to
1622
+ the [appium:injectedImageProperties capability](#emulator-android-virtual-device)
1623
+ in order to prepare the emulator for image injection if this extension is used
1624
+ on a newly created or resetted device.
1625
+
1626
+ There is also a possiblity to perform a manual configuration of the necessary preconditions
1627
+ if you don't want to restart the emulator on session startup. For that replace the content
1628
+ of the `Toren1BD.posters` file located in `$ANDROID_HOME/emulator/resources` folder with the
1629
+ following text:
1630
+
1631
+ ```
1632
+ poster wall
1633
+ size 2 2
1634
+ position -0.807 0.320 5.316
1635
+ rotation 0 -150 0
1636
+ default poster.png
1637
+
1638
+ poster table
1639
+ size 1 1
1640
+ position 0 0 -1.5
1641
+ rotation 0 0 0
1642
+ ```
1643
+
1644
+ Save the changed file and re(start) the emulator to pick up the changes.
1645
+ You may also customize values for different image properties under `poster table` in the above
1646
+ text snippet.
1647
+
1648
+ ### mobile: bluetooth
1649
+
1650
+ Allows to control the bluetooth adapter in the device under test.
1651
+ An error is thrown if the device has no default bluetooth adapter.
1652
+ Available since driver version 3.4.0
1653
+
1654
+ #### Arguments
1655
+
1656
+ Name | Type | Required | Description | Example
1657
+ --- | --- | --- | --- | ---
1658
+ action | string | yes | The action to execute on the bluetooth adapter. The following actions are supported: `enable`, `disable`, `unpairAll`. Calling the same action more than once is a noop. | disable
1659
+
1660
+ ### mobile: nfc
1661
+
1662
+ Allows to control the NFC adapter in the device under test.
1663
+ An error is thrown if the device has no default NFC adapter.
1664
+ Available since driver version 3.4.0
1665
+
1666
+ #### Arguments
1667
+
1668
+ Name | Type | Required | Description | Example
1669
+ --- | --- | --- | --- | ---
1670
+ action | string | yes | The action to execute on the NFC adapter. The following actions are supported: `enable`, `disable`. Calling the same action more than once is a noop. | disable
1671
+
1672
+ ## Applications Management
1673
+
1674
+ UiAutomator2 driver supports Appium endpoints for applications management:
1675
+ - Check if app is installed ([mobile: isAppInstalled](#mobile-isappinstalled))
1676
+ - Install/upgrade app ([mobile: installApp](#mobile-installapp))
1677
+ - Activate app ([mobile: activateApp](#mobile-activateapp))
1678
+ - Since UIAutomator2 driver v2.2.0, the server calls `am start`/`am start-activity` to start the application on devices with API level 24+. [monkey](https://developer.android.com/studio/test/other-testing-tools/monkey) tool is called on devices below API level 24.
1679
+ - UIAutomator2 driver v2.1.2 and lower versions call the `monkey` tool on all devices.
1680
+ - The `monkey` tool [turns on auto rotation](https://stackoverflow.com/questions/56684778/adb-shell-monkey-command-changing-device-orientation-lock), so please consider using [mobile: startActivity](#mobile-startactivity) if you would like to keep your current rotation preferences.
1681
+ - Uninstall app ([mobile: removeApp](#mobile-removeapp))
1682
+ - Terminate app ([mobile: terminateApp](#mobile-terminateapp))
1683
+ - Start app activity ([mobile: startActivity](#mobile-startactivity))
1684
+ - Query the current app state ([mobile: queryAppState](#mobile-queryappstate))
1685
+ - Background app ([mobile: backgroundApp](#mobile-backgroundapp))
1686
+
1687
+ Refer to the corresponding Appium client tutorial to find out the names of the corresponding wrappers for these APIs.
1688
+
1689
+ Useful links:
1690
+ - https://appiumpro.com/editions/9-testing-android-app-upgrades
1691
+ - https://github.com/appium/python-client/blob/master/appium/webdriver/extensions/applications.py
1692
+ - https://github.com/appium/java-client/blob/master/src/main/java/io/appium/java_client/InteractsWithApps.java
1693
+
1694
+
1695
+ ## Files Management
1696
+
1697
+ UiAutomator2 driver supports Appium endpoints for files management:
1698
+ - Push file ([mobile: pushFile](#mobile-pushfile))
1699
+ - Pull file ([mobile: pullFile](#mobile-pullfile))
1700
+ - Pull folder ([mobile: pullFolder](#mobile-pullfolder))
1701
+
1702
+ Refer to the corresponding Appium client tutorial to find out the names of the corresponding wrappers for these APIs.
1703
+
1704
+ Useful links:
1705
+ - https://github.com/appium/java-client/blob/master/src/main/java/io/appium/java_client/PushesFiles.java
1706
+ - https://github.com/appium/python-client/blob/master/appium/webdriver/extensions/remote_fs.py
1707
+
1708
+
1709
+ ## Clipboard Management
1710
+
1711
+ UiAutomator2 driver supports Appium endpoints for clipboard management:
1712
+ - Set clipboard content (`POST /appium/device/set_clipboard'`)
1713
+ - Get clipboard content (`POST /appium/device/get_clipboard`)
1714
+ - [mobile: getClipboard](#mobile-getclipboard)
1715
+ - [mobile: setClipboard](#mobile-setclipboard)
1716
+
1717
+ Useful links:
1718
+ - https://github.com/appium/python-client/blob/master/appium/webdriver/extensions/clipboard.py
1719
+ - https://github.com/appium/java-client/blob/master/src/main/java/io/appium/java_client/clipboard/HasClipboard.java
1720
+ - https://appiumpro.com/editions/16-automating-the-clipboard-on-ios-and-android
1721
+
1722
+
1723
+ ## Hybrid Mode
1724
+
1725
+ UIA2 driver supports automation of web pages opened in mobile Chrome or Chromium, and
1726
+ hybrid apps that use Chrome-based web views, by managing a
1727
+ [Chromedriver](https://sites.google.com/a/chromium.org/chromedriver/) instance and
1728
+ proxying commands to it when necessary.
1729
+
1730
+ The following endpoints are used to control the current context:
1731
+
1732
+ - POST `/session/:sessionId/context`: To set the current context. The body contains a single mandatory `name` parameter, which has the name of the context to be set. The name of the default context is `NATIVE_APP`.
1733
+ - GET `/session/:sessionId/context`: To retrieve the name of the current context
1734
+ - GET `/session/:sessionId/contexts`: To retrieve the list of available context names
1735
+ - [mobile: getContexts](#mobile-getcontexts)
1736
+
1737
+ By default, the driver starts in the native context, which means that most of REST API commands are being
1738
+ forwarded to the downstream [appium-uiautomator2-server](https://github.com/appium/appium-uiautomator2-server).
1739
+ This server is running on the device under test, and trasforms API commands to appropriate low-level UiAutomator framework calls. There is always only one native context, although multiple web contexts are possible.
1740
+ Each web context could contain zero or more pages/windows. It is possible to start UIA2 driver session in web context by default by setting the `browserName` capability value or by enabling the `appium:autoWebview` capability.
1741
+
1742
+ Web context(s) could be detected if a browser or a web view is active on the device. If a context is switched to
1743
+ a web one then UIA2 driver spins up a Chromedriver instance for it and forwards most of the commands
1744
+ to that Chromedriver instance. Note that web views must be properly configured and
1745
+ debuggable in order to connect to them or get their names in the list of available contexts.
1746
+ The availability of a particular web view could be easily verified by using
1747
+ [Chrome Remote Debugger](https://developer.chrome.com/docs/devtools/remote-debugging/).
1748
+ You could switch between different contexts (and windows in them) at any time during the session.
1749
+
1750
+ The [appium-chromedriver](https://github.com/appium/appium-chromedriver) package bundled with UIA2 always
1751
+ tries to download the most recent version of Chromedriver known to it. Google requires that the used Chromedriver version must always match to the version of the browser or a web view engine being automated. If these versions do not match then Chromedriver fails its creation, and context switch API shows a failure message
1752
+ similar to:
1753
+
1754
+ ```
1755
+ An unknown server-side error occurred while processing the command.
1756
+ Original error: unknown error: Chrome version must be >= 55.0.2883.0
1757
+ ```
1758
+
1759
+ To work around this issue it is necessary to provide UIA2 driver with a proper Chromedriver binary
1760
+ that matches to the Chrome engine version running on the device under test.
1761
+ Read the [Chromedriver/Chrome compatibility](#chromedriverchrome-compatibility) topic below to
1762
+ know more about finding a matching Chromedriver executable.
1763
+
1764
+ There are several ways to provide a customized Chromedriver to UIA2 driver:
1765
+
1766
+ #### When installing the driver
1767
+
1768
+ _Note_: This only works for driver versions below 3.8.0
1769
+
1770
+ Specify the Chromedriver version in the `CHROMEDRIVER_VERSION` environment variable:
1771
+
1772
+ ```bash
1773
+ CHROMEDRIVER_VERSION=2.20 appium install driver uiautomator2
1774
+ ```
1775
+
1776
+ #### When starting a session (manual discovery)
1777
+
1778
+ Chromedriver version can be specified in session capabilities, by providing the
1779
+ `appium:chromedriverExecutable` [capability](#web-context),
1780
+ containing the full path to a matching Chromedriver executable, which must be manually
1781
+ downloaded and put to the server file system.
1782
+
1783
+ #### When starting a session (automated discovery)
1784
+
1785
+ UIA2 driver could also try to detect the version of the target Chrome engine and
1786
+ download matching chromedriver for it automatically if it does not exist on the local file system.
1787
+ Read the [Automatic discovery of compatible Chromedriver](#automatic-discovery-of-compatible-chromedriver)
1788
+ topic below for more details.
1789
+
1790
+ ### Chromedriver/Chrome Compatibility
1791
+
1792
+ Since version *2.46* Google has changed their rules for Chromedriver versioning, so now the major Chromedriver version corresponds to the major web view/browser version, that it can automate. Follow the [Version Selection](https://chromedriver.chromium.org/downloads/version-selection) document in order to manually find the Chromedriver, that supports your current browser/web view if its major version is equal or above *73*.
1793
+
1794
+ To find the minimum supported browsers for older Chromedriver versions (below *73*), get the
1795
+ [Chromium](https://www.chromium.org/Home)
1796
+ [source code](https://chromium.googlesource.com/chromium/src/+/master/docs/get_the_code.md),
1797
+ check out the release commit, and check the variable `kMinimumSupportedChromeVersion`
1798
+ in the file `src/chrome/test/chromedriver/chrome/version.cc`. (To find the
1799
+ release commits, you could use `git log --pretty=format:'%h | %s%d' | grep -i "Release Chromedriver version"`.)
1800
+
1801
+ The complete list of available Chromedriver releases and release notes is located at [Chromedriver Storage](https://chromedriver.storage.googleapis.com/index.html).
1802
+
1803
+ The list of Chromedriver versions and their matching minimum
1804
+ Chrome versions known to appium-chromedriver package is stored at
1805
+ https://raw.githubusercontent.com/appium/appium-chromedriver/master/config/mapping.json
1806
+
1807
+ ### Automatic Discovery of Compatible Chromedriver
1808
+
1809
+ UIA2 driver is able to pick the correct Chromedriver for the
1810
+ version of Chrome/web view under test. While appium-chromedriver only comes bundled with the Chromedriver
1811
+ most recently released at the time of the corresponding package version's release, more Chromedriver
1812
+ versions could be downloaded and placed into a custom location indicated to UIA2 driver via the `appium:chromedriverExecutableDir` [capability](#web-context).
1813
+
1814
+ A custom mapping of Chromedrivers to the minimum
1815
+ Chrome/web view version they support could be given to UIA2 driver through the
1816
+ `appium:chromedriverChromeMappingFile` [capability](#web-context). This should be the
1817
+ absolute path to a file with the mapping
1818
+ in it. The contents of the file needs to be parsable as a JSON object, like:
1819
+
1820
+ ```json
1821
+ {
1822
+ "2.42": "63.0.3239",
1823
+ "2.41": "62.0.3202"
1824
+ }
1825
+ ```
1826
+
1827
+ There is a possibility to automatically download the necessary chromedriver(s) into `appium:chromedriverExecutableDir` from the official Google storage. The script will automatically search for the newest chromedriver version that supports the given browser/web view, download it (the hash sum is verified as well for the downloaded archive) and add to the `appium:chromedriverChromeMappingFile` mapping. Everything, which is needed to be done from your side is to execute the server with `chromedriver_autodownload` feature enabled (like `appium server --allow-insecure chromedriver_autodownload`).
1828
+
1829
+ ### Troubleshooting Chromedriver Download Issues
1830
+
1831
+ Check the [Custom binaries url](https://github.com/appium/appium-chromedriver?tab=readme-ov-file#custom-binaries-url)
1832
+ section of appium-chromedriver README for more details on how to customize the download CDN.
1833
+
1834
+ It may also be necessary to adjust network proxy and firewall settings for the above to work.
1835
+
1836
+ If you use a UIA2 driver below version 3.8.0, and you
1837
+ would like skip the automated download of Chromedriver upon driver install, do it by
1838
+ defining the `APPIUM_SKIP_CHROMEDRIVER_INSTALL` environment variable:
1839
+
1840
+ ```bash
1841
+ APPIUM_SKIP_CHROMEDRIVER_INSTALL=1 appium driver install uiautomator2
1842
+ ```
1843
+
1844
+ ### W3C Support in Web Context
1845
+
1846
+ Chromedriver did not follow the W3C standard until version 75. If you encounter proxy command error like [this issue](https://github.com/appium/python-client/issues/234), please update your Chromedriver version.
1847
+ Old Android devices can't use newer Chromedriver versions. You could avoid the error if you enforce
1848
+ Mobile JSON Wire Protocol for Chromedriver. This could be done by providing `{'w3c': False}` item
1849
+ to `appium:chromeOptions` capability value.
1850
+ Since major version *75* W3C mode is the default one for Chromedriver, although it could be still switched to JSONWP one as described above (keep in mind that eventually Chromedriver will drop the support of
1851
+ JSON Wire protocol completely).
1852
+ The history of W3C support in Chromedriver is available for reading at
1853
+ [downloads section](https://sites.google.com/a/chromium.org/chromedriver/downloads).
1854
+
1855
+
1856
+ ## Troubleshooting
1857
+
1858
+ ### Activity Startup
1859
+
1860
+ If you experience issues with application activities being not found or not starting then consider checking [How To Troubleshoot Activities Startup](docs/activity-startup.md) article.
1861
+
1862
+ ### Poor Elements Interaction Performance
1863
+
1864
+ If you observe automated tests need at least 10 seconds or more to locate/interact with a single element then consider changing the default value for [waitForIdleTimeout setting](#settings-api). By default, UiAutomator framework (and all other Accessibility-based frameworks) always waits for the accessibility event stream to become idle before interacting with it (the default timeout there is 10000ms). This is needed to make sure all animations/transitions are finished before you, for example, interact with an element by clicking it. In case the application under test constantly runs some background animations or hogs the accessibility event stream in some other way these waits may significantly slow down the automation flow.
1865
+
1866
+ Setting the value of `waitForIdleTimeout` to zero `0` ms should completely disable any waits, and enforce interactions to happen immediately ignoring the accessibility event stream state. The downside of that would be that all interactions are never going to be delayed, so clicks and other actions might happen at wrong places of the application UI. That is why is it important to check the app under test first and fix its source to get rid of activities hogging the event loop. Sometimes it makes sence to disable animations completely for the app build under test, which could speed up your flows significantly in some situations.
1867
+
1868
+ > [!Warning]
1869
+ > `waitForIdleTimeout` is a setting, not a capability.
1870
+
1871
+ ### Session Startup Issues
1872
+
1873
+ Sometimes various legacy driver parts might be cached on the device under test (like settings.apk), which would prevent a new/upgraded driver version from starting a session. Run
1874
+
1875
+ ```bash
1876
+ appium driver run uiautomator2 reset
1877
+ ```
1878
+
1879
+ in order to cleanup the cached UIA2 driver binaries from all connected devices on the current machine.
1880
+
1881
+ ### Socket Hangup Error
1882
+
1883
+ This type of error means the driver is unable to connect to the UiAutomator2 REST server, which is running on the device under test. There might be multiple causes to this issue:
1884
+ - The automation session gets unexpectedly deleted if your test code sends the `DELETE /session/<id>` request to it, also the corresponding session and the server itself are terminated as a result. Sending further commands to the same server would create the error above because it is not listening anymore and must be newly started by the instrumentation first. Such issues usually happen if the session management is not configured properly in your code, so one starts a new session while an existing one is still running and has not been quit properly, or there is a timeout while waiting for a new command. Fixing session management logic (e.g. make sure each session is being properly created in the test setup section and is terminated in the test teardown) or changing/disabling the commands' timeout (check the [newCommandTimeout capability](#other)) might help to address such type of errors.
1885
+ - The server has been unexpectedly killed by Android OS itself. There might be several reasons to that. Usually fetching the [logcat](https://developer.android.com/studio/command-line/logcat) output and finding occurrences of `io.appium.uiautomator2.server` traces with `error` or `exception` label might help to figure out what happens. Sometimes it is necessary to turn off some internal phone optimizations, sometimes the server crashes because of an internal UiAutomator framework bug, sometimes because of a bug in the server code itself. Each case should be investigated separately if the search over the internet shows no matches…
1886
+ - The connectivity between the phone and the host is unstable. Nothing much to add on this one. Maybe the phone has a defect, or the USB cable is damaged, or the installed Android SDK is out of date…
1887
+
1888
+ ### Element(s) Cannot be Found
1889
+
1890
+ All element location strategies in UIA2 driver work similarly under the hood except of the xpath one.
1891
+ If some element is not found, but you see/assume it is present in the page source then make sure no race condition
1892
+ happens. Add a timer and wait for a couple of seconds before giving up on the element location. In case the lookup
1893
+ still fails after the timeout and your non-xpath locator is used then, most likely, it contains a typo, or the
1894
+ destination element is not present. There is not much that could be done in UIA2 to change/influence that, since it passes such lookup calls directly to Google's UiAutomator framework.
1895
+
1896
+ In case of _xpath_ locators you could try to change values of the following settings:
1897
+
1898
+ 1. [allowInvisibleElements](#settings-api)
1899
+ 2. [ignoreUnimportantViews](#settings-api)
1900
+ 3. [enableMultiWindows](#settings-api)
1901
+ 4. [snapshotMaxDepth](#settings-api)
1902
+
1903
+ By default, the first setting is set to `false`, which hides
1904
+ elements that are not visible from the page source and from the xpath location. Changing the setting value
1905
+ to `true` would add such invisible elements to the page source and make them locatable.
1906
+
1907
+ The second one is enabled by default (e.g. `true`). By disabling it the page source could receive more elements
1908
+ that are normally hidden, because of their unimportance.
1909
+
1910
+ The third setting being set to `true` extends the page source by adding the actual content of other windows that are currently present on the device's screen. For example, the on-screen keyboard in Android is not a part of the current app hierarchy, but rather belongs to a separate window.
1911
+
1912
+ It only makes sense to change the default value of the `snapshotMaxDepth` setting if the application under test
1913
+ has deeply nested elements in the page tree hierarchy (e.g. more than 70 levels), and the destination element
1914
+ is suspected to be a part of these deeply nested views. Increasing the value of this
1915
+ setting will reduce the performance of xPath searches and page tree retrievals, so be careful while assigning too
1916
+ high values to it.
1917
+
1918
+ In case of _id_ locators you could try to change the value of the following setting:
1919
+
1920
+ 1. [disableIdLocatorAutocompletion](#settings-api)
1921
+
1922
+ The general resources naming convention for Android apps is `<app_id>:id/<resource_name>`. This should guarantee uniqueness of each identifier accross the user interface. Although, this is only a convention and it is still allowed to have various resource names that do not follow it. If you have gotten one of such applications for automated testing then consider assigning `disableIdLocatorAutocompletion` setting value to `true`, so UiAutomator2 driver does not automatically rewrite supplied id values by adding `<app_id>:id/` prefixes to them.
1923
+
1924
+ > [!Warning]
1925
+ > Default values for settings above have been selected to optimize xpath lookup and page source generation performance.
1926
+ > Having these settings always different from their default values may sometimes significantly (especially in case of huge accessbility hierarchies) reduce xpath lookup and page source generation speed.
1927
+
1928
+ > [!Warning]
1929
+ > All items above are settings, not capabilities.
1930
+
1931
+ ### ClassCastException: java.util.ArrayList$ListItr cannot be cast to org.eclipse.wst.xml.xpath2.processor
1932
+
1933
+ This exception happens due to a known bug in the [Eclipse's Psychopath](https://wiki.eclipse.org/PsychoPathXPathProcessor) library used by UiAutomator2 driver to support [XPath2](https://www.w3.org/TR/xpath20/) syntax. The issue has been observed while using `following::` or `preceding::` axes in xpath queries. Unfortunately, this library has not been maintained for quite a while, and there is no good open source alternative to it. The only known workaround would be to forcefully switch the driver's XPath processor to the standard Android's Apache Harmony-based XPath1, which does not have this issue (but also does not support XPath2 syntax). See the Appium issue [#16142](https://github.com/appium/appium/issues/16142#issuecomment-1003954166) for more details.
1934
+
1935
+ ### A gesture, like scroll or swipe, does not have any effect / It is unclear how to do it
1936
+
1937
+ The UiAutomator2 driver provides multiple options for touch gestures automation.
1938
+ For simple gestures, like swipe, scroll, drag, double click, fling or pinch use the corresponding
1939
+ [gesture shortcuts](#mobile-gesture-commands).
1940
+ You may also use [UiScrollable-based UiAutomator locators](./docs/uiautomator-uiselector.md)
1941
+ to automate various scrolling behaviours.
1942
+ For more sophisticated gestures
1943
+ consider using [W3C actions](https://w3c.github.io/webdriver/#actions).
1944
+
1945
+
1946
+ Make sure you don't use deprecated JWP touch actions APIs. They have been
1947
+ removed from the UIA2 driver since version 3.
1948
+
1949
+ If the action code in the client source looks good and satisfies the above requirements,
1950
+ but its execution still does not deliver the expected result then the following debugging
1951
+ meassures might be applied:
1952
+
1953
+ - Enable `Show taps` and `Pointer location` Developer options in the device Settings. After running
1954
+ your automation code with the above options enabled you would be able to see the exact pointer trace path
1955
+ and check the velocity of the gesture. It also works for multi-touch gestures. Compare the trace
1956
+ to how the same gesture is usually done manually and apply the necessary updates to your code.
1957
+ - Check the device [logcat](https://developer.android.com/studio/debug/logcat) output for possible
1958
+ error messages. Usually a single gesture consists of hundreds of atomic steps. If any of these steps
1959
+ receives incorrect/unsupported parameters then the whole gesture might fail. The log has details
1960
+ about each step being executed and arguments passed to it.
1961
+ - Make sure the gesture has valid coordinates and respects pauses between pointer state changes.
1962
+ For example, it is always mandatory to provide a valid element or valid `absolute` coordinates
1963
+ to any gesture at the beginning. Android only registers
1964
+ a long touch/click if the pointer has been depressed for longer than 500ms. For shorter actions
1965
+ a simple click is registered instead.
1966
+ - Do not mix webview and native elements in actions arguments. It simply won't work. Native
1967
+ actions could only consume native elements. A single possibility to perform a native action
1968
+ on a web element would be to traslate its coordinates into the native context and pass these
1969
+ coordinates as native action arguments.
1970
+
1971
+ Check the below tutorials for more details on how to build reliable action chains:
1972
+
1973
+ - [Automating Complex Gestures with the W3C Actions API](https://appiumpro.com/editions/29-automating-complex-gestures-with-the-w3c-actions-api)
1974
+ - [Swiping your way through Appium by Wim Selles #AppiumConf2021](https://www.youtube.com/watch?v=oAJ7jwMNFVU)
1975
+ - [Low-Level Insights on Android Input Events](./docs/actions.md)
1976
+
1977
+ ### window/tab hanlding in WEBVIEW context implemented by chrome custom tabs
1978
+
1979
+ [Chrome custom tabs](https://developer.chrome.com/docs/android/custom-tabs/) could have its own window handlings as same as regular Selenium Web automation.
1980
+
1981
+ Appium lets you switch the context from `NATIVE_APP` to `WEBVIEW_xyz`, for example, to interact with the WEBVIEW contents over chromedriver. Then, if the WEBVIEW was chrome custom tabs implementation, the WEBVIEW context may require you to switch the window handler properly to interact with contents in a handler.
1982
+ It is worth to try out this idea if `chrome://inspect` or [mobile: getContexts](#mobile-getcontexts) shows you available pages more than availale contexts.
1983
+
1984
+ ```ruby
1985
+ # Ruby
1986
+ # Change the context to WebView (Attach to a chromedriver session)
1987
+ driver.set_context('WEBVIEW_XYZ')
1988
+
1989
+ # Get available tabs/windows in the chrome instance
1990
+ driver.window_handles
1991
+
1992
+ # Change the tab/window in the "chrome" instance
1993
+ driver.switch_to.window('a window_handle name')
1994
+
1995
+ # interact with the tab/window
1996
+ ```
1997
+
1998
+ ## Usage Examples
1999
+
2000
+ ```python
2001
+ # Python3 + PyTest
2002
+ import pytest
2003
+
2004
+ from appium import webdriver
2005
+ # Options are available in Python client since v2.6.0
2006
+ from appium.options.android import UiAutomator2Options
2007
+
2008
+
2009
+ def generate_options():
2010
+ common_caps = {
2011
+ # A real device udid could be retrieved from `adb devices -l` output
2012
+ # If it is ommitted then the first available device will be used
2013
+ 'appium:udid': '123456',
2014
+ # ...or run the test on an emulator
2015
+ # 'appium:avd': 'emulator-5554',
2016
+ }
2017
+ app_options = UiAutomator2Options().load_capabilities(common_caps)
2018
+ app_options.app = '/Projects/myapp.apk'
2019
+ # It might also be necessary to provide more info about app activities
2020
+ # Read [How To Troubleshoot Activities Startup](docs/activity-startup.md)
2021
+ # for more details
2022
+ # app_options.appPackage = 'com.mypackage'
2023
+ # app_options.appActivity = '.myMainActivity'
2024
+ # app_options.appWaitActivity = '.mySplashScreenActivity'
2025
+ chrome_options = UiAutomator2Options().load_capabilities(common_caps)
2026
+ chrome_options.browser_name = 'chrome'
2027
+ # Read [Hybrid Mode](#hybrid-mode)
2028
+ chrome_options.chromedriver_executable = '/Project/chromedriver_linux64'
2029
+ return [app_options, chrome_options]
2030
+
2031
+
2032
+ @pytest.fixture(params=generate_options())
2033
+ def driver(request):
2034
+ # The default URL is http://127.0.0.1:4723/wd/hub in Appium1
2035
+ drv = webdriver.Remote('http://localhost:4723', options=request.param)
2036
+ yield drv
2037
+ drv.quit()
2038
+
2039
+
2040
+ def test_edit_text(driver):
2041
+ locator = 'android.view.TextEdit' if driver.current_context == 'NATIVE_APP' else 'input'
2042
+ edit_field = driver.find_element_by_class_name(locator)
2043
+ edit_field.send_keys('hello world')
2044
+ assert edit_field.text == 'hello world'
2045
+ edit_field.clear()
2046
+ assert edit_field.text == ''
2047
+
2048
+ ```
2049
+
2050
+
2051
+ ## API Notes
2052
+
2053
+ `lock` behaves differently in Android than it does in iOS. In Android it does not take any arguments, and locks the screen and returns immediately.
2054
+
2055
+
2056
+ ## Development
2057
+
2058
+ ```
2059
+ npm install appium-uiautomator2-driver
2060
+ npm run dev
2061
+ ```
2062
+
2063
+ Unit tests:
2064
+
2065
+ ```
2066
+ npm run test
2067
+ ```
2068
+
2069
+ Functional tests:
2070
+
2071
+ ```
2072
+ npm run e2e-test:commands
2073
+ npm run e2e-test:commands:find
2074
+ npm run e2e-test:commands:general
2075
+ npm run e2e-test:commands:keyboard
2076
+ npm run e2e-test:driver
2077
+ ```