Scrolling to top of the page in Python using Selenium

后端 未结 6 1410
悲哀的现实
悲哀的现实 2020-11-27 07:30

I\'m having issues with scrolling to the top of the web page when using Python and Selenium.

When the page loads for some reason you are taken to the bottom of the

6条回答
  •  渐次进展
    2020-11-27 08:01

    from selenium import webdriver
    from selenium.webdriver.common.by import By
    
    driver = webdriver.Chrome()
    driver.get("__")
    
    #to scroll try use the following command
    driver.execute_script("scrollBy(0,250);")
    

    It will work !!

提交回复
热议问题