Introduction
Before Selenium can use an Implicit Wait, it must first be configured in the WebDriver instance. Once configured, Selenium automatically waits for the specified duration whenever it attempts to locate a web element.
Unlike Explicit Wait, an Implicit Wait is configured only once and remains active throughout the entire WebDriver session unless it is explicitly modified. This makes it a convenient synchronization mechanism for handling minor delays while locating elements.
In this tutorial, you’ll learn what Implicit Wait configuration is, how it works, practical examples, real-world use cases, common mistakes, and best practices.
What is Implicit Wait Configuration?
Configuring an Implicit Wait means specifying the maximum amount of time Selenium should wait while locating web elements.
Once configured:
Selenium automatically applies the wait to every
find_element()call.Selenium also applies the wait to every
find_elements()call.There is no need to repeatedly specify the wait duration.
The wait remains active until the browser session ends or a new timeout value is configured.
For example:
driver.implicitly_wait(15)
The above statement instructs Selenium to:
Wait for a maximum of fifteen seconds.
Poll the DOM while locating elements.
Immediately continue execution if the element becomes available earlier.
Throw a
NoSuchElementExceptionif the timeout expires.
Why Configure an Implicit Wait?
Configuring an Implicit Wait helps you:
Handle slow-loading webpages.
Improve synchronization.
Reduce
NoSuchElementExceptionfailures.Improve automation reliability.
Avoid repetitive wait statements.
Simplify Selenium automation scripts.
How Implicit Wait Configuration Works
When Selenium executes:
driver.find_element()
it follows the below process:
Locate Element
│
▼
Is Element Available?
Yes No
│ │
▼ ▼
Continue Wait
│
▼
Poll the DOM
│
▼
Element Available?
Yes No
│ │
▼ ▼
Success Timeout
│
▼
NoSuchElementException
Implicit Wait automatically performs this synchronization process for every element lookup throughout the WebDriver session.
Syntax
driver.implicitly_wait(
timeout_in_seconds
)
For example:
driver.implicitly_wait(15)
which configures Selenium to wait for a maximum of fifteen seconds whenever it searches for a web element.
Example
The Selenium practice website dynamically loads the “Hello World!” message after clicking the Start button.
Initially, the message is not available on the webpage.
After clicking:
Start
JavaScript begins loading:
<h4>Hello World!</h4>
Since an Implicit Wait has been configured, Selenium automatically waits while locating the dynamically loaded element.
The Selenium code is:
from selenium import webdriver
from selenium.webdriver.common.by import By
# Topic: 21. Implicit Wait - Configuration
# Practice site: https://the-internet.herokuapp.com/dynamic_loading/1
# Run: pytest -s 21_examples/test_02_implicit_wait_configuration.py
#
# implicitly_wait(seconds) sets the default wait time for all find_element
# calls in the session.
def test_implicit_wait_configuration():
driver = webdriver.Chrome()
try:
driver.implicitly_wait(15)
driver.get(
"https://the-internet.herokuapp.com/dynamic_loading/1"
)
driver.find_element(
By.CSS_SELECTOR,
"#start button"
).click()
message = driver.find_element(
By.CSS_SELECTOR,
"#finish h4"
).text
assert "Hello World!" in message
finally:
driver.quit()
Output
The dynamically loaded
message becomes available
successfully.
Hello World!
The configured Implicit
Wait automatically applies
to every element lookup
during the browser session.
Understanding the Code
Create the WebDriver
driver = webdriver.Chrome()
Launches the Chrome browser.
Configure the Implicit Wait
driver.implicitly_wait(15)
Configures Selenium to wait for a maximum of fifteen seconds whenever it searches for web elements.
This configuration automatically applies throughout the WebDriver session.
Open the Practice Website
driver.get(
"https://the-internet.herokuapp.com/dynamic_loading/1"
)
Launches the Selenium practice website.
Click the Start Button
driver.find_element(
By.CSS_SELECTOR,
"#start button"
).click()
Begins the JavaScript-based loading process.
Locate the Dynamically Loaded Element
driver.find_element(
By.CSS_SELECTOR,
"#finish h4"
)
Since the element is not immediately available, Selenium automatically polls the DOM until:
The element becomes available.
The timeout expires.
Retrieve the Message
message = driver.find_element(
By.CSS_SELECTOR,
"#finish h4"
).text
Retrieves the dynamically loaded message.
Validate the Result
assert (
"Hello World!"
in message
)
Verifies that Selenium successfully synchronized with the webpage.
How Implicit Wait Configuration Works
Start WebDriver
│
▼
Configure Implicit Wait
│
▼
Open Website
│
▼
Locate Element
│
▼
Is Element Available?
Yes No
│ │
▼ ▼
Continue Wait
│
▼
Poll the DOM
│
▼
Element Available?
Yes No
│ │
▼ ▼
Success Timeout
│
▼
NoSuchElementException
The configured timeout automatically applies to all subsequent element searches performed by Selenium.
Practical Example
Suppose you’re automating an E-Commerce website.
After opening the product page:
Product information is retrieved.
Images are loaded dynamically.
Recommendations become available.
Reviews are rendered asynchronously.
Instead of manually adding synchronization statements before every element search, Selenium automatically applies the configured Implicit Wait.
Open Product Page
│
▼
Locate Elements
│
▼
Selenium Waits Automatically
│
▼
Elements Become Available
│
▼
Continue Execution
│
▼
Test Passes
Automation Testing Example
Consider an online banking application.
After a successful login:
Dashboard widgets are loaded.
Account balances become available.
Transaction history is retrieved.
User notifications are rendered.
Instead of repeatedly adding synchronization code throughout the framework, the automation framework configures the Implicit Wait once during browser initialization.
All subsequent element lookups automatically use the configured timeout.
Real-World Example
Implicit Wait configuration is commonly used in:
Banking applications.
E-Commerce websites.
CRM systems.
Healthcare portals.
ERP applications.
HR management systems.
SaaS products.
Enterprise web applications.
Most Selenium automation frameworks configure synchronization settings immediately after creating the WebDriver instance.
Advantages of Configuring Implicit Wait
Configured only once.
Applies globally to all element lookups.
Improves automation reliability.
Simplifies Selenium scripts.
Reduces repetitive synchronization code.
Improves framework maintainability.
Limitations
Applies to every element lookup even when unnecessary.
Cannot wait for specific conditions such as visibility or clickability.
Large timeout values may increase execution time.
Mixing wait strategies improperly may produce unexpected delays.
Provides less flexibility than Explicit Wait.
Implicit Wait Configuration vs Explicit Wait
| Feature | Implicit Wait | Explicit Wait |
|---|---|---|
| Configuration | Once | Per Condition |
| Scope | Global | Specific Condition |
| Waits for Visibility | No | Yes |
| Waits for Clickability | No | Yes |
| Flexibility | Lower | Higher |
| Real-World Usage | Moderate | Extensive |
| Suitable for Dynamic Elements | Limited | Excellent |
Common Mistakes Beginners Make
Configuring the Wait Multiple Times
Many beginners repeatedly write:
driver.implicitly_wait(15)
throughout the automation script.
Usually, one configuration during WebDriver initialization is sufficient.
Using Very Large Timeout Values
Avoid
driver.implicitly_wait(
120
)
Large timeout values unnecessarily increase execution time.
Always choose reasonable timeout values.
Expecting Implicit Wait to Handle Every Synchronization Problem
Implicit Wait only waits while locating elements.
It does not wait for:
Element visibility.
Element clickability.
Alert appearances.
URL changes.
Text updates.
Explicit Wait is usually better suited for these scenarios.
Best Practices
Configure Implicit Wait immediately after creating the WebDriver.
Use reasonable timeout values.
Configure it only once per browser session.
Prefer Explicit Wait for condition-based synchronization.
Avoid unnecessarily large timeout durations.
Apply synchronization strategies consistently throughout the automation framework.
Conclusion
Configuring an Implicit Wait is one of the simplest ways to improve synchronization in Selenium automation testing. Once configured, Selenium automatically waits whenever it searches for web elements, reducing synchronization-related failures and simplifying automation scripts.
Although Implicit Wait is useful for handling minor synchronization issues, Explicit Wait remains the preferred choice for dynamic web applications that require condition-based waiting. Understanding how to configure Implicit Wait correctly is essential for building reliable and maintainable Selenium automation frameworks.
Frequently Asked Questions (FAQs)
When should I configure an Implicit Wait?
Immediately after creating the WebDriver and before interacting with web elements.
Does Implicit Wait need to be configured before every element search?
No.
Once configured, it applies globally throughout the entire WebDriver session.
Can I change the timeout value later?
Yes.
Calling driver.implicitly_wait() again updates the timeout value.
Does Implicit Wait apply to find_elements()?
Yes.
It applies to both:
find_element()find_elements()
Is Implicit Wait recommended for modern automation frameworks?
It is useful for basic synchronization, but Explicit Wait is generally preferred because it provides greater flexibility for dynamic applications.
Key Takeaways
Configure Implicit Wait once immediately after creating the WebDriver.
It applies globally to all element lookups.
Selenium automatically waits while locating elements.
Use reasonable timeout values whenever possible.
Prefer Explicit Wait for condition-based synchronization requirements.
Proper synchronization configuration significantly improves automation reliability and framework maintainability.
