During automation in Selenium, you will come across different selenium exceptions and need to manage them. Regardless of whether you work with other automation testing tools like Katalon Studio, you may still face these types of exception in selenium. They are, but, more effectively fixable than bugs or errors as they can throw logical termination.
Automation code execution mostly may not complete as expected because of numerous elements engaged with execution like server stability, Internet issues, network stability issues, and so forth. We may get exceptions in selenium because of inadequate holding up time or erroneous language structures, parameters, and so forth.
This cheat sheet has top common exceptions in selenium webdriver. Above all, we should examine some significant information regarding the term “exception” in Selenium.
What are Selenium Exceptions?
An exception is known as an uncommon or phenomenal event that happens amid the execution of a software program or application. It is a runtime error of an unexpected outcome or event which impact and upset regular program flow. An exception is likewise considered as a fault.
Characterization of Exception in Selenium
Selenium all exceptions is partitioned into two kinds including Checked Exceptions and Unchecked Exceptions.
Checked Exceptions are handled during the way toward composing codes. These exceptions are taken care of before compiling the code, in this manner; such exceptions are analyzed at the compile time.
These exceptions are tossed at runtime. Unchecked exceptions are more calamitous than the compile-time exception as it causes issues while running Automation pack in headless.
Common Exceptions in Selenium:
Here is a rundown of probably the most outstanding exceptions in Selenium WebDriver which you might possibly experience.
- RemoteDriverServerException: This is thrown when the server does not react because of the issue that the abilities portrayed are not proper.
- ScreenshotException: It is difficult to capture a screen.
- ScriptTimeoutException: Thrown when executeAsyncScript takes additional time than the given time limit to return the value.
- SessionNotCreatedException: another session couldn’t be effectively made.
- SessionNotFoundException: The WebDriver is playing out the activity directly after you quit the program.
- StaleElementReferenceException: This occurs if the web element is detached from the current DOM.
- TimeoutException: Thrown when there isn’t sufficient time for a direction to be finished.
- UnableToCreateProfileException: You can open a program with specific choices utilizing profiles, yet in some cases, another version of Selenium driverserver or program may not support the profiles.
- WebDriverException: This happens when the WebDriver is performing the activity directly after you close the program.
We have recorded a wide range of selenium exceptions alongside their clarifications above. From here, you can create robust and ideal codes in Selenium just as Katalon Studio by taking care of these exceptions wisely. We trust this blog will be a brisk reference for you to understand exceptions in Selenium.