How to get access to android's "custom view" using UiAutomator2?

Hello!
Im trying to automate android native app by using Appium and UiAutomator2 but can’t get access to any content in custom view for interaction (click, sendKeys, e.t.c).
Android developers added id’s for appropriate views and content, but nothing changed.
Custom Views are successfully inspected in Android Studio, but not visible in Appium (see screenshot). I tried call driver.getPageSource method and also custom views are absent.

I found the same problem, discussed here: https://github.com/appium/appium/issues/9404 and tried to add capability ignoreUnimportantViews = false - it wasn’t helpful for me.

Appium version is 1.13.0
I use next Capabilities:

Capabilities {allowTestPackages: true, appActivity: com.ref.login_screen, appPackage: com.pdr, autoGrantPermissions: true, automationName: UIAutomator2, deviceName: RedmiNote, ignoreUnimportantViews: false, newCommandTimeout: 300, noSign: true, platformName: Android, platformVersion: 5.0, systemPort: 8201, udid: 4e463e1f0502, uiautomator2ServerLaunchTimeout: 50000}

Please check https://developer.android.com/guide/topics/ui/accessibility/custom-views.html and talk to the dev’s about making it more accessible.

2 Likes