Monday, November 8, 2010

Selenium - Calculate page response time

Calculate page response time selenium.

Any functional testing tool should provide timer objects to calculate page response time.
In QTP we have "MercuryTimers.Timer()" , but I didn't find similar stuff in selenium, so I started using following code for calculating page response time.

long start;   
start = System.currentTimeMillis();"popup_ok");

System.out.println("Login Page : " + (System.currentTimeMillis() - start) + " msec.");

Selenium timer extension



  1. Hi Bharat,

    Is there any function in selenium to estimate the test run time even before running the test, (Ex: similar to, while copying a file, the estimated time of completion of copy is displayed) ?

    1. TestNG has built in timer that would calculate the time and display it in the report.

  2. Hello Am New To Selenium wants to know page response time function will affect the testsuite or not ?

  3. No, It is handled by Java not through Selenium.
    This might not work if the page contain AJAX related items.