org.openqa.selenium.SessionNotCreatedException: session not created exception

社会主义新天地 提交于 2019-12-17 23:26:58

问题


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?


回答1:


Update your chromedriver with lastest version. And please clarify your question.

https://chromedriver.storage.googleapis.com/index.html?path=2.24/




回答2:


If your chrome browser is recently updated to V54.0.x, then you might get this error. The solution for this problem is simply to update your chrome driver.

Choose chrome driver from the below link that will suit your system architecture.

Latest Chromedriver v2.25




回答3:


This issue started showing up after chrome Version 54.0.x updates. Remove the older chromedriver from your path and update your chromedriver to 2.24. This should resolve your issue.




回答4:


I had the same issue . Updating the chrome driver solved my problem.




回答5:


A few things to bare in mind for these type of cases:

  • Disable browsers auto update - at least on your slaves to avoid these type of breaking your CI process. Link for how to on Chrome, and be sure to watch these settings on the installation.
  • Versioning is the first thing to check with Selenium when it breaks all of a sudden. See notes for version compatibility.
  • I'm using my own Maven plugin to check compatibility between chromedriver and Chrome version

Hope it helps...




回答6:


You might be using the lower version of the chrome driver.

org.openqa.selenium.SessionNotCreatedException: session not created exception

I had the similar issue and was getting the exception as above. So always check the latest version of driver from here: https://sites.google.com/a/chromium.org/chromedriver/downloads




回答7:


You might need to set in /etc/hosts

127.0.0.1  localhost



回答8:


In my case the problem was that I kept a Selenium script running for too much time than I run out of disk free space.

So, I just clean out the Temp folder and created a routine to keep cleaning selenium folders, and problem solved.




回答9:


You will get this error when your code looks like below:

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

You have to setProperty first and then create driver instance next

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


来源:https://stackoverflow.com/questions/40067849/org-openqa-selenium-sessionnotcreatedexception-session-not-created-exception

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!