Click on one of several buttons

I have to test buttons on a page. The number of buttons depends on the data.
All buttons have the same name and open the same page with different data.

When I use the recorder, it creates the item "Click ".

But when I run the test, I have the error “Unable to click on object”

How to trigger the click on a particular button (the 2nd for example)?

Thank you very much for your help

You could index the buttons on the page so it knows which one to select. So for example -

<input type="submit" id="button" value="Edit"/>
<input type="submit" id="button" value="Edit"/>
<input type="submit" id="button" value="Edit"/>
By.xpath("(//input[@type='submit'])[0]")  ---> To Click 1st Button
By.xpath("(//input[@type='submit'])[1]")  ---> To Click 2nd Button
By.xpath("(//input[@type='submit'])[2]")  ---> To Click 3rd Button


Can you share the screenshot and HTML source code, there are some techniques to get the XPATH that based on the data table.

//td[contains(text(),'Francisco Chang')]//following-sibling::td//button

The screenshoot :

I would like to click on the 2nd button “Sélectionner ce dossier” (line “QA TELESERVICE FILS 10/10/2000”)

Here is the code of the html page
code.html (8.5 KB)

lbo_atti76 you can try with “preceding” to get the element on the right side. Example:

In your case:


Thank you sang
To test your answer, I recreated the test this morning, using the same data and doing the same actions.
And today, it works. I do not understand.
All the better. But I’m sorry for making you waste time.
Thank you so much.