How to handle Element changes in Android Lollipop 5.0.1 version?

Hi All,
I am automating the Android/iOS app using appium. In Android my app is working fine still kitkat 4.4.4 version, When i was trying to execute scripts in lollipop, all test got failed.

I have investigated the issues, it is elements page object changed from kitKat to Lollipop.
example
KitKat- //android.webkit.WebView[1]/android.view.View[1]/android.view.View[1]
Lollipop-//android.webkit.WebView[1]/android.webkit.WebView[1]/android.view.View[1]

Because of this issues, all script getting fail , UiAutomator view also changed.

Please any one suggest me to handle this kind of issues in all version of android (4.3 to latest) version.

1 Like

Even i am facing same issue, any idea
to handle it?

This is one of the reasons why use of xpath is not recommended (full xpath at least). You could use the following xpath

//android.webkit.WebView[1]//android.view.View[1]

where all elements between the two elements are ignored, but it will find every android.view.View elements under the Webview, regardless of their “hierarchy”.
Is there no other way to locate your elements ? Like a resource-id, or a text, or even a parent element that has one ?