There is:

Firefox == 58.0.2 selenium == 3.9.0 geckodriver == 0.19.1 Python == 3.6.4 Debian based Linux (64bit) 

chmod +x -knite geckodriver in usr/local/bin .
Running geckodriver --version in the terminal geckodriver --version :

geckodriver 0.19.1

Testing / geckodriver in https://hg.mozilla.org/mozilla-central .

This program is subject to the Mozilla Public License 2.0. You can obtain a copy of the license at https://mozilla.org/MPL/2.0/ .

Firefox installed not via apt-get, but unzipped to /usr/bin/firefox

In .bashrc file added line:

 export PATH=$PATH:/usr/bin/firefox 

When I run the bottom:

 from selenium import webdriver from selenium.webdriver.common.desired_capabilities import DesiredCapabilities cap = DesiredCapabilities().FIREFOX cap["marionette"] = False browser = webdriver.Firefox(capabilities=cap, executable_path="/usr/local/bin") link = browser.get('https://duckduckgo.com') web2 = link.find_element_by_class_name('logo_homepage__tt').text print(web2) 

I get the error:

RuntimeError: Could not find firefox in your system PATH. Please specify the firefox binary location or install firefox

  • Just in case echo $ SHELL show. - de_frag
  • @defrag, echo $SHELL gives /bin/bash - Tanya

1 answer 1

There are three points to solve:

  1. Install Firefox from the repository. ( That does not suit me )

  2. Specify the path for the Firefox binary to selenium.

  3. Add a Firefox binary to Path.

For the second item:

To set the path to Firefox you need to use FirefoxBinary in the code:

 from selenium.webdriver.firefox.firefox_binary import FirefoxBinary binary = FirefoxBinary('/Firefox/Path') # binary = FirefoxBinary('/usr/bin/firefox/firefox') # в моём случае driver = webdriver.Firefox(firefox_binary=binary) 

For the third item:

Add bottom to ~ / .profile or ~ / .bashrc:

 export PATH="$PATH:/home/firefox" 

in my case (it was necessary to prescribe the file, and not the folder):

 было --> export PATH="$PATH:/usr/bin/firefox стало --> export PATH="$PATH:/usr/bin/firefox/firefox 

To find out where Firefox is located: give the command which firefox or whereis firefox in the terminal.

A source