How do I find an element that contains specific text in Selenium WebDriver (Python)?

Try the following:

driver.find_elements_by_xpath("//*[contains(text(), 'My Button')]")

Leave a Comment