Hi. If I have an modal screen with a menu (please check the screenshots), how can I find an item from the menu to tap on it? If I try driver.elementsByXPath("//android.widget.TextView") the last element is “Contul meu”
I don’t know how’s your app’s DOM but the sentence must look like something like that: ((WebDriver)driver).findElement(By.xpath("//android.widget.TextView[@text='Logout']")).click();
Notice that I’m using findElement instead findElements.
@Aleksei is right, just check the page source and build an xpath to uniquely locate the target node. If you cannot find your text you may take advantage from the front-design of your app:
May exists more attributes that allow you to identify that node.
May build a more complex xpath expression to associate the target node to another identifiable node.
May identify a parent node that is wrapping the target textview and can tap on it with the same practical effects…
Any of the previous scenarios.
Appium is just a tool. The location strategy is on the programmer’s hand.