There are different ways to find element on a page (name, id, xpath, content-description, class name).
For devices with API > 18, id works well but if it is API < 18 you need to add content-description to your element. Finding element by name also looks good but not in my case.
I have never used xPath before and for now it looks like the best option.
I am writing an automation app that uses Appium and allows testers testing the application on multiple Android devices at the same time. Therefore I want to have a method that will work best with everything rather than writing different test classes/methods for each version.
I also asked this question at SO but didn't get any answer yet, any help would be appreciated.
Thanks
// setup
capa.setCapability("automationName", "Selendroid");
capa.setCapability("platformName", "Android");
// find one element WebElement elem = = driver.findElement(By.id("resourceID"));
// amount of elements with the same ID
int amount = driver.findElements(By.id("resourceID")).size();