SessionNotCreatedException in Selenium: How to Resolve? - testRigor AI-Based Automated Testing Tool (2024)

Turn your manual testers into automation experts! Request a DemoStart testRigor Free

SessionNotCreatedException in Selenium: How to Resolve? - testRigor AI-Based Automated Testing Tool (1)

Pragya Yadav

  • -Resources-

Selenium has stayed synonymous with automation testing for a long. Test scripting in Selenium gets caught up with many types of exceptions.

org.openqa.selenium.SessionNotCreatedException: session not created exception is one that happens explicitly when there is a mismatch or compatibility issue between the browser and WebDriver versions.

When Selenium cannot start a new browser session, SessionNotCreatedException is thrown. In this article, let us look into this exception’s reasons and possible resolution.

Reasons for SessionNotCreatedException in Selenium

  • Browser and WebDriver Versions are Incompatible

    This is the most common cause of SessionNotCreatedException in Selenium. For example, the browser version for Chrome and Firefox is incompatible with their corresponding WebDrivers like ChromeDriver and GeckoDriver.

    Example: You have updated the Chrome browser to version 114 during the latest version update but missed updating the ChromeDriver version and using version 112.

  • WebDriver Path is Incorrect

    If you have incorrectly set the WebDriver executable path in the Selenium script, this exception will be thrown. Selenium cannot interact with the WebDriver and cannot start the session.

    Example: You have set the path to ChromeDriver as C:\Drivers\ChromeDriver.exe in your Selenium script, but the actual path where ChromeDriver is located is C:\SeleniumDrivers\ChromeDriver.exe. This discrepancy can result in a SessionNotCreatedException.

  • Browser or WebDriver Installation is Corrupted

    If your browser and WebDriver installation are not complete/corrupted, then Selenium may not create a new session.

    Example: The ChromeDriver executable wasn’t completely downloaded due to a network issue.

  • Restrictive WebDriver Permission

    Sometimes, WebDriver might not have the necessary permissions to execute due to security settings.

    Example: You downloaded GeckoDriver from the internet on a Windows machine, then tried to run it without administrative rights. This might cause the exception because Selenium cannot start a new session.

  • Error in WebDriver Initialization

    This exception may occur if you have not initialized the WebDriver with the required capabilities in your Selenium script.

    Example: Incorrectly trying to set an option that doesn’t exist or is wrongly formatted in ChromeOptions().

    Another example is when your code looks like below, where you have created a driver instance before setting up the property:

    WebDriver driver = new ChromeDriver();System.setProperty ("webdriver.chrome.driver", "C:\\driver\\chromedriver.exe");

    You have to setProperty first and then create a driver instance next to resolve the exception.

    System.setProperty("webdriver.chrome.driver", "C:\\driver\\chromedriver.exe");WebDriver driver = new ChromeDriver();
  • Unsupported Browser Features

    An exception occurs when trying to run a browser feature in an older version that does not support that feature.

    Example: You are using Selenium to automate web application tests that utilize a very recent HTML5 feature, such as ‘Web Bluetooth API’ on Chrome version 70. Here, the exception occurs because the Chrome browser can not process the feature correctly.

How to Resolve SessionNotCreatedException?

Resolutions for SessionNotCreateException are as follows:

  • Check the Compatibility of the Browser and WebDriver: Browsers get frequent updates, so make sure the updated version is compatible with the existing WebDriver version. For example, you can download the latest ChromeDriver from the official website. Download the GeckoDriver from the GitHub repository.
  • Correct the Path to WebDriver: Check that the path specified for the WebDriver is correct or the WebDriver executable is present in the specified path. If not, correct the path. Also, check if the path to the WebDriver is added to your system’s PATH environment variable. If not, add it manually.
  • Re-download WebDriver: If there were issues with the WebDriver download and it got corrupted. Then, re-download and install the WebDriver executable to resolve the exception.
  • Provide the Permissions: The exception occurs when WebDriver lacks the required running permissions. Change the permission for WebDriver so that it can run properly. On Unix systems, this might involve using chmod to make it executable.
  • Correct WebDriver Initialization: Use the required accurate capabilities during the WebDriver initialization.
  • Use WebDrivermanager: By using WebDriverManager in your Selenium project, you can automatically manage the WebDriver binaries. Add the WebDriverManager dependency to your project and use it to set up the WebDriver.
  • Restart Your System: In some cases, simply restarting your computer can resolve the exception, especially after you have installed updates. In some cases, memory overuse occurs, and Selenium fails to open a session. In such cases, the system restart works well.
  • Check for Other Errors: Sometimes, SessionNotCreatedException can be caused by other underlying issues in your Selenium setup or script. Review the complete error message and stack trace for any additional clues.
  • Seek Help on Forums: If you still face issues, consider seeking help on forums like Stack Overflow. Provide details about your browser version, WebDriver version, and the error message you are encountering, and the community will help.

