I'm trying to run selenium on a Raspberry Pi 3.

I've installed geckodriver and added it to my path.

$: which geckodriver


echo $PATH


I've seen this post and have done the following:

sudo apt-get update
sudo apt-get install iceweasel
sudo apt-get install xvfb

sudo pip install selenium
sudo pip install PyVirtualDisplay
sudo pip install xvfbwrapper

When I execute the following code:

from selenium import webdriver
driver = webdriver.Firefox()

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/webdriver.py", line 145, in __init__
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/common/service.py", line 74, in start
    stdout=self.log_file, stderr=self.log_file)
  File "/usr/lib/python2.7/subprocess.py", line 710, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1335, in _execute_child
    raise child_exception
OSError: [Errno 8] Exec format error

I've seen a lot of posts about OSError: [Errno 8] Exec format error - most of them say "use Chrome instead" but I know chrome but chrome doesn't support ARM architecture

Not sure where to go with this. Folks seem to be able to get selenium running but I haven't been able to make that happen

OS Info:

pi:~$ uname -a
Linux rpb 4.4.50-v7+ #970 SMP Mon Feb 20 19:18:29 GMT 2017 armv7l GNU/Linux

pi:~$ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)"
  • 2
    I found the issue for folks struggling like me! I had installed the wrong version of geckodriver - github.com/mozilla/geckodriver/releases - I had installed the linux version rather than the ARM version – shartshooter Mar 13 '17 at 4:47
  • You should wither answer your own question and accept the answer in a few days, or you could delete the question. The former would be preferred. – Steve Robillard Mar 13 '17 at 16:07
  • @SteveRobillard - will do – shartshooter Mar 13 '17 at 18:09

I had the same issue and it was just that the webdriver I had installed was for linux and when I changed it to ARM webdriver ( a bit older version ) it worked. The webdriver I used was: https://github.com/mozilla/geckodriver/releases/download/v0.19.1/geckodriver-v0.19.1-arm7hf.tar.gz.

Also follow this blog and selenium automation will work smoothly for you. http://www.knight-of-pi.org/python3-browser-tests-on-a-raspberry-pi-with-firefox-virtualdisplay-selenium-and-pytest/

| improve this answer | |

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.