1.4.0 does not seem to work with PhantomJS
I know, PhantomJS is not officially supported by Protractor, but since everything worked in 1.3.1 I decided to report this issue nonetheless. Feel free to close it as invalid (a short notice on the browser-setup page of the docs would be nice, though).
My protractor tests started to fail with 1.4.0 with this stacktrace:
Starting selenium standalone server...
Selenium standalone server started at http://172.31.195.6:53427/wd/hub
[launcher] Error: UnknownError: org.openqa.selenium.browserlaunchers.Proxies
at new bot.Error (/Users/matthias/workspace/my-app/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/lib/atoms/error.js:113:18)
at Object.bot.response.checkResponse (/Users/matthias/workspace/my-app/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/lib/atoms/response.js:106:9)
at /Users/matthias/workspace/my-app/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:152:24
at /Users/matthias/workspace/my-app/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1582:15
at webdriver.promise.ControlFlow.runInNewFrame_ (/Users/matthias/workspace/my-app/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1654:20)
at notify (/Users/matthias/workspace/my-app/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:465:12)
at notifyAll (/Users/matthias/workspace/my-app/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:442:7)
at resolve (/Users/matthias/workspace/my-app/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:420:7)
at fulfill (/Users/matthias/workspace/my-app/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:535:5)
at /Users/matthias/workspace/my-app/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1582:15
==== async task ====
WebDriver.createSession()
at Function.webdriver.WebDriver.acquireSession_ (/Users/matthias/workspace/my-app/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:149:22)
at Function.webdriver.WebDriver.createSession (/Users/matthias/workspace/my-app/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:123:30)
at Builder.build (/Users/matthias/workspace/my-app/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/builder.js:294:22)
at LocalDriverProvider.getDriver (/Users/matthias/workspace/my-app/node_modules/grunt-protractor-runner/node_modules/protractor/lib/driverProviders/local.js:121:9)
at /Users/matthias/workspace/my-app/node_modules/grunt-protractor-runner/node_modules/protractor/lib/runner.js:222:41
at _fulfilled (/Users/matthias/workspace/my-app/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/q/q.js:797:54)
at self.promiseDispatch.done (/Users/matthias/workspace/my-app/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/q/q.js:826:30)
at Promise.promise.promiseDispatch (/Users/matthias/workspace/my-app/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/q/q.js:759:13)
at /Users/matthias/workspace/my-app/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/q/q.js:573:44
I use grunt-protractor-runner, as you can see. My e2e.conf.js looks like that:
exports.config = {
"capabilities": {
"browserName": "phantomjs",
"phantomjs.binary.path": require("phantomjs").path,
"phantomjs.ghostdriver.cli.args": ["--loglevel=DEBUG"]
},
"specs": [
"e2e/**/*.js"
]
};
When using Chrome as a Browser, everything works fine.
Thanks, I'm happy to label this issue and leave it open. If anyone wants to look in to Phantom issues I'd be happy to take a look at PRs.
Downgrading to 1.3.1 fixes this issue for me too, thanks for the heads up @gweax .
This is down to a deprecated method in Selenium being removed. The selenium driver for phantomjs, ghostdriver, was relying on this method. This was reported to ghostdriver, and subsequently a pull request was merged, but has not yet been released.
We will need to wait for ghostdriver to release, then phantomjs to push a release including it, then finally for the npm phantomjs wrapper to release before we can use protractor 1.4 with phantomjs again.
@ReactiveRaven Thank you for looking into this and the thorough response!
+1 can't wait to see all this happen
+1 this is quite critical for me as well :)
+1
+1
+1 Waiting for 1.4.0 support for PhantomJs
+1 yes please...
If the issue is with PhantomJS trying to use a deprecated selenium method as @ReactiveRaven pointed out, you should be able to get protractor 1.4/1.5 working with Phantom by downgrading the selenium version (https://github.com/angular/protractor/blob/master/config.json). We're not going to downgrade it in master, but you should be able to downgrade it locally and see if it's working with that change.
Yup, I'd been planning to try that and just finally gave it a shot.
I'm running this as a postinstall script for my npm package to force protractor down to 2.43.1 of selenium server standalone:
var pconfig = require('protractor/config.json');
pconfig.webdriverVersions.selenium = '2.43.1';
require('fs').writeFile(
'node_modules/protractor/config.json', JSON.stringify(pconfig)
);
and PhantomJS works again (w/protractor 1.5.0). I'm going to cross my fingers and hope other things don't break before this hack can be removed. :)
The problem is also present in 1.5.0, sadly.
Downgrading selenium to 2.43.1 works, thanks @stu-salsbury.
+1 1.5.0 is awesome and I can't go back to 1.3.1. For now, I'm using @stu-salsbury hack.
For what it's worth, I've run into the kind of strange behavior I hoped not to see from PhantomJS/WebDriver combo -- yet-to-be-explained test failures in Travis. I've got a Linux VM I'm going to run my tests against to see if I can figure out what the issue is, but I don't think it's protractor's "fault" (unless it's an "angular ready/digest-cycles concluded" issue), because the failures begin with an inability to find an element by.className.
+1
@laurelnaiad thanks for this hack, works fine for me!
You can download last JAR Selenium version here : http://www.seleniumhq.org/download/ and follow the instruction here : https://github.com/detro/ghostdriver#register-ghostdriver-with-a-selenium-grid-hub
Only way I found to use phantomJS with the last Selenium version.
For the automated test on server I forked the project and downgrade the version on Selenium into the config.json :
{ "webdriverVersions": { "selenium": "2.43.1", "chromedriver": "2.13", "iedriver": "2.44.0" } }
I'm aggressively closing issues that we are unable to reproduce, are support issues specific to one test, or deal with integrations with other projects that we don't directly support. If you feel you have a question, please see https://github.com/angular/protractor/blob/master/CONTRIBUTING.md#questions. If you still have a bug report or feature request, please open a new issue. Thank you!