2

please I'm quite a selenium newbie and I would need help with the following.

I have this simple HTML code:

<button class="_5s5nM yZn2p  ">Log in</button> == $0

I need to find this element using the words "Log in". I tried this code but I get an error message:

test_submit2 = driver.find_element_by_link_text("Log in")

any idea of why it doesn't work? Many thanks

1
  • does't loook like you've incuded any error message... – Mark Mayo Mar 30 at 23:46
2

Try this below code, this may work in your case:

//button[contains(text(), 'Log in')];

In your code the syntax seems to be incorrect, linkText will also work.

driver.findElement(By.linkText("Log in")):

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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