Skip to content
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

python AttributeError: 'WebDriver' object has no attribute 'find_element_by_css_selector' 해결방법

 

 

 

 

line 26, in <module> play_button = driver.find_element_by_css_selector('button.ytp-large-play-button.ytp-button') AttributeError: 'WebDriver' object has no attribute 'find_element_by_css_selector'

 

라인의 오류해결 방법.

 


이 오류는 driver 객체가 find_element_by_css_selector 메소드를 갖고 있지 않아 발생한 것입니다.

 

이전 코드에서는 webdriver.Chrome() 객체를 생성했지만, 해당 객체에는 find_element_by_css_selector와 같은 WebDriver API가 포함되어 있지 않습니다.

 

해당 메소드를 사용하려면 webdriver.Chrome()으로 생성된 driver 객체의 find_element 메소드를 사용하면 됩니다. 즉, driver.find_element_by_css_selector 대신 driver.find_element(By.CSS_SELECTOR, ...) 형태로 사용해야 합니다.

 

따라서, line 26을 다음과 같이 수정해주시면 됩니다.

 

 
python
from selenium.webdriver.common.by import By
.
.
.
play_button = driver.find_element(By.CSS_SELECTOR, 'button.ytp-large-play-button.ytp-button')
 
로그인 후 댓글쓰기가 가능합니다.

?

  1. 테블릿을 세컨트모니터로???

  2. python AttributeError: 'WebDriver' object has no attribute 'find_element_by_css_selector' 해결방법

  3. No Image 10May
    by
    2023/05/10 Views 55132 

    파이썬 셀레니움에서의 오류(raise TimeoutException(message, screen, stacktrace) selenium.common.exceptions.TimeoutException: Message:)

  4. H734GP 공유기 시스템로그 중 >>> Send Offer / Receive Discover /

  5. 한우경매낙찰 유튜브 영상의 이미지에서 특정 문자 가져와서 저장하기

  6. 파이썬에서 인식이 잘되는 OCR 종류

  7. CANON PRINTER ERROR CODE B203, B204 해결방법

  8. 2023-09-23 서버다운 후 복구완료

  9. 파이썬 request, beautifulshop으로 정액정보 받아오기

  10. 파이썬 랜덤으로 시험문제 풀기

Board Pagination Prev 1 ... 231 232 233 234 235 Next
/ 235

http://urin79.com

우린친구블로그

sketchbook5, 스케치북5

sketchbook5, 스케치북5

나눔글꼴 설치 안내


이 PC에는 나눔글꼴이 설치되어 있지 않습니다.

이 사이트를 나눔글꼴로 보기 위해서는
나눔글꼴을 설치해야 합니다.

설치 취소