Skip to content

Console errors when running multiple Electron sessions using multiremote — windowHandle is undefined #1096

@DenysT07

Description

@DenysT07

I’m trying to run two Electron sessions simultaneously using WebdriverIO's multiremote mode. While the test itself does not crash and continues running, the console outputs the following errors:

ERROR @wdio/utils:shim: TypeError: Cannot read properties of undefined (reading 'windowHandle')
 at switchToActiveWindow (D:\qweasdqwe\node_modules\src\window.ts:35:87)
 at ensureActiveWindowFocus (D:\qweasdqwe\node_modules\src\window.ts:59:13)
 at ElectronWorkerService.beforeCommand (D:\qweasdqwe\node_modules\src\service.ts:157:5)
 at async Promise.all (index 0)
 at Browser.executeHooksWithArgs (D:\qweasdqwe\node_modules\@wdio\utils\build\index.js:890:18)
 at Browser.wrapCommandFn (D:\qweasdqwe\node_modules\@wdio\utils\build\index.js:901:7)
 at async Promise.all (index 0)
 at MultiRemoteDriver.<anonymous> (D:\qweasdqwe\node_modules\webdriverio\build\node.js:8526:22)
 at MultiRemoteDriver.wrapCommandFn (D:\qweasdqwe\node_modules\@wdio\utils\build\index.js:907:23)
 at async Runner.endSession (file:///D:/qweasdqwe/node_modules/@wdio/runner/build/index.js:909:5)
 at async Runner.run (file:///D:/qweasdqwe/node_modules/@wdio/runner/build/index.js:761:7)

ERROR webdriver: WebDriverError: javascript error: Cannot read properties of undefined (reading 'execute')
 (Session info: chrome=124.0.6367.243) when running "execute/sync" with method "POST" and args "function executeWithinElectron(script, ...args) {
       return window.wdioElectron.execute(script, args);
   }"

This only occurs when running more than one session. If I run the test with just a single Electron session, everything works as expected with no errors.

Here is my capabilities setup:

capabilities: {
  firstSession: {
    capabilities: {
      browserName: 'electron',
      browserVersion: '124.0.6367.243',
      'wdio:electronServiceOptions': {
        appBinaryPath: 'C:/Users/UserName/AppData/Local/slack/app-4.44.59/slack.exe',
        appArgs: []
      }
    }
  },
  secondSession: {
    capabilities: {
      browserName: 'electron',
      browserVersion: '124.0.6367.243',
      'wdio:electronServiceOptions': {
        appBinaryPath: 'C:/Users/UserName/AppData/Local/slack/app-4.44.59/slack.exe',
        appArgs: []
      }
    }
  }
}

📌 Notes:

  • Tested using WebdriverIO with the Electron service plugin.
  • Using browserVersion: 124.0.6367.243.
  • Also tested using the official Slack Electron app — the same errors appear in the console.
  • Issue happens regardless of the app path or args.
  • My expectation is to be able to run two Electron sessions via multiremote without encountering internal errors.
  • Let me know if you need a minimal reproduction repo.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:testsUpdates to testsbackport:requestedShould be applied to the maintained (previous) versionhelp:wantedAdditional help is neededrelease:nextInclude in the next release within its tracksemver:patchChanges that don't affect the API (bug fixes)status:investigatingNeeds definition before work can starttrack:mainFor the current stable version tracktype:bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions