[Solved] Selenium - Python - AttributeError: 'WebDriver' object has no attribute 'find_element_by_name'

Problem:
I am trying to get Selenium working with Chrome, but I keep running into this error message:
AttributeError: 'WebDriver' object has no attribute 'find_element_by_name'
The same problem occurs with find_element_by_id()
, find_element_by_class()
, etc..
I also could not call send_keys()
.
Solution:
As per their Official Document of Selenium 4.3.0 they have removed find_element_by_* and find_elements_by_* . You Can Also Read these Documents Here.
Selenium 4.3.0
* Deprecated find_element_by_* and find_elements_by_* are now removed(#10712)
* Deprecated Opera support has been removed (#10630)
Now you can use find_element() instead. And You can Use find_element instead of find_element_by_name. Like that-
driver.find_element("name", "q")
NOTE: If you want to find several elements you have to add an s
, so instead of find_elements_by_*
it is now find_elements()
Thank you for reading the article. If you face any further problem feel free to ask us.