shellscape/mocha-chrome

net::ERR_INSECURE_RESPONSE when protocol is https

Closed this issue · 1 comments

ferbs commented

Looks like I stumbled onto a fresh new mocha-chrome, thanks for creating and sharing it.

Any thoughts on how to get it to work on https pages? I get net::ERR_INSECURE_RESPONSE

I tried adding the --ignore-certificate-errors flag to the chrome-launcher options in lib/instance.js but it didn't help.

  • Operating System:
    Mac OS X v10.12.3

  • Node Version:
    v7.7.4

  • NPM Version:
    yarn v0.27.5, npm v5.0.3

  • mocha Version:
    v3.5.0

  • mocha-chrome Version:
    v0.1.1

  • This is a feature request
  • This is a bug

Code

$ mocha-chrome https://localhost:8000
Resource Failed to Load: { url: 'https://localhost:8000/',
  method: 'GET',
  reason: 'net::ERR_INSECURE_RESPONSE' }
[chrome-exception] { timestamp: 1502357619852.674,
  exceptionDetails: 
   { exceptionId: 1,
     text: 'Uncaught',
     lineNumber: 5,
     columnNumber: 8,
     stackTrace: { callFrames: [Object] },
     exception: 
      { type: 'object',
        subtype: 'error',
        className: 'DOMException',
        description: 'DOMException: Failed to read the \'localStorage\' property from \'Window\': Storage is disabled inside \'data:\' URLs.\n    at <anonymous>:6:9\n    at <anonymous>:16:3',
        objectId: '{"injectedScriptId":2,"id":1}',
        preview: [Object] },
     executionContextId: 2 } }
Mocha-Chrome Failed: Failed to load the page. Check the url: https://localhost:8000

Expected Behavior

Actual Behavior

For Bugs; How can we reproduce the behavior?

For Features; What is the motivation and/or use-case for the feature?

ferbs commented

It sounds like chrome-headless isn't going to support the --ignore-certificate-errors switch:
https://bugs.chromium.org/p/chromium/issues/detail?id=721739

The chrome-remote-interface wiki has a solution posted though, which works when added to lib/client.js:
https://github.com/cyrus-and/chrome-remote-interface/wiki/Bypass-certificate-errors-(%22Your-connection-is-not-private%22)