我如何可以滚动使用硒的webdriver Python中的网页? [英] How can I scroll a web page using selenium webdriver in python?

查看:351
本文介绍了我如何可以滚动使用硒的webdriver Python中的网页?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前使用的硒的webdriver通过Facebook用户的朋友页面解析和提取的AJAX脚本所有ID。但是,我需要向下滚动让所有的朋友。我怎样才能在硒向下滚动。我使用的蟒蛇。

I am currently using selenium webdriver to parse through facebook user friends page and extract all ids from the AJAX script. But I need to scroll down to get all the friends. How can I scroll down in Selenium. I am using python.

推荐答案

driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")

滚动到页面的底部。

to scroll to the bottom of the page.

这篇关于我如何可以滚动使用硒的webdriver Python中的网页?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