Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[馃悰 Bug]: Session not created in windows via wdio/cli#14729

Copy link
Copy link
@aviralpostman

Description

@aviralpostman
Issue body actions

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

8.46.0

Node.js Version

20.11.1

Mode

Standalone Mode

Which capabilities are you using?

{
      browserName: 'chrome',
      pageLoadStrategy: 'eager',
      'goog:chromeOptions': {
        excludeSwitches: ['enable-automation'],
        args: ['--test-type=browser',
    '--no-sandbox',
    '--disable-infobars',
    '--disable-gpu'],
        prefs: {
          credentials_enable_service: false,
          profile: {
            password_manager_enabled: false,
            content_settings: {
              exceptions: {
                clipboard: {
                  ['*,*']: {
                    expiration: '0',
                    last_modified: Date.now(),
                    model: 0,
                    setting: 1,
                  },
                },
              },
            },
          },
          directory_upgrade: true,
          prompt_for_download: false,
          'download.default_directory': downloadDir,
          'profile.managed_default_content_settings.popups': 2,
          'profile.managed_default_content_settings.notifications': 2,
        },
      },
      acceptInsecureCerts: true,
    },

What happened?

I'm currently migrating my codebase to use @wdio/cli instead of using child_processes to execute the wdio command.
After migrating the code to use wdio/cli, I'm seeing that it works on linux and mac but fails on windows and the failure is around session not getting created.

What is your expected behavior?

Session is not getting created specifically in windows when I use the Launcher method i.e. @wdio/cli
Expected behaviour is for the session to get created and test to run.

How to reproduce the bug.

create a minimal wdio.conf file with the capability attached above run tests via the following script in windows:

import { Launcher } from '@wdio/cli';

async function runTests() {
  runnerOptions.spec = ['test.spec.js'];

  const wdio = new Launcher('wdio.conf.js', runnerOptions);
  wdio.run().then(
    async (code) => {
      process.exit(code);
    },
    async (error) => {
      logger.error('Launcher failed to start the test', error.stacktrace || error);
      process.exit(1);
    }
  );
}

runTests()

Relevant log output

