Skip to main content Skip to navigation
hero
Sachin Ghait·Sep 11, 2021·7 min read

TL;DR: Want to run Selenium-based browser automation on a Raspberry Pi Zero W? Firefox's geckodriver dropped ARM support in 2018, so it's a dead end. The solution is using the chromium-chromedriver package that comes pre-built for ARM on Raspbian. This post covers the challenges of running browser automation on ARM hardware, the geckodriver vs chromedriver decision, and the full setup for headless Chromium with Selenium on Pi Zero W.

Selenium Webdriver on Raspberry Pi Zero W.

I have earlier written a post on how selenium can be used to automate browser based tasks.

Find that post here.

I recently bought a raspberry-pi, So wanted to add some tasks like making changes in router settings on raspberry-pi device.

Raspberry Pi zero w overview.

Raspberry-pi's raspbian OS is Linux based and its hardware is arm based. To check this on your raspberry-pi device run below command.

$ uname -a

Linux raspber 5.10.17+ #1414 Fri Apr 30 13:16:27 IST 2021 armv6l GNU/Linux

What challenges I faced ? 😞

I decided to go for firefox and geckodriver combination along with selenium. I thought this will be lightweight than chromium.

I did not find any suitable version of geckodriver for arm based machines. As geckodriver project has stopped supporting it since 2018.

I tried out some older versions of geckodriver shared online. But none of these work for me.

I also tried one geckodriver version built by someone following below process. And this as well didn't work.

https://firefox-source-docs.mozilla.org/testing/geckodriver/ARM.html

I was getting error for OS mismatch with all geckodriver executables I tried.

Firefox - OSError: [Errno 8] Exec format error

Solution ✔️

I thought I have stuck dead-end and was about to keep this thing on the side. Then I found an article about chomium-chromedriver version supported by the Raspbian project.

https://ivanderevianko.com/2020/01/selenium-chromedriver-for-raspberrypi

Run below command to install chomium-chromedriver package

$ sudo apt-get install chromium-chromedriver

This installs both chromium browser and chromedriver on raspberry-pi. Chromium is required for selenium to run a browser in headless mode and chromedriver to connect and control that browser.

This package works awesome on raspberry-pi, I was able to get the selenium tasks installed, and run them from CLI commands.

Later on I used ngrok to access these from anywhere, more about that in below post

Find that post here.

References 🖊️