scroll up in selenium python code example
Example 1: python selenium scroll all down
from selenium import webdriver
import time
browser = webdriver.Firefox()
browser.get("https://en.wikipedia.org")
browser.execute_script("window.scrollTo(0,document.body.scrollHeight)")
time.sleep(3)
browser.close()
Example 2: how to scroll by in selenium python
for i in range(20):
driver.execute_script("window.scrollBy(0, 250)")
time.sleep(1)
Example 3: scroll to element python selenium
from selenium.webdriver.common.action_chains import ActionChains
element = driver.find_element_by_id("my-id")
actions = ActionChains(driver)
actions.move_to_element(element).perform()