How to handle the Firefox 48 security popup message "You are about to log in to the site ..." with selenium webdriver

From Test Automation Wiki
Jump to: navigation, search

Often in test automation you have to test a website that has a proxy protection. Mostly this authentication is worked around by adding the credentials in the URL as following:

In FireFox 48 they have added an extra protection layer to warn the user that they are logging in to a protected URL:

You are about to log in to the site "(...)" with the username "(...)"

This new warning message will break all automation going to a protected domain.

Silencing the error message in Firefox

In Firefox you have have to manually add the following configuration network.http.phishy-userpass-length. You can add it by going to the URL about:config, right click the page and select "add" > "Integer". Fill in the above configuration with value 255.

However, in test automation, a new clean browser is opened without any of your configurations to the browser. So these settings need to be defined before the browser starts.

Lapis Lazuli

Add the following code to your env.rb file:

LapisLazuli.Start do
  # If BROWSER is NIL, Lapis Lazuli will default to Firefox
  if !ENV['BROWSER'] || ENV['BROWSER'] == 'firefox'
    # Get Selenium to create a profile object
    require 'selenium-webdriver'
    profile =
    profile['network.http.phishy-userpass-length'] = 255
    browser :firefox, :profile => profile


require 'selenium-webdriver'
profile =
profile['network.http.phishy-userpass-length'] = 255
WebDriver driver = new FirefoxDriver(profile);