Introduction
Selenium automation testing can throw several types of exceptions due to various issues during the execution of test scripts. Here are some of the most common exceptions encountered in Selenium.
1. WebDriverException is a base class for all exceptions thrown by the WebDriver API.
2. StaleElementReferenceException is thrown when trying to interact with an element no longer attached to the DOM (Document Object Model). This can happen if the element has been deleted or the page has been refreshed since the element was located. "stale" is often used to refer to something that is no longer fresh or current.
3. TimeoutException is thrown when a command times out. This can occur if the page takes too long to load or if an element is not found within the specified time period.
4. UnreachableBrowserException is thrown when a connection to a web browser cannot be established.
5. NoSuchElementException is thrown when it cannot find an element on the page that it is trying to interact with.
6. NoSuchFrameException is thrown when it cannot find the frame that it is trying to switch to.
7. NoSuchWindowException is thrown when it cannot find the window that it is trying to switch to.
8. NoAlertPresentException is thrown when trying to switch to an alert that is not present.
9. ElementClickInterceptedException is thrown when an element that a program is trying to click is blocked from being clicked. This can happen if another element on the page is covering the element that the program is trying to click on, or if the element is obscured by a modal dialog or pop-up window.
10. InvalidElementStateException is thrown when an operation is attempted on an element that is not in a valid state for the operation. For example, if you try to click a button on a webpage using Selenium, but the button is not visible or is disabled.
11. SessionNotFoundException Occurs when WebDriver tries to perform an action after the browser session has ended or is invalid.
12. ElementNotInteractableException Thrown when an element is present and visible in the DOM but cannot be interacted with (e.g., a disabled button or an input field).
13. ElementNotVisibleException occurs when an element is present in the DOM but not visible on the page, so Selenium cannot interact with it.
Comments
Post a Comment