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

Selenium with PhantomJS and proxies

Discussion in 'C, C++, C#' started by Jomasdf, Jun 28, 2016.

  1. Jomasdf

    Jomasdf Jr. VIP Jr. VIP

    Joined:
    Jul 7, 2012
    Messages:
    427
    Likes Received:
    155
    Occupation:
    C# dev
    Location:
    Sweden
    Home Page:
    I want to connect via proxy.

    It appears to be working fine, according to the console window my proxyType is set to "none" and the httpProxy to the ip of the proxy.
    But I got suspicious to if it was acctually working so I had it connect to a random IP-checking website and take a screenshot. It showed my real IP.

    I'm now completely clueless as to what might be wrong with it. Alternativly I would appreciate alternatives to headless browsers that can work with proxies.

    Here is the code I'm using:
    Code:
                PhantomJSDriverService service = PhantomJSDriverService.CreateDefaultService();
                service.IgnoreSslErrors = true;
                service.SslProtocol = "any";
    
                var options = new PhantomJSOptions();                       
                options.AddAdditionalCapability(CapabilityType.Proxy, new Dictionary<string, string>
                {
                    {"proxyType", "none"},
                    {"httpProxy", proxyL}
                });
    
     
  2. B.Shahin

    B.Shahin Junior Member

    Joined:
    Dec 10, 2016
    Messages:
    101
    Likes Received:
    17
    Gender:
    Male
    check the documentation it may help you!
    seleniumhq.org/docs/04_webdriver_advanced.jsp#using-a-proxy
     
  3. Jomasdf

    Jomasdf Jr. VIP Jr. VIP

    Joined:
    Jul 7, 2012
    Messages:
    427
    Likes Received:
    155
    Occupation:
    C# dev
    Location:
    Sweden
    Home Page:
    I did get this solved ~10 months ago. But thanks anyway.
     
    • Thanks Thanks x 1