This document describes various exceptions that can occur when using Selenium for automated testing. Some common exceptions include NoSuchElementException when an element is not found, ElementNotVisibleException when an element is hidden, and TimeoutException when an action is not completed within the specified time. Other exceptions handle issues such as invalid arguments, missing browser contexts, and errors interacting with elements, windows, and alerts.
Download as TXT, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
33 views
Exceptions
This document describes various exceptions that can occur when using Selenium for automated testing. Some common exceptions include NoSuchElementException when an element is not found, ElementNotVisibleException when an element is hidden, and TimeoutException when an action is not completed within the specified time. Other exceptions handle issues such as invalid arguments, missing browser contexts, and errors interacting with elements, windows, and alerts.
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2
ElementNotVisibleException ||| This type of Selenium exception occurs
when an existing element in DOM has a feature set as hidden.
ElementNotSelectableException ||| The element is visible, but not selectable. Use the respective expected condition to avoid this. NoSuchElementException ||| The element is not found in the DOM by Selenium. It might not be loaded, so use a type of wait. NoSuchFrameException ||| This Exception occurs if the frame target to be switched to does not exist. NoAlertPresentException ||| This Exception occurs when you switch to no presented alert. NoSuchWindowException ||| This Exception occurs if the window target to be switch does not exist. StaleElementReferenceException ||| The element is old and might not be available in the DOM anymore. SessionNotFoundException ||| The WebDriver is called after it has been closed. TimeoutException ||| Thrown when there is not enough time for a command to be completed. For Example, the element searched wasn't found in the specified time. WebDriverException ||| The WebDriver is called after it has been closed. ConnectionClosedException ||| You disconnected the driver most probably. ElementClickInterceptedException ||| The element may not receive the click. Try the javascriptExecutor class to click it. ElementNotInteractableException ||| Element is in the DOM, however you cannot interact with it. Use the appropiate expected condition. InsecureCertificateException ||| Self-signed, invalid or expired certificate. InvalidArgumentException ||| It occurs when an argument does not belong to the expected type. For example, the url is malformed and you perform driver.get() on it. InvalidCoordinatesException ||| This type of Exception matches an interacting operation that is not valid. InvalidElementStateExceptio ||| It occurs when command can't be finished when the element is invalid. InvalidSessionIdException ||| The driver session is inactive. Maybe you are using a different webdriver, instead of using an existing one. InvalidSwitchToTargetException ||| The target window to be switched does not exist. JavascriptException ||| Invalid javascript sent to javascriptExecutor object. NoSuchAttributeException ||| This kind of Exception occurs when the attribute of an element could not be found. MoveTargetOutOfBoundsException ||| It takes place if the target provided to the ActionChains move() methodology is not valid. For Example, out of the document. NoSuchContextException ||| ContextAware does mobile device testing. NotFoundException ||| This Exception is a subclass of WebDriverException. This will occur when an element on the DOM does not exist. RemoteDriverServerException ||| This Selenium exception is thrown when the server is not responding because of the problem that the capabilities described are not proper. ScreenshotException ||| It is not possible to capture a screen. SessionNotCreatedException ||| It happens when a new session could not be successfully created. UnableToSetCookieException ||| This occurs if a driver is unable to set a cookie. UnexpectedTagNameException ||| Happens if a support class did not get a web element as expected. UnhandledAlertException ||| This expectation occurs when there is an alert, but WebDriver is not able to perform Alert operation. UnexpectedAlertPresentException ||| It occurs when there is the appearance of an unexpected alert. UnreachableBrowserException ||| Browser crashes most probably. Update you webdriver and browser. UnsupportedCommandException ||| This occurs when remote WebDriver does not send valid commands as expected.