Closed phawxby closed 7 years ago
Experiencing a similar issue on Jenkins (CentOS) running with slightly different dependencies. This is from the WillLuce/WebdriverIO_Typescript boiler plate.
Dependencies:
"devDependencies": {
"@types/chai": "^3.4.34",
"@types/mocha": "^2.2.32",
"@types/webdriverio": "^4.4.0",
"chai": "^3.5.0",
"rimraf": "^2.5.4",
"typescript": "^2.0.6",
"wdio-junit-reporter": "^0.3.0",
"wdio-mocha-framework": "^0.5.7",
"wdio-selenium-standalone-service": "0.0.7",
"webdriverio": "^4.8.0"
}
Output:
+ npm run test
> webdriver_typescript@1.0.0 test /var/jenkins/workspace/QA/Test-Project/default
> node ./node_modules/typescript/lib/tsc.js && node ./node_modules/webdriverio/bin/wdio && node ./node_modules/rimraf/bin.js src
A service failed in the 'onPrepare' hook
Error: Unable to connect to selenium
at Timeout.hasStarted (/var/jenkins/workspace/QA/Test-Project/default/node_modules/selenium-standalone/lib/check-started.js:17:10)
at ontimeout (timers.js:365:14)
at tryOnTimeout (timers.js:237:5)
at Timer.listOnTimeout (timers.js:207:5)
ERROR: connect ECONNREFUSED 127.0.0.1:4444
chrome
Error: connect ECONNREFUSED 127.0.0.1:4444
ERROR: connect ECONNREFUSED 127.0.0.1:4444
firefox
Error: connect ECONNREFUSED 127.0.0.1:4444
With the above error I am unsure if the selenium server even started. The configuration does work locally just when attempting to run it on Jenkins does it show this behaviour.
We are getting a similar error message under version 0.0.8. Meanwhile 0.0.5 works just fine.
A service failed in the 'onPrepare' hook
Error: Selenium server did not start.
Another Selenium process may already be running or your java version may be out of date.
Be sure to check the official Selenium release notes for minimum required java version: https://raw.githubusercontent.com/SeleniumHQ/selenium/master/java/CHANGELOG
at ChildProcess.errorIfNeverStarted (/home/travis/build/SpeedlineSolutions/SL-OLO/functional-tests/node_modules/selenium-standalone/lib/start.js:152:10)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
Continue...
ERROR: connect ECONNREFUSED 127.0.0.1:4444
phantomjs
Error: connect ECONNREFUSED 127.0.0.1:4444
ERROR: connect ECONNREFUSED 127.0.0.1:4444
firefox
Error: connect ECONNREFUSED 127.0.0.1:4444
@darrenv-speedline your error is obvious:
Another Selenium process may already be running or your java version may be out of date. Be sure to check the official Selenium release notes for minimum required java version: https://raw.githubusercontent.com/SeleniumHQ/selenium/master/java/CHANGELOG
That seems to be not related to this bug.
Closing due to inactivity.
Leaving the following links here which solved this problem for me:
Mine was basically a java path issue. Applying the instructions on the stackoverflow link worked for me.
Getting the same error, but I don't have a dependency on wdio-selenium-standalone-server in package.json (was not trying to use it and Jasmine suites run fine via the same Jenkins setup without it, though the corresponding Cucumber-framework suite prompted for wdio-selenium-standalone-server to be installed).
It is likely there is already a Selenium process running on port 4444 (which I am using), as http://127.0.0.1:4444/wd/hub/sessions is accessible (but says " "status":13,"value":{"message":"Session [(null externalkey)] not available and is not among the last 1000 terminated sessions.\nActive sessions are[ext. key 6319236f-122c-4001-b651-ad6871249ab0, ext. key 88bbbab0-79e6-43a1-b6ed-98b0780b1562, ext. key 5c70efc4-0b24-4464-9567-e02cd18f5965]","class":"org.openqa.grid.common.exception.GridException","stackTrace"" ). The grid console is also available, and says http://127.0.0.1:4444/grid/console?config=true&configDebug=true: ub launched with : -browserTimeout 120000 -debug false -help false -log log\hub_4444.log -port 4444 ....
Log Error: A service failed in the 'onPrepare' hook Error: Unable to connect to selenium at Timeout.hasStarted [as _onTimeout] (C:\Users\quality\AppData\Roaming\npm\node_modules\wdio-selenium-standalone-service\node_modules\selenium-standalone\lib\check-started.js:17:10) at ontimeout (timers.js:365:14) at tryOnTimeout (timers.js:237:5) at Timer.listOnTimeout (timers.js:207:5)
The error indicates it is trying to connect to wdio-selenium-standalone-service in this case and not the Hub instance that the Jasmine suite is running. Is there a way to have it not require/try to use wdio-selenium-standalone-service?
Package.json currently has the following dependencies listed: "dependencies": { "Faker": "^0.7.2", "colors": "^1.1.2", "download-file": "^0.1.5", "follow-redirects": "^1.2.1", "lodash": "^4.17.4", "cucumber": "2.3.1", "babel-preset-es2015": "~6.24.0", "babel-register": "~6.26.0", "wdio-cucumber-framework": "^1.1.0", "wdio-allure-reporter": "^0.1.3", "wdio-junit-reporter": "^0.3.1", "wdio-spec-reporter": "0.0.5", "webdriverio": "^4.6.2", "yargs": "^6.6.0" }, "devDependencies": { "wdio-cucumber-framework": "^1.1.0", "wdio-allure-reporter": "^0.1.3", "wdio-junit-reporter": "^0.3.1", "chai": "~4.1.2", "babel-jest": "~22.1.0", "babel-polyfill": "~6.26.0", "eslint": "~4.16.0", "eslint-config-airbnb-base": "~12.1.0", "eslint-plugin-import": "~2.8.0", "forever": "~0.15.3", "http-server": "~0.11.0", "jest": "~22.1.0" }
Windows 10 x64 Enterprise
After running the test command I can see Selenium has started but it fails to run any tests and throws an unable to connect error. Any help would be much appreciated.
Dependencies (truncated)
Gulpfile
Output