     [Answers](https://scrapfly.io/blog)   /  [selenium](https://scrapfly.io/blog/tag/selenium)   /  [How to scroll to the bottom of the page with Selenium?](https://scrapfly.io/blog/answers/how-to-scroll-to-the-bottom-with-selenium)   # How to scroll to the bottom of the page with Selenium?

 by [Bernardas Alisauskas](https://scrapfly.io/blog/author/bernardas) Apr 18, 2026 2 min read [\#selenium](https://scrapfly.io/blog/tag/selenium) 

 [  ](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-scroll-to-the-bottom-with-selenium "Share on LinkedIn")    

 

 

Web scraping modern websites faces numerous challenges, one of them being infinite scroll pages. A common solution for such cases is using Selenium scroll to bottom of the page.

To scroll down a web page with Selenium scripts, we can use the popular `window.scrollTo(x, y)` JavaScript method. This simple scroll operation navigates to Selenium driver to the specified coordinates.

Since infinite scroll pages require executing multiple vertical scroll operations. In other words, to scroll till end means that there are **no more changes recorded in the window height**. Let's have a look at an example by scraping [web-scraping.dev/testimonials](https://web-scraping.dev/testimonials):

python```python
from selenium  webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time

# initiate a new Chrome webdriver
driver = webdriver.Chrome()

# navigate to the target web page
driver.get("https://web-scraping.dev/testimonials/")

prev_height = -1 
max_scrolls = 100
scroll_count = 0

while scroll_count < max_scrolls:
    driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
    time.sleep(1)  # give some time for new results to load
    new_height = driver.execute_script("return document.body.scrollHeight")
    if new_height == prev_height:
        break
    prev_height = new_height
    scroll_count += 1

# Collect all loaded data
elements = WebDriverWait(driver, 10).until(EC.presence_of_all_elements_located((By.CLASS_NAME, "testimonial")))

results = []
for element in elements:
    text = element.find_element(By.CLASS_NAME, "text").get_attribute('innerHTML')
    results.append(text)

print(f"scraped: {len(results)} results!")

driver.quit()
```



In the above code snippet, we infinite scroll the page in Selenium webdriver using two parameters: previous and current height. It starts by executing the `window.scrollTo` method to scroll till the page end, record the new height, and compare the previous and current ones till the maximum height is reached.

For further details into using Selenium for web scraping refer to our dedicated guide.

[Web Scraping with Selenium and PythonIntroduction to web scraping dynamic javascript powered websites and web apps using Selenium browser automation library and Python.](https://scrapfly.io/blog/posts/web-scraping-with-selenium-and-python)



 

    



Scale Your Web Scraping

Anti-bot bypass, browser rendering, and rotating proxies, all in one API. Start with 1,000 free credits.

  No credit card required  1,000 free API credits  Anti-bot bypass included 

 [Start Free](https://scrapfly.io/register) [View Docs](https://scrapfly.io/docs/onboarding) 

 Not ready? Get our newsletter instead. 

 

## Explore this Article with AI

 [ ChatGPT ](https://chat.openai.com/?q=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-scroll-to-the-bottom-with-selenium) [ Gemini ](https://www.google.com/search?udm=50&aep=11&q=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-scroll-to-the-bottom-with-selenium) [ Grok ](https://x.com/i/grok?text=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-scroll-to-the-bottom-with-selenium) [ Perplexity ](https://www.perplexity.ai/search/new?q=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-scroll-to-the-bottom-with-selenium) [ Claude ](https://claude.ai/new?q=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-scroll-to-the-bottom-with-selenium) 



 ## Related Articles

 [  

 python headless-browser 

### Web Scraping with Selenium and Python

Introduction to web scraping dynamic javascript powered websites and web apps using Selenium browser automation library ...

 

 ](https://scrapfly.io/blog/posts/web-scraping-with-selenium-and-python) [  

 python selenium 

### Intro to Web Scraping Using Selenium Grid

In this guide, you will learn about installing and configuring Selenium Grid with Docker and how to use it for web scrap...

 

 ](https://scrapfly.io/blog/posts/intro-to-web-scraping-using-selenium-grid) [  

 python headless-browser 

### How To Take Screenshots In Python?

Learn how to take Python screenshots through Selenium and Playwright, including common browser tips and tricks for custo...

 

 ](https://scrapfly.io/blog/posts/how-to-take-screenshots-in-python) 

  ## Related Questions

- [ Q How to scroll to the bottom of the page with Puppeteer? ](https://scrapfly.io/blog/answers/how-to-scroll-to-the-bottom-with-puppeteer)
- [ Q How to scroll to the bottom of the page with Playwright? ](https://scrapfly.io/blog/answers/how-to-scroll-to-the-bottom-with-playwright)
- [ Q How to scroll to an element in Selenium? ](https://scrapfly.io/blog/answers/scroll-to-element-selenium)
- [ Q How to get page source in Selenium? ](https://scrapfly.io/blog/answers/how-to-get-page-source-in-selenium)
 
  



   



 Run headless browsers at scale, **1,000 free credits** [Start Free](https://scrapfly.io/register)