I'm using webbrowser, so I can open a html to an performance test I'm currently doing.
This small piece of code is the begin of the automation. The goal of the function
except webbrowser.Error, e:
print "It couldn't open the url: ", url
url = "www.google.com"
www.google.com Total time to load page in (secs): 2.641
Do you need to use the web browser? As in do you need to view the result?
Otherwise you could do this.
import urllib2 from time import time stream = urllib2.urlopen('http://www.rarlab.com/rar/winrar-x64-420.exe') start_time = time() output = stream.read() end_time = time() stream.close() print(end_time-start_time)
If you want a more human-readable result you can use round.
0.865000009537 # Without Round 0.865 # With Round