I'm trying to run Selenium on my Raspberry Pi 2 Model B but I'm having trouble finding a compatible combination of versions of Selenium, Firefox, and geckodriver.
(I've already run sudo apt-get update
, upgrade
and dist-upgrade
.)
Using "old" Selenium like 2.53.1 (
pip3 install selenium==2.53.1
) produces the "can't load the profile" error:$ uname -a ; firefox --version ; python3 --version ; python3 -c "import selenium ; print(\"Selenium: \" + selenium.__version__)" ; xvfb-run python3 -c "from selenium import webdriver ; browser = webdriver.Firefox()" Linux raspberrypi 4.1.19+ #858 Tue Mar 15 15:52:03 GMT 2016 armv6l GNU/Linux Mozilla Firefox 45.9.0 Python 3.2.3 Selenium: 2.53.1 Traceback (most recent call last): File "<string>", line 1, in <module> File "/home/pi/.virtualenv/python3.2.3/lib/python3.2/site-packages/selenium/webdriver/firefox/webdriver.py", line 103, in __init__ self.binary, timeout) File "/home/pi/.virtualenv/python3.2.3/lib/python3.2/site-packages/selenium/webdriver/firefox/extension_connection.py", line 51, in __init__ self.binary.launch_browser(self.profile, timeout=timeout) File "/home/pi/.virtualenv/python3.2.3/lib/python3.2/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 68, in launch_browser self._wait_until_connectable(timeout=timeout) File "/home/pi/.virtualenv/python3.2.3/lib/python3.2/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 106, in _wait_until_connectable % (self.profile.path)) selenium.common.exceptions.WebDriverException: Message: Can't load the profile. Profile Dir: /tmp/tmpv2bdep If you specified a log_file in the FirefoxBinary constructor, check it for details.
(Note: Increasing the timeout in firefox_binary.py
as described here didn't change the error.)
The standard response to this error is to use a modern version of Selenium. However:
Using "new" Selenium like 3.7 (
pip3 install --upgrade selenium
) requires geckodriver, which requires Firefox 55+, but my package manager only provides Firefox 45:$ apt-cache policy firefox-esr firefox-esr: Installed: 45.9.0esr-1~deb7u1 Candidate: 45.9.0esr-1~deb7u1 Version table: *** 45.9.0esr-1~deb7u1 0 500 http://mirrordirector.raspbian.org/raspbian/ wheezy/main armhf Packages 100 /var/lib/dpkg/status
Additionally, geckodriver doesn't offer an ARM6 binary in their Releases, and when I try to build it from source, I get an error that my glibc is too old:
/home/pi/.rustup/toolchains/stable-arm-unknown-linux-gnueabihf/bin/rustc: /lib/arm-linux-gnueabihf/libc.so.6: version `GLIBC_2.15' not found (required by /home/pi/.rustup/toolchains/stable-arm-unknown-linux-gnueabihf/bin/../lib/../lib/../lib/librustc_llvm-d6e9fbf157b3f888.so)
(Running ldd --version
tells me I'm running glibc version Debian EGLIBC 2.13-38+rpi2+deb7u12) 2.13
.)
Lastly, a thoughtful redditor posted ARM6-compiled versions of geckodriver, but these result in errors about my glibc version as well:
./geckodriver: /lib/arm-linux-gnueabihf/libc.so.6: version `GLIBC_2.18' not found (required by ./geckodriver)
I tried using Chromium instead of Firefox, but Selenium requires chromedriver
which isn't available on ARM 6.
So I guess my question is:
Is there a way to run Selenium and Firefox on a Raspberry Pi 2 Model B?
Thanks.
UPDATE
I got a working configuration:
- bought a $35 Raspberry Pi 3 from Adafruit
- Ships with Python 3.5.3
lscpu
shows it runs ARM7 cpu architecture (required by geckodriver)
- Using OS: Raspbian based on Debian Stretch (Sep 7, 2017, linux kernel v4.9)
- Firefox 52.5.0 (
sudo apt-get install firefox-esr
) - geckodriver v0.17.0 for ARM7
Note: Don't use the latest geckodriver -- you need to pick the one that matches your version of Firefox. This is hard because the geckodriver release notes aren't consistent about saying which version of Firefox and Selenium they're compatible with.
iceweasel
gblic
you are using an outdated release. Upgrade tostretch
. I am runningjessie
and myglibc
version is 2.19firefox
andiceweasel
point tofirefox-esr
. I think you are correct that I will have to upgrade to Debian Stretch. The Raspbian docs advise rebuilding a fresh installation instead of upgrading, which means I'll have to rebuild my whole system. Is there another way? That's a pain!