Python 在selenium中滚动网页时,如何转到网站的下一页并继续滚动等等?
我想从网站上提取应用程序的所有评论,但自动滚动器会在显示页面按钮处停止,需要单击并滚动下一页,以此类推,直到结束。我需要添加什么才能再次单击和滚动 我用硒来做这件事Python 在selenium中滚动网页时,如何转到网站的下一页并继续滚动等等?,python,python-3.x,selenium,selenium-webdriver,selenium-chromedriver,Python,Python 3.x,Selenium,Selenium Webdriver,Selenium Chromedriver,我想从网站上提取应用程序的所有评论,但自动滚动器会在显示页面按钮处停止,需要单击并滚动下一页,以此类推,直到结束。我需要添加什么才能再次单击和滚动 我用硒来做这件事 from selenium import webdriver from bs4 import BeautifulSoup import time import datetime browser = webdriver.Chrome() url="https://www.g2.com/products/sap-concur/revi
from selenium import webdriver
from bs4 import BeautifulSoup
import time
import datetime
browser = webdriver.Chrome()
url="https://www.g2.com/products/sap-concur/reviews?focus_review=2070722&product_id=sap-concur"
browser.maximize_window()
browser.get(url)
html = browser.page_source.encode('utf-8').strip()
soup=BeautifulSoup(html,'html.parser')
reviews = soup.find_all('div', {"class":"x-review slat slat--review"})
for tag in reviews:
print(str(tag))
browser.execute_script("window.scrollTo(0, document.body.scrollHeight);")
browser.find_element_by_xpath('//*[@id="pjax-container"]/div[2]/div[2]/div[6]/ul/li[2]/a').click()
reviews2 = soup.find_all('div', {"class":"x-review slat slat--review"})
for tag in reviews2:
print(str(tag))
您正在尝试哪个应用程序?您可以共享url吗?您正在尝试哪个应用程序?您可以共享url吗?