Protractor - How can I bypass the mixed content error



  • I am getting the below error when I was trying to approve a document in a webpage

    Mixed Content: The page at \'https://example.com\' was loaded over HTTPS, but requested an insecure resource \'http://insecure-page.com:9870/xyz\'. This request has been blocked; the content must be served over HTTPS.'
    

    It is because my test is trying to load a non secure page over a secured page. The page is loaded, but I am not able to proceed further. I am using Protractor-cucumber-javascript framework.

    Could someone help me to bypass this error so I can continue with the rest of the steps in my automation testing script.



  • This is actually a security feature of your browser.

    If you know that the content from this HTTP url is safe, and if you are using Chrome, you should be able to instruct Chrome to load insecure content by specifying --allow-running-insecure-content command-line option in your config:

    capabilities: {
      'browserName': 'chrome',
      'chromeOptions': {
        'args': ['--allow-running-insecure-content']
      }
    },
    

    *In general, though, this is not ideal security-wise as all HTTP content would be allowed for loading.

    Reference materials:



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2