ghost
ghost

Reputation: 29

Python, Selenium | Can't Click Test Here

enter image description here

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

Answers (2)

Arundeep Chohan
Arundeep Chohan

Reputation: 9969

Click the button and not the span.

Add /parent::button would fix your xpath.

Upvotes: 1

Red
Red

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

Related Questions