How can I make a time delay in Python?

Explanation

To make a time delay in python we can use the different methods such as :

The first method is sleep :

import time
time.sleep(5) # Delay for 5 seconds.

The second method used to delay is wait for method:

 driver.implicitly_wait(5)

The third method is more useful when you have to wait until a particular action is completed or until an element is found:

self.wait.until(EC.presence_of_element_located((By.ID, 'UserName'))

 

Also read, event.preventDefault() vs. return false

Share this post

Leave a Reply

Your email address will not be published. Required fields are marked *