If you are trying to figure out how long it takes to fully load the page using Selenium WebDriver (aka Selenium 2).
Usually WebDriver should return control to your code only after the page has fully loaded.
So the following Selenium Java code can help you find the page load time -
long start = System.currentTimeMillis(); driver.get("Some url"); long finish = System.currentTimeMillis(); long totalTime = finish - start; System.out.println("Total Time for page load - "+totalTime);
If this does not work, you have to wait until any element appears on the page -
long start = System.currentTimeMillis(); driver.get("Some url"); WebElement ele = driver.findElement(By.id("ID of some element on the page which will load")); long finish = System.currentTimeMillis(); long totalTime = finish - start; System.out.println("Total Time for page load - "+totalTime);
source share