Python Selenium页面滚动并单击下一步按钮 [英] Python Selenium Page scrolling and clicking next button
本文介绍了Python Selenium页面滚动并单击下一步按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有人可以使用python代码从页面顶部到底部滚动,然后单击按钮在浏览器中加载更多页面吗?
Does anyone have any python code that would allow me to scroll from top to the bottom of a page and then click on a button to load more pages in the browser?
推荐答案
要滚动到页面底部,您可以使用:
To scroll to the bottom of the page you can use:
driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
要单击按钮,您可以使用:
To click on a button you can use:
driver.find_element_by_css_selector('.button.c_button.s_button').click()
这篇关于Python Selenium页面滚动并单击下一步按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文