I have a code to test an app, and I need to record the time that the progress bar is present on the page. I have an idea in mind with a while loop and try-except, but I am afraid it might be inaccurate due to the possible delays with finding an element function. Any ideas? Python preferred.
CodePudding user response:
You can initialize a creation_time variable right before your element appears on the screen, and then a destory_time variable right after your element gets destoryed.
from datetime import datetime
# REST OF THE CODE
creation_time = datetime.now()
# ......
destroy_time = datetime.now()
appearance_time = destory_time - creation_time
CodePudding user response:
This may have been your thought but I'd try using EC.visibility_of_element_located in a while loop. When the element is first located, store the time in a variable as the above answer suggests. Then when the element is no longer visible, store the time in another variable and stop the loop
