inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

살려주세요 'WebDriver' object has no attribute 'find_elements_by_xpath' 에러가 나요

136

윤 하

작성한 질문수 1

0

from bs4 import BeautifulSoup

import openpyxl

import time

from selenium import webdriver

 

url = "https://www.amazon.com/Wireless-Keyboard-Rechargeable-Cimetech-Cordless/product-reviews/B07VCPLMQR/ref=cm_cr_dp_d_show_all_btm?ie=UTF8&reviewerType=all_reviews"

 

browser = webdriver.Chrome(executable_path=r'D:\dev_python\Webdriver\chromedriver.exe')

browser.get(url)

 

time.sleep(1)

 

soup = BeautifulSoup(browser.page_source, 'html.parser')

 

wb = openpyxl.Workbook()

ws = wb.active

 

ws.title = "review data"

ws.append(['name', 'review'])

 

ws.column_dimensions['A'].width = 12

ws.column_dimensions['B'].width = 60

 

for page in range(0, 100): 

     

    review_name = soup.select('#customer_review-RHQYUQ8OC53OJ > div:nth-child(1) > a > div.a-profile-content > span')

    product_review = soup.select('#customer_review-RHQYUQ8OC53OJ > div.a-row.a-spacing-small.review-data > span > span')

        

    for name, review in zip(review_name, product_review):

        ws.append([name.text, review.text])

        

    button = browser.find_elements_by_xpath('//*[@id="cm_cr-pagination_bar"]/ul/li[2]/a')

    button.click()

    

    time.sleep(3)

    

wb.save("crawling review data.xlsx")

 

 

 

이런 코드를 짰는데 자꾸 'WebDriver' object has no attribute 'find_elements_by_xpath' 에러가 떠요 살려주세요 제발 제발 제발 제발 제발.........

답변 0

상금은 언제 받을 수 있나요?

4

75

0

4강 카드뉴스 자동화 자료

4

63

1

Issuance 테이블에 status, couponId 인덱스가 꼭 필요할까요?

2

59

1

리프레시 토큰

1

37

1