Using Protractor with Firefox or IE
The protractor works fine with Chrome, but I can't get it to start 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"]
};
Once launched npm run webdriver-manager-update
, <project-home>\node_modules\protractor\node_modules\webdriver-manager\selenium\
contains files chromedriver_2.28.exe
, geckodriver-v0.15.0.exe
and IEDriverServer3.3.0.exe
.
On startup, npm run protractor
I get the 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 this refers to a system property webdriver.ie.driver
)
After a lot of searching, I tried the following fixes:
a) Add <project-home>\node_modules\protractor\node_modules\webdriver-manager\selenium\
to system environment variable Path
. It doesn't seem to matter.
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
gives:
[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
(similar behavior with IE)
My search results show that I'm not the only one with this problem, but unfortunately I haven't found a solution.
source to share
Finally, I found a solution in Nick Tomlin's answer :
seleniumArgs
You don't need to install it, 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"]
},
(similar to IE)
source to share
You can do this with localSeleniumStandaloneOpts
. The local driver parameter allows you to start the selenium standalone server before the Protractor test, run the test and finally remove the server.
Another way you can do this - it webdriver-manager start --ie
and seleniumAddress
in your configuration file. In your config file, you will set seleniumAddress: "http://127.0.0.1:4444/wd/hub"
.
A quick note on Firefox. Make sure you are using the latest gecko and Firefox versions. If Firefox tests are not working as expected, check out the gecko driver github page .
Another note on Internet Explorer. You must be using IE11 and 32 bit driver. If you look at the Problem with the Treatise page , the technician has discovered a number of problems. I assume these issues will not be fixed.
source to share