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.

ConvexMartian
  • 181
  • 1
  • 1
  • 4

1 Answers1

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.

alexpotato
  • 131
  • 3