I have a problem with the two same XPath with dynamic ID on the same page. I have tested for selenium in java, when I need to confirm button on delete upload file. Instead of this, test first submits the first button in order on delete whole record.
Both buttons are connected with a modal window so I need to locate the second button instead of the first button on the page. XPath looks like this:
//*[@id="button-with-dialog-modal-confirm-action-button-0XP"]/span
(//*[@id="button-with-dialog-modal-confirm-action-button-0XP"]/span)[1]