Skip to content
Advertisement

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()

Advertisement

Answer

Click the button and not the span.

Add /parent::button would fix your xpath.

Advertisement