Back to feed
Renewal·마흔의 생활코딩

[selenium] find_element_by_class_name not working

NS
normalstory
cover image

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

 

This English version was translated by Claude.

친절한 찰쓰씨
Written by
친절한 찰쓰씨

Pleasant Charles — UI/UX researcher at AIT. Keeping notes on design, planning, and slow days here since 2010.

More on the author's page

Keep reading

Renewal

Steadily, for the long haul, without burning out

Mar 31, 2026·9 min
Renewal

Tech-life balance

Feb 7, 2026·3 min
Renewal

Humanality, by Park Jeong-ryeol

Feb 7, 2026·11 min