How to handle Mixed Content blocker in Firefox via WebDriver

In new version of Firefox, recently I encountered mixed content blocker where page given in specific frame was not loading. I noticed on the top of the screen in latest Firefox there is an icon on the top of the screen


1

What is Mixed Content?

You can find very detailed explanation on Mozilla support page but just for quick explanation if you don’t want to read there:

“HTTP is not encrypted but HTTPS and if you have a http content into HTTPS page then there are chances that your content can be hacked and its known as Mixed content”

How to Handle manually

To handle that you need to click on dropdown next to Keep Blocking and select option “Disable Protection on This Page”.

2

After disabling, your content will display but with orange warning  triangle as below.

3

To learn more about this refer:

https://support.mozilla.org/en-US/kb/how-does-content-isnt-secure-affect-my-safety?as=u&utm_source=inproduct

How to handle using WebDriver

To handle this, you need to change the preference setting before starting the Firefox driver. To access preference type about:config in address bar, accept the agreement and type “mixed_content” in search field, you will see the following.

4

security.mixed_content.block_active_content  : false

security.mixed_content.block_display_content : true

This is causing content not to display. Before launching Firefox driver, you need to change these preferences to allow content to display as below.

Code

5

Now if you open website with mixed content, it will load without any issue.

Warning: Just make sure with your development team if it’s valid for application to load.

5 Comments

  • Morgan Goose

    July 19, 2014

    One should set both to false if they want mixed content images to still be able to display. The swap only allows JS and other active content.

    Reply
  • Kannan

    May 29, 2015

    Is there any command line switch to load insecure content in IE ? in chrome we got –allow-running-insecure-content….is there any for IE similar to this?

    Reply
    • Aditya

      May 29, 2015

      Kannan,
      Try this:

      Start your driver like this:

      driver = Selenium::WebDriver.for :ie, :switches => %w[–ignore-certificate-errors –disable-popup-blocking –disable-translate]

      Open your browser as an Admin, and change settings in Internet Options to allow popups and also keep “Protected Mode”disabled.

      Reply
      • Kannan

        June 1, 2015

        Thanks for your reply. But I am working in Java. I used to run using JUnit. Is there any option for setting that using webdriver?

        Reply

Leave a Reply



Notice: Undefined variable: font_family in /home/chyqruxavcln/public_html/learnseleniumtesting.com/wp-content/plugins/gdpr-cookie-compliance/moove-modules.php on line 282