Selenium webdriver (Python) page operation: scroll and zoom

from selenium import webdriver
# Scroll to the top of the browser
js_top = "var q=document.documentElement.scrollTop=0"
# Scroll to the bottom of the browser
js_bottom = "var q=document.documentElement.scrollTop=10000"
js_bottom2 = "window.scrollTo(0,document.body.scrollHeight)"
# Enlarge the page
js_zoom_in = "document.body.style.zoom='1.7'"
# Page reduction
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()

Read more here: Source link