Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

"Error forwarding the new session new session request for webdriver should contain a location header with the session" When using PhantomJS with selenium grid in RemoteWebDriver mode #11610

Closed
seaders opened this issue Sep 9, 2013 · 6 comments
Labels

Comments

@seaders
Copy link

seaders commented Sep 9, 2013

I start a selenium grid hub with it's default startup command,

java -jar selenium-server-standalone-2.33.0.jar -role hub

And I start up PhantomJS in it's webdriver mode, on the same machine, like,

phantomjs --webdriver=8080 --webdriver-selenium-grid-hub=http://127.0.0.1:4444

When PhantomJS starts up, I get nothing but "All 'OK'" messages,

[INFO  - 2013-09-09T18:10:38.849Z] GhostDriver - Main - running on port 8080
[INFO  - 2013-09-09T18:10:38.850Z] GhostDriver - Main - registering to Selenium HUB 'http://127.0.0.1:4444' using '127.0.0.1:8080'
[INFO  - 2013-09-09T18:11:47.164Z] HUB Register - register - Registered with grid hub: http://127.0.0.1:4444/ (ok)

But if I try to use that browser, with

driver = webdriver.Remote(command_executor='http://127.0.0.1:4444/wd/hub',
                          desired_capabilities=DesiredCapabilities.PHANTOMJS)

Looking at the output from the PhantomJS executable,

[INFO  - 2013-09-09T18:17:12.531Z] Session [0c5c9500-197c-11e3-8eed-b3b7a73965aa] - _decorateNewWindow - page.settings: {"XSSAuditingEnabled":false,"javascriptCanCloseWindows":true,"javascriptCanOpenWindows":true,"javascriptEnabled":true,"loadImages":true,"localToRemoteUrlAccessEnabled":false,"userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.2 Safari/534.34","webSecurityEnabled":true}
[INFO  - 2013-09-09T18:17:12.531Z] Session [0c5c9500-197c-11e3-8eed-b3b7a73965aa] - page.customHeaders:  - {}
[INFO  - 2013-09-09T18:17:12.531Z] Session [0c5c9500-197c-11e3-8eed-b3b7a73965aa] - CONSTRUCTOR - Desired Capabilities: {"platform":"ANY","javascriptEnabled":true,"browserName":"phantomjs","version":""}
[INFO  - 2013-09-09T18:17:12.531Z] Session [0c5c9500-197c-11e3-8eed-b3b7a73965aa] - CONSTRUCTOR - Negotiated Capabilities: {"browserName":"phantomjs","version":"1.9.2","driverName":"ghostdriver","driverVersion":"1.0.4","platform":"mac-10.7 (Lion)-32bit","javascriptEnabled":true,"takesScreenshot":true,"handlesAlerts":false,"databaseEnabled":false,"locationContextEnabled":false,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"cssSelectorsEnabled":true,"webStorageEnabled":false,"rotatable":false,"acceptSslCerts":false,"nativeEvents":true,"proxy":{"proxyType":"direct"}}
[INFO  - 2013-09-09T18:17:12.531Z] SessionManagerReqHand - _postNewSessionCommand - New Session Created: 0c5c9500-197c-11e3-8eed-b3b7a73965aa

Everything seems to be fine, but the code crashes :/ I get a huge error stacktrace, mainly down to,

selenium.common.exceptions.WebDriverException: Message: u'Error forwarding the new session new session request for webdriver should contain a location header with the session.'

And if you check the output of the grid hub,

