title: Expected browser binary location, but unable to find binary in default location, no 'moz:firefoxOptions.binary' capability provided
body: <p>I am trying to get back into using Python Webdriver. I have here the code</p>
  <pre><code>from selenium import webdriver
  driver = webdriver.Firefox(executable_path=r'C:\Users\Cody\Downloads\geckodriver.exe')
  driver.get('http://inventwithpython.com')
  </code></pre>
  <p>This causes:</p>
  <pre><code>C:\Users\Cody\Projects&gt;python accounting.py
  Traceback (most recent call last):
    File &quot;accounting.py&quot;, line 4, in &lt;module&gt;
      driver = webdriver.Firefox(executable_path=r'C:\Users\Cody\Downloads\geckodriver.exe')
    File &quot;C:\Users\Cody\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\selenium\webdriver\firefox\webdriver.py&quot;, line 170, in __init__
      RemoteWebDriver.__init__(
    File &quot;C:\Users\Cody\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\selenium\webdriver\remote\webdriver.py&quot;, line 157, in __init__
      self.start_session(capabilities, browser_profile)
    File &quot;C:\Users\Cody\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\selenium\webdriver\remote\webdriver.py&quot;, line 252, in start_session
      response = self.execute(Command.NEW_SESSION, parameters)
    File &quot;C:\Users\Cody\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\selenium\webdriver\remote\webdriver.py&quot;, line 321, in execute
      self.error_handler.check_response(response)
    File &quot;C:\Users\Cody\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\selenium\webdriver\remote\errorhandler.py&quot;, line 242, in check_response
      raise exception_class(message, screen, stacktrace)
  selenium.common.exceptions.SessionNotCreatedException: 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
  </code></pre>
  <p>If I try:</p>
  <pre><code>from selenium import webdriver
  driver = webdriver.Firefox(executable_path=r'C:\Users\Cody\Downloads')
  driver.get('http://inventwithpython.com')
  </code></pre>
  <p>I get</p>
  <pre><code>C:\Users\Cody\Projects&gt;python accounting.py
  Traceback (most recent call last):
    File &quot;C:\Users\Cody\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\selenium\webdriver\common\service.py&quot;, line 72, in start
      self.process = subprocess.Popen(cmd, env=self.env,
    File &quot;C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.2032.0_x64__qbz5n2kfra8p0\lib\subprocess.py&quot;, line 854, in __init__
      self._execute_child(args, executable, preexec_fn, close_fds,
    File &quot;C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.2032.0_x64__qbz5n2kfra8p0\lib\subprocess.py&quot;, line 1307, in _execute_child
      hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
  PermissionError: [WinError 5] Access is denied
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File &quot;accounting.py&quot;, line 4, in &lt;module&gt;
      driver = webdriver.Firefox(executable_path=r'C:\Users\Cody\Downloads')
    File &quot;C:\Users\Cody\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\selenium\webdriver\firefox\webdriver.py&quot;, line 164, in __init__
      self.service.start()
    File &quot;C:\Users\Cody\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\selenium\webdriver\common\service.py&quot;, line 86, in start
      raise WebDriverException(
  selenium.common.exceptions.WebDriverException: Message: 'Downloads' executable may have wrong permissions.
  </code></pre>
  <p>Geckodriver.exe is sitting right there in the downloads folder.</p>
  <p><a href="https://i.stack.imgur.com/zSZK0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zSZK0.png" alt="enter image description here" /></a></p>