electron-userland / spectron

DEPRECATED: 🔎 Test Electron apps using ChromeDriver
http://electronjs.org/spectron
MIT License
1.68k stars 229 forks source link

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

Open alberto-f opened 3 years ago

alberto-f commented 3 years ago

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                         
electron-quick-start@1.0.0 /Users/albertf/Test/electron-quick-start
├── electron@10.3.0 
└── spectron@12.0.0 

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

Thanks.

DWboutin commented 3 years ago

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

dhanyn10 commented 3 years ago

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

> electron-with-bootbox@0.0.0 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)
ghost commented 3 years ago

Same here:

{
  "devDependencies": {
...
    "electron": "^12.0.5",
    "spectron": "^14.0.0",
...
  },
}
smaydew commented 3 years ago

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

$ npm test

electron-spectron-example@1.1.0 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 electron-spectron-example@1.1.0 /home/smaydew/projects/electron-spectron-example ├── electron@12.0.1 └── spectron@14.0.0

kkondracki commented 3 years ago

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