Differences Between Implicit and Explicit Waits in Selenium with Python



The differences between implicit and explicit wait are listed below −


Implicit Wait Explicit Wait
1 The 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.
2 It is a global wait and applied to all elements on the webpage.
It is not a global wait and applied to a particular scenario.
3 It 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
4 Syntax
driver.implicitly_wait(2)
Syntax
w = WebDriverWait(driver, 7)
w.until(expected_conditions.presence_of_ele
ment_located((By.ID, "Tutorialspoint")))
5 It is simple and easy to implement.
It is more complex in implementation compared to implicit wait.
6 It 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.
7 It does not catch performance issues in the application.
It can catch performance issues in the application.
Updated on: 2020-07-28T15:28:16+05:30

12K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements