Skip to content

Instantly share code, notes, and snippets.

@wilsonmar
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wilsonmar/fa87d71a8f116dd5dc40 to your computer and use it in GitHub Desktop.
Save wilsonmar/fa87d71a8f116dd5dc40 to your computer and use it in GitHub Desktop.
Selenium response time timer
// From http://qtpseleniumsudhakar.blogspot.com/2014/02/measuring-response-time-using-timer-in.html
// Get the Start Time
long startTime = System.currentTimeMillis();
// Sample app: Open the BMI Calculator Mobile Application
driver.get("http://dl.dropbox.com/u/55228056/bmicalculator.html");
// Wait for the Calculate Button
new WebDriverWait(driver, 10).until(ExpectedConditions.
presenceOfElementLocated(By.id("Calculate")));
// WebElement ele = driver.findElement(By.id("ID of some element on the page which will load"));
long endTime = System.currentTimeMillis(); // Get the End Time
long totalTime = endTime - startTime; // Measure total time
System.out.println("Total Page Load Time: " + totalTime + "milliseconds");
@wilsonmar
Copy link
Author

add other element check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment