I am currently developing an webdriver automation tool to perform a task in which I have to interact with a huge amount of elements. To do so, I am using Python 3.6.3, Selenium and Pandas.
One of these elements occurs to be a button that appears multiple times in the same screen. The problem is, only one of those buttons is the one I have to click on and there is no difference between them, except for its xpath (which changes everytime the page is refreshed).
The only way to know which one is the correct is by identifying the text contente of its simbling elements, which describes what the button in supposed to do. I managed to reach this element using:
element=driver.find_elements_by_xpath("//*[contains(text(),'"+textvariable+"')]")
But now I am stuck! How can I tell Selenium to click the button knowing only the text contente of its sibling?