Passing username and password with proxy for Firefox Driver[Selenium] not working

Mission IMpossible

Regular Member
Joined
Jan 16, 2014
Messages
251
Reaction score
40
Below is the code I'm trying. But its still showing the dialog box asking for authorization when the browser starts. Where might I be going wrong?
Code:
FirefoxProfile profile = new FirefoxProfile();
Proxy firefox_proxy = new Proxy();
firefox_proxy.HttpProxy = proxy;
firefox_proxy.SslProxy = proxy;
profile.SetProxyPreferences(firefox_proxy);

Firefoxdriver driver = new FirefoxDriver(new FirefoxBinary(), profile, TimeSpan.FromMinutes(3));
driver.Navigate().GoToUrl("http://" + proxy_username + ":" + proxy_password + "@www.xyz.com/");
 
This is a simple example of using selenium (in java) I think that you have to use the "setHttpProxy()" function.
Code:
String PROXY = "localhost:8080";

org.openqa.selenium.Proxy proxy = new org.openqa.selenium.Proxy();
proxy.setHttpProxy(PROXY)
     .setFtpProxy(PROXY)
     .setSslProxy(PROXY);
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(CapabilityType.PROXY, proxy);
WebDriver driver = new FirefoxDriver(cap);
 
if you are are trying to set the proxy USERNAME:PASSWORD, then you cannot last time I looked. Use IP AUTH proxies in those cases
 
Back
Top