Scrolling to top of the page in Python using Selenium

You can simply use CTRL + HOME keys. It will scroll to the top of the page.

from selenium.webdriver.common.keys import Keys
driver.find_element_by_tag_name('body').send_keys(Keys.CONTROL + Keys.HOME)

Leave a Comment