selenium操作浏览器滚动条
纵向滚动条上下滑动
代码:
execute_script("window.scrollTo(document.body.scrollHeight, height)")
# height: 距页面顶部的位置高度
滚动条滑动到顶部,设height = 0即可:execute_script("window.scrollTo(document.body.scrollHeight, 0)")
PS:如果想要滑动到页面底部,一种方式可以设置height值足够大,超过页面整体高度;
不过我们基本采用另
原创
2020-10-20 15:28:52 ·
1107 阅读 ·
0 评论