Android | How to find a specific element, when several elements have the same id?

I have an element with an ID, but - That ID is not unique. More elements have the same ID.
I would like to tap on the first 3 out of the whole, How do I do that?

I have a previous practice with: driver.findElementByXPath(“(//Class_Name) [i]”);,
That way I can choose an ‘i’ element when several exist with the same className.

I tried manipulating this syntax with a ‘recourse-id’, but with no success.
Please advice?

When you have an ID on your element, you can search like this, using “findElements()”:

driver.findElements(By.id(“your_id”)).get(index);

1 Like

Thanks @MrZigaS.
I’ll leave here my implementation using POM in case someone will need it.

Element:
@AndroidFindBy(id = “spinner_edittext”)
public List dropDownList;

test case:
myProfile.dropDownList.get(1).click();