Skip to content
Selenium WebDriver · error message

Selenium: TimeoutException (WebDriverWait timed out)

RetryableWaits & timeouts

Last verified

The exact message
selenium.common.exceptions.TimeoutException: Message: (Java) org.openqa.selenium.TimeoutException: Expected condition failed: waiting for visibility of element located by By.id: login (tried for 10 second(s) with 500 milliseconds interval)

What it means

Most of the time this comes from an explicit wait. WebDriverWait evaluated your expected condition every 500 ms until the timeout and it never returned a truthy value. In Python the message is often empty (Message: followed by nothing), because the binding raises it without text unless you pass a message to until(). The Java binding describes the condition and the polling interval.

It can also come from the browser: if a page load exceeds the page load timeout (300 seconds by default), driver.get() raises it, and ChromeDriver may report timeout: Timed out receiving message from renderer. Script timeouts from async JavaScript have their own ScriptTimeoutException.

What is not wrong: the wait mechanism. The condition you waited for genuinely did not happen in time, so ask why it did not.

What it looks like

from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

options = webdriver.ChromeOptions()
options.page_load_strategy = "eager"
driver = webdriver.Chrome(options=options)
driver.get("https://example.com/login")
try:
    WebDriverWait(driver, 10).until(
        EC.visibility_of_element_located((By.ID, "login")),
        "login field never became visible",
    )
except TimeoutException:
    driver.save_screenshot("timeout.png")
    raise

Why it happens

  • The locator inside the expected condition is wrong, so the condition can never be met.
  • The condition is stricter than needed (visibility or clickability when presence would do).
  • The element is in an iframe the driver has not switched into.
  • The page is slow or an earlier step failed silently (login rejected, form not submitted).
  • A page load hangs on slow third-party resources, exceeding the page load timeout.

How to fix it

  1. Pass a message to until() so the failure says what was awaited: wait.until(cond, 'login field never appeared').
  2. Take a screenshot and log driver.current_url in the except block to see the real page state.
  3. Verify the locator with find_elements on the same page; if it returns nothing, the wait can never succeed.
  4. Switch into the right frame before waiting.
  5. For page loads that hang, set options.page_load_strategy = 'eager' and wait for the specific element you need.

How to stop it recurring

Always give waits a descriptive message and capture a screenshot on failure, so timeouts explain themselves. Wait for the weakest condition that is sufficient for the next step. Do not mix implicit and explicit waits; Selenium's documentation warns the combination can produce unpredictable wait times.

Official documentation: www.selenium.dev/documentation/webdriver/troubleshooting/errors/#timeoutexception. See all Selenium error messages.

Related errors

Definitions

Quick answers

What does "TimeoutException (WebDriverWait timed out)" mean in Selenium?

Most of the time this comes from an explicit wait. WebDriverWait evaluated your expected condition every 500 ms until the timeout and it never returned a truthy value. In Python the message is often empty ( Message: followed by nothing), because the binding raises it without text unless you pass a message to until() . The Java binding describes the condition and the polling interval.

How do I fix "TimeoutException (WebDriverWait timed out)"?

1. Pass a message to until() so the failure says what was awaited: wait.until(cond, 'login field never appeared'). 2. Take a screenshot and log driver.current_url in the except block to see the real page state. 3. Verify the locator with find_elements on the same page; if it returns nothing, the wait can never succeed. 4. Switch into the right frame before waiting. 5. For page loads that hang, set options.page_load_strategy = 'eager' and wait for the specific element you need.

Run browser automation you can watch and take over

Autonoly runs each job in a real cloud Chromium browser driven by Playwright. Timeouts and detached elements still happen; the difference is that you can watch the run live, see the step that failed, and take control of the browser to finish it.

Also see Live browser control.