Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Protractor with Firefox or IE

Protractor works fine with Chrome, but I cannot get it to start up Firefox or Internet Explorer.

  • Windows 7
  • Node v6.9.1

Snippet from package.json:

"scripts": {
    ....
    "webdriver-manager-update": "webdriver-manager update --ie",
    "protractor": "protractor protractor.conf.js",
    ...
},
...
"devDependencies": {
    ...
    "protractor": "5.1.1",
    ...
}

protractor.conf.js:

exports.config = {
    capabilities: {
      browserName: "firefox" // or "internet explorer"
    },
    specs: ["target/e2e/**/*.e2e-spec.js"]
};

After running npm run webdriver-manager-update, <project-home>\node_modules\protractor\node_modules\webdriver-manager\selenium\ contains the files chromedriver_2.28.exe, geckodriver-v0.15.0.exe and IEDriverServer3.3.0.exe.

When running npm run protractor, I get an error:

[12:29:45] I/launcher - Running 1 instances of WebDriver
[12:29:45] I/local - Starting selenium standalone server...
[12:29:46] I/local - Selenium standalone server started at http://192.168.213.25:62661/wd/hub
[12:29:46] E/launcher - The path to the driver executable must be set by the webdriver.gecko.driver system property

(for IE, it refers to the webdriver.ie.driver system property)

After lots of googling, I tried the following fixes:

a) Add <project-home>\node_modules\protractor\node_modules\webdriver-manager\selenium\ to the system environment variable Path. This seems to make no difference.

b) Add the following line to protractor.conf.js:

seleniumArgs: ["-Dwebdriver.gecko.driver=<project-home>\\node_modules\\protractor\\node_modules\\webdriver-manager\\selenium\\geckodriver-v0.15.0.exe"],

Now npm run protractor yields:

[12:40:35] I/launcher - Running 1 instances of WebDriver
[12:40:35] I/local - Starting selenium standalone server...
[12:40:35] E/launcher - Error: Error: Server terminated early with status 1
    at Error (native)
    at earlyTermination.catch.e (<project-home>\node_modules\selenium-webdriver\remote\index.js:252:52)
    at process._tickCallback (internal/process/next_tick.js:103:7)
[12:40:35] E/launcher - Process exited with error code 100

(analoguous behavior with IE)

My search results suggest I am not the only one having this problem, but unfortunately, I did not discover a solution.

like image 544
Marco Eckstein Avatar asked Mar 10 '23 11:03

Marco Eckstein


1 Answers

Finally I found the solution in an answer by Nick Tomlin:

Its is not seleniumArgs you need to set, but localSeleniumStandaloneOpts.jvmArgs. So, in protractor.conf.js, write:

localSeleniumStandaloneOpts: {
    jvmArgs: ["-Dwebdriver.gecko.driver=<project-home>\\node_modules\\protractor\\node_modules\\webdriver-manager\\selenium\\geckodriver-v0.15.0.exe"]
  },

(analoguous for IE)

like image 137
Marco Eckstein Avatar answered Apr 26 '23 07:04

Marco Eckstein