INFO: Trying to create a new session on test slot {seleniumProtocol=WebDriver, browserName=phantomjs, maxInstances=1}
INFO: Available nodes: [host :http://127.0.0.1:8080 time out : 300000]

There also seems to be an issue. It seems like, for whatever reason, the grid hub doesn't get any information back from the PhantomJS executable, even though it seems like it is processing things correctly.

For testing, I also have a regular selenium node running, on the same machine, with the command

java -jar selenium-server-standalone-2.33.0.jar -role node

and if I start up a Firefox RemoteWebDriver session (in Python), with

driver = webdriver.Remote(command_executor='http://127.0.0.1:4444/wd/hub',
                          desired_capabilities=DesiredCapabilities.FIREFOX)

all is fine.

It looks like everything is set up correctly, I'm keeping things as 'vanilla' and close to what the docs say as possible, but just can't get over the fence here.

The exact same error happens when trying in Java, too

WebDriver driver = new RemoteWebDriver(DesiredCapabilities.phantomjs());

And my versions are 1.9.2 for PhantomJS and obviously 2.33.0 for selenium.

@jessesanford
Copy link

I am also seeing this. It does not occur with phantomjs 1.9.1. I imagine this is something introduced in the new ghostdriver code.

@jessesanford
Copy link

There is question up on stack overflow describing this exact issue here:

http://stackoverflow.com/questions/18704626/error-running-phantomjs-with-selenium-remotewebdriver/18808329#18808329

@jessesanford
Copy link

This seems to be solved by updating to the 2.35.0 selenium jar. You can get it here:

https://code.google.com/p/selenium/downloads/detail?name=selenium-server-standalone-2.35.0.jar&can=2&q=

@alexgorbatchev
Copy link

seeing this problem consistently with phantom 1.9.2 with selenium 2.35.0

~ ❯ phantomjs --webdriver=1234 --webdriver-selenium-grid-hub=http://localhost:4444
PhantomJS is launching GhostDriver...
[INFO  - 2013-10-08T03:21:29.278Z] GhostDriver - Main - running on port 1234
[INFO  - 2013-10-08T03:21:29.279Z] GhostDriver - Main - registering to Selenium HUB 'http://localhost:4444' using '127.0.0.1:1234'
[INFO  - 2013-10-08T03:21:29.309Z] HUB Register - register - Registered with grid hub: http://localhost:4444/ (ok)
[INFO  - 2013-10-08T03:21:39.696Z] Session [bf133ac0-2fc8-11e3-96a2-8d953e0f94c6] - _decorateNewWindow - page.settings: {"XSSAuditingEnabled":false,"javascriptCanCloseWindows":true,"javascriptCanOpenWindows":true,"javascriptEnabled":true,"loadImages":true,"localToRemoteUrlAccessEnabled":false,"userAgent":"Mozilla/5.0 (Macintosh; PPC Mac OS X) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.2 Safari/534.34","webSecurityEnabled":true}
[INFO  - 2013-10-08T03:21:39.696Z] Session [bf133ac0-2fc8-11e3-96a2-8d953e0f94c6] - page.customHeaders:  - {}
[INFO  - 2013-10-08T03:21:39.696Z] Session [bf133ac0-2fc8-11e3-96a2-8d953e0f94c6] - CONSTRUCTOR - Desired Capabilities: {"platform":"ANY","javascriptEnabled":true,"browserName":"phantomjs","version":""}
[INFO  - 2013-10-08T03:21:39.696Z] Session [bf133ac0-2fc8-11e3-96a2-8d953e0f94c6] - CONSTRUCTOR - Negotiated Capabilities: {"browserName":"phantomjs","version":"1.9.2","driverName":"ghostdriver","driverVersion":"1.0.4","platform":"mac-10.8 (Mountain Lion)-64bit","javascriptEnabled":true,"takesScreenshot":true,"handlesAlerts":false,"databaseEnabled":false,"locationContextEnabled":false,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"cssSelectorsEnabled":true,"webStorageEnabled":false,"rotatable":false,"acceptSslCerts":false,"nativeEvents":true,"proxy":{"proxyType":"direct"}}
[INFO  - 2013-10-08T03:21:39.696Z] SessionManagerReqHand - _postNewSessionCommand - New Session Created: bf133ac0-2fc8-11e3-96a2-8d953e0f94c6

@exu
Copy link

exu commented Oct 29, 2013

Maybe not phantomJs related, but I have the same problem when connecting from Behat Selenium2Driver. In my case problem was in diverged versions of Selenium Node and Selenium Grid (node had 2.37 and grid had 2.33)

After updating version on Selenium Grid server everything works fine.

@stale stale bot added the stale label Dec 27, 2019
@stale
Copy link

stale bot commented Dec 30, 2019

Due to our very limited maintenance capacity, we need to prioritize our development focus on other tasks. Therefore, this issue will be automatically closed (see #15395 for more details). In the future, if we see the need to attend to this issue again, then it will be reopened. Thank you for your contribution!

@stale stale bot closed this as completed Dec 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants