What are different types of waits in Selenium with Python?

Selenium WebDriver provide 2 types of waits:

1. Implicit Wait

2. Explicit Wait

Implicit Wait: An implicit wait tells WebDriver to poll the DOM for a certain amount of time when trying to find any element (or elements) not immediately available. The default setting is 0. Once set, the implicit wait is set for the life of the WebDriver object. Example:

driver.implicitly_wait(10) # seconds

Explicit Wait: An explicit wait is a code you define to wait for a certain condition to occur before proceeding further in the code.

element = WebDriverWait(driver, 10).until(
        expected_conditions.presence_of_element_located((By.ID, "myDynamicElement"))

Other Techniques: There are other techniques to wait for page load and stop a program execution for certain amount of time.


In above code exception will be thrown if page does not load in 1 seconds. time.sleep is used to stop the program execution for 2 seconds.