英文:
SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 114 using latest Chromium v116.0
问题
尝试在Linux机器上使用ChromeDriverManager运行Selenium与Chromium。
错误消息:
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 114
Chromium信息:
$ chrome --version
Chromium 116.0.5826.0
$ which chrome
/usr/local/bin/chrome
Python代码:
from selenium import webdriver
from selenium.webdriver.chrome.service import Service as ChromiumService
from webdriver_manager.chrome import ChromeDriverManager
from webdriver_manager.core.utils import ChromeType
chromium_driver = ChromeDriverManager(chrome_type=ChromeType.CHROMIUM).install()
driver = webdriver.Chrome(service=ChromiumService(chromium_driver))
driver.get("http://www.justinbieber.sucks")
driver.quit()
错误消息明显表明这是一个版本/兼容性问题(Chromium和ChromeDriver之间的问题),但似乎还没有适用于Chromium 16.0的ChromeDriver。此外,我也无法找到Chromium 14的下载链接。ChromeDriverManager也没有提供太多帮助。
英文:
Trying to run Selenium with Chromium (through ChromeDriverManager) on a Linux machine.
Error message:
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 114
Chromium info:
$ chrome --version
Chromium 116.0.5826.0
$ which chrome
/usr/local/bin/chrome
Python code:
from selenium import webdriver
from selenium.webdriver.chrome.service import Service as ChromiumService
from webdriver_manager.chrome import ChromeDriverManager
from webdriver_manager.core.utils import ChromeType
chromium_driver = ChromeDriverManager(chrome_type=ChromeType.CHROMIUM).install()
driver = webdriver.Chrome(service=ChromiumService(chromium_driver))
driver.get("http://www.justinbieber.sucks")
driver.quit()
The error message makes it obvious that this is a version/compatibility issue (between Chromium and ChromeDriver), but there doesn't seem to be a ChromeDriver for Chromium 16.0 yet. Also, I can't for the love of God find a download link for Chromium 14. ChromeDriverManager is not helping a lot either.
答案1
得分: -1
这个错误消息...
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 114
...意味着 [tag:chromium] 和 ChromeDriver 版本之间存在不兼容性。
这个用例
最新的 ChromeDriver 版本是 v114.0.5735.90,您必须相应降级 Chromium 浏览器版本。
解决方案
要在 Linux 上下载、安装和使用特定版本的 Chrome / Chromium,您需要按照 下载 Chromium 页面上的相关步骤进行操作:
> 下载旧版本的 Chrome / Chromium,假设您想要一个 Chrome 44 的版本用于调试。谷歌不提供旧版本,因为它们没有最新的安全修复。
>
> 但是,您可以获取一个 Chromium 44.x 的版本,它应该大致与稳定版本相匹配。
>
> 下面是如何查找它的方法:
>
> 查看 https://googlechromereleases.blogspot.com/search/label/Stable,找到最后一次提到 "44." 的时间。查找该版本的历史("44.0.2403.157"),在这种情况下,它返回一个基本位置 "330231"。这是 44 版本的分支位置,回溯到 2015 年 5 月。* 打开连续构建存档,单击您的平台(Linux/Mac/Win),将 "330231" 粘贴到顶部的筛选字段中,并等待所有结果 XHR 进来。最终我找到了完美的命中:https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Mac/330231/。有时您可能需要递减提交编号,直到找到一个。下载并运行!
>
> * 由于这个版本是在 44 分支点制作的,所以在 beta 版中没有合并任何提交。
>
> 通常这是可以的,但如果您需要一个真正的 "44.0.2403.x" 版本,那么您需要从 2403 分支构建 Chromium。一些 PortableApps/PortableChromium 网站提供了这样的二进制文件,但出于安全原因,Chrome 团队不建议运行它们。
英文:
This error message...
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 114
...implies that there is a version incompatibility between [tag:chromium] and ChromeDriver version.
This usecase
The latest ChromeDriver being v114.0.5735.90 you have to downgrade the Chromium browser version accordingly.
Solution
To download, install and use a specific version of Chrome / Chromium on Linux you need to follow the relevant steps from the Download Chromium page:
> Downloading old builds of Chrome / Chromium Let's say you want a build
> of Chrome 44 for debugging purposes. Google does not offer old builds
> as they do not have up-to-date security fixes.
>
> However, you can get a build of Chromium 44.x which should mostly
> match the stable release.
>
> Here's how you find it:
>
> Look in https://googlechromereleases.blogspot.com/search/label/Stable
> updates for the last time "44." was mentioned. Loop up that version
> history ("44.0.2403.157") in the Position Lookup In this case it
> returns a base position of "330231". This is the commit of where the
> 44 release was branched, back in May 2015.* Open the continuous builds
> archive Click through on your platform (Linux/Mac/Win) Paste "330231"
> into the filter field at the top and wait for all the results to XHR
> in. Eventually I get a perfect hit:
> https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Mac/330231/
> Sometimes you may have to decrement the commit number until you find
> one. Download and run!
> * As this build was made at 44 branch point, it does not have any commits merged in while in beta.
>
> Typically that's OK, but if you need a true build of "44.0.2403.x"
> then you'll need to build Chromium from the 2403 branch. Some
> PortableApps/PortableChromium sites offer binaries like this, due to
> security concerns, the Chrome team does not recommend running them.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论