8

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

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

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.

9
  • try with geckodriver 0.17, firefox 56, latest selenium Commented Nov 20, 2017 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? Commented Nov 20, 2017 at 16:21
  • In debian and it's derivative, firefox is iceweasel Commented Nov 20, 2017 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 Commented Nov 20, 2017 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! Commented Nov 20, 2017 at 17:39

1 Answer 1

2

I was trying to do the same but on Raspberry Pi 3B running Raspbian Buster.

I did a search through the whole root partition and realized that there is a ARM compatible version of geckodriver here:

/opt/Wolfram/WolframEngine/12.0/SystemFiles/Components/WebUnit/Resources/DriverBinaries/GeckoDriver/Linux-ARM

I should point out that I am running the desktop version of raspbian with the "full" desktop.

I had also seen suggestion to check the geckodriver github page but it looks like they no longer offer an ARM binary so this worked out for me.

I also haven't tried this but it's another option: https://github.com/d0ku/GeckoDriver_ARMv6

NOTE: According to this answer: Raspberry Pi Zero W is ARMv6 or ARMv7?, ARMv7 processors are backward compatible so I'm assuming you could use the Github link above with a more modern Pi as well.

Not the answer you're looking for? Browse other questions tagged or ask your own question.