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

Python Selenium, Error with find_element_by() command

I don’t know the reason for this error, for some reason the find_element_by_() commands are not being recognized, I’ve already tried to reinstall everything, I changed the Python version, nothing works, does anyone know how to solve this problem?

Error: Unresolved attribute reference 'find_element_by_name' for class 'WebDriver

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

>Solution :

find_element_by_* methods are now deprecated.
find_element(By. are used now.
So, instead of find_element_by_name it is a driver.find_element(By.NAME, "name_attribute") now.
Similarly driver.find_element(By.XPATH, "element_xpath_locator") etc.
To use these methods you will need the following import:

from selenium.webdriver.common.by import By
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