Home Ask Login Register

Developers Planet

Your answer is one click away!

Kirill KZ February 2016

Firefox webdriver with socks aren't work. What's wrong?

I have trubs with my code. I bought list of proxy. Name is "List of SOCKS 4/5 proxies with a binding to IP address" and it everyhour is update. So, I take first line from this txt file, paste into my code, but isn't work! Code is:

        FirefoxProfile profile = new FirefoxProfile();
        profile.SetPreference("network.proxy.socks", "");
        profile.SetPreference("network.proxy.socks_port", 1085);

        profile.SetPreference("network.proxy.type", 1);         // this is used to set proxy configuration to manual, after which firefox considers the //proxy set above

        FirefoxDriver driver = new FirefoxDriver(profile);

Also I tried another way:

    FirefoxProfile profile = new FirefoxProfile();
    String PROXY = "";
    OpenQA.Selenium.Proxy proxy = new OpenQA.Selenium.Proxy();
    proxy.SocksProxy = PROXY;
    int timeoutSeconds = 1800;
    FirefoxDriver Driver = new FirefoxDriver(new FirefoxBinary(), profile, new TimeSpan(0, 0, 0, timeoutSeconds));

BUT IT DOESN'T WORK. Please, help me. Some interesting fact: this proxy real and it's should work. Also I have another lists. There are:

List of HTTP/HTTPS proxies with authentication by password:
List of SOCKS 4/5 proxies with authentication by password:
List of HTTP/HTTPS proxies with a binding to IP address:
List of SOCKS 4/5 proxies with a binding to IP address:

How I can do it with login and password? Thanks for all and everyone. Peace.


Kim Homann February 2016

I haven't used SOCKS, but I think it should look like this:

private FirefoxDriver _CreateFirefoxDriver(string socksProxy)
    if (string.IsNullOrEmpty(socksProxy))
        return new FirefoxDriver();

    var caps = new DesiredCapabilities();
    caps.SetCapability(CapabilityType.Proxy, new Proxy { SocksProxy = socksProxy });
    return new FirefoxDriver(caps);

nilesh February 2016

Documentation shows it this way (This is java code but same applies to C#)

String PROXY = "";

org.openqa.selenium.Proxy proxy = new org.openqa.selenium.Proxy();
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(CapabilityType.PROXY, proxy);
WebDriver driver = new FirefoxDriver(cap);

Post Status

Asked in February 2016
Viewed 3,091 times
Voted 5
Answered 2 times


Leave an answer

Quote of the day: live life