high

NoSuchElementException

No element matching the locator strategy could be found in the current page DOM. The element may not exist, may not have loaded yet, or the locator may be incorrect.

Common Causes

  1. 1Element hasn't loaded yet — no explicit wait used
  2. 2Incorrect locator (typo in ID, class, or XPath)
  3. 3Element is inside an iframe that hasn't been switched to
  4. 4Element is in a shadow DOM
  5. 5Page hasn't finished rendering

How to Fix

Use explicit waits instead of findElement

// Python
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By

element = WebDriverWait(driver, 10).until(
    EC.visibility_of_element_located((By.CSS_SELECTOR, '#my-element'))
)

Explicit waits poll the DOM until the element appears or the timeout expires. Much more reliable than Thread.sleep().

Switch to iframe first

// Python
driver.switch_to.frame('iframe-id')
element = driver.find_element(By.ID, 'button')
element.click()
driver.switch_to.default_content()

Elements inside iframes are not accessible from the main document. Switch to the iframe context first.

How ObserveOne Helps

ObserveOne's self-healing locators automatically find alternative selectors when elements can't be found.

Start Monitoring Free

Related Errors