Solved — Selenium — Python — AttributeError: ‘WebDriver’ object has no attribute ‘find_element_by_name’

Get Selenium working with Chrome — Deprecated find_element_by_* and find_elements_by_* are now removed

Flutter Developer

--

Selenium removed find_element_by_ in version 4.3.0. See the CHANGES: https://github.com/SeleniumHQ/selenium/blob/a4995e2c096239b42c373f26498a6c9bb4f2b3e7/py/CHANGES

Selenium 4.3.0
* Deprecated find_element_by_* and find_elements_by_* are now removed (#10712)
* Deprecated Opera support has been removed (#10630)
* Fully upgraded from python 2x to 3.7 syntax and features (#10647)
* Added a devtools version fallback mechanism to look for an older version when mismatch occurs (#10749)
* Better support for co-operative multi inheritance by utilising super() throughout
* Improved type hints throughout

You now need to use:

driver.find_element("name", "q")

In your example, it would become:

search_box = driver.find_element("name", "q")search_box.send_keys('ChromeDriver')search_box.submit()

For improved reliability, you should consider using WebDriverWait in combination with element_to_be_clickable.

--

--

No responses yet