SELENIUM BASICS:


SELENIUM WEBDRIVER:


TESTNG:


REPORTS:


BUILD & CONTINUOUS INTEGRATION TOOLS:


CROSS BROWSER TESTING:


MOBILE TESTING:


AUTOMATION FRAMEWORKS:


API Testing:


INTERVIEW QUESTIONS:


SAMPLE RESUME:

Exceptions in Selenium Python

In the previous articles on Selenium Python Tutorial, we have covered “Assertions in Selenium Python“. In this tutorial, we will learn Exceptions in Selenium Python. 

An exception is an unexpected incident that is encountered during the program execution. It halts the normal execution flow of the program, can cause system crash or stop all the other processes.

Selenium exception classes are a part of selenium.common.execeptions. Let us discuss some of the common Selenium exceptions.

ElementClickInterceptedException – This exception is encountered if a click action could not be performed as the web element we are currently dealing with is hidden.

ElementNotInteractableException – This exception is encountered if we want to perform an action on the web element is unavailable in DOM.

ElementNotSelectableException – This exception is encountered with a web element having <select> tag. This exception comes if we try to select an option which is unavailable or not selectable.

ElementNotVisibleException – This exception is encountered if we want to perform an action on a web element which is invisible on the web page but present in DOM.

ErrorInResponseException – This exception is encountered if there exists an error on the server side.

ImeActivationFailedException – This exception is encountered if IME engine activation failed.

ImeNotAvailableException – This exception is encountered if IME support is unavailable from all the IME related method invocation.

InsecureCertificateException – This exception is encountered when a navigation by a user agent comes across a certificate warning. The warning from a certificate is generated by an improper TLS certificate.

InvalidArgumentException – This exception is encountered when improper arguments are passed to a command.

InvalidCookieDomainException – This exception is encountered in addition to a cookie from a different URL to the present URL.

InvalidCoordinatesException – This exception is encountered if we try to do mouse movement to an invalid coordinate.

InvalidElementStateException – This exception is encountered when an action is being performed on a web element which is in disabled state.

InvalidSelectorException – This exception is encountered if a selector fails to identify a web element on the page. This is common with customized xpath expressions having incorrect syntax or formation.

InvalidSessionIdException – This exception is encountered if the provided session id is not among the list of sessions which are active. This means the session id is inactive.

InvalidSwitchToTargetException – This exception is encountered if the user tries to switch to a nonexistent window or frame.

MoveTargetOutOfBoundsException – This exception is encountered when a user makes an attempt to drag or move a web element or cursor beyond the visible portion of the screen.

NoAlertPresentException – This exception is encountered if the user makes an attempt to switch to a nonexistent alert pop up.

NoSuchAttributeException – This exception is encountered if an attribute of a web element could not be traced.

NoSuchCookieException – This exception is encountered if there is no identical cookie in the list of available cookies in the active browser.

NoSuchElementException – This exception is encountered when there is no matching web element on the page.

NoSuchFrameException – This exception is encountered if the user makes an attempt to switch to a nonexistent frame.

NoSuchWindowException – This exception is encountered if the user makes an attempt to switch to a nonexistent browser window.

ScreenshotException – This exception is encountered when there is a failure to capture a screenshot of a page.

SessionNotCreatedException – This exception is encountered when there is a failure to build a new session.

StaleElementReferenceException – This exception is encountered if the web element has been deleted or detached from the DOM.

TimeoutException – This exception is encountered if the web element cannot be identified within the specified wait time provided by the user.

UnableToSetCookieException – This exception is encountered if the driver object could not position a cookie.

UnexpectedAlertPresentException – This exception is encountered due to the appearance of an unanticipated alert pop up.

UnexpectedTagNameException – This exception is encountered when a user attempts to access a web element with a class which does not work with a particular tag name. For example, using the Select class with an input tag.

WebDriverException – This exception extends the Runtime Exception class. WebDriverException class is the super class of all exceptions in Selenium.

In the next article, we will learn How To Handle Web Tables in Selenium Python

Related posts:

Sharing is caring.

Share on facebook
Facebook
Share on twitter
Twitter
Share on linkedin
LinkedIn

Like This Post?

We have a lot more where that came from?

We only send really good stuff occasionally, promise.

Rajkumar SM

Leave a Comment

Your email address will not be published. Required fields are marked *

Share on facebook
Share on google
Share on twitter
Share on linkedin
Share on whatsapp

Recent Posts:

Scroll to Top
API Testing eBook

DOWNLOAD FOR FREE