Hi,
first of all I’m very new to appium and to Java as well. I want to test some basic Android features so I can’t rewrite any app because I’m really testing Android OS.
e.g. I want appium to get to Settings - Cloud and Accounts and then click on Accounts. So far so goo. I know that the App package is com.android.settings and the app activity is com.android.settings.Settings$CloudAccountSettingsActivity.
When I start the Inspection with Appium Desktop App I can click on Accounts and get the xpath (ID is not available) and the test is working perfectly whith this xpath BUT
sometimes the Android menu is changing based on some features of the device.
So now xpath is
/hierarchy/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout[2]/android.support.v4.widget.DrawerLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.support.v7.widget.RecyclerView/android.widget.LinearLayout[2]/android.widget.RelativeLayout/android.widget.TextView
but in case Samsung Cloud is missing the xpath is changing to
/hierarchy/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout[2]/android.support.v4.widget.DrawerLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.support.v7.widget.RecyclerView/android.widget.LinearLayout[1]/android.widget.RelativeLayout/android.widget.TextView
That means Android is using arrays for their menus which makes it (currently) impossible for me to automate some tests.
I tried to change the array to [@text=‘Accounts’] but this isn’t working.
I also tried to not use xpath but the resource-id as By.id("…"); but it’s obviously not working.
Any other ideas? I currently can’t see the wood for the trees