python selenium geckodriver - executable needs to be in PATH / how to install on armbian buster

7.5k views Asked by At

When I try to create a Selenium Firefox Webdriver on my Orange Pi with Armbian Buster like

import selenium
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
    
options = Options()
options.headless = True    
driver = webdriver.Firefox(options=options, executable_path='/usr/local/bin/geckodriver')

the exception

selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH. 

is thrown. This happens when I use the last geckodriver build for ARMv7 from github and when I build the geckodriver according to here.

The geckodriver binary lies in /usr/local/bin/ and is executable, but when I try to

geckodriver --version

I get

-bash: /usr/local/bin/geckodriver: No such file or directory

which leads my to the assumption that there is something fundamentally wrong with my approach. So how do I install geckodriver correctly on the Orange Pi with Armbian Buster?

2

There are 2 answers

0
Andy Ef On BEST ANSWER

I solved the problem by downloading the latest Ubuntu ARM64 package for firefox-geckodriver, extracting the geckodriver binary and placing it in /usr/local/bin. This is also way faster than compiling the geckodriver myself and provides the most recent geckodriver release.

3
Shrini On

Just use this https://pypi.org/project/webdriver-manager/.

No Hassle of providing the path of Geckodriver. This will do that for you.