3
votes

I'm trying to use Selenium in Python 2.7 and I get the following error,

WebDriverException: Message: Expected browser binary location, but unable to find binary in default location, no 'moz:firefoxOptions.binary' capability provided, and no binary flag set on the command line

Any idea what could it be?

1

1 Answers

4
votes

You can avoid this issue in two different ways:

  1. Explicit where to find firefox binary to your selenium code:

    from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
    from selenium import webdriver
    firefox_binary = FirefoxBinary('/usr/bin/firefox/')
    driver = webdriver.Firefox(firefox_binary=firefox_binary)
    
  2. Add firefox to your PATH environment variabile. Windows, Ubuntu