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


try this below code. this will work

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

in your code the syntax seems to be incorrect

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

this will also work.

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.