I have this HTML code:

<button> class="btn btn-lg btn-primary btn-block"
input type="hidden" name="next" value="/"/

Using below locator I'm not able to click on that button.


Can someone please help me out !

1 Answer 1


A <button></button> HTML tag is not the same as a link <a></a>. So it cannot find it with the find_element_by_link_text() method, because it looks for link HTML tags.

If you want to find elements by text try the following:

driver.find_elements_by_xpath("//*[contains(text(), 'Autentificare')]")
  • now im stuck at this: driver.find_elements_by_xpath("//*[contains(text(), 'Autentificare')]").sendKeys(Keys.ENTER) . i cant manage to send the enter key in order to send the login info
    – Alex Alex
    Mar 22, 2019 at 11:57
  • this is the error driver.find_elements_by_xpath("//*[contains(text(), 'Autentificare')]").sendKeys(Keys.ENTER) AttributeError: 'list' object has no attribute 'sendKeys'
    – Alex Alex
    Mar 22, 2019 at 12:02
  • @AlexAlex You cannot send text to a button, you need to send text to an input. This sounds as another question, because your original question is about clicking. If the clicking works, accept the answer and ask a new question for the new issues :) Mar 22, 2019 at 12:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.