【发布时间】:2021-05-10 11:50:43
【问题描述】:
我一直在尝试让selenium 在我的 Raspberry Pi 4 上工作一段时间,但在使用geckodriver 0.23.0 ( 2018-10-04 ) 正常运行它时,我不断收到此错误:
selenium.common.exceptions.SessionNotCreatedException: Message: Unable to find a matching set of capabilities
还有一个类似的错误:
RuntimeError: Could not find firefox in your system PATH. Please specify the firefox binary location or install firefox
它会告诉我它如何在 PATH 中找不到 Firefox,如果尚未安装 Firefox 二进制文件,我将安装它。我使用以下命令为我的操作系统安装了似乎是唯一兼容的Firefox 版本:
sudo apt-get install firefox-esr
我再次尝试了我的脚本,但得到了这个:
selenium.common.exceptions.WebDriverException: Message: The browser appears to have exited before we could connect. If you specified a log_file in the FirefoxBinary constructor, check it for details.
我猜这是因为我使用的是 Raspbian OS (Lite),这意味着它在基于终端的环境中运行,但这并不是很令人担忧,因为我很可能只使用虚拟环境。但是,这不是我想要的。在升级我的 Pi 之前,我可以很好地使用 selenium,它是相同版本的 selenium,但处于无头模式。
如果我已经设置好了geckodriver 和selenium,为什么还要安装Firefox?
使用Python3.9.1
【问题讨论】:
标签: python selenium firefox raspberry-pi geckodriver