Disable Firefox insecure password warning when testing with Selenium

If you use Selenium and Firefox version 52 or higher for testing your UI and your development site does not use SSL, then you will get the following warning when entering passwords on your login page “This connection is not secure. Logins entered here could be compromised”

Firefox will also open the URL https://support.mozilla.org/en-US/kb/insecure-password-warning-firefox?as=u&utm_source=inproduct in a new tab which takes the focus away from the page you are testing.

This is a great feature and will hopefully stop some users from giving away their passwords over insecure connections. However if you are a developer/tester this is a very annoying feature and breaks your Selenium/Firefox tests during the development phase.

You can stop this warning and the new tab opening by changing the Firefox preference security.insecure_field_warning.contextual.enabled to false

I am using C# to run my tests so my code for setting up the Firefox driver looks something like this:

// Firefox driver setup
FirefoxProfile profile = new FirefoxProfile();
profile.SetPreference("security.insecure_field_warning.contextual.enabled", false); // disable insecure password warning
IWebDriver driver = new FirefoxDriver(profile);

// more test code

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.