✅ Join us — https://sendfox.com/thetestingacademy
In this video, We are going to learn How to Handle Selenium Exceptions and Top 10 Selenium Exceptions.
Exception in the Automation code is very common. ‘Exception’ as the word indicates, is a special or uncommon case.
Selenium Exception handling is a very important part of every Selenium Script and for Interview.
🚀 Notes: — https://scrolltest.com/9oPk
🚀 What is an Exception?
- The unwanted event which occurs during the execution of a program or code;
- It disturbs the normal flow of the program.
- Example: You are trying 1/0 division.
- Arithmetic Exception trying to access an element of an array which is more than the size of that array
- ArrayOutOfBound Exception handling is a very important part of every Selenium Script and for Interview.
🚀 Top 10 Selenium Exceptions
- NoSuchWindowException Webdriver is trying to switch to an invalid window, which is unavailable
- NoSuchFrameException: Webdriver attempts to switch to an invalid frame, which is unavailable
- NoSuchElementException Webdriver is not able to determine the elements during runtime, i.e., the FindBy method cannot find a particular component
- NoAlertPresentException Webdriver is trying to switch to an invalid alert, which is unavailable
- TimeoutException The command did not complete in the specified time. For example, the element didn’t display at the specified time. This is especially encountered when working with waits
- StaleElementReferenceException The referenced element is no longer present on the DOM page (a reference to a component is now Stale). For example, the item belongs to a different frame than the current one or the user has navigated away to another page Due to ? Navigation to another page DOM has refreshed A frame or window switch
- ElementNotVisibleException In spite of the element being present in the DOM, it is not visible (can not be interactive). For example, elements defined in HTML with type =”hidden”
An element is disabled (can not be clicked/selected) in spite of being present in the DOM
For ElementNot Interactable
- Webdriver is acting immediately after ‘quitting’ the browse