Open In App

Implicit Waits in Selenium Python

Last Updated : 03 Sep, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

Modern web applications often use AJAX techniques, where elements on a page may load at different times. This asynchronous loading can make locating elements tricky: if an element is not yet present in the DOM, Selenium will throw an ElementNotVisibleException.

To handle such scenarios, Selenium provides waits, which add a delay between actions like locating elements or performing operations on them. There are two types of waits in Selenium: Implicit Waits and Explicit Waits.

What is an Implicit Wait?

An implicit wait tells Selenium WebDriver to poll the DOM for a certain amount of time when trying to find elements that are not immediately available.

  • Default Setting: 0 seconds (no waiting).
  • Scope: Once set, the implicit wait applies throughout the lifetime of the WebDriver instance.
  • Behavior: Selenium waits up to the specified time before throwing a NoSuchElementException if the element is not found.

Syntax

driver.implicitly_wait(time_in_seconds)

  • driver: WebDriver instance.
  • time_in_seconds: Maximum time to wait for elements to appear.

Example 1: Basic Implicit Wait

Python
from selenium import webdriver

# WebDriver object
driver = webdriver.Firefox()
driver.implicitly_wait(10)  

driver.get("http://somedomain/url_that_delays_loading")
myDynamicElement = driver.find_element_by_id("myDynamicElement")

Output:

Output
Element Loaded

Explanation:

  • Selenium will poll the DOM for up to 10 seconds until the element with ID "myDynamicElement" appears.
  • If the element is found earlier, Selenium proceeds immediately.
  • If the element is not found within 10 seconds, a TimeoutException is raised.

Example 2: Implicit Wait on GeeksforGeeks.

Python
from selenium import webdriver
from selenium.webdriver.common.by import By

# WebDriver object
driver = webdriver.Firefox()
driver.implicitly_wait(10)  # Wait up to 10 seconds for elements

driver.get("https://www.geeksforgeeks.org/")

# Locate element using modern Selenium syntax
element = driver.find_element(By.LINK_TEXT, "Courses")
element.click()

# Close the browser
driver.quit()

Output:

Output
Courses Page

Explanation:

  • Selenium opens the GeeksforGeeks homepage.
  • It waits up to 10 seconds to locate the Courses link.
  • Once found, it clicks on the link and navigates to the corresponding page.