1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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

Discussion in 'C, C++, C#' started by Mission IMpossible, Apr 22, 2016.

  1. Mission IMpossible

    Mission IMpossible Registered Member

    Joined:
    Jan 16, 2014
    Messages:
    62
    Likes Received:
    11
    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/");
     
  2. REEND

    REEND Newbie

    Joined:
    May 31, 2015
    Messages:
    30
    Likes Received:
    1
    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);
    
     
  3. rootjazz

    rootjazz Jr. VIP Jr. VIP

    Joined:
    Dec 21, 2012
    Messages:
    684
    Likes Received:
    326
    Occupation:
    Developer
    Location:
    UK
    Home Page:
    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