Today I recieved my Raspberry pi 3 Model B+. I downloaded NOOBS and installed it on my raspberry pi. However, I cannot run a selenium browser on it. I have tried to install iceweasel but it says that package is not available. I tried and installed FireFox-esr but the python script crashes. I tried to use Chromium, but that also doesn't work. All the questions/answers to this problem I looked up, don't work in 2019.

So my question is. What version of selenium do I need to install, and what browser do I need? Can someone tell me the commands to use, as well as show me a quick test script (just to open the url https://www.youtube.com on selenium). I don't care what browser it is, I just want to get selenium to work (prefer chrome, but I don't mind).

My test script

from selenium import webdriver

driver = webdriver.Firefox()
#driver = webdriver.Chrome()

  • NOOBS is not an operating system. What operating system do you use from it? Is it Raspbian? What version? – Ingo Sep 27 '19 at 7:25

I've got Selenium and Chromium/chromedriver working on my RaspPi 3 Model B Rev 1.2 running Buster. Here's how I installed everything and below is code that works for me.

I started with update and dist-upgrade:

sudo apt-get upgrade
sudo apt-get dist-upgrade

Install Selenium (if you haven't already):

sudo pip install selenium

Install chromedriver (these steps could prob be shortened, but they worked for me):

I got a .deb file from https://launchpad.net/ubuntu/trusty/+package/chromium-chromedriver I chose this one: "chromium-chromedriver 65.0.3325.181-0ubuntu0.14.04.1 in armhf (Updates)" which has the URL http://launchpadlibrarian.net/361669488/chromium-chromedriver_65.0.3325.181-0ubuntu0.14.04.1_armhf.deb (but note there is another version labeled “Release” that could be tried) (this is an older version of chromedriver, but it gets updated in subsequent steps below)

So I ran

wget http://launchpadlibrarian.net/361669488/chromium-chromedriver_65.0.3325.181-0ubuntu0.14.04.1_armhf.deb

then (following https://unix.stackexchange.com/questions/159094/how-to-install-a-deb-file-by-dpkg-i-or-by-apt):

sudo dpkg -i chromium-chromedriver_65.0.3325.181-0ubuntu0.14.04.1_armhf.deb


sudo apt-get install -f

Then, sudo reboot and sudo apt-get update && sudo apt-get dist-upgrade

The dist-upgrade results showed that chromedriver was updated to version 74 (same as my Chromium)

I also installed a couple of other required packages:

sudo apt-get install xvfb
sudo pip install PyVirtualDisplay
sudo pip install xvfbwrapper 

I then rebooted.

The following Python 2.7 code works for me:

#!/usr/bin/env python

from selenium import webdriver
from pyvirtualdisplay import Display

print 'Starting ...'
display = Display(visible=0, size=(1600, 1200))
driver = webdriver.Chrome('/usr/lib/chromium-browser/chromedriver')
print 'webdriver loaded'

# Navigate to target website

print 'target page loaded adnd screenshot taken'
print 'Done'

Hope this helps, good luck!


I would suggest switching to ChromeDriver and using a package from the Raspbian repo as described here

sudo apt-get install chromium-chromedriver
  • I think that this is the simplest and faster method to use selenium. No need to specify the path when using it – Matteo Antolini Jun 6 '20 at 13:19

Your Answer

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

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