YahooArchive / arrow

FE Test framework designed to promote TDD
http://yahoo.github.io/arrow/arrow_intro.html
BSD 3-Clause "New" or "Revised" License
55 stars 59 forks source link

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

Closed dmitris closed 10 years ago

dmitris commented 11 years ago

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 commented 11 years ago

fix submited in https://github.com/yahoo/arrow/pull/20

pranavparikh commented 10 years ago

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