Please guide me how to locate element attributes if xPath and ID for multiple elements are same | Appium Forum
T
Timir Dilipkumar Trivedi Posted on 21/04/2020

Team,

I am stuck on one technical challenge. 

I want to automate one "add quantity" text box but on screen there are multiple "add quantity" text box with same xpath , ID and class name

I am stuck how to pass/enter value in to first  "Add Quantity" text box if attributes are same for multiple elements.

Also, attached screenshot for your reference.


S
Shalini Replied on 30/07/2020

You can take all element in a list and try to click by index number

 

List<MobileElement> li = driver.findElementsBy(xpath("<xapth> id"));

li.get(Index).click();