How to handle the Firefox 48 security popup message "You are about to log in to the site ..." with selenium webdriver
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: http://username:password@test.website.com/
.
In FireFox 48 they have added an extra protection layer to warn the user that they are logging in to a protected URL:
Contents
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.
White listing a domain for proxy authentication
Firfox also has a configuration setting network.automatic-ntlm-auth.trusted-uris
that can be found going to the URL about:config
. In this configuration you can add domains that you trust and thus will not give the warning message.
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 = Selenium::WebDriver::Firefox::Profile.new profile['network.http.phishy-userpass-length'] = 255 browser :firefox, :profile => profile end end
Selenium
require 'selenium-webdriver' profile = Selenium::WebDriver::Firefox::Profile.new profile['network.http.phishy-userpass-length'] = 255 WebDriver driver = new FirefoxDriver(profile);