Click on object with index

I would like to click on a object with an index.

So the situation is there are several object with the same ID on the page and I would like to click on the third one. I tried to add an index but that didn’t work.

Example: WebUI.click(findTestObject(‘Album detail screen/buttonListen’)[3])

does any one know how to use an index in Katalon?

you need to define parametric xpath
eg //button[${ButtonPosition}]

and then call WebUI.click(findTestObject(‘Album detail screen/buttonListen’, [(‘ButtonPosition’): IdexForButton]))

where IndexForButton = 3 or whatever

The item would need to accept a parameter. Then you pass that when you click the object.
//div[@id=‘ItemID’]/div/div[${ItemIndex}]/a
WebUI.click(findTestObject(‘Object Path/ItemName’,[(‘ItemIndex’) : 3]))

thanks guys