简体   繁体   中英

org.openqa.selenium.SessionNotCreatedException: Message: Could not start a new session. Response code 500 error using Selenium Java

A window appears after launch and immediately disappears, I can not understand what's wrong. Google except for the latest version, selenium is also set to the LATEST parameter (nothing changes with a specific version).

Error:

org.openqa.selenium.SessionNotCreatedException: Message:  Could not start a new session. Response code 500. Message: session not created

Code:

代码

Error:错误

更新你的chromedriver版本,看来你的浏览器和浏览器当前驱动版本不一样。

https://chromedriver.storage.googleapis.com/index.html?

This error message...

org.openqa.selenium.SessionNotCreatedException: Message:  Could not start a new session. Response code 500. Message: session not created:
.
Driver info: org.openqa.selenium.chrome.ChromeDriver

...implies that the ChromeDriver was unable to initiate/spawn a new Browsing Context ie session.

Your main issue is the incompatibility between the version of the binaries you are using as follows:

  • You are using chrome=99.0
  • Release Notes of ChromeDriver v99.0 clearly mentions the following :

Supports Chrome version 99

  • But your chromedriver version is not getting detected.

Driver info: org.openqa.selenium.chrome.ChromeDriver

  • Your JDK version 1.8.0_281 is also old and ancient.

So most possibly there is a mismatch between jdk version , chromedriver version and the chrome=99.0


Solution

Ensure that:

总之,出现这样的问题需要安装之前版本的web驱动

If some one is on linux,

some distros install /usr/bin/google-chrome-stable, web driver manager tries to retry the version of chrome with the command

/usr/bin/google-chrome --version

Since that bin does not exists, is going to fail; The solution is very simple just a simbolic link to google-chrome

# ln -s /usr/bin/google-chrome-stable /usr/bin/google-chrome

More than an answer this continues with the question.

I'm using serenity-bdd with the following characteristics:

  • Ubuntu: 22.04.1
  • Google-Chrome: 106.0.5249.103
  • Chrome driver: 106.0.5249.61

And the generated message error is:

 <<< ERROR..net.thucydides.core.webdriver:DriverConfigurationError. Could not instantiate class org.openqa.selenium.chrome:ChromeDriver Caused by..net.thucydides.core.webdriver:DriverConfigurationError. Could not instantiate new WebDriver instance of type class org.openqa.selenium.chrome.ChromeDriver (Could not start a new session. Response code 500: Message: unknown error: Chrome failed to start. exited abnormally: (unknown error, DevToolsActivePort file doesn't exist) (The process started from chrome location /usr/bin/google-chrome is no longer running. so ChromeDriver is assuming that Chrome has crashed.)

Was trying with different driver combinations and none of them are working. Funny enough when i run on windows with the same configuration all works.

Starting ChromeDriver 109.0.5414.74 (e7c5703604daa9cc128ccf5a5d3e993513758913-refs/branch-heads/5414@{#1172}) on port 48484 Only local connections are allowed. Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe. ChromeDriver was started successfully. Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: unknown error: Failed to create Chrome process. Host info: host: 'A-LAPTOP', ip: '192. .0. ' Build info: version: '4.7.2', revision: '4d4020c3b7' System info: os.name: 'Windows 11', os.arch: 'amd64', os.version: '10.0', java.version: '17.0.5' Driver info: org.openqa.selenium.chrome.ChromeDriver Command: [null, newSession {capabilities=[Capabilities {browserName: chrome, goog:chromeOptions: {args: [], extensions: []}}], desiredCapabilities=Capabilities {browserName: chrome, goog:chromeOptions: {args: [], extensions: []}}}] at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:148) at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:106) at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:67) at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:156) at org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute(DriverCommandExecutor.java:167) at o rg.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:142) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:535) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:228) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:156) at org.openqa.selenium.chromium.ChromiumDriver.(ChromiumDriver.java:101) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:82) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:50) at com.project.skyfall.Browser_Drivers.main(Browser_Drivers.java:13)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

Related Question org.openqa.selenium.SessionNotCreatedException: Message: Could not start a new session. Response code 500 error using Appium Java org.openqa.selenium.SessionNotCreatedException:Could not start a new session.Response code 500.Message:unknown error: Failed to create Chrome process org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Error while creating session with the driver service-docker container SessionNotCreatedException: Could not start a new session. Response code 500 error using Selenium Java and WebDriverManager through pom.xml org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. while initializing android driver in emulator org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: 'java -version' failed. Error: spawn ENOENT) org.openqa.selenium.SessionNotCreatedException: Unable to create session error using GeckoDriver and Firefox through Selenium and Java org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: Requested a new session but one was in progress) Could not start a new session. Response code 500. Message: unknown error: DevToolsActivePort file doesn't exist error using Selenium ChromeDriver Java org.openqa.selenium.SessionNotCreatedException
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM