Selenium exceptions, decoded
Pasted a stack trace into a search engine? Each page explains what the error means, shows how it looks in every language, ranks the likely causes and gives a fix you can paste. Verified against Selenium 4.52.0.
Errors almost everyone hits
Synchronisation and locator problems. Fix these and most flakiness disappears.
NoSuchElementException Fix Selenium NoSuchElementException (NoSuchElementError in JS): timing, wrong locators, iframes, shadow DOM and windows, with fixes in Java, Python, JS and C#. no such element StaleElementReferenceException Fix Selenium StaleElementReferenceException (StaleElementReferenceError in JS): why elements go stale after re-renders and navigation, and how to re-find them. stale element reference ElementClickInterceptedException Fix Selenium ElementClickInterceptedException (ElementClickInterceptedError in JS): overlays, cookie banners, sticky headers and animations blocking your click. element click intercepted ElementNotInteractableException Fix Selenium ElementNotInteractableException (ElementNotInteractableError in JS): hidden elements, duplicate matches, zero-size inputs and custom controls. element not interactable TimeoutException Fix Selenium TimeoutException (TimeoutError in JS, WebDriverTimeoutException in C#): failed explicit waits, page load and script timeouts, implicit wait mixing. timeout SessionNotCreatedException Fix Selenium SessionNotCreatedException: browser/driver version mismatch, Selenium Manager and proxy TLS errors, user-data-dir in use, Grid capability mismatch. session not created
Common errors
Session, window, frame and input problems you will meet in any real suite.
NoSuchWindowException Fix Selenium NoSuchWindowException (NoSuchWindowError in JS): closed tabs, self-closing popups, stale window handles and switching before a new tab opens. no such window NoSuchFrameException Fix Selenium NoSuchFrameException (NoSuchFrameError in JS): iframes that load late, wrong frame names or indexes, nested frames and re-rendered iframes. no such frame UnhandledAlertException Fix Selenium UnhandledAlertException (UnexpectedAlertPresentException in Python, UnexpectedAlertOpenError in JS): surprise alerts and prompt behaviour. unexpected alert open InvalidSelectorException Fix Selenium InvalidSelectorException (InvalidSelectorError in JS): XPath and CSS syntax errors, XPath 2.0 functions, text() results and jQuery pseudo-classes. invalid selector JavascriptException Fix Selenium JavascriptException (JavascriptError in JS, JavaScriptException in C#): null elements, syntax errors and missing libraries in executeScript. javascript error InvalidSessionIdException Fix Selenium InvalidSessionIdException (NoSuchSessionException in Java, NoSuchSessionError in JS): quit drivers, crashed browsers and Grid session timeouts. invalid session id WebDriverException Fix Selenium WebDriverException (WebDriverError in JS): chrome not reachable, connection refused, unknown error, net::ERR messages and client HTTP timeouts. unknown error
Less common errors
Edge cases with specific, fixable causes.
MoveTargetOutOfBoundsException Fix Selenium MoveTargetOutOfBoundsException (MoveTargetOutOfBoundsError in JS): Actions moves outside the viewport, centre offsets and small headless windows. move target out of bounds InvalidArgumentException Fix Selenium InvalidArgumentException (InvalidArgumentError in JS): URLs without a scheme, missing upload files, bad capabilities and invalid cookie fields. invalid argument NoSuchShadowRootException Fix Selenium NoSuchShadowRootException (NoSuchShadowRootError in JS): wrong shadow host, closed shadow roots, late web components and nested shadow DOM. no such shadow root
Still stuck?
Start with Common Selenium Errors for the overview, then Flaky Tests: Diagnosis and Cure. If the error appeared after an upgrade, check Releases & News for breaking changes.