简体   繁体   English

org.openqa.selenium.SessionNotCreatedException:消息:无法启动新的 session。响应代码 500 错误使用 Selenium Java

[英]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. A window 启动后出现并立即消失,我不明白出了什么问题。 Google except for the latest version, selenium is also set to the LATEST parameter (nothing changes with a specific version).谷歌除了最新版本,selenium也设置为LATEST参数(具体版本无变化)。

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. ...意味着ChromeDriver无法启动/产生新的浏览上下文,即会话。

Your main issue is the incompatibility between the version of the binaries you are using as follows:您的主要问题是您使用的二进制文件版本之间的不兼容,如下所示:

  • You are using chrome=99.0您正在使用chrome=99.0
  • Release Notes of ChromeDriver v99.0 clearly mentions the following : ChromeDriver v99.0的发行说明清楚地提到了以下内容:

Supports Chrome version 99支持 Chrome 版本 99

  • But your chromedriver version is not getting detected.但是您的chromedriver版本没有被检测到。

Driver info: org.openqa.selenium.chrome.ChromeDriver驱动程序信息:org.openqa.selenium.chrome.ChromeDriver

  • Your JDK version 1.8.0_281 is also old and ancient.您的JDK版本1.8.0_281也很古老。

So most possibly there is a mismatch between jdk version , chromedriver version and the chrome=99.0所以很可能jdk 版本chromedriver 版本chrome=99.0之间存在不匹配


Solution解决方案

Ensure that:确保这件事:

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

If some one is on linux,如果有人在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-stable,网络驱动程序管理器尝试使用命令重试 chrome 版本

/usr/bin/google-chrome --version

Since that bin does not exists, is going to fail;由于该 bin 不存在,因此将失败; The solution is very simple just a simbolic link to google-chrome解决方案非常简单,只是一个指向 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:我正在使用具有以下特征的 serenity-bdd:

  • Ubuntu: 22.04.1 Ubuntu:22.04.1
  • Google-Chrome: 106.0.5249.103谷歌浏览器:106.0.5249.103
  • Chrome driver: 106.0.5249.61 Chrome 驱动程序: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.当我以相同的配置在 windows 上运行时,这很有趣。

Starting ChromeDriver 109.0.5414.74 (e7c5703604daa9cc128ccf5a5d3e993513758913-refs/branch-heads/5414@{#1172}) on port 48484 Only local connections are allowed.在端口 48484 上启动 ChromeDriver 109.0.5414.74 (e7c5703604daa9cc128ccf5a5d3e993513758913-refs/branch-heads/5414@{#1172}) 仅允许本地连接。 Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.请参阅https://chromedriver.chromium.org/security-considerations以获取有关保持 ChromeDriver 安全的建议。 ChromeDriver was started successfully. ChromeDriver 已成功启动。 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.线程“main”中的异常 org.openqa.selenium.SessionNotCreatedException:无法启动新的 session。响应代码 500。消息:未知错误:无法创建 Chrome 进程。 Host info: host: 'A-LAPTOP', ip: '192.主机信息:主机:'A-LAPTOP',ip:'192。 .0. .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 '构建信息:版本:'4.7.2',修订版:'4d4020c3b7'系统信息:os.name:'Windows 11',os.arch:'amd64',os.version:'10.0',java.version:' 17.0.5' 驱动信息:org.openqa.selenium.chrome.ChromeDriver 命令:[null, newSession {capabilities=[Capabilities {browserName: chrome, goog:chromeOptions: {args: [], extensions: []}}], desiredCapabilities = 能力 {browserName: chrome, goog:chromeOptions: {args: [], extensions: []}}}] 在 org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:148) 在 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) 在 org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute(DriverCommandExecutor.java:167) 在 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) 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)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 org.openqa.selenium.SessionNotCreatedException:消息:无法启动新的 session。使用 Appium Java 时出现响应代码 500 错误 - org.openqa.selenium.SessionNotCreatedException: Message: Could not start a new session. Response code 500 error using Appium Java org.openqa.selenium.SessionNotCreatedException:无法启动新的 session.响应码 500.Message:未知错误:无法创建 Chrome 进程 - 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:无法启动新的 session。 使用驱动程序 service-docker 容器创建 session 时出错 - 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 错误使用 Selenium Java 和 WebDriverManager 通过 pom.xml - SessionNotCreatedException: Could not start a new session. Response code 500 error using Selenium Java and WebDriverManager through pom.xml org.openqa.selenium.SessionNotCreatedException:无法创建新的远程会话。 在模拟器中初始化android驱动程序 - org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. while initializing android driver in emulator org.openqa.selenium.SessionNotCreatedException:无法创建新的会话。 (原始错误:&#39;java -version&#39;失败。错误:产生ENOENT) - org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: 'java -version' failed. Error: spawn ENOENT) org.openqa.selenium.SessionNotCreatedException:无法通过 Selenium 和 Java 使用 GeckoDriver 和 Firefox 创建会话错误 - org.openqa.selenium.SessionNotCreatedException: Unable to create session error using GeckoDriver and Firefox through Selenium and Java org.openqa.selenium.SessionNotCreatedException:无法创建新会话。 (原始错误:请求了一个新会话,但正在进行中) - org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: Requested a new session but one was in progress) 无法启动新的 session。 响应代码 500。消息:未知错误:DevToolsActivePort 文件不存在错误使用 Selenium ChromeDriver Java - 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 - org.openqa.selenium.SessionNotCreatedException
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM