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

1 comment: