Currently I have the following setup for my NodeJS based test for firefox in Windows 7

Firefox 61.0.1
"geckodriver": "^1.11.0",
"selenium-webdriver": "^4.0.0-alpha.1"

However when I execute the command

let driver = await new webDr.Builder().withCapabilities(webDr.Capabilities.firefox()).build(); 

I get the error

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

I suspect this is because I was not able to set the PATH variable in my windows with what most tutorials have.. like this one.

"Add the chromedriver and geckodriver driver's location to your system PATH variable. This should be an absolute path from the root of your hard disk, to the directory containing the drivers. For example, if we were using a Mac OS X machine, our user name was bob, and we put our drivers in the root of our home folder, the path would be /Users/bob."

however, our company laptop has restricted modifying the following: System folders, registries and unfortunately.. PATH variables.

How can I point to my Firefox binaries without modifying PATH variable?

If I switch to firefoxdriver, will I still have the same dillema?


I tried the following based on the documentation on the firefox file:

      const firefox = require('selenium-webdriver/firefox');

      let options = new firefox.Options().setBinary(os.homedir() + '/AppData/Local/Mozilla Firefox'); 

      let driver = new webDr.Builder()

However, the error now says...

"SessionNotCreatedError: Failed to start browser (the path) : Permission Denied"

how can I get around this?

1 Answer 1


I found the answer Turns out in options.. you're supposed to point to firefox.exe itself, not just the path

  const firefox = require('selenium-webdriver/firefox');

  let options = new firefox.Options().setBinary(os.homedir() + '/AppData/Local/Mozilla Firefox/firefox.exe'); 

  let driver = new webDr.Builder()
  • 1
    There may be better solutions.. please feel free to provide a better one Jul 20, 2018 at 17:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.