Waits in Selenium WebDriver
ImplicitWait:
If elements are not immediately available, an implicit wait tells the WebDriver to poll the DOM for a certain amount of time.
The default setting is 0. Once set, the implicit wait is set for the duration of the WebDriver object.
This means that we can tell Selenium WebDriver that we would like it to wait for a certain amount of time before throwing an exception that it cannot find the element on the page.
Explicit Wait:
Explicit Wait is the custom one.
It will be used if we want the execution to wait for some time until some condition is achieved.
An explicit wait is what we can define to wait for a certain condition to occur before proceeding further in the code.
Below are some of the available expected conditions:
• alert_is_present
• element_located_selection_state_to_be
• element_located_to_be_selected
• element_selection_state_to_be
• element_to_be_clickable
• element_to_be_selected
• frame_to_be_available_and_switch_to_it
• invisibility_of_element_located
• presence_of_all_elements_located
• presence_of_element_located
• staleness_of
• text_to_be_present_in_element
• text_to_be_present_in_element_value
• title_contains
• title_is
• visibility_of
• visibility_of_element_located
Example of Implicit wait:
Example of Explicit wait: