Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Using selenium WebDriver to perform a click in python

I have a button defined on a webpage as:

<div class="form-group mt-3 mb-1 d-grid">
    <button type="submit" class="btn btn-lg btn-primary">
            Login
    </button>
</div>

In Python, I have coded up like so…

browser = webdriver.Safari(options=Options)
browser.get(url)
browser.find_element("xpath","//*[contains(text(), 'Login')]").click()

I get the exception below…

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementNotInteractableException: Message: 

How do I automate the click on the login button?

>Solution :

from selenium.webdriver.common.keys import Keys

browser = webdriver.Safari(options=Options)
browser.get(url)
login_btn = browser.find_element("xpath","//*[contains(text(), 'Login')]")

login_btn.send_keys(Keys.ENTER)
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading