spectron icon indicating copy to clipboard operation
spectron copied to clipboard

Electron 10.3.0 and Spectron 12.0.0 gives error "Failed to create session"

Open alberto-f opened this issue 3 years ago • 5 comments

Hello,

Im trying to run the electron-quick-start app using Electron 10.3.0 and Spectron 12.0.0 under node v12.18.3

Im getting the following error:

Application launch
    1) "before each" hook for "shows an initial window"


  0 passing (1s)
  1 failing

  1) Application launch
       "before each" hook for "shows an initial window":
     Error: Failed to create session.
unknown error: Chrome failed to start: exited abnormally.
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /Users/albertf/Test/electron-spectron-failed-to-create-session-error/node_modules/spectron/lib/launcher.js is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
      at Object.startWebDriverSession (node_modules/webdriver/build/utils.js:34:15)
      at processTicksAndRejections (internal/process/task_queues.js:97:5)

I created a repo for reproducing same error https://github.com/alberto-f/electron-spectron-failed-to-create-session-error

Could someone help me spot what it is wrong in here ? AFAIK Im even using the right versions.

albertf@albertf-mac electron-quick-start % npm ls spectron electron                         
[email protected] /Users/albertf/Test/electron-quick-start
├── [email protected] 
└── [email protected] 

If you don't have the time, Could you tell me what version of Spectron should work with the electron-quick-start repo?

Thanks.

alberto-f avatar Jan 18 '21 08:01 alberto-f

I got the same error, looks like a wrong version of Chrome browser in Spectron launcher https://github.com/electron-userland/spectron/issues/843

DWboutin avatar Jan 26 '21 23:01 DWboutin

me too.

my package.json

  "devDependencies": {
    "electron": "^12.0.2",
    "electron-builder": "^22.10.4",
    "mocha": "^8.3.2"
  },
  "dependencies": {
    "bootbox": "^5.4.0",
    "bootstrap": "^3.3.7",
    "spectron": "^14.0.0"
  }

here's the output from github actions

Run npm run test

> [email protected] test /home/runner/work/electron-example/electron-example/bootbox
> mocha



  Application launch
    1) "before each" hook for "show an initial window"


  0 passing (6s)
  1 failing

  1) Application launch
       "before each" hook for "show an initial window":
     Error: Failed to create session.
unknown error: Chrome failed to start: exited abnormally.
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /home/runner/work/electron-example/electron-example/bootbox/node_modules/spectron/lib/launcher.js is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
      at Object.startWebDriverSession (node_modules/webdriver/build/utils.js:34:15)
      at processTicksAndRejections (internal/process/task_queues.js:93:5)
      at async Function.newSession (node_modules/webdriver/build/index.js:35:45)
      at async Object.exports.remote (node_modules/webdriverio/build/index.js:53:22)

dhanyn10 avatar Apr 17 '21 15:04 dhanyn10

Same here:

{
  "devDependencies": {
...
    "electron": "^12.0.5",
    "spectron": "^14.0.0",
...
  },
}

ghost avatar Apr 26 '21 15:04 ghost

Has anyone found an answer to this issue? Same configurations as above:

$ npm test

[email protected] test /home/smaydew/projects/electron-spectron-example node ./node_modules/mocha/bin/_mocha --require esm --timeout 20000

Sample Test 1) "before each" hook for "opens a window"

0 passing (2s) 1 failing

  1. Sample Test "before each" hook for "opens a window": Error: Failed to create session. unknown error: Chrome failed to start: exited abnormally. (unknown error: DevToolsActivePort file doesn't exist) (The process started from chrome location /home/smaydew/projects/electron-spectron-example/node_modules/spectron/lib/launcher.js is no longer running, so ChromeDriver is assuming that Chrome has crashed.) at Object.startWebDriverSession (node_modules/webdriver/build/utils.js:34:15) at processTicksAndRejections (internal/process/task_queues.js:93:5) at async Function.newSession (node_modules/webdriver/build/index.js:35:45) at async Object.exports.remote (node_modules/webdriverio/build/index.js:53:22)

npm ERR! Test failed. See above for more details.

$ npm ls spectron electron [email protected] /home/smaydew/projects/electron-spectron-example ├── [email protected] └── [email protected]

smaydew avatar Jun 10 '21 19:06 smaydew

Spectron does not work with contextIsolation=true and enableRemoteModule=false See #693

kkondracki avatar Jun 15 '21 12:06 kkondracki