After successfully developing cucumber tests that passed and tested some URLs with Chrome, I encountered errors when uploading to the pipeline despite the tests succeeding. Webdriver generated the following errors:
INFO webdriver: DATA {
57[0-0] capabilities: {
58[0-0] alwaysMatch: { browserName: 'chrome', acceptInsecureCerts: true },
59[0-0] firstMatch: [ {} ]
60[0-0] },
61[0-0] desiredCapabilities: { browserName: 'chrome', acceptInsecureCerts: true }
62[0-0] }
ERROR webdriver: RequestError: connect ECONNREFUSED 127.0.0.1:9515
64[0-0] at ClientRequest.<anonymous> (/builds/zdf-cloud/fitness-functions/node_modules/got/dist/source/core/index.js:962:111)
65[0-0] at Object.onceWrapper (events.js:418:26)
66[0-0] at ClientRequest.emit (events.js:323:22)
67[0-0] at ClientRequest.EventEmitter.emit (domain.js:482:12)
68[0-0] at ClientRequest.origin.emit (/builds/zdf-cloud/fitness-functions/node_modules/@szmarczak/http-timer/dist/source/index.js:43:20)
69[0-0] at Socket.socketErrorListener (_http_client.js:426:9)
70[0-0] at Socket.emit (events.js:311:20)
71[0-0] at Socket.EventEmitter.emit (domain.js:482:12)
72[0-0] at emitErrorNT (internal/streams/destroy.js:92:8)
73[0-0] at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
74[0-0] at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1137:16)
75[0-0] 2022-02-18T10:21:26.227Z ERROR @wdio/runner: Error: Failed to create session.
76[0-0] Unable to connect to "http://localhost:9515/", make sure browser driver is running on that address.
77[0-0] 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.
78[0-0] at startWebDriverSession (/builds/zdf-cloud/fitness-functions/node_modules/webdriver/build/utils.js:72:15)
79[0-0] at processTicksAndRejections (internal/process/task_queues.js:97:5)
80[0-0] FAILED in chrome - /src/cucumber/features/www/originCheck.feature
812022-02-18T10:21:26.343Z INFO @wdio/cli:launcher: Run onComplete hook
82Spec Files: 0 passed, 1 failed, 1 total (100% completed) in 00:00:11
832022-02-18T10:21:26.345Z INFO @wdio/local-runner: Shutting down spawned worker
842022-02-18T10:21:26.596Z INFO @wdio/local-runner: Waiting for 0 to shut down gracefully
852022-02-18T10:21:26.597Z INFO @wdio/local-runner: shutting down
Despite implementing the configurations recommended on the WebDriver main site and trying various combinations of chromedriver
and selenium-standalone
settings in wdio.conf.js, the issue persisted:
capabilities: [{
maxInstances: 5,
browserName: 'chrome',
acceptInsecureCerts: true
}],
logLevel: 'info',
baseUrl: '',
waitforTimeout: 10000,
connectionRetryTimeout: 120000,
connectionRetryCount: 3,
services:
[
['selenium-standalone', { drivers: { firefox: '0.29.1', chrome: true, chromiumedge: 'latest' } }],
['chromedriver',
{
logFileName: 'wdio-chromedriver.log',
outputDir: 'driver-logs',
chromedriverCustomPath: './chromedriver.exe'
}]
],
Even after trying to downgrade the chromedriver version and changing docker images in the pipeline, the 'Failed to create session.' error persists. Do you have any suggestions on how to resolve this issue and avoid session creation errors when using Chrome with WebDriver?