Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def measure_page_performance_time(driver, tries_count, url):
- average = 0
- print "url: ", url
- for n in range(tries_count):
- driver.get(url)
- stext = driver.execute_script(
- "return ( window.performance.timing.loadEventEnd - window.performance.timing.navigationStart )")
- average = average + int(stext)
- print "trying ", n + 1, " time", "........Value is: %s" % float(float(stext) / 1000), "seconds"
- total_load_time = (float(float(average) / float(tries_count)) / 1000)
- if total_load_time < TIME_THRESHOLD:
- warning_msg = " - OK"
- else:
- warning_msg = "!!!WARNING!!! THIS PAGE PERFORMANCE IS TOO SLOW"
- print "||url: ", url, "AVERAGE is: %s" % total_load_time, "seconds" + warning_msg + "||"
- print ""
Advertisement
Add Comment
Please, Sign In to add comment