I user Webdriverio 6.3.6 with selenium-standalone-service 6.1.14 and all my tests run successfully locally but my test fails in bitbucket pipeline with the following error
ERROR @wdio/cli:utils: A service failed in the 'onPrepare' hook
Error: not found: java
The same error happens for both firefox and chrome browser. How this can be fixed ?
The entire log is below.
(node:112) ExperimentalWarning: The dns.promises API is experimental
(node:112) ExperimentalWarning: The fs.promises API is experimental
2020-08-07T19:55:34.208Z INFO @wdio/cli:launcher: Run onPrepare hook
2020-08-07T19:55:34.852Z ERROR @wdio/cli:utils: A service failed in the 'onPrepare' hook
Error: not found: java
at getNotFoundError (/opt/atlassian/pipelines/agent/build/node_modules/which/which.js:13:12)
at Function.whichSync [as sync] (/opt/atlassian/pipelines/agent/build/node_modules/which/which.js:134:9)
at start (/opt/atlassian/pipelines/agent/build/node_modules/selenium-standalone/lib/start.js:60:27)
at Promise (internal/util.js:275:30)
at new Promise (<anonymous>)
at start (internal/util.js:274:12)
at SeleniumStandaloneLauncher.onPrepare (/opt/atlassian/pipelines/agent/build/node_modules/@wdio/selenium-standalone-service/build/launcher.js:59:81)
Continue...
2020-08-07T19:55:34.854Z INFO @wdio/cli:launcher: Run onWorkerStart hook
2020-08-07T19:55:34.856Z INFO @wdio/local-runner: Start worker 0-0 with arg: ./wdio.conf.js,--suite,regression
[0-0] (node:125) ExperimentalWarning: The dns.promises API is experimental
[0-0] (node:125) ExperimentalWarning: The fs.promises API is experimental
[0-0] 2020-08-07T19:55:35.347Z INFO @wdio/local-runner: Run worker command: run
[0-0] 2020-08-07T19:55:35.356Z INFO webdriverio: Initiate new session using the ./protocol-stub protocol
[0-0] RUNNING in chrome - /test/specs/regression/createMonitor.spec.js
[0-0] 2020-08-07T19:55:35.656Z INFO webdriverio: Initiate new session using the webdriver protocol
[0-0] 2020-08-07T19:55:35.659Z INFO webdriver: [POST] http://localhost:4444/wd/hub/session
[0-0] 2020-08-07T19:55:35.660Z INFO webdriver: DATA { capabilities:
{ alwaysMatch: { browserName: 'chrome' }, firstMatch: [ {} ] },
desiredCapabilities: { browserName: 'chrome' } }
[0-0] 2020-08-07T19:55:35.686Z ERROR webdriver: RequestError: connect ECONNREFUSED 127.0.0.1:4444
at ClientRequest.request.once (/opt/atlassian/pipelines/agent/build/node_modules/got/dist/source/core/index.js:890:25)
at Object.onceWrapper (events.js:277:13)
at ClientRequest.emit (events.js:194:15)
at ClientRequest.EventEmitter.emit (domain.js:441:20)
at ClientRequest.origin.emit.args (/opt/atlassian/pipelines/agent/build/node_modules/@szmarczak/http-timer/dist/source/index.js:39:20)
at Socket.socketErrorListener (_http_client.js:392:9)
at Socket.emit (events.js:189:13)
at Socket.EventEmitter.emit (domain.js:441:20)
at emitErrorNT (internal/streams/destroy.js:82:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1097:14)
[0-0] 2020-08-07T19:55:35.687Z ERROR @wdio/runner: Error: Failed to create session.
Unable to connect to "http://localhost:4444/wd/hub", make sure browser driver is running on that address.
If you use services like chromedriver see initialiseServices logs above or in wdio.log file as the service might had problems to start the driver.
at startWebDriverSession (/opt/atlassian/pipelines/agent/build/node_modules/webdriver/build/utils.js:45:11)
at process._tickCallback (internal/process/next_tick.js:68:7)
[0-0] Error: Failed to create session.
Unable to connect to "http://localhost:4444/wd/hub", make sure browser driver is running on that address.
If you use services like chromedriver see initialiseServices logs above or in wdio.log file as the service might had problems to start the driver.
[0-0] FAILED in chrome - /test/specs/regression/createMonitor.spec.js
2020-08-07T19:55:35.797Z INFO @wdio/cli:launcher: Run onComplete hook
Spec Files: 0 passed, 1 failed, 1 total (100% completed) in 00:00:01
2020-08-07T19:55:35.798Z INFO @wdio/local-runner: Shutting down spawned worker
2020-08-07T19:55:36.050Z INFO @wdio/local-runner: Waiting for 0 to shut down gracefully
2020-08-07T19:55:36.050Z INFO @wdio/local-runner: shutting down
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! monitoring_tests@1.0.0 regression: `wdio ./wdio.conf.js --suite regression`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the monitoring_tests@1.0.0 regression script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-08-07T19_55_36_063Z-debug.log
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am sorry for late response, I just changed the docker image to one of circleCI docker images with browsers and all tests run successfully. The problem was in docker
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hah! I was mostly kidding, but I always run into this situation where the person says they fixed it and didn't say how. glad it worked for you. More than likely it was because the image that was calling selenium-standalone did not have java installed. If you can build the image, try adding an " RUN npm install -g selenium-standalone" or something like that
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Hayk Sardaryan : can you please share the yml file for reference. I'm getting similar error while running webdriver.io tests (written in typescript) in bitbucket pipeline.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.