Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Outline

See also


Wait:

Resize:

Scroll:

  • How can I scroll a web page using selenium webdriver in python?

    driver.execute_script("window.scrollTo(0, Y)")

    ---

    while driver.find_element_by_tag_name('div'): driver.execute_script("window.scrollTo(0, document.body.scrollHeight);") divs = driver.find_element_by_tag_name('div').text if 'End of Results' in Divs: print 'end' break

    ---

    element = find_element_by_xpath("xpath of the li you are trying to access")

    element.location_once_scrolled_into_view

    ---

    SCROLL_PAUSE_TIME = 0.5

    Get scroll height

    last_height = driver.execute_script("return document.body.scrollHeight")

    while True: # Scroll down to bottom driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")

      # Wait to load page
      time.sleep(SCROLL_PAUSE_TIME)
    
      # Calculate new scroll height and compare with last scroll height
      new_height = driver.execute_script("return document.body.scrollHeight")
      if new_height == last_height:
          break
          
      last_height = new_height    
    

    ---

    page.driver.browser.mouse.move_to( find("element").native,100,100)

    ---

    Actions actions = new Actions(driver); actions.sendKeys(Keys.BACK_SPACE).perform();

    ---

    WebDriver driver = new FirefoxDriver(); JavascriptExecutor js = (JavascriptExecutor)driver; js.executeScript("window.scrollTo(0,Math.max(document.documentElement.scrollHeight," + "document.body.scrollHeight,document.documentElement.clientHeight));");

Morty Proxy This is a proxified and sanitized view of the page, visit original site.