Trying to Automatize Testing of an Android app. However, the elements don't have any IDs attached to them, only xpaths. These xpaths are dynamic and can change depending on the screen size and the elements location on the screen.
I have tried to use contains() function, but in some cases there is no common nominator. This also doesn't seem to be the most reliable way.
Example:
/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.view.ViewGroup/android.support.v4.widget.DrawerLayout/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup[2]/android.view.ViewGroup/android.widget.ScrollView/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup[2]/android.view.ViewGroup/android.view.ViewGroup[4]
changes to
/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.view.ViewGroup/android.support.v4.widget.DrawerLayout/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup[2]/android.view.ViewGroup/android.widget.ScrollView/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup[2]
when scrolling down on the screen.
What would be the best and most reliable solution? The same test script should run on multiple devices with varying screen sizes.
Is it even recommended to use xpaths in Appium or should I go to the developers and ask for unique IDs for each element?