## TL;DR

If you see it and Selenium does not, the driver is looking in the wrong place: wrong frame, too early, or a subtly wrong locator. Check frames first, then timing, then the locator in the console.

## Error

```text
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"#submit"}
```

## Steps

1. Check for frames: `driver.find_elements(By.TAG_NAME, "iframe")`. If any, `driver.switch_to.frame(...)` before finding. Expected: the most common cause eliminated.
2. Add an explicit wait: `WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.ID, "submit")))`. Expected: timing issues resolve.
3. Test the locator in the browser console: `document.querySelector('#submit')`. Expected: null means the locator is wrong, not the timing.
4. Check for shadow DOM: if the element is under `#shadow-root`, pierce it with script. Expected: shadow boundary identified.
5. Check the locator scope: after any `switch_to`, switch back with `driver.switch_to.default_content()`. Expected: no stuck frame context.

## When to use

- Element visible in screenshots but not found.
- After page changes involving frames.

## When not to use

- Stale element (found then lost).
- Playwright (different engine).

## Tool compatibility

- Selenium 4.x; `WebDriverWait`, frame switching.

## Variant phrasings

### Unable to locate element in Selenium

The general form; frames-timing-locator in that order.

### Selenium cannot find element that exists

Same symptom; same checklist.

## Why it happens

The driver searches one document at a time, at one moment. Frames, async rendering, and shadow DOM each hide elements from a naive search.

## Edge cases

- Implicit waits do not help inside frames you never switched to.
- Dynamically inserted iframes need a wait for the frame itself.
- `find_elements` (plural) returning empty is easier to debug than the exception form.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_jjNeR6AEPqaWV88ZKW4kaw
