Tuesday, July 23, 2013


How to get rid of "Authentication Required" dialog window in Selenium?

Solution 1

Put this code inside the method when you instantiate the Firefox driver. 

FirefoxProfile myProfile = new FirefoxProfile();
myProfile .setPreference("network.http.phishy-userpass-length", 255);
myProfile .setPreference("network.automatic-ntlm-auth.trusted-uris","yourDomain");

new FirefoxDriver(myProfile);


Problem with Solution 1

Above solution does not work with newer versions of Firefox.

Solution for above Problem

Install AutoAuth Firefox plugin.
Go to URL and enter your username and password and click on save the credentials.

then Instantiate Firefox web-driver as following:

FirefoxProfile myProfile = new ProfilesIni().getProfile("default");
File pluginAutoAuthentication = new File("src/test/resources/autoauth-2.1-fx+fn.xpi");
myProfile.addExtension(pluginAutoAuthentication);

return new FirefoxDriver(myProfile);

No comments:

Post a Comment