英文:
Problem with ChromeDriver in Selenium 3.141.59
问题
我正在使用版本为3.141.59的Java Selenium,但代码无法启动Chromium实例,而是抛出异常:
> 嵌套异常为org.openqa.selenium.SessionNotCreatedException:
> 会话未创建:此版本的ChromeDriver仅支持Chrome版本81
该代码在Ubuntu 18.04上运行,使用OpenJDK Runtime Environment(构建版本1.8.0_252-8u252-b09-1~18.04-b09),并且Chromium和ChromeDriver的版本应匹配:
chromium-browser --version
Chromium **81.0.4044.138**,构建于Ubuntu,运行在Ubuntu 18.04
chromedriver --version
ChromeDriver **81.0.4044.138**(8c6c7ba89cc9453625af54f11fd83179e23450fa-refs/branch-heads/4044@{#999})
两者都在运行此代码的用户的$PATH中:
which chromedriver
/usr/bin/chromedriver
which chromium-browser
/usr/bin/chromium-browser
我还尝试了Selenium版本4.0.0-alpha-5,但这并没有改变行为。
我还尝试了System.setProperty("webdriver.chrome.driver", "/usr/bin/chromedriver"),但也没有帮助。
非常感谢您的帮助。
英文:
I'm using Selenium for Java in version 3.141.59 and the code is unable to start a chromium instance but throws an exception:
> nested exception is org.openqa.selenium.SessionNotCreatedException:
> session not created: This version of ChromeDriver only supports Chrome
> version 81
The code is running on Ubuntu 18.04 with OpenJDK Runtime Environment (build 1.8.0_252-8u252-b09-1~18.04-b09) and the chromium and chromedriver versions should fit:
chromium-browser --version
Chromium 81.0.4044.138 Built on Ubuntu , running on Ubuntu 18.04
chromedriver --version
ChromeDriver 81.0.4044.138 (8c6c7ba89cc9453625af54f11fd83179e23450fa-refs/branch-heads/4044@{#999})
Both are in $PATH for the user running this code:
which chromedriver
/usr/bin/chromedriver
which chromium-browser
/usr/bin/chromium-browser
I also tried the Selenium version 4.0.0-alpha-5 but this didn't change the behaviour.
I also tried System.setProperty("webdriver.chrome.driver", "/usr/bin/chromedriver"), which didn't help either.
Any help is appreciated.
答案1
得分: 0
我发现了问题:只有在版本冲突时才会出现这个问题,我查看了是否安装了不同的版本:
dpkg -l | grep chrome
ii chromium-chromedriver 81.0.4044.138-0ubuntu0.18.04.1 amd64 用于Chromium浏览器的WebDriver驱动程序
ii google-chrome-stable 83.0.4103.61-1 amd64 来自谷歌的网页浏览器
一个简单的
dpkg --purge google-chrome-stable
解决了这个问题。
英文:
I found the problem: as this only happens when there are version conflicts, I looked up if there are any different versions installed:
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
A simple
dpkg --purge google-chrome-stable
solved the problem.
答案2
得分: 0
你能尝试将 chromedriver 放到 /usr/local/bin 中吗?然后运行命令 "sudo chmod +x chromedriver"。
英文:
Can you try putting chromedriver in /usr/local/bin? then run "sudo chmod +x chromedriver"
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论