Wednesday, 9 January 2013

Track WebPage Load Time | Selenium

long start = System.currentTimeMillis();
driver.get("http://www.website.com");    

// Locate an element [code here]

long finish = System.currentTimeMillis();
long TotalTime = finish - start;
System.out.println("Total Time for page load - "+TotalTime); 


#PYTHON
def setUp(self):
        self.startTime = time.time()

def tearDown(self):
        t = time.time() - self.startTime
        print "%s: %.3f" % (self.id(), t)
        self.driver.quit

2 comments:

  1. Thanks for the great information in your blog Selenium Training in Chennai

    ReplyDelete
  2. Is there any way to the show the load time of the page or element in the testng-reports?

    ReplyDelete