MARK MARK - 1 year ago 114
Android Question

Find element in appium

How do I find an element in a linear layout which have a specific index, as obtain in the image I have this element android.widget.EditText, which has index 3. When I try to find it using the search parameter:


and I tried this as well

driver.FindElementByXPath("//*[@class='android.widget.EditText' and @index='3']").SendKeys("123");

I get this exception
{"An element could not be located on the page using the given search parameters."}

How can i select this element?

Answer Source

Since index is involved , i would suggest u to put the element identifier in a list and and get index and click. Try the below code

List<WebElement> list= driver.findElements(By.XPath("identifier"));
System.out.println("size of List= " + list.size());
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download