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. 04
    Jun 2023
    08:11

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

    Category컴퓨터잡담 Views51486
    Read More
  2. 10
    May 2023
    06:06

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

    Views54664
    Read More
  3. 07
    May 2023
    04:17

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

    Category파이썬 Views47494
    Read More
  4. 26
    Apr 2023
    01:11

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

    Category컴퓨터잡담 Views38044
    Read More
  5. 21
    Apr 2023
    20:10

    DiffusionWrapper has 859.52 M params.

    Category파이썬 Views37376
    Read More
  6. 16
    Apr 2023
    08:28

    티피씨글로벌 차트가 너무좋네.

    Category주식 Views38468
    Read More
  7. 13
    Apr 2023
    22:24

    한창산업 - 아연분말,인산아연,제올라이트,바나듐 생산업체

    Category주식 Views38468
    Read More
  8. 13
    Apr 2023
    22:17

    최강 한동훈주

    Category주식 Views36753
    Read More
  9. 26
    Mar 2023
    08:12

    구글 스프레드시트에서 셀값이 특정일에서 현재일과 3일 이내의 범위에 들어오면 이메일을 발송하는 방법

    Category[Docs]스프레드시트 Views40473
    Read More
  10. 25
    Mar 2023
    12:40

    파이썬으로 captCha 분석하여 웹사이트 소스 가져오기

    Category파이썬 Views19020
    Read More
Board Pagination Prev 1 2 3 4 5 ... 235 Next
/ 235

http://urin79.com

우린친구블로그

sketchbook5, 스케치북5

sketchbook5, 스케치북5

나눔글꼴 설치 안내


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

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

설치 취소