Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Why WDIO Selenium test fails in pipeline ?

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' hookError: 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 experimental2020-08-07T19:55:34.208Z INFO @wdio/cli:launcher: Run onPrepare hook2020-08-07T19:55:34.852Z ERROR @wdio/cli:utils: A service failed in the 'onPrepare' hookError: 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 hook2020-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.js2020-08-07T19:55:35.797Z INFO @wdio/cli:launcher: Run onComplete hookSpec 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 worker2020-08-07T19:55:36.050Z INFO @wdio/local-runner: Waiting for 0 to shut down gracefully2020-08-07T19:55:36.050Z INFO @wdio/local-runner: shutting downnpm ERR! code ELIFECYCLEnpm ERR! errno 1npm ERR! monitoring_tests@1.0.0 regression: `wdio ./wdio.conf.js --suite regression`npm ERR! Exit status 1npm 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

 

1 answer

Update: fixed

what was the fix??

@Hayk Sardaryan  Seriously, you can't just say that and then not respond!

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

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

@Hayk Sardaryan what was the image name? do you remember?

@Patrick Boyd it is circleci/node:lts-browsers

Like Mike Shtil likes this

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket Pipelines

What We Learned When We Researched Open Source Vulnerabilities in 7 Popular Coding Languages

...hey are a part of us, shaping how we interact with the world around us. The same holds true for programming languages when we think about how different kinds of vulnerabilities raise their heads in t...

1,323 views 0 3
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you