How can I get the following information from this website, checking gif there are more reviews in next pages? I would like to use selenium and web driver
<span class="a-profile-name">NAME</span><i data-hook="review-star-rating" class="a-icon a-icon-star a-star-2 review-rating"><span class="a-icon-alt">2.0 out of 5 stars</span></I>-
Fell apart after a few months
<span data-hook="review-date" class="a-size-base a-color-secondary review-date">Reviewed in the United States on January 23, 2019</span>
the review body:
The sole came completely unglued after about 4 months of wearing them in an office environment. I can't imagine a legitimate pair of Converse sneakers would have such shoddy quality. I'm not an expert but I think they're fake.
Either way these shoes are not worth the money.
I prefer to use selenium as I can move to the next pages easily and store data collected.
For each of these fields I should have separate lists which collect: author, dates, stars, review's title and review's body.
An example could be the following:
having 2226 rating reviews.
Do you think is something doable with selenium?
Code (the code contains missing information and probably the part of search is also wrong):
from bs4 import BeautifulSoup
import time
from selenium import webdriver
import re
def spider():
driver = webdriver.Chrome('path/chromedriver'))
driver.get('https://www.amazon.com/Converse-Chuck-Taylor-Star-Core/dp/B07KLM7JRL/ref=sr_1_1?dchild=1&keywords=converse&qid=1596469913&sr=8-1&th=1') #in th I should add page number info
time.sleep(1)
search = driver.find_element_by_name('q')
time.sleep(2)
search.submit()
author = []
dates = []
score = []
review_min = []
review = []
while True:
soup = BeautifulSoup(driver.page_source,'lxml')
result_div = soup.find_all('div', attrs={'class': 'g'})
time.sleep(2)
for r in result_div:
# here there should be the part to get info about author, dates, scores, ...
time.sleep(1)
# part where I append results scraped
next_page_btn =driver.find_elements_by_xpath("//a[@id='pnnext']")
if len(next_page_btn) <1:
print("no more pages left")
break
element =WebDriverWait(driver,100).until(expected_conditions.element_to_be_clickable((By.ID,'pnnext')))
driver.execute_script("return arguments[0].scrollIntoView();", element)
element.click()
time.sleep(2)
driver.quit()