gpt4 book ai didi

java - Selenium 3.141.59 中的 ChromeDriver 问题

转载 作者:行者123 更新时间:2023-12-01 16:29:20 25 4
gpt4 key购买 nike

我在版本 3.141.59 中使用 Selenium for Java,代码无法启动 chromium 实例,但会引发异常:

nested exception is org.openqa.selenium.SessionNotCreatedException: session not created: This version of ChromeDriver only supports Chrome version 81

代码在具有 OpenJDK 运行时环境(版本 1.8.0_252-8u252-b09-1~18.04-b09)的 Ubuntu 18.04 上运行,并且 chromium 和 chromedriver 版本应该适合:

Chrome 浏览器--版本

Chromium 81.0.4044.138 基于 Ubuntu 构建,在 Ubuntu 18.04 上运行

chromedriver --版本

ChromeDriver 81.0.4044.138 (8c6c7ba89cc9453625af54f11fd83179e23450fa-refs/branch-heads/4044@{#999})

对于运行此代码的用户来说,两者都在 $PATH 中:

哪个 chromedriver

/usr/bin/chromedriver

哪个 chromium 浏览器

/usr/bin/chromium-browser

我还尝试了 Selenium 版本 4.0.0-alpha-5 但这并没有改变行为。我还尝试了 System.setProperty("webdriver.chrome.driver", "/usr/bin/chromedriver"),但这也没有帮助。

感谢任何帮助。

最佳答案

我发现了问题:因为只有在版本冲突时才会发生这种情况,我查看了是否安装了任何不同的版本:

dpkg -l |grep chrome
ii chromium-chromedriver 81.0.4044.138-0ubuntu0.18.04.1 amd64 WebDriver driver for the Chromium Browser
ii google-chrome-stable 83.0.4103.61-1 amd64 The web browser from Google

一个简单的

dpkg --purge google-chrome-stable

解决了问题。

关于java - Selenium 3.141.59 中的 ChromeDriver 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62081174/

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