Selendroid-mode tests incompatible when switching to Appium-mode?

I’m running my test in Selendroid-mode for older Android versions, but want to switch to Appium-mode for Android 4.4+. The test uses XPath locators, which work fine in Selendroid-mode, but fail when I switch. The locators come from the Selendroid Inspector.

Are these simply incompatible? And if so, is there any way to use locators that work in both Selendroid and Appium modes?

@Triqqo
I am using Xpath locators in my webview tests and they are the same between Appium and Selendroid, so I am gonna assume you are using Native context here.

There is some differences in locating elements between Appium and Selendroid. I personally prefer to locate elements by ID as they are rarely changed by the developers and using them makes my tests more robust.

Can you tell us what version of Appium are you using and also in what version did you write your tests as both Appium and Selendroid have both been significantly changed.

1 Like

i think basic locator strategies would remain same (class name,id,css selector for mobile apps) for webcontexts. but i think in native context, resource id suffiece with class name in appium mode.
like id in appium: (com.test.app/btnsend) while in selendroid mode u need to use (btnsend) to make it work.

However please let us know where do u face issues?

Thanks,
Priyank Shah

I was using Appium 1.2.2 and the bundled version of Selendroid (I think it’s 0.11). After a bit of Googling, I found out that XPath locators are different in Appium in that they require the full path. Instead of, for example, “//Textview[@value=text]”, it needs “//Linear[1]/Listview[1]/Textview[2]”, etc… I figured the best way to solve this in the short term, is by getting the developers to use proper IDs.

1 Like