Reputation: 29
Hello, I am trying to click the button 'Test Here' using selenium in Python via chrome. I have no clue what it is not working. My code is shared below...
driver.find_element_by_xpath("//*[contains(text(), 'Test Here')]").click()
Upvotes: 0
Views: 52
Reputation: 9969
Click the button and not the span.
Add /parent::button would fix your xpath.
Upvotes: 1
Reputation: 27557
You can try the find_element_by_link_text
method, like this:
driver.find_element_by_link_text("Test Here").click()
Upvotes: 0