What are the differences between implicit and explicit waits in Selenium with python?


The differences between implicit and explicit wait are listed below −


Implicit WaitExplicit Wait
1The driver is asked to wait for a specific amount of time for the element to be available on the DOM of the page.
The driver is asked to wait till a certain condition is satisfied.
2It is a global wait and applied to all elements on the webpage.
It is not a global wait and applied to a particular scenario.
3It does not require you to meet any condition.
It is required to satisfy a particular condition. Some of the expected conditions include −
  • title_contains
  • visibility_of_element_located
  • presence_of_element_located
  • title_is
  • visibility_of
  • element_selection_state_to_be
  • presence_of_all_elements_located
  • element_located_to_be_selected
  • alert_is_present
  • element_located_selection_state_to_b e
  • staleness_of
  • element_to_be_clickable
  • invisibility_of_element_located
  • frame_to_be_available_and_switch_to _it
  • text_to_be_present_in_element_value
  • text_to_be_present_in_element
  • element_to_be_selected
4Syntax
driver.implicitly_wait(2)
Syntax
w = WebDriverWait(driver, 7)
w.until(expected_conditions.presence_of_ele
ment_located((By.ID, "Tutorialspoint")))
5It is simple and easy to implement.
It is more complex in implementation compared to implicit wait.
6It affects the execution speed since each step waits for this wait till it gets the element it is looking for.
It does not affect the execution speed since it is applicable to a particular element of the page.
7It does not catch performance issues in the application.
It can catch performance issues in the application.

Updated on: 28-Jul-2020

9K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements