How to set proxies with Username and Password in FirefoxDriver

How to set proxies with Username and Password in FirefoxDriver



Setting up Custom Firefox Profile to run Selenium Tests on Desktop Firefox

Even though Selenium � WebDriver � FirefoxDriver � Proxy with Basic/Kerberos Authentication didn�t work, you can achieve this with an alternate step that overrides Firefox browser Proxy Authentication.

The alternate step is nothing but allowing WebDriver to run tests on default/custom Firefox profile rather than running from FirefoxDriver.

Note:
In Selenium 2.0 (WebDriver) every popular browsers has its own selenium drivers to run tests.

Let us go with the concept now�


Create Firefox Profile Manager

Important: Before you can start the Profile Manager, Firefox must be completely closed.

1. At the top of the Firefox window, click on the Firefox button and then select Exit
2. Press Win + R (click the Windows Start button and select Run... on Windows XP).
3. In the Run dialog box, type in:
    firefox.exe -p
4. Click OK.



5. Now, create the firefox profile "myProjectProfile".

If the Profile Manager window does not open, Firefox may have been running in the background, even though it was not visible. Close all instances of Firefox or restart the computer and then try again.

Add this New Firefox Profile on your code

ProfilesIni profile = new ProfilesIni();
FirefoxProfile myprofile = profile.getProfile("myProjectProfile");
WebDriver driver = new FirefoxDriver(myprofile);

Firefox configuration settings

This works fine without prompting any authentication when you do the following settings..

1) Type "about:config" on your FF url
2) Now type "Proxy" in the search field
3) Make sure "signon.autologin.proxy" is set "true" (By default it is "false")



go to link download