You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you experince issues with application activities being not found or not starting then consider checking [How To Troubleshoot Activities Startup](docs/activity-startup.md) article.
1181
+
1182
+
### Poor Elements Interaction Performance
1183
+
1184
+
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 Accessiblity-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 significatly slow down the automation flow.
1185
+
1186
+
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.
1187
+
1188
+
> **Warning**
1189
+
> `waitForIdleTimeout` is a setting, not a capability.
1190
+
1191
+
### Session Startup Issues
1192
+
1193
+
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
1194
+
1195
+
```bash
1196
+
appium driver run uiautomator2 reset
1197
+
```
1198
+
1199
+
in order to cleanup the cached UIA2 driver binaries from all connected devices on the current machine.
1200
+
1201
+
### Element(s) Cannot be Found
1202
+
1203
+
All element location strategies in UIA2 driver work similarly under the hood except of the xpath one.
1204
+
If some element is not found, but you see/assume it is present in the page source then make sure no race condition
1205
+
happens. Add a timer and wait for a couple of seconds before giving up on the element location. In case the lookup
1206
+
still fails after the timeout and your non-xpath locator is used then, most likely, it contains a typo, or the
1207
+
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.
1208
+
1209
+
In case of xpath locators you could also try to change values of the following settings:
1210
+
1211
+
1.[allowInvisibleElements](#settings-api)
1212
+
2.[ignoreUnimportantViews](#settings-api)
1213
+
3.[enableMultiWindows](#settings-api)
1214
+
1215
+
By default, the first setting is set to `false`, which hides
1216
+
elements that are not visible from the the page source and from the xpath location. Changing the setting value
1217
+
to `true` would add such invisible elements to the page source and make them locatable.
1218
+
1219
+
The second one is enabled by default (e.g. `true`). By disabling it the page source could receive more elements
1220
+
that are normally hidden, because of their unimportance.
1221
+
1222
+
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.
1223
+
1224
+
> **Warning**
1225
+
> Default values for settings above have been selected to optimize xpath lookup and page source generation performance.
1226
+
> 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.
0 commit comments