Testing Whiz Home / Video /

30 Common Selenium Exceptions And How To Handle Them | LambdaTest

30 Common Selenium Exceptions And How To Handle Them | LambdaTest

...Playlist

...

About The Video

Learn what is Stale Element Reference Exception in Selenium, its causes, and strategies to overcome it effectively.

Video Chapters

00:04 - Introduction to Selenium Exceptions

00:17 - Element Click Interception Exception

00:32 - Element Not Interactable Exception

02:19 - Element Not Selectable Exception

04:16 - Element Not Visible Exception

05:53 - Insecure Certification Exception

08:24 - Unable to Set Cookie Exception

08:39 - Invalid Cookie Domain Exception

10:21 - Invalid Coordinates Exception

11:29 - Invalid Element State Exception

11:35 - Invalid Session ID Exception

12:32 - Invalid Switch to Target Exception

13:26 - JavaScript Exception

14:45 - Move Target Out of Bounds Exception

15:12 - No Alert Present Exception

16:08 - No Such Attribute Exception

17:06 - No Such Cookie Exception

18:28 - No Such Element Exception

19:02 - Invalid Selector Exception

20:04 - No Such Frame Exception

20:30 - No Such Window Exception

21:12 - Remote Driver Server Exception

21:57 - Stale Element Reference Exception

23:39 - Timeout Exception

25:01 - Unexpected Alert Present Exception

26:06 - WebDriver Quit & No Such Session Exception

27:02 - WebDriver Exception

28:01 - Unable to Locate Host Exception

29:12 - Element Not Enabled Exception

30:13 - Custom Exception Handling in Java

31:13 - Best Practices for Exception Handling

Key Topics Covered

Introduction to Selenium Exceptions Selenium exceptions occur when the WebDriver fails to execute a command due to various issues like incorrect element interaction or invalid session states. Understanding these exceptions is crucial for creating stable and reliable automation tests.

Element Click Interception Exception This happens when a click action is blocked due to another overlaying element. It can be resolved by using explicit waits or ensuring the element is fully visible before clicking.

Element Not Interactable Exception Occurs when an element is present in the DOM but cannot be interacted with. Handling it involves waiting for visibility and using JavaScript executor for certain interactions.

Element Not Selectable Exception Thrown when trying to select a disabled or hidden element. The solution is to check the element’s state before attempting any interaction.

Element Not Visible Exception Occurs when an element exists in the DOM but is not visible for interaction. Using explicit waits ensures the element becomes visible before performing actions.

Insecure Certification Exception Happens when navigating to a website with invalid SSL certificates. It can be bypassed using Chrome DevTools Protocol (CDP) or browser-specific settings.

Unable to Set Cookie Exception Occurs when WebDriver fails to set a cookie due to domain mismatches. Ensuring the correct domain and using appropriate cookie management techniques can fix this.

Invalid Coordinates Exception Thrown when performing an action using incorrect screen coordinates. This can be avoided by maximizing the browser window and verifying element positions before execution.

Invalid Element State Exception Happens when an element is not in an appropriate state for interaction. It is handled by checking the element’s state before performing any operations.

Invalid Session ID Exception Occurs when trying to interact with a session that is no longer active. Proper session management and ensuring the WebDriver quits properly help prevent this.

No Such Element Exception Thrown when Selenium cannot locate an element. This can be resolved by verifying locators and using implicit or explicit waits for dynamic elements.

No Such Window Exception Occurs when attempting to switch to a window that no longer exists. Using getWindowHandles() ensures that the target window is still available.

Remote Driver Server Exception Happens due to issues with the Selenium Grid remote server. Checking server logs and configurations can help identify and fix the problem.

Session Not Created Exception Occurs when WebDriver fails to create a session due to outdated drivers or browser mismatches. Keeping drivers updated and ensuring compatibility resolves this.

Stale Element Reference Exception Happens when an element is removed from the DOM before an action is performed. The fix is to re-locate the element before executing commands.

Timeout Exception Occurs when a command takes longer than the specified time to execute. Using appropriate implicit or explicit waits helps in handling this exception.

Unexpected Alert Exception Happens when an unexpected pop-up alert appears during execution. Using try-catch blocks and handling alerts in the script can resolve this.

WebDriver Exception A general exception that occurs when WebDriver fails to execute commands. Ensuring correct browser-driver configuration and handling failures properly prevents this issue.

No Such Session Exception Occurs when commands are executed after the browser session has been closed. Managing the WebDriver lifecycle properly helps in avoiding this issue.

Custom Exception Handling in Selenium Creating well-structured exception messages improves debugging and test clarity. Formatting output messages properly helps in analyzing test failures efficiently.

More Videos from Testing Whiz

LT Video

30 Common Selenium Exceptions And How To Handle Them | LambdaTest

Testing Whiz
LT Video

What is a Stale Element Reference Exception? | LambdaTest

Testing Whiz
LT Video

Top Automation Testing Tools for 2025 | LambdaTest

Testing Whiz
LT Video

Test Observability: Debug Your Tests Faster | LambdaTest

Testing Whiz
LT Video

Benefits of Shift Left and Shift Right Testing | LambdaTest

Testing Whiz
LT Video

Understanding Selenium Locators: Identify Web Elements with Ease | LambdaTest

Testing Whiz
LT Video

Test Execution Reporting: Tools, Trends, and Best Practices | LambdaTest

Testing Whiz
LT Video

Contract Testing: Key Approaches and Best Practices | LambdaTest

Testing Whiz
LT Video

Performance Testing: Backend & Frontend Strategies | LambdaTest

