Skip to content
Advertisement

Finding the ‘Sign in’ button on a webpage using Selenium

I’m new to Selenium and I’m trying to automate a login task on this webpage using Chrome. I’ve been successful in finding and sending keys to the email and password fields. However I’m unable to click the ‘Sign in’ button.

The inspect element yields the following,

<button class="btn btn-lg btn-primary btn-block mt15" type="submit">Sign in</button>

I’ve tried using

driver.find_element_by_name("Sign in").click()

which yielded in an error since there’s no name field. I’ve found that this can be done using xpaths or css selectors.

Please Advise

Advertisement

Answer

driver.find_element_by_class_name("btn").click()

You can try this too.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement