Listen to this blog
Analysing automation script failures using Exception details is an important skill for an automation tester. Selenium and Appium are the most widely used open-source automation testing tools. If you are aware of the Selenium WebDriver Exceptions list, it would put you at ease while troubleshooting failures. As a leading test automation services company, we would like to list Selenium WebDriver exceptions and their reasons.
Unsupported Command Exception This exception is triggered when the Selenium client library sends a command which is unknown to Selenium Server. For example: If you are using a higher version of the Selenium client library which has new commands, then the lower versions of the Selenium Server can’t understand new commands which are sent from the client.
Stale Element Reference Exception The stale element reference error is a WebDriver error that occurs because the referenced web element is no longer attached to the DOM.
Every DOM element is represented in WebDriver by a unique identifying reference, known as a web element. The web element reference is a UUID used to execute commands targetting specific elements, such as getting an element’s tag name and retrieving a property of an element.
When an element is no longer attached to the DOM, i.e. it has been removed from the document or the document has changed, it is said to be stale. Staleness occurs for example when you have a web element reference and the document it was retrieved from navigates.
Reference: Mozilla MDN Web Docs
Invalid Selector Exception If XPath/CSS Selector syntax is invalid, then it will throw Invalid Selector Error. Or if the selector’s expression is not selecting an element e.g. count(//input), then Invalid Selector Exception will be invoked.
Invalid Argument Exception The invalid argument error is a WebDriver error that occurs when the arguments passed to a command are either invalid or malformed.