4

I am making an automation of an AngularJS website and I need to run Selenium Chrome Driver with Protractor headless. The problem is that i'm getting this error in terminal:

Mixed Content: The page at 'https://x.com' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://y.com'. This request has been blocked; the content must be served over HTTPS.

I tried to use some Chrome args in the code below but it was unsuccessful. However, if I remove the headless arg, it works.

capabilities: {
  browserName: 'chrome',
  acceptInsecureCerts : true,
  acceptSslCerts : true,
  chromeOptions: {
    args: [
      '--headless',
      '--disable-gpu',

      '--remember-cert-error-decisions',

      '--ignore-certificate-errors',
      '--reduce-security-for-testing',
      '--allow-running-insecure-content',

      '--window-size=800,600'
    ]
  },
},
Lucas Müller
  • 382
  • 1
  • 4
  • 21

2 Answers2

0

https://github.com/angular/protractor/blob/master/docs/browser-setup.md#using-headless-chrome

capabilities: {
  browserName: 'chrome',

  chromeOptions: {
     args: [ "--headless", "--disable-gpu", "--window-size=800,600" ]
   }
}

Above three args are enough to run in headless mode.

Try removing the other args in your capabilities

Bharath Kumar S
  • 1,410
  • 2
  • 10
  • 29
  • 1
    Bharath, i want to run headless allowing Mixed Content. I'm running headless, but i'm getting the error in the question – Lucas Müller Jan 28 '19 at 10:36
  • https://stackoverflow.com/questions/33507566/mixed-content-blocked-when-running-an-http-ajax-operation-in-an-https-page. Should help you. – Bharath Kumar S Jan 28 '19 at 10:41
0

I ran into this same issue. The solution is to click the "shield" icon in your browser to the right of the URL, then click "Load Unsafe Scripts"

This is very related: How to get Chrome to allow mixed content?

thaspius
  • 1,135
  • 3
  • 17
  • 33