Xpath how to get the first element?

Hello,

I’am trying to get the first element of my objects
I want to use something like : Mobile.tap(findTestObject(‘Plus1’), 1,FailureHandling.OPTIONAL )

In Object Spy I can find my “+” buttons (3 buttons) with resource_id attributes. I want to click the first one.

//[resource-id='fr.myobject:id/case_more] => returns my 3 elements
I try :
//
[resource-id='fr.myobject:id/case_more][1] => returns my 3 elements also.

How can I do to get the first one ?

Thank you

I need the first one :

Hi,
Try with

(//*[resource-id='fr.myobject:id/case_more])[1] 

Thanks a lot Helene, you saved my day !

This works :
(//*[@resource-id=‘fr.myobject:id/case_more’])[1]