Cucumber Capybara scroll to bottom of page

Eric M. picture Eric M. · Dec 13, 2010 · Viewed 25.2k times · Source

I'd like to use my Cucumber/Capybara setup to test endless scroll by driving a browser and scrolling to the bottom of the page to ensure that the new content is loaded. Is there a way to do this?

Answer

Nat Ritmeyer picture Nat Ritmeyer · Jun 15, 2012

You could use javascript to achieve this:

page.execute_script "window.scrollBy(0,10000)"