mardi 24 septembre 2019

Different xpaths are showing for different Android OS Versions

I am working on the native Android application. I need to automate the process and for that I am using Appium to get the element information such as xpaths and id etc. My objective is to automate the process on every android devices across all the android versions but I am facing an issue. I am using two Android Versions, one is 6.0.1 and other is 9.0, my problem is when I connect Android 6.0.1 its show me the xpath for the element for e.g

xpath = "//android.widget.EditText[@text='username']"

And for the same field, on Android Version 9.0 its shows:

/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.RelativeLayout/android.widget.LinearLayout/android.webkit.WebView/android.webkit.WebView/android.view.View[5]/android.view.View[2]/android.view.View/android.view.View/android.view.View[2]/android.widget.EditText

Which is hard to use.

Why is there so much difference in xpaths on both Android Versions. Also I have found some unsual behavior in Appium, as the 'hint' in the input field is available in Android 6.0.1, but for the same field 'hint' is not available on android 9.0.

Aucun commentaire:

Enregistrer un commentaire