Error: self signed certificate in certificate chai

2019-08-06 13:29发布

问题:

I can run the selenium server with fresh rebooting of my Windows 7. However if I kill the server and start it again, I will get this error. Sometimes doing webdriver-manager update--ignore_ssl may fix the problem, but most of time it won't fix. Any idea?

I am running it on Windows 7 x64.

C:\Users\...> webdriver-manager start --ignore_ssl
events.js:163
      throw er; // Unhandled 'error' event
      ^

Error: self signed certificate in certificate chain
    at TLSSocket.<anonymous> (_tls_wrap.js:1084:38)
    at emitNone (events.js:86:13)
    at TLSSocket.emit (events.js:188:7)
    at TLSSocket._finishInit (_tls_wrap.js:606:8)
    at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:436:38)

回答1:

Most of the time clearing cache and ignoring ssl during webdriver-manager update would solve the problem

npm cache clean
webdriver-manager update --ignore_ssl

In my case I resolved by updating webdriver manage locally in the project and starting standalone server

package.json

"scripts": {
    "webdrivermanager:update": "node node_modules/protractor/bin/webdriver-manager update --versions.standalone=3.2.0 --ignore_ssl",
    "webdrivermanager:clean": "node node_modules/protractor/bin/webdriver-manager clean",
    "install": "npm run webdrivermanager:clean && npm run webdrivermanager:update"
  }

protractor configuration file

seleniumServerJar: 'node_modules/protractor/node_modules/webdriver-manager/selenium/selenium-server-standalone-3.2.0.jar',

npm install update your webdriver-manager first time and everytime you need just issue the command protractor protractor.conf.js