[ selenium ] 'WebDriver' object has no attribute 'find_element_by_class_name'


[ selenium ] 'WebDriver' object has no attribute 'find_element_by_class_name'

문제 상황 네이버 로그인 자동화 과정에서 아래와 같은 코드를 썼다. # 2. 로그인 버튼 클릭 elem = browser.find_element_by_class_name("link_login") elem.click() 그랬더니 아래와 같은 오류가 떴다. AttributeError: 'WebDriver' object has no attribute 'find_element_by_class_name' 에러 이유 셀레니움 상위 버전(4)에서 나타나는 에러. 더는 쓰이지 않는 함수를 써서 발생함. 해결 방안 먼저 import를 해준다 from selenium.webdriver.common.by import By find_element_by...() 함수를 사용하지 말고 다음 예제처럼 사용해야 한다. elem = driver.find_element(By.CLASS_NAME, "link_login") 이전 버전 driver.findElementByClassName("className");...


#selenium #셀레니움 #에러 #에러해결 #웹스크래핑 #파이썬

원문링크 : [ selenium ] 'WebDriver' object has no attribute 'find_element_by_class_name'