@Test // Description = Checking the Web Page load time using Selenium
WebDriver
public void LoadTime()
{
long startTime = System.currentTimeMillis()/1000;
System.out.println("The startTime is "+startTime);
//Set the acceptable Page load time to 60 sec
driver.manage().timeouts().pageLoadTimeout(60, TimeUnit.SECONDS);
driver.get("http://seleniumsubbu.blogspot.in/");
WebElement search = driver.findElement(By.id("edit-search-block-form--2"));
//Iterate through the loop as long as time(60sec) is with in the acceptable Page load time
while(((System.currentTimeMillis()/1000)-startTime)<60)
{
if(search.isDisplayed())
{
long endTime = System.currentTimeMillis()/1000;
System.out.println("The endTime is "+endTime);
long loadTime = endTime - startTime;
System.out.println("Totaltime: " +loadTime + " seconds");
break;
}
}
}
public void LoadTime()
{
long startTime = System.currentTimeMillis()/1000;
System.out.println("The startTime is "+startTime);
//Set the acceptable Page load time to 60 sec
driver.manage().timeouts().pageLoadTimeout(60, TimeUnit.SECONDS);
driver.get("http://seleniumsubbu.blogspot.in/");
WebElement search = driver.findElement(By.id("edit-search-block-form--2"));
//Iterate through the loop as long as time(60sec) is with in the acceptable Page load time
while(((System.currentTimeMillis()/1000)-startTime)<60)
{
if(search.isDisplayed())
{
long endTime = System.currentTimeMillis()/1000;
System.out.println("The endTime is "+endTime);
long loadTime = endTime - startTime;
System.out.println("Totaltime: " +loadTime + " seconds");
break;
}
}
}