Home » Java » Selenium webdriver – End of the page(using vertical scroll)

Selenium webdriver – End of the page(using vertical scroll)

Posted by: admin September 21, 2018 Leave a comment

Questions:

How can I check if I reached the end of the page (using vertical scroll)?

From the Webdriver – press the page down key till end of the page. Using for loop I have done this :

for(int di=0; di<40; di++) { 
   driver.findElement(By.tagName("body")).sendKeys(Keys.PAGE_DOWN);
   Thread.sleep(1500);
}

My for loop always executed 40 times even its less size. So I need help how I can check if it reached the end of the page, because if I reached then I will break and come out of the loop.

Answers: