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

How to find which element to use with Selenium Python?

I’m trying to log in to this website but it’s created with js, I think it is React which I have no experience.

This is an image of inspected code of the website that I try to log in.

enter image description here

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

I tried this…

email_field = browser.find_element_by_name('input_login_3kzbI')
email_field = browser.find_element_by_id('login-modal-email')

and then it should go this, but it fails on the line above…

email_field.send_keys("pepero.guy@gmail.com")

>Solution :

find_element_by_name checks against name attribute, and find_element_by_id checks against id attribute. There is no such attributes for the input element, so it failed.

Try this: browser.find_element_by_xpath('//input[@qa-id="login-modal-email"]')

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