Selenium / Raspberry Pi 3 - Unable to find a matching set of capabilities

北战南征 提交于 2020-02-23 07:49:05

问题


I want to run a Python 3 script on my Raspberry Pi and do stuff with it. The script works just fine on my Mac, however I want it to run 24/7 and the Pi is more energy efficient. Not to mention I need my Mac for other things.

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
browser = webdriver.Firefox()
browser.get('www.website.com')

I am running Raspbian Jesse and have installed Iceweasel (installed today through command line, V 45) and geckodriver (0.18.0).

Running the script throws the following error:

selenium.common.exceptions.WebDriverException: Message: Unable to find a matching set of capabilities

Ideas?

Cheers.


回答1:


I ran into the exact same problem. For me, installing an older version of selenium fixed the problem.

sudo pip3 uninstall selenium
sudo pip3 install selenium==3.3.2

Works for me on Raspbian Jessie with Firefox 45.9.0, geckodriver v0.18.0.




回答2:


Try updating to the latest Selenium, Firefox, and geckodriver.

Firefox:

sudo apt-get install firefox-esr --upgrade

Selenium:

pip install selenium --upgrade

Mozilla no longer publishes arm7 geckodriver binaries, but there are instructions to crosscompile it for arm7 from another platform here and regular building instructions here. The first step is downloading the source:

curl https://hg.mozilla.org/mozilla-central/archive/tip.zip/testing/ > testing.zip
unzip testing.zip

Or if v26 is sufficient, I've compiled it for arm7 here: https://github.com/Tahlor/geckodriver



来源:https://stackoverflow.com/questions/45400232/selenium-raspberry-pi-3-unable-to-find-a-matching-set-of-capabilities

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!