【发布时间】:2022-01-19 16:21:32
【问题描述】:
我正在尝试抓取网站中的所有数据,如图所示。 为此,我需要继续向下滚动无限滚动。但我无法访问内卷轴。我使用以下代码进行无限滚动
last_height = driver.execute_script("return document.body.scrollHeight")
while True:
driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
time.sleep(3)
new_height = driver.execute_script("return document.body.scrollHeight")
if new_height == last_height:
break
last_height = new_height
它不起作用。它向下滚动主外部滚动而不是内部滚动,如下所示。请帮我向下滚动内部滚动
【问题讨论】:
标签: python python-3.x selenium web-scraping infinite-scroll