I'm interesting in getting the time waited until an object was clickable on the page. So once the element is clickable a metric is displayed showing how long it took for the element to become active.
try:
WebDriverWait(self.driver, 10, poll_frequency=0.5).until( lambda d: self.submit_button)
except TimeoutException:
assert False
Above is the code that I am using to poll for the element, but I'm looking for a way to get time waited metric out.
Any suggestions ?
You will not get the exact time, as because you have polling every N seconds and the overall wait. But you can have the average approximation.
It's not only for Selenium purposes, but you can use import time, for example.
just before executing the command add: start = time.time()
and right after the command: end = time.time()
then, the needed value will be print end - start
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With