0

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

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

$: which geckodriver

/bin/geckodriver

echo $PATH

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

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__
    self.service.start()
  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)"
shartshooter
  • 137
  • 1
  • 1
  • 6

1 Answers1

1

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/