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.)

  1. 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
      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:

  1. 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
      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?



I got a working configuration:

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.

  • try with geckodriver 0.17, firefox 56, latest selenium – Arpit Agarwal Nov 20 '17 at 10:13
  • @ArpitAgarwal, thanks for the suggestion. However, as the post explains, geckodriver produces a glibc incompatibility error and firefox 56 isn't available in the Raspbian package manager. Is there a way around this? – ConvexMartian Nov 20 '17 at 16:21
  • In debian and it's derivative, firefox is iceweasel – Arpit Agarwal Nov 20 '17 at 16:24
  • As for gblic you are using an outdated release. Upgrade to stretch. I am running jessie and my glibc version is 2.19 – Arpit Agarwal Nov 20 '17 at 16:38
  • On my machine, both firefox and iceweasel point to firefox-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! – ConvexMartian Nov 20 '17 at 17:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.