Error content
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'WebDriver' object has no attribute 'find_element_by_class_name'
The cause of find_element_by_class_name not working was Selenium - Python - AttributeError: 'WebDriver' object has no attribute 'find_element_by_name'. And regarding this, a link with specific related content: Selenium just removed that method in version 4.3.0. See the CHANGES
GitHub - SeleniumHQ/selenium: A browser automation framework and ecosystem.
A browser automation framework and ecosystem. Contribute to SeleniumHQ/selenium development by creating an account on GitHub.
github.com
To summarize,
Previous code
from selenium import webdriver
driver = webdriver.Chrome("C:/Users/everp/Documents/env_p3/chromedriver.exe")
driver.get("https://www.naver.com")
elem=driver.find_element_by_class_name("link_login")
elem.click()
Fix code
# python terminal에서 바로 실행
from selenium import webdriver
from selenium.webdriver.common.by import By
driver = webdriver.Chrome("C:/Users/everp/Documents/env_p3/chromedriver.exe")
driver.get("https://www.naver.com")
elem=driver.find_element(By.CLASS_NAME,"link_login")
elem.click()
Code that keeps changing and improving. Complacency is the end. That's why the world of living-coding is so attractive and fair! hahaha
The most important official documentation
https://www.selenium.dev/selenium/docs/api/py/index.html
Selenium Client Driver — Selenium 4.8 documentation
www.selenium.dev
