Search code examples
appiumandroid-uiautomator

What is the difference between UIAutomator and UIAutomator2. Why should I switch to UIAutomator2?


I am currently using UIAutomator2, but I am not sure what other capabilities it gives on top of UIAutomator. I am using Appium with UIAutomator2 and face no challenges, but want to leverage some new features introduced in UIAutomator2, if any.


Solution

  • UiAutomator2 is a custom implementation of Google UiAutomator by Appium community, that mostly fixes existing issues in original UiAutomator and stabilise/speedup interactions with UI elements: from my own measurement tests running Android 6/UiAutomator 2 are in average 20-30% faster then the same ones on Android 5.1/UiAutomator

    Starting with Android 6 Appium supports UiAutomator2 only, so basically there is no choice to go with old flaky UiAutomator and community do not support it, so if smth doesn't work with UiAutomator -> its up to you to solve it.

    There not to much custom features actually, but you may try and use some of capabilities and for sure read release notes of appium as they usually display whats new in recent UiAutomator2 release, e.g. Speed up screenshot logic in UiAutomator2