In the following image, I want the total response time from the webpage. I can't seem to find it in the file sample HAR file, i.e. 38.79s in this case. Does anyone know how to get this?
I am going to use Selenium along with Firebug and NetExport to export the HAR file, but right now I am trying to do it manually. Adding the individual responses does not give correct numbers.
At some point I would like a Java program to find and extract the total response time.
The total load time is not calculated by summarizing all request times but by the latest request end time. Graphically spoken it is the right end of the request bar ending at the far right. In your example screenshot it's either the last, third to last or fourth to last request.
The request end time is calculated by the request start time indicated by the
startedDateTime
property of a request plus the time span needed for the response, which is available through thetime
property of each request. To get the maximum request end time, you need to loop over all requests and compare the end time of each request. See the following code:Executing this code the variable
loadTimeSpan
will contain the wanted time span in milliseconds.Important note:
The so calculated time span may still differ from the time displayed by Firebug or the online HAR Viewer, because they split the requests into different phases depending on the time elapsed between two requests. They then calculate the time span from the first to the last request of each phase and summarize those time spans in the end.