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

Firefox 61.0.1
"": "^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 , but unable to find in default locaion, no ‘moz:firefoxOptions.’ capability provided, and no flag on the command line”

I suspect this is because I was not able to set the 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?

UPDATE:

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()
          .forBrowser('firefox').setFirefoxOptions(options).build();

However, the error now says…

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

how can I get around this?



Source link https://sqa.stackexchange.com/questions/34851/nodejs-selenium-webdriver-firefox-geckodriver-set-browser-binary-location-withou

LEAVE A REPLY

Please enter your comment!
Please enter your name here