gpt4 book ai didi

selenium - 无法开始新 session 。响应代码 500。消息 : session not created: This version of ChromeDriver only supports Chrome version 105

转载 作者:行者123 更新时间:2023-12-05 08:03:24 26 4
gpt4 key购买 nike

我正在开发一个使用 selenium 的应用程序。

  • 操作系统:带有 Apple Silicon 的 macOS
  • 语言: Kotlin
  • JDK:Java 18

但它失败了。

输出

Starting ChromeDriver 105.0.5195.19 (b9c217c128c16f53d12f9a02933fcfdec1bf49af-refs/branch-heads/5195@{#176}) on port 50362
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
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 105
Current browser version is 104.0.5112.79 with binary path /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
Build info: version: '4.4.0', revision: 'e5c75ed026a'
System info: host: 'mymac.local', ip: '2400:2200:6f0:7919:347b:3223:3841:9545%en0', os.name: 'Mac OS X', os.arch: 'aarch64', os.version: '12.3', java.version: '18.0.2'
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:144)
......

build.gradle.kts

dependencies {
testImplementation(kotlin("test"))
implementation(compose.desktop.currentOs)

// Selenium
// https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java
implementation("org.seleniumhq.selenium:selenium-java:4.4.0")
// https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-chrome-driver
implementation("org.seleniumhq.selenium:selenium-chrome-driver:4.4.0")
}

代码

fun launch() {
System.setProperty(
"webdriver.chrome.driver",
"/driver/path/chromedriver"
);
ChromeDriver();
}

Chrome 驱动程序版本 105.0.5195.19 是我保存在 /driver/path/chromedriver 的驱动程序之一。104.0.5112.79 是我在 macOS 上安装的 Chrome 版本。

我必须使用 chromedriver 版本 104 吗?或者有什么方法可以使用 105 版本之一吗?

我不确定为什么在设置 webdriver.chrome.driver 时需要 macOS 上的 chrome 版本。

最佳答案

您可以检查您当前的 google chrome 版本,如果不是 105,您可以更新。

在我的例子中是:

版本 104.0.5112.102

或者另一种解决方案是降级 chrome 驱动程序

关于selenium - 无法开始新 session 。响应代码 500。消息 : session not created: This version of ChromeDriver only supports Chrome version 105,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73337711/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com