Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

I'm not a QA person, just a front end developer. I'm using the Selenium IDE plugin for the Firefox browser to make some simple tests.

The site I'm making the tests for uses ajax to bring in new content via infinite scroll. So each time the user scrolls to the bottom of the page new content is loaded. How can I get Selenium IDE to scroll to the bottom of the page? What would the command look like for that?

I tried:


35 is the key value for the "end" key on the keyboard. When a human presses that on this site it brings the user to the bottom of the page and triggers the infinite scroll. But when selenium does it, the test passes but the screen doesn't indicate that key has been pressed. The page doesn't go to the bottom and the ajax isn't triggered.

Anyway ideas how to achieve this?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

Selenium automatically calls the javascript scrollIntoView function on any element you try to interact with. If you know an element exists at the bottom of the page then doing anything with that element (including getting an attribute or hovering over it, etc) will cause the page to scroll.

Alternatively, you are probably on the right track with trying to scroll down with either End or Page Down key, however I'm most familiar with Selenium2/Webdriver so I can't speak to the correctness of your approach above.

share|improve this answer
Thanks @SamWoods. focus(locator) will do the trick with a locator known to be at the bottom of the page. –  AlessMascherpa Dec 4 '13 at 11:49

I am not sure whether you could do that in IDE. But I do have a solution if you want to do that in WebDriver. There are two approaches to do so and you might like the one where you can execute some javascript . The first option is to use Keys class to simulate any keypress event in WebDriver. Regarding the other one, you can execute javascript (scrollTo) by casting the WebDriver instance to JavascriptExecutor.

    import org.openqa.selenium.By;
    import org.openqa.selenium.JavascriptExecutor;
    import org.openqa.selenium.Keys;
    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.firefox.FirefoxDriver;

public class ScrollPage {
    public static void main(String[] args) {
    WebDriver driver = new FirefoxDriver();
        //  driver.findElement(By.id("shell")).sendKeys(Keys.END);

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.