Skip to content

[🐛 Bug]: Expose driver logs to stdout if outputDir is not set #11162

@iamatharva

Description

@iamatharva

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

8.16.0

Node.js Version

18.16.0

Mode

WDIO Testrunner

Which capabilities are you using?

capabilities: [
    {
      browserName: 'chrome',
      acceptInsecureCerts: true,
      browserVersion: 'stable',
      'goog:chromeOptions': {
        args: ['--no-sandbox', '--disable-infobars', '--headless', '--disable-gpu', '--window-size=1440,735'],
      },
    },

What happened?

WDIO failed to create session when started in docker container with node image.
Running test in headful/headless mode works fine if started on a local machine without being containerised.
The docker file configuration and the package.json wdio version's are mentioned below in How to reproduce the bug. section.

What is your expected behavior?

The execution should happen in the same way the way it happens on local machine in headless mode.

How to reproduce the bug.

The capabilities are mentioned above in the Which capabilities are you using? section.

I am using following docker file to reproduce the issue:

FROM node:18.16.0-slim

USER root

WORKDIR /app/

COPY . .

COPY package*.json ./

RUN npm install

RUN mkdir screenshots

ENTRYPOINT ["npm", "run", "test"]

Following versions are being used in package.json

    "@wdio/cli": "^8.16.0",
    "@wdio/local-runner": "^8.16.0",
    "@wdio/mocha-framework": "^8.16.0",
    "@wdio/spec-reporter": "^8.16.0",

The error is mentioned in the Relevant log output section.

Relevant log output

2023-09-13T09:49:42.913Z INFO @wdio/utils: Setting up browser driver for: chrome@stable
2023-09-13T09:49:42.918Z INFO @wdio/utils: Setting up browser binaries for: chrome@stable
2023-09-13T09:49:43.189Z INFO webdriver: Downloading Chromedriver v117.0.5938.62
2023-09-13T09:49:43.264Z INFO webdriver: Setting up chrome v117.0.5938.62
2023-09-13T09:49:43.696Z INFO webdriver: Downloading Chromedriver 47.13%
2023-09-13T09:49:44.696Z INFO webdriver: Downloading chrome (117.0.5938.62) 5.37%
2023-09-13T09:49:45.696Z INFO webdriver: Downloading chrome (117.0.5938.62) 13.37%
2023-09-13T09:49:46.696Z INFO webdriver: Downloading chrome (117.0.5938.62) 21.37%
2023-09-13T09:49:47.696Z INFO webdriver: Downloading chrome (117.0.5938.62) 29.37%
2023-09-13T09:49:48.696Z INFO webdriver: Downloading chrome (117.0.5938.62) 36.47%
2023-09-13T09:49:49.696Z INFO webdriver: Downloading chrome (117.0.5938.62) 44.48%
2023-09-13T09:49:50.696Z INFO webdriver: Downloading chrome (117.0.5938.62) 52.48%
2023-09-13T09:49:51.697Z INFO webdriver: Downloading chrome (117.0.5938.62) 60.50%
2023-09-13T09:49:52.698Z INFO webdriver: Downloading chrome (117.0.5938.62) 68.52%
2023-09-13T09:49:53.699Z INFO webdriver: Downloading chrome (117.0.5938.62) 76.24%
2023-09-13T09:49:54.700Z INFO webdriver: Downloading chrome (117.0.5938.62) 83.63%
2023-09-13T09:49:55.701Z INFO webdriver: Downloading chrome (117.0.5938.62) 91.65%
2023-09-13T09:49:56.701Z INFO webdriver: Downloading chrome (117.0.5938.62) 99.66%
2023-09-13T09:50:00.659Z INFO @wdio/cli:launcher: Run onWorkerStart hook
2023-09-13T09:50:00.659Z INFO @wdio/local-runner: Start worker 0-0 with arg: ./config/headless.conf.ts
2023-09-13T09:50:00.667Z DEBUG @wdio/local-runner: Send command run to worker with cid "0-0"
[0-0] 2023-09-13T09:50:01.276Z INFO @wdio/local-runner: Run worker command: run
[0-0] 2023-09-13T09:50:01.452Z DEBUG @wdio/runner: init remote session
[0-0] 2023-09-13T09:50:01.454Z DEBUG @wdio/utils:initialiseServices: initialise service "intercept" as NPM package
[0-0] RUNNING in chrome - file:///e2e/abc.e2e.ts
[0-0] 2023-09-13T09:50:01.902Z DEBUG @wdio/runner: init remote session
[0-0] 2023-09-13T09:50:01.903Z INFO webdriver: Initiate new session using the WebDriver protocol
[0-0] 2023-09-13T09:50:02.078Z INFO webdriver: Setting up chrome v117.0.5938.62
[0-0] 2023-09-13T09:50:02.079Z INFO webdriver: Using Chromedriver v117.0.5938.62 from cache directory /tmp
[0-0] 2023-09-13T09:50:12.161Z INFO @wdio/utils: Started Chromedriver v117.0.5938.62 with params --port=41775 --allowed-origins=* --allowed-ips=0.0.0.0 in 10257ms on port 41775
[0-0] 2023-09-13T09:50:12.214Z INFO webdriver: [POST] http://0.0.0.0:41775/session
[0-0] 2023-09-13T09:50:12.214Z INFO webdriver: DATA {
[0-0]   capabilities: {
[0-0]     alwaysMatch: {
[0-0]       browserName: 'chrome',
[0-0]       acceptInsecureCerts: true,
[0-0]       browserVersion: 'stable',
[0-0]       'goog:chromeOptions': [Object]
[0-0]     },
[0-0]     firstMatch: [ {} ]
[0-0]   },
[0-0]   desiredCapabilities: {
[0-0]     browserName: 'chrome',
[0-0]     acceptInsecureCerts: true,
[0-0]     browserVersion: 'stable',
[0-0]     'goog:chromeOptions': {
[0-0]       binary: '/tmp/chrome/linux-117.0.5938.62/chrome-linux64/chrome',
[0-0]       args: [Array]
[0-0]     }
[0-0]   }
[0-0] }
[0-0] 2023-09-13T09:50:12.223Z ERROR webdriver: RequestError: connect ECONNREFUSED 0.0.0.0:41775
[0-0]     at ClientRequest.<anonymous> (file:///app/node_modules/webdriver/node_modules/got/dist/source/core/index.js:790:107)
[0-0]     at Object.onceWrapper (node:events:628:26)
[0-0]     at ClientRequest.emit (node:events:525:35)
[0-0]     at ClientRequest.emit (node:domain:489:12)
[0-0]     at Socket.socketErrorListener (node:_http_client:502:9)
[0-0]     at Socket.emit (node:events:513:28)
[0-0]     at Socket.emit (node:domain:489:12)
[0-0]     at emitErrorNT (node:internal/streams/destroy:151:8)
[0-0]     at emitErrorCloseNT (node:internal/streams/destroy:116:3)
[0-0]     at processTicksAndRejections (node:internal/process/task_queues:82:21)
[0-0]     at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1494:16)
[0-0] 2023-09-13T09:50:12.223Z ERROR @wdio/runner: Error: Failed to create session.
[0-0] Unable to connect to "http://0.0.0.0:41775/", make sure browser driver is running on that address.
[0-0] It seems like the service failed to start or is rejecting any connections.
[0-0]     at startWebDriverSession (file:///app/node_modules/webdriver/build/utils.js:68:15)
[0-0]     at processTicksAndRejections (node:internal/process/task_queues:95:5)
[0-0]     at async Function.newSession (file:///app/node_modules/webdriver/build/index.js:27:45)
[0-0]     at async remote (file:///app/node_modules/webdriverio/build/index.js:45:22)
[0-0]     at async Runner._startSession (file:///app/node_modules/@wdio/runner/build/index.js:224:29)
[0-0]     at async Runner._initSession (file:///app/node_modules/@wdio/runner/build/index.js:190:25)
[0-0]     at async Runner.run (file:///app/node_modules/@wdio/runner/build/index.js:79:19)
2023-09-13T09:50:12.356Z DEBUG @wdio/local-runner: Runner 0-0 finished with exit code 1


### Code of Conduct

- [X] I agree to follow this project's Code of Conduct

### Is there an existing issue for this?

- [X] I have searched the existing issues

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions