Solution : Session Not Created Exception

5/5 - (1 vote)

I’m trying to run some Selenium tests using the ChromeDriver, and I started getting this error:

Starting ChromeDriver 2.23.409699 (49b0fa931cda1caad0ae15b7d1b68004acd05129) on port 42985 Only local connections are allowed. Exception in thread “main” org.openqa.selenium.SessionNotCreatedException: session not created exception from unknown error: Runtime.executionContextCreated has invalid ‘context’: {“auxData”:{“frameId”:”7576.1″,”isDefault”:true},”id”:1,”name”:””,”origin”:”://”} (Session info: chrome=54.0.2840.59) (Driver info: chromedriver=2.23.409699 (49b0fa931cda1caad0ae15b7d1b68004acd05129),platform=Windows NT 10.0.14393 x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 2.48 seconds Build info: version: ‘unknown’, revision: ‘2aa21c1’, time: ‘2016-08-02 14:59:43 -0700’ System info: host: ‘SUJITH’, ip: ‘192.168.43.228’, os.name: ‘Windows 10’, os.arch: ‘amd64’, os.version: ‘10.0’, java.version: ‘1.8.0_101’ Driver info: org.openqa.selenium.chrome.ChromeDriver at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206) at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:683) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:247) at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:130) at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:143) at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:170) at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:159) at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:116) at Selenium.Test2.main(Test2.java:15)

Why is this happening, and how can I fix it?

Solution:

I understand that encountering errors while running tests can be a bit frustrating. The error you’re facing, org.openqa.selenium.SessionNotCreatedException: session not created exception, is commonly due to a version mismatch between the ChromeDriver and the Chrome browser you’re using.

In your case, you’re using ChromeDriver version 2.23 with Chrome version 54.0.2840.59. This combination seems to be causing the issue. To rectify this, you’ll need to update your ChromeDriver to a version that’s compatible with your current Chrome browser.

Let me guide you through the steps:

  1. Remove the older ChromeDriver: First things first, remove the older version of ChromeDriver from your system path.
  2. Download the latest ChromeDriver: Next, visit the ChromeDriver download page and get the latest version that suits your Chrome browser version.
  3. Add the new ChromeDriver to your path: Finally, add the updated ChromeDriver to your system path.

After you’ve finished these steps, try running your Selenium tests again. The error should be resolved.

However, there could be other reasons for this error as well. For instance, an invalid address of the remote server or a failure in the startup of your browser. So, do ensure the address of your remote server is correct and your browser starts up successfully.

Remember, keeping your testing tools and environment in sync is a key factor for successful test execution. If you face any more issues, don’t hesitate to ask. We’re here to help you navigate through your coding journey, one step at a time.

google-news
Avinash

Avinash is the Founder of Software Testing Sapiens. He is a blogger and Software Tester who has been helping people to get thier Jobs over a years Now.

Leave a Comment

whatsapp-icon
0 Shares
Copy link