tsivarajan tsivarajan - 10 months ago 46
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?


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");