Running Electron with webdriverio throws chrome not reachable

Viewed 342

Has anyone tried working with electron and webdriverio? I am using the latest electron 16 version with "wdio-chromedriver-service": "^7.2.2" and chromedriver "96.0.0" version. I am getting the following error:

$ npx wdio run ./wdio.conf.js --spec welcome-test.e2e.js

Execution of 1 workers started at 2021-11-30T11:14:38.431Z


2021-11-30T11:14:38.516Z INFO @wdio/cli:launcher: Run onPrepare hook
2021-11-30T11:14:38.517Z INFO chromedriver: Start Chromedriver (C:\Projects\abc\node_modules\chromedriver\lib\chromedriver\chromedriver.exe) with args --silent --port=9515 --url-base=/
2021-11-30T11:14:38.652Z INFO @wdio/cli:launcher: Run onWorkerStart hook
2021-11-30T11:14:38.657Z INFO @wdio/local-runner: Start worker 0-0 with arg: run,./wdio.conf.js,--spec,welcome-test.e2e.js
[0-0] 2021-11-30T11:14:39.340Z INFO @wdio/local-runner: Run worker command: run
[0-0] RUNNING in chrome - C:\Projects\abc\test\specs\welcome-test.e2e.js
[0-0] 2021-11-30T11:14:40.069Z INFO webdriver: Initiate new session using the WebDriver protocol
[0-0] 2021-11-30T11:14:40.136Z INFO webdriver: [POST] http://localhost:9515/session
[0-0] 2021-11-30T11:14:40.137Z INFO webdriver: DATA {
[0-0]   capabilities: {
[0-0]     alwaysMatch: {
[0-0]       browserName: 'chrome',
[0-0]       acceptInsecureCerts: true,
[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]     'goog:chromeOptions': {
[0-0]       binary: 'C:/Projects/abc/node_modules/electron/dist/electron.exe',
[0-0]       args: [Array]
[0-0]     }
[0-0]   }
[0-0] }
[0-0] 2021-11-30T11:14:45.557Z WARN webdriver: Request failed with status 500 due to unknown error: Chrome failed to start: exited normally.
[0-0]   (chrome not reachable)
[0-0]   (The process started from chrome location C:/Projects/abc/node_modules/electron/dist/electron.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.)

My wdio.conf.js file look like this:

capabilities: [{
        // maxInstances can get overwritten per capability. So if you have an in-house Selenium
        // grid with only 5 firefox instances available you can make sure that not more than
        // 5 instances get started at a time.
        maxInstances: 1,
        browserName: 'chrome',
        acceptInsecureCerts: true,
        'goog:chromeOptions': {
            binary: 'C:/Projects/abc/node_modules/electron/dist/electron.exe', // Path to your Electron binary.
            args: ['app=C:/Projects/abc', '--no-sandbox', '--headless'], // Optional, perhaps 'app=' + /path/to/your/app/
        },
        // If outputDir is provided WebdriverIO can capture driver session logs
        // it is possible to configure which logTypes to include/exclude.
        // excludeDriverLogs: ['*'], // pass '*' to exclude all driver session logs
        // excludeDriverLogs: ['bugreport', 'server'],
    }],

Any help is appreciated.

0 Answers
Related