from selenium import webdriver
#滚动到浏览器顶部
js_top = "var q=document.documentElement.scrollTop=0"
#滚动到浏览器底部
js_bottom = "var q=document.documentElement.scrollTop=10000"
js_bottom2 = "window.scrollTo(0,document.body.scrollHeight)"
#页面放大
js_zoom_in = "document.body.style.zoom='1.7'"
#页面缩小
js_zoom_out = "document.body.style.zoom='0.5'
driver = webdriver.Chrome()
driver.get(url)
driver.execute_script(js_bottom)
driver.execute_script(js_top)
driver.execute_script(js_zoom_in)
driver.execute_script(js_zoom_out)
driver.close()
|