FlickFlack
FlickFlack

Reputation: 11

Running Selenium on Raspberry Pi: Possible GeckoDriver Issue

I'm fairly new to Raspberry Pi's and Python and trying to run selenium to try to do a web automated program on my PI Model B. I have everything installed and just trying to run a simple command like:

from selenium import webdriver
browser = webdriver.Firefox()
browser.get('http://seleniumhq.org/')

This should open FireFox (as I've installed IceWeasel) but I keep getting this error:

Traceback (most recent call last): File "BingBotTest.py", line 3, in browser = webdriver.Firefox() 
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/webdriver.py", line 142, in init self.service.start() 
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/common/service.py", line 81, in start os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH. 

I knew I needed the GeckoDriver for Firefox, so I downloaded it. I assumed I should download the ARM7 version of GeckoDriver. However when I extract it, it doesn't make an executable so I can route my code to it. Anyone with any guidance?

Upvotes: 1

Views: 3337

Answers (1)

d0ku
d0ku

Reputation: 11

Better late than never, right? :D First of all, if you got Pi Model B from the 1st series, then armv7 geckodriver will not work for you . You have either to compile your own geckodriver or use binary compiled by someone else. I have compiled geckodriver for armv6 which should work so you are lucky. Here is what you have to do to make it work:

  1. Go to https://github.com/d0ku/GeckoDriver_ARMv6 and download the geckodriver file specific for your version of Firefox (you will find binaries in Releases tab).

  2. Put it in your usr/bin, you can do it by opening the terminal in folder where is your downloaded geckodriver and typing sudo cp ./geckodriver /usr/bin

Then your program should work just fine.

Upvotes: 1

Related Questions