无法启动新会话。响应代码500。消息:未创建会话:此版本的ChromeDriver仅支持Chrome 114版本。

5

操作系统:Windows Server

语言:Java

Chrome 版本:116.0.5845.97

Chrome 驱动程序版本:116.0.5845.96

输出:

SLF4J: No SLF4J providers were found.
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See https://www.slf4j.org/codes.html#noProviders for further details.
Starting ChromeDriver 114.0.5735.90 (386bc09e8f4f2e025eddae123f36f6263096ae49-refs/branch-heads/5735@{#1052}) on port 10267
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
FAILED CONFIGURATION: @BeforeMethod StartDriver
org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: session not created: This version of ChromeDriver only supports Chrome version 114
Current browser version is 116.0.5845.97 with binary path C:\Program Files\Google\Chrome\Application\chrome.exe 
Host info: host: 'WSAMZN-5U0L0QME', ip: '10.40.2.21'
Build info: version: '4.8.2', revision: '826dbfc730'
System info: os.name: 'Windows Server 2019', os.arch: 'amd64', os.version: '10.0', java.version: '17.0.2'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Command: [null, newSession {capabilities=[Capabilities {acceptInsecureCerts: true, browserName: chrome, goog:chromeOptions: {args: [--disable-notifications, ----disable-gpu, --disable-blink-features, --disable-blink-features=Au..., enable-automation, --no-sandbox, --disable-setuid-sandbox, --disable-infobars, --disable-dev-shm-usage, --disable-browser-side-navi..., --force-device-scale-factor=1, --remote-allow-origins=*, start-maximized, --safebrowsing-disable-down..., safebrowsing-disable-extens...], extensions: [], prefs: {download.default_directory: D:\SeleniumWebdriver\backlo..., download.extensions_to_open: application/exe, download.prompt_for_download: false, safebrowsing.enabled: true}}, pageLoadStrategy: none, unhandledPromptBehavior: accept}], desiredCapabilities=Capabilities {acceptInsecureCerts: true, browserName: chrome, goog:chromeOptions: {args: [--disable-notifications, ----disable-gpu, --disable-blink-features, --disable-blink-features=Au..., enable-automation, --no-sandbox, --disable-setuid-sandbox, --disable-infobars, --disable-dev-shm-usage, --disable-browser-side-navi..., --force-device-scale-factor=1, --remote-allow-origins=*, start-maximized, --safebrowsing-disable-down..., safebrowsing-disable-extens...], extensions: [], prefs: {download.default_directory: D:\SeleniumWebdriver\backlo..., download.extensions_to_open: application/exe, download.prompt_for_download: false, safebrowsing.enabled: true}}, pageLoadStrategy: none, unhandledPromptBehavior: accept}}]
    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:165)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute(DriverCommandExecutor.java:183)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:158)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:543)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:229)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:157)
    at org.openqa.selenium.chromium.ChromiumDriver.<init>(ChromiumDriver.java:101)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:88)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:84)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:73)
    at com.cgw.resources.Base.StartDriver(Base.java:151)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:133)
    at org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:62)
    at org.testng.internal.ConfigInvoker.invokeConfigurationMethod(ConfigInvoker.java:385)
    at org.testng.internal.ConfigInvoker.invokeConfigurations(ConfigInvoker.java:321)
    at org.testng.internal.TestInvoker.runConfigMethods(TestInvoker.java:700)
    at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:527)
    at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:173)
    at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:46)
    at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:824)
    at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:146)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
    at org.testng.TestRunner.privateRun(TestRunner.java:794)
    at org.testng.TestRunner.run(TestRunner.java:596)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:377)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:371)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:332)
    at org.testng.SuiteRunner.run(SuiteRunner.java:276)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1212)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1134)
    at org.testng.TestNG.runSuites(TestNG.java:1063)
    at org.testng.TestNG.run(TestNG.java:1031)
    at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:115)
    at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)

你确定Chrome驱动程序是116版本吗?因为日志显示它是114版本 - Starting ChromeDriver 114.0.5735.90。也许驱动文件的属性指向了错误的位置? - undefined
这是关于新的Chromedriver发布所影响的ew CfT端点的问题,也影响到了WebDriverManager - 在这里查看答案:https://dev59.com/RFh2hooBIXSAPYfQET5Y#76998277 - undefined
8个回答

6
问题:您正在使用不支持最新浏览器的selenium版本(4.8.2)。
解决方案:升级到支持此浏览器版本的最新selenium版本(JAVA为4.11.0,PYTHON为4.11.2)。

这个方法有效。另外,别忘了下载与你的Chrome版本兼容的chromedriver版本。 - undefined

2

2
使用最新版本的工具对我很有效。
使用了最新版本的Selenium。
<dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>4.11.0</version>
</dependency>

使用了最新版本的webdriver管理器。
<dependency>
        <groupId>io.github.bonigarcia</groupId>
        <artifactId>webdrivermanager</artifactId>
        <version>5.4.1</version>
        <scope>test</scope>
</dependency>

https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java https://github.com/bonigarcia/webdrivermanager


是的,对我来说有效。 - undefined

0

升级Selenium版本到最新版,并安装Selenium Manager。


2
不好意思,但我看不出你的“答案”有什么新的内容,它已经在其他答案中提到了。 - undefined

0

这些是所有软件质量保证公司在 Chrome 浏览器更新时面临的常见问题。 我们需要根据 Chrome 浏览器版本(版本:115 或最新版本)更新 chromedriver.exe。

从日志中,我们可以观察到 Chrome 驱动程序版本未更新:

启动 ChromeDriver:114.0.5735.90

当前浏览器版本:116.0.5845.97

注意:如果您已经更新了 Chrome 驱动程序但仍然遇到相同的问题,请检查任务管理器中的 chromedriver.exe 线程并终止它们。 或者在命令提示符中执行以下命令关闭所有 chromedriver.exe 线程并构建应用程序。 "taskkill /F /IM ChromeDriver.exe /T"



0
如果你正在使用Selenide库,也请将其更新到最新版本6.17.1。

你的回答可以通过提供更多支持性信息来改进。请编辑以添加进一步的细节,例如引用或文档,以便他人能够确认你的回答是否正确。你可以在帮助中心找到关于如何撰写好回答的更多信息。 - undefined

0
对我来说,当我尝试更新Selenium和WebDriver的最新版本时,它起作用。
 <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>4.11.0</version>
    </dependency>

最新版本的webdriver管理器
<dependency>
        <groupId>io.github.bonigarcia</groupId>
        <artifactId>webdrivermanager</artifactId>
        <version>5.4.1</version>
        <scope>test</scope>
</dependency>

如果这些文件不在那里的话,也请将文件放在src\test\java目录下。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接