Testing Whiz
LT Video

How to Test Cookies on a Website? | LambdaTest

Testing Whiz
LT Video

How to Handle Alerts in Selenium | LambdaTest

Testing Whiz
LT Video

How to Handle Alerts in Selenium | LambdaTest

Testing Whiz
LT Video

Setting Up JUnit 4 Dependency | LambdaTest

Testing Whiz
LT Video

Selenium Vs Cypress Vs Playwright: Key Differences at a Glance | LambdaTest

Testing Whiz
LT Video

Understanding Playwright Selectors | LambdaTest

Testing Whiz
LT Video

Understanding Implicit Waits in Selenium | LambdaTest

Testing Whiz
LT Video

Automating Build and Publish with Jenkins & GitHub | LambdaTest

Testing Whiz
LT Video

Finding Elements Using WebdriverIO Selectors | LambdaTest

Testing Whiz
LT Video

Promises in JavaScript | LambdaTest

Testing Whiz
LT Video

Why Async and Await Are Crucial in WebdriverIO Testing | LambdaTest

Testing Whiz
LT Video

Impact of User-Centric Testing on Product Quality and Customer Satisfaction | LambdaTest

Testing Whiz
LT Video

Most Used Git Commands | LambdaTest

Testing Whiz
LT Video

Use Cases of Machine Learning | LambdaTest

Testing Whiz
LT Video

AI Use Cases in Software Testing | LambdaTest

Testing Whiz
LT Video

What are TestNG Annotations? | LambdaTest

Testing Whiz
LT Video

Difference between JUnit 4 and JUnit 5 | LambdaTest

Testing Whiz
LT Video

How to Convert Test Scripts From JUnit 4 To JUnit 5 | LambdaTest

Testing Whiz
LT Video

Key features of WebdriverIO Waits | LambdaTest

Testing Whiz
LT Video

Impact of Generative AI on Testing | LambdaTest

Testing Whiz
LT Video

JUnit 5 Architecture | LambdaTest

Testing Whiz
LT Video

What are WebSockets? | LambdaTest

Testing Whiz
LT Video

The Role of Human Testing in Quality Assurance | LambdaTest

Testing Whiz
LT Video

What is Jenkins Pipeline | LambdaTest

Testing Whiz
LT Video

Best Tools for Software Developers | LambdaTest

Testing Whiz
LT Video

What Are the Challenges in Test Automation? | LambdaTest

Testing Whiz
LT Video

Strategies for Accelerating Feedback | LambdaTest

Testing Whiz
LT Video

What is Modal Dialog Box? | LambdaTest

Testing Whiz
LT Video

Importance of Manual Testing | LambdaTest

Testing Whiz
LT Video

AI-Driven Strategies in Software Testing | LambdaTest

Testing Whiz
LT Video

What Are Flaky Tests And Where Do They Come From? | LambdaTest

Testing Whiz
LT Video

Difference Between Hard Assert & Soft Assert in pytest | LambdaTest

Testing Whiz
LT Video

What are JUnit Annotations| LambdaTest

Testing Whiz
LT Video

What is Quality-Driven Development (QDD)| LambdaTest

Testing Whiz
LT Video

How to Apply Timeout to The Class? | LambdaTest

Testing Whiz
LT Video

What Are Different Selenium Wait Methods | LambdaTest

Testing Whiz
LT Video

What is JUnit 5? | LambdaTest

Testing Whiz
LT Video

Role of Artificial Intelligence (AI) in Software Testing | LambdaTest

Testing Whiz
LT Video

What is Appium? | Introduction to Appium | LambdaTest

Testing Whiz
LT Video

What is Parameterization? | LambdaTest

Testing Whiz
LT Video

How to build a Test Automation Strategy? | LambdTest

Testing Whiz
LT Video

What is Maven Jenkins Plugin? | LambdTest

Testing Whiz
LT Video

GitHub vs Git Flow Explained | LambdaTest

Testing Whiz
LT Video

What are Progressive Web Apps?| LambdaTest

Testing Whiz
LT Video

What is a JavaScript alert?| LambdaTest

Testing Whiz
LT Video

What are Alerts in Playwright? | LambdaTest

Testing Whiz
LT Video

What is Localization? | LambdaTest

Testing Whiz
LT Video

What is the 'git add' command? | LambdaTest

Testing Whiz
LT Video

What is UI Testing? | LambdaTest

Testing Whiz
LT Video

What is Responsive Testing? | LambdaTest

Testing Whiz
LT Video

What is Shift Left Testing? | LambdaTest

Testing Whiz
LT Video

WebDriver Bidi Unveiled: What's New & How to Use It! | LambdaTest

Testing Whiz
LT Video

What are Web Components? | LambdaTest

Testing Whiz
LT Video

What is Shadow DOM? | LambdaTest

Testing Whiz
LT Video

What is Headless Testing | LambdaTest

Testing Whiz
LT Video

What is JUnit? | LambdaTest

Testing Whiz
LT Video

What is pytest? | LambdaTest

Testing Whiz
LT Video

What is a Window in Selenium | LambdaTest

Testing Whiz
LT Video

What is Page Object Model? | LambdaTest

Testing Whiz
LT Video

What is an Emulator? | LambdaTest

Testing Whiz
LT Video

What Is TestNG | LambdaTest

Testing Whiz
LT Video

What Is Mocha | LambdaTest

Testing Whiz
LT Video

What Is Playwright 🎭 | LambdaTest

Testing Whiz
LT Video

What Is Cypress | LambdaTest

Testing Whiz