Hey there! any question in your mind? Ask It Now!.

Popular Categories

Get response time of a webpage

0 votes
asked in Software Testing by Gaurav
I want to automate this process of getting response time of a webpage in every 3 hour. You can explain me in java , php , python or may be in selenium tool or without it .

1 Answer

0 votes
answered by Sidhant
edited by Bhartesh
Hi Gaurav,

It's a commonly used scenario to test response time and throw the alert in case of high response time. I used simple PHP code for the same.

you can use this function to get response time.


function getResponseTime($url){
  $ch = curl_init($url);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
  $info = curl_getinfo($ch);
    // echo 'Took ' . $info['total_time'] . ' seconds to transfer a request to ' . $info['url'].$_GET['env'];
    $rs_time = $info['total_time'];
  return $rs_time;

   $responsetime = getResponseTime("url");
   echo $responsetime;


This is a simple implementation and you can set up a corn and schedule this file as per your need.

In selenium: You can get an URL and on the basis of an element present in the web page can log the time. But it's not a good solution for checking response time.

Related Questions

0 votes
1 answer 180 views
+2 votes
1 answer 1,270 views
+1 vote
1 answer 2,250 views
+5 votes
7 answers 14,605 views
+1 vote
1 answer 547 views
+11 votes
1 answer 124 views
+13 votes
1 answer 117 views

Not a Member yet?

Ask to Folks Login

My Account
751 Folks are online
57 members and 694 guest online
Your feedback is highly appreciated