CosmoCode (Formerly TeachMeSelenium)

How to disable insecure password warning in Firefox for Selenium?

If you use Selenium and Firefox version 52 or higher for running the automated tests and your development site does not use SSL, 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. It causes currently running Selenium tests to be failed.

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

Selenium code to Create the browser profile & set preference

// Create a Firefox profile
FirefoxProfile profile = new FirefoxProfile();
//Set the preference to disable insecure password warning
profile.setPreference("security.insecure_field_warning.contextual.enabled", false);
//Pass the profile to the FirefoxDriver
WebDriver driver = new FirefoxDriver(profile);
 
// Start of test code
from selenium import webdriver
# Create a Firefox profile
profile = webdriver.FirefoxProfile()
# Set the preference to disable insecure password warning
profile.set_preference("security.insecure_field_warning.contextual.enabled", false);
# Pass the profile to the FirefoxDriver
driver = webdriver.Firefox(firefox_profile=profile);
 
# Start of test code
Exit mobile version