How can Generative AI and NLP Help?

When Artificial Intelligence is transforming every domain and industry, test automation is no exception. If you are using the Selenium framework for testing activities, use AI to transform your existing Selenium framework.

The plethora of Selenium exceptions and other disadvantages have caused organizations to seek better alternatives. Here are the 11 reasons why not to use Selenium for automation testing.

A more straightforward and optimized solution is using intelligent AI-powered test automation tools such as testRigor. It is a codeless testing tool where you can write your test cases in plain English. testRigor’s NLP-based capabilities let you write your test cases quickly without prior programming language knowledge. Everyone on your team can write and execute test cases. How liberating it is!

With testRigor, you need not identify UI elements with XPath/CSS paths. Just use the UI element text that you see on the UI. Here is an example:

enter "TV" into "Search"enter enterclick "TV"click "Add To Cart"check that page contains "Item Added To Cart"

As you can see, writing test cases in testRigor is super easy and quick through its generative AI capabilities. You can also use the recorder to record your UI actions, and testRigor generates test cases in plain English.

Easily integrate testRigor into your existing testing workflow, as testRigor supports integrations with all significant test management, test reporting, ERP, CRM, and infrastructure providers.

Conclusion

You can resolve Selenium SessionNotCreatedException by addressing compatibility issues between the browser and the WebDriver, correcting configuration mistakes, or updating your testing environment.

However, if you want to bypass all these configuration overheads and focus on creating robust tests, use intelligent tools such as testRigor instead. Where you need not worry about the configurations and updates, testRigor handles all cross-browser, cross-platform, API, web, mobile, and desktop testing singlehandedly.

Join the next wave of functional testing now.

A testRigor specialist will walk you through our platform with a custom demo.

Request a Demo

Start testRigor Free

SessionNotCreatedException in Selenium: How to Resolve? - testRigor AI-Based Automated Testing Tool (2024)
Top Articles
The Home Depot Completes Acquisition of HD Supply
Dara McAnulty: A day in the life of a naturalist in lockdown
Xre-02022
Ups Dropoff Location Near Me
Faridpur Govt. Girls' High School, Faridpur Test Examination—2023; English : Paper II
What to Do For Dog Upset Stomach
Craigslist Mexico Cancun
Learn How to Use X (formerly Twitter) in 15 Minutes or Less
Sams Gas Price Fairview Heights Il
Little Rock Arkansas Craigslist
Slushy Beer Strain
Michaels W2 Online
Wizard Build Season 28
10-Day Weather Forecast for Florence, AL - The Weather Channel | weather.com
Missed Connections Inland Empire
Johnnie Walker Double Black Costco
Jordan Poyer Wiki
Sienna
The 15 Best Sites to Watch Movies for Free (Legally!)
Smartfind Express Login Broward
Hrconnect Kp Login
Speechwire Login
Pokemon Inflamed Red Cheats
Login.castlebranch.com
Federal Express Drop Off Center Near Me
Jail Roster Independence Ks
Experity Installer
Sam's Club Near Wisconsin Dells
Donald Trump Assassination Gold Coin JD Vance USA Flag President FIGHT CIA FBI • $11.73
Clearvue Eye Care Nyc
Nail Salon Open On Monday Near Me
Capital Hall 6 Base Layout
Haley Gifts :: Stardew Valley
All Things Algebra Unit 3 Homework 2 Answer Key
Orangetheory Northville Michigan
Terrier Hockey Blog
拿到绿卡后一亩三分地
Gets Less Antsy Crossword Clue
The disadvantages of patient portals
Ferguson Employee Pipeline
Weather Underground Corvallis
Skyward Marshfield
How I Passed the AZ-900 Microsoft Azure Fundamentals Exam
2Nd Corinthians 5 Nlt
Mynord
Gas Buddy Il
Wisconsin Volleyball titt*es
Washington Craigslist Housing
What Time Do Papa John's Pizza Close
Obituary Roger Schaefer Update 2020
Cheryl Mchenry Retirement
Texas 4A Baseball
Latest Posts
Article information

Author: Prof. Nancy Dach

Last Updated:

Views: 5859

Rating: 4.7 / 5 (77 voted)

Reviews: 92% of readers found this page helpful

Author information

Name: Prof. Nancy Dach

Birthday: 1993-08-23

Address: 569 Waelchi Ports, South Blainebury, LA 11589

Phone: +9958996486049

Job: Sales Manager

Hobby: Web surfing, Scuba diving, Mountaineering, Writing, Sailing, Dance, Blacksmithing

Introduction: My name is Prof. Nancy Dach, I am a lively, joyous, courageous, lovely, tender, charming, open person who loves writing and wants to share my knowledge and understanding with you.