WebDriverException:消息:使用 ChromeDriver 和 Selenium 在 Raspberry-Pi 上意外退出服务/usr/lib/chromium-browser/chromedriver
问题描述
我编写了一个 python 脚本,它在浏览器中执行一些任务(使用 Selenium),它在 Windows 中运行良好.现在我正试图把它放到我的树莓派上.
我进行了大量搜索以找到使其与 Chromium 一起使用的最佳方法.我能找到的最好的是这个 Reddit 链接.p>
问题是我找不到适合我的 Chromium 版本(版本 56.0.2924.84)的 chromedriver.当我进行 apt-get upgrade 时,它建议我拥有最新版本的 Chromium.我已经通过从这个 Launchpad Link 下载尝试了 chromedriver 版本 53 到 65.
所以当我运行以下命令时
从 selenium 导入 webdriverdriver_path = 'usr/lib/chromium-browser/chromedriver'驱动程序 = webdriver.Chrome(driver_path)
Chrome 驱动程序出现此错误 > 58
selenium.common.exceptions.SessionNoteCreatedException: Message: session not创建的异常:Chrome 版本必须是 >= 59.0.3071.0(驱动信息:chromedriver=2.43,platform=Linux 4.9.35-v7+ armv7l)
或者 chrome 驱动程序的这个错误 <58
selenium.common.exceptions.WebDriverException:消息:服务/usr/lib/chromium-browser/chromedriver 意外退出.状态码是:127
如有任何帮助,我们将不胜感激
解决方案根据您的问题,您的 Chromium 二进制文件的版本为 56.0.2924.84.因此,考虑到这一限制,解决方案是从 ChromeDriver 版本nofollow noreferrer">ChromeDriver Google 存储
- ChromeDriver v84:支持 Chrome v84
- ChromeDriver v83:支持 Chrome v83
- ChromeDriver v82:被故意跳过
- ChromeDriver v81:支持 Chrome v81
- ChromeDriver v80:支持 Chrome v80
- ChromeDriver v79:支持 Chrome v79
- ChromeDriver v78:支持 Chrome v78
- ChromeDriver v77:支持 Chrome v77
- ChromeDriver v76:支持 Chrome v76
- ChromeDriver v75:支持 Chrome v75
- ChromeDriver v74:支持 Chrome v74
- ChromeDriver v73:支持 Chrome v73
- ChromeDriver v2.46:支持 Chrome v71-73
- ChromeDriver v2.46:支持 Chrome v71-73
- ChromeDriver v2.45:支持 Chrome v70-72
- ChromeDriver v2.44:支持 Chrome v69-71(与 ChromeDriver 2.43 相同,但修复了其他错误)
- ChromeDriver v2.43:支持 Chrome v69-71
- ChromeDriver v2.42:支持 Chrome v68-70
- ChromeDriver v2.41:支持 Chrome v67-69
- ChromeDriver v2.40:支持 Chrome v66-68
- ChromeDriver v2.39:支持 Chrome v66-68
- ChromeDriver v2.38:支持 Chrome v65-67
- ChromeDriver v2.37:支持 Chrome v64-66
- ChromeDriver v2.36:支持 Chrome v63-65
- ChromeDriver v2.35:支持 Chrome v62-64
- ChromeDriver v2.34:支持 Chrome v61-63
- ChromeDriver v2.33:支持 Chrome v60-62
- ChromeDriver v2.32:支持 Chrome v59-61
- ChromeDriver v2.31:支持 Chrome v58-60
- ChromeDriver v2.30:支持 Chrome v58-60
- ChromeDriver v2.29:支持 Chrome v56-58li>
- ChromeDriver v2.28:支持 Chrome v55-57
- ChromeDriver v2.27:支持 Chrome v54-56
注意:几个月前,Chromium 团队做了一个 初步公告 ChromeDriver 的版本控制模型将发生变化.Chromium 团队 正在推进该计划.具体来说,ChromeDriver 2.46 将是最后一个带有 2 主要版本的版本.未来的 ChromeDriver 版本将带有类似于 Chrome 版本的版本号.我们将在下周发布 ChromeDriver 73,在 Chrome 73 Beta 版之前发布.
以下是新发布模型的工作方式:
- ChromeDriver 将使用与 Chrome 相同的版本号方案.请参阅 https://www.chromium.org/developers/version-numbers 了解更多信息详情.
- ChromeDriver 的每个版本都将支持具有匹配的主要、次要和内部版本号的 Chrome.例如,即将推出的 ChromeDriver 73.0.3683.* 将支持以 73.0.3683 开头的所有 Chrome 版本.
- 在新的 Chrome 主要版本进入 Beta 版之前,将发布一个匹配的 ChromeDriver 版本.例如,下周将发布新版本的 ChromeDriver,以匹配 Chrome m73 的 Beta 版本.
- 在新的主要版本首次发布后,我们将根据需要发布补丁.这些补丁可能与 Chrome 的更新一致,也可能不一致.
用于树莓派的 Chrome 驱动程序
当您使用 Raspberry Pi 时,您需要从 ChromeDriver 的 arm 格式github.com/electron/electron/releases/download/v1.6.0/chromedriver-v2.21-linux-armv7l.zip" rel="nofollow noreferrer">link 并在您的程序中使用它.
<小时>其他注意事项
- 将 Selenium 升级到当前级别版本 3.11.0.
- 按照上述讨论升级 ChromeDriver.
- 将 Chrome 版本保持在 Chrome v56.x 级别.(根据讨论)
- 清理你的项目工作区通过你的IDE和重建你的项目只需要依赖.
- 使用 CCleaner 工具清除之前和在您的测试套件执行之后.
- 如果您的基础 Web Client 版本太旧,请通过 卸载它Revo Uninstaller 并安装最新的 GA 和发布版本的 Web Client.
- 进行一次系统重启.
- 执行你的
@Test
.
I have written a python script that does some tasks in the browser (using Selenium), which works fine in Windows. Now I am trying to now get it onto my Raspberry Pi.
I did a lot of searching to find the best way to get this to work with Chromium. The best I could find was at this Reddit Link.
The problem is that I cannot find a chromedriver that jives with my version of Chromium (version 56.0.2924.84). And when I do apt-get upgrade it advises me that I have the newest version of Chromium. I've tried chromedriver versions 53 through 65 by downloading from this Launchpad Link.
So when I run the following
from selenium import webdriver
driver_path = 'usr/lib/chromium-browser/chromedriver'
driver = webdriver.Chrome(driver_path)
I get this error for chrome drivers > 58
selenium.common.exceptions.SessionNoteCreatedException: Message: session not
created exception: Chrome version must be >= 59.0.3071.0
(Driver info: chromedriver=2.43,platform=Linux 4.9.35-v7+ armv7l)
or this error for chrome drivers < 58
selenium.common.exceptions.WebDriverException: Message:
Service /usr/lib/chromium-browser/chromedriver unexpectedly exited. Status code was: 127
any help here would be appreciated
解决方案As per your question your Chromium binary is of version 56.0.2924.84. So keeping this constraint in consideration the solution would be to download either of the following ChromeDriver version from ChromeDriver Google Storage
- ChromeDriver v84: Supports Chrome v84
- ChromeDriver v83: Supports Chrome v83
- ChromeDriver v82: Was intentionally skipped
- ChromeDriver v81: Supports Chrome v81
- ChromeDriver v80: Supports Chrome v80
- ChromeDriver v79: Supports Chrome v79
- ChromeDriver v78: Supports Chrome v78
- ChromeDriver v77: Supports Chrome v77
- ChromeDriver v76: Supports Chrome v76
- ChromeDriver v75: Supports Chrome v75
- ChromeDriver v74: Supports Chrome v74
- ChromeDriver v73: Supports Chrome v73
- ChromeDriver v2.46: Supports Chrome v71-73
- ChromeDriver v2.46: Supports Chrome v71-73
- ChromeDriver v2.45: Supports Chrome v70-72
- ChromeDriver v2.44: Supports Chrome v69-71 (same as ChromeDriver 2.43, but with additional bug fixes)
- ChromeDriver v2.43: Supports Chrome v69-71
- ChromeDriver v2.42: Supports Chrome v68-70
- ChromeDriver v2.41: Supports Chrome v67-69
- ChromeDriver v2.40: Supports Chrome v66-68
- ChromeDriver v2.39: Supports Chrome v66-68
- ChromeDriver v2.38: Supports Chrome v65-67
- ChromeDriver v2.37: Supports Chrome v64-66
- ChromeDriver v2.36: Supports Chrome v63-65
- ChromeDriver v2.35: Supports Chrome v62-64
- ChromeDriver v2.34: Supports Chrome v61-63
- ChromeDriver v2.33: Supports Chrome v60-62
- ChromeDriver v2.32: Supports Chrome v59-61
- ChromeDriver v2.31: Supports Chrome v58-60
- ChromeDriver v2.30: Supports Chrome v58-60
- ChromeDriver v2.29: Supports Chrome v56-58
- ChromeDriver v2.28: Supports Chrome v55-57
- ChromeDriver v2.27: Supports Chrome v54-56
Note: A few months ago, Chromium Team made a preliminary announcement that ChromeDriver's versioning model will be changing. Chromium Team is moving forward with the plan. Specifically, ChromeDriver 2.46 will be the last release carrying the major version of 2. Future ChromeDriver releases will carry a version number similar to Chrome release. We will start with a release of ChromeDriver 73 next week, before the Beta release of Chrome 73.
Here is how the new release model will work:
- ChromeDriver will be using the same version number scheme as Chrome. See https://www.chromium.org/developers/version-numbers for more details.
- Each version of ChromeDriver will support Chrome with matching major, minor, and build version numbers. For example, upcoming ChromeDriver 73.0.3683.* will support all Chrome versions that start with 73.0.3683.
- Before a new major version of Chrome goes to Beta, a matching version of ChromeDriver will be released. For example, a new version of ChromeDriver will be release next week to match the Beta release of Chrome m73.
- After the initial release of a new major version, we will release patches as needed. These patches may or may not coincide with updates to Chrome.
ChromeDriver for Raspberry Pi
As you are using Raspberry Pi you need to download the arm format of ChromeDriver from this link and use it within your program.
Additional Considerations
- Upgrade Selenium to current levels Version 3.11.0.
- Upgrade ChromeDriver as per the above discussion.
- Keep Chrome version at Chrome v56.x levels. (as per the discussion)
- Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
- Use CCleaner tool to wipe off all the OS chores before and after the execution of your test Suite.
- If your base Web Client version is too old, then uninstall it through Revo Uninstaller and install a recent GA and released version of Web Client.
- Take a System Reboot.
- Execute your
@Test
.
相关文章