[0-1] 2025-08-27T07:34:10.374Z DEBUG @wdio/runner: init remote session
[0-1] 2025-08-27T07:34:10.376Z INFO webdriver: Initiate new session using the WebDriver protocol
[0-1] 2025-08-27T07:34:10.586Z INFO webdriver: Using Chromedriver v139.0.7258.155 from cache directory C:\Users\circleci\AppData\Local\Temp
[0-1] 2025-08-27T07:34:10.623Z INFO chromedriver: Starting ChromeDriver 139.0.7258.155 (206d8aac017ed2a506c9ee9389c39d5d97663c9d-refs/branch-heads/7258@{#2927}) on port 50347
[0-1] 2025-08-27T07:34:10.624Z INFO chromedriver: Remote connections are allowed by an allowlist (0.0.0.0).
[0-1] 2025-08-27T07:34:10.624Z INFO chromedriver: Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
[0-1] 2025-08-27T07:34:10.629Z INFO chromedriver: ChromeDriver was started successfully on port 50347.
[0-0] 2025-08-27T07:34:11.156Z INFO @wdio/utils: Started Chromedriver v139.0.7258.155 with params --port=50344 --allowed-origins=* --allowed-ips=0.0.0.0 in 1048ms on port 50344
[0-0] 2025-08-27T07:34:11.163Z INFO webdriver: [POST] http://127.0.0.1:50344/session
[0-0] 2025-08-27T07:34:11.164Z INFO webdriver: DATA {
[0-0]   capabilities: {
[0-0]     alwaysMatch: {
[0-0]       browserName: 'chrome',
[0-0]       pageLoadStrategy: 'eager',
[0-0]       'goog:chromeOptions': [Object],
[0-0]       acceptInsecureCerts: true,
[0-0]       'wdio:sharedStoreServicePort': 50340
[0-0]     },
[0-0]     firstMatch: [ {} ]
[0-0]   },
[0-0]   desiredCapabilities: {
[0-0]     browserName: 'chrome',
[0-0]     pageLoadStrategy: 'eager',
[0-0]     'goog:chromeOptions': {
[0-0]       binary: 'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe',
[0-0]       excludeSwitches: [Array],
[0-0]       args: [Array],
[0-0]       prefs: [Object]
[0-0]     },
[0-0]     acceptInsecureCerts: true,
[0-0]     'wdio:sharedStoreServicePort': 50340
[0-0]   }
[0-0] }
[0-1] 2025-08-27T07:34:11.622Z INFO @wdio/utils: Started Chromedriver v139.0.7258.155 with params --port=50347 --allowed-origins=* --allowed-ips=0.0.0.0 in 1046ms on port 50347
[0-1] 2025-08-27T07:34:11.635Z INFO webdriver: [POST] http://127.0.0.1:50347/session
[0-1] 2025-08-27T07:34:11.636Z INFO webdriver: DATA {
[0-1]   capabilities: {
[0-1]     alwaysMatch: {
[0-1]       browserName: 'chrome',
[0-1]       pageLoadStrategy: 'eager',
[0-1]       'goog:chromeOptions': [Object],
[0-1]       acceptInsecureCerts: true,
[0-1]       'wdio:sharedStoreServicePort': 50340
[0-1]     },
[0-1]     firstMatch: [ {} ]
[0-1]   },
[0-1]   desiredCapabilities: {
[0-1]     browserName: 'chrome',
[0-1]     pageLoadStrategy: 'eager',
[0-1]     'goog:chromeOptions': {
[0-1]       binary: 'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe',
[0-1]       excludeSwitches: [Array],
[0-1]       args: [Array],
[0-1]       prefs: [Object]
[0-1]     },
[0-1]     acceptInsecureCerts: true,
[0-1]     'wdio:sharedStoreServicePort': 50340
[0-1]   }
[0-1] }
[0-1] 2025-08-27T07:34:13.524Z DEBUG webdriver: request failed due to response error: session not created
[0-1] 2025-08-27T07:34:13.525Z WARN webdriver: Request failed with status 500 due to session not created: probably user data directory is already in use, please specify a unique value for --user-data-dir argument, or don't use --user-data-dir

<Removed logs of automated retries as they all were same>

[0-1] 2025-08-27T07:34:43.815Z ERROR webdriver: session not created: session not created: probably user data directory is already in use, please specify a unique value for --user-data-dir argument, or don't use --user-data-dir
[0-1]     at getErrorFromResponseBody (file:///C:/Users/circleci/project/node_modules/webdriver/build/utils.js:195:12)
[0-1]     at NodeJSRequest._request (file:///C:/Users/circleci/project/node_modules/webdriver/build/request/index.js:193:23)
[0-1]     at processTicksAndRejections (node:internal/process/task_queues:95:5)
[0-1]     at startWebDriverSession (file:///C:/Users/circleci/project/node_modules/webdriver/build/utils.js:64:20)
[0-1]     at Function.newSession (file:///C:/Users/circleci/project/node_modules/webdriver/build/index.js:19:45)
[0-1]     at remote (file:///C:/Users/circleci/project/node_modules/webdriverio/build/index.js:46:22)
[0-1]     at Runner._startSession (file:///C:/Users/circleci/project/node_modules/@wdio/runner/build/index.js:241:29)
[0-1]     at Runner._initSession (file:///C:/Users/circleci/project/node_modules/@wdio/runner/build/index.js:207:25)
[0-1]     at Runner.run (file:///C:/Users/circleci/project/node_modules/@wdio/runner/build/index.js:88:19)


I'm not sure why session creation is failing all the time specifically in windows while it's passing for mac and linux.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bug 馃悰help wantedIssues that are free to take by anyone interestedIssues that are free to take by anyone interested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.