Skip to content

(usability) arrow_selenium --list dies with a Javascript error if no webdriver instance is found #19

Closed
dmitris opened this Issue Oct 1, 2012 · 2 comments

2 participants

@dmitris
dmitris commented Oct 1, 2012

If you don't have Selenium Server running on http://localhost:4444/wd/hub and run:
arrow_selenium --list
you get a Javascript error:

$ arrow_selenium --list
[2012-10-01 12:00:20.726] [INFO] selenium - Selenium host: http://localhost:4444/wd/hub
[2012-10-01 12:00:20.740] [FATAL] WebDriverSession - Error while connecting to Selenium Server: http://localhost:4444/wd/hub
[2012-10-01 12:00:20.740] [FATAL] WebDriverSession - Error Message : connect ECONNREFUSED

/Users/dmitris/.nvm/v0.8.11/lib/node_modules/yahoo-arrow/arrow_selenium/selenium.js:39
    if (0 === arrSessions.length) {
                         ^
TypeError: Cannot read property 'length' of null
    at listSessions (/Users/dmitris/.nvm/v0.8.11/lib/node_modules/yahoo-arrow/arrow_selenium/selenium.js:39:26)
    at ClientRequest.WebDriverSession.getSessions (/Users/dmitris/.nvm/v0.8.11/lib/node_modules/yahoo-arrow/lib/session/wdsession.js:58:9)
    at ClientRequest.EventEmitter.emit (events.js:93:17)
    at Socket.socketErrorListener (http.js:1330:9)
    at Socket.EventEmitter.emit (events.js:93:17)
    at Socket._destroy.self.errorEmitted (net.js:328:14)
    at process.startup.processNextTick.process._tickCallback (node.js:244:9)

If you do have a server running but no browser instances created, the error is:

$ arrow_selenium --list
[2012-10-01 11:55:37.488] [INFO] selenium - Selenium host: http://localhost:4444/wd/hub
[2012-10-01 11:55:37.505] [FATAL] WebDriverSession - No active selenium session found
[2012-10-01 11:55:37.505] [INFO] WebDriverSession - You can also create sessions here : http://localhost:4444/wd/hub

/Users/dmitris/.nvm/v0.8.11/lib/node_modules/yahoo-arrow/arrow_selenium/selenium.js:39
    if (0 === arrSessions.length) {
                         ^
TypeError: Cannot read property 'length' of null
    at listSessions (/Users/dmitris/.nvm/v0.8.11/lib/node_modules/yahoo-arrow/arrow_selenium/selenium.js:39:26)
    at IncomingMessage.WebDriverSession.getSessions (/Users/dmitris/.nvm/v0.8.11/lib/node_modules/yahoo-arrow/lib/session/wdsession.js:46:17)
    at IncomingMessage.EventEmitter.emit (events.js:123:20)
    at IncomingMessage._emitEnd (http.js:366:10)
    at HTTPParser.parserOnMessageComplete [as onMessageComplete] (http.js:149:23)
    at Socket.socketOnData [as ondata] (http.js:1366:20)
    at TCP.onread (net.js:403:27)

It would be good to add some error checking and user-friendly message - for example, a reminder that you can download the selenium-server-standalone JAR from http://code.google.com/p/selenium/downloads/list and start the server with:
java -jar path/to/jar/selenium-server-standalone-2..jar

@dmitris
dmitris commented Oct 1, 2012

fix submited in #20

@proverma proverma pushed a commit that referenced this issue Dec 13, 2012
@dmitris dmitris Minor change to address issue #19 - Javascript error if no selenium b…
…rowser sessions found, also expanded the help to clarify use of --open
bf37fdf
@pranavparikh

arrow_selenium --list

[2014-03-19 10:14:18.620] [INFO] selenium - Selenium host: http://localhost:4444/wd/hub
[2014-03-19 10:14:18.630] [FATAL] WebDriverSession - No active selenium session found
[2014-03-19 10:14:18.630] [INFO] WebDriverSession - You can also create sessions here : http://localhost:4444/wd/hub
[2014-03-19 10:14:18.631] [INFO] selLib - Error : No active selenium session found

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.