tsivarajan tsivarajan - 1 year ago 81
Java Question

How to calculate the page scroll length in web application?

I'm doing the below code for scroll down in selenium webdriver.

WebDriver driver = new FirefoxDriver();
JavascriptExecutor jse = (JavascriptExecutor)driver;
jse.executeScript("window.scrollBy(0,250)", "");

In the above code, what is the
? how to calculate the
from the web page?

Answer Source

It's not really clear what you want to calculate. What is 250? lol, it could be anything, page size, window size, webelement Y location

Page Height

js.ExecuteScript("return document.body.scrollHeight");

Window Height

js.ExecuteScript("return window.innerHeight");
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download