Back

Explore Courses Blog Tutorials Interview Questions
0 votes
3 views
in DevOps and Agile by (19.7k points)

I am using the Selenium-Firefox-driver and Selenium-Chrome-Driver version 2.0a5 (Web Driver API), and I am trying to test a web app that has BASIC authentication (there is a popup that comes up to authenticate the user when I hit whatever page, the popup is not part of the HTML).

Now, I need a strategy to authenticate the user in Firefox, Chrome, and IE (I'm going to import the IE Driver soon).

I was reading in a few articles that I can set a Firefox profile for instance..something like:

FirefoxProfile ffProfile = new FirefoxProfile();

ffProfile.setPreference("network.http.phishy-userpass-length", 255);

WebDriver driver = new FirefoxDriver(ffProfile);

driver.get("http://username:password@hostname");  

but it doesn't seem to work for me. Does anyone have a working solution for those browsers?

1 Answer

0 votes
by (62.9k points)

I used the following code using firefox webdriver:

profile.SetPreference("network.automatic-ntlm-auth.trusted-uris", "google.com");

driver = new FirefoxDriver(profile);

 

driver.Navigate().GoToUrl("http://user:[email protected]");

Hope this helps!

If you are interested to learn Selenium on a much deeper level and want to become a professional in the testing domain, check out Intellipaat’s automation testing course!

Browse Categories

...