mozilla/geckodriver

Proxy support

Opened this issue · 57 comments

Can not get to work new Firefox 47 / MarionetteDriver via socks proxy. Here is my code:

Proxy proxy = new Proxy();
proxy.setSocksProxy("localhost:22001");
DesiredCapabilities capability = new DesiredCapabilities();
capability.setCapability(CapabilityType.PROXY, proxy);
MarionetteDriver driver = new MarionetteDriver(capability);
driver.get("https://httpbin.org/ip");

But browser use my machine IP, not this socks. This socks proxy is absolutely working, when I set up it in Firefox 47 via Preferences -> Network manually it works fine.

How to set up socks proxy for Selenium MarionetteDriver?

The proxy capability is not yet supported. You can currently provide a custom profile with the proxy settings in the prefs file as a workaround. Let me know if you need help with that.

How do you provide a custom profile? We are having trouble doing that, Marionette is saying it's not a valid option.

@sermoa Can you provide a reproducible test case? What input are you giving, what errors are you getting back?

It looks like proxy support was added in https://hg.mozilla.org/mozilla-central/rev/27039dda138e as part of bug 1165449, so it would be interesting to find out why it does not work for you.

It should be possible to use a SOCKS proxy with the following capabilities (pseudo code):

capabilities = {
  "requiredCapabilities": {
    "proxy": {
      "proxyType": "manual",
      "socksProxy": url,
      "socksProxyPort": port,
      "socksVersion": 4,
      "socksUsername": "cake",
      "socksPassword": "made with cake"
    }
  }
}
driver = new_session(capabilities)

I'm using c# and would love to see an example of the proxy workaround mentioned by jgraham above.

Currently I've got:

            this.service = FirefoxDriverService.CreateDefaultService();
            this.service.FirefoxBinaryPath = @"C:\Program Files (x86)\Mozilla Firefox\firefox.exe";
            if (useProxy)
            {
                this.service.FirefoxBinaryPath += " -no-remote -P proxy_profile";
            }

            this.Driver = new FirefoxDriver(this.service);

and have setup the proxy_profile but the firefox instance that runs up does not use the proxy. When I manually run up firefox from a dos prompt using the same arguments, it uses the proxy fine.

@serge-nikitin Can you provide more debug information? If you see my above comment, Marionette does have proxy support, and it works in our internal tests.

@andreastt

Code:

        Proxy proxy = new Proxy();
        proxy.setSocksProxy("localhost:22001");
        DesiredCapabilities capability = new DesiredCapabilities();
        capability.setCapability(CapabilityType.PROXY, proxy);
        MarionetteDriver driver = new MarionetteDriver(capability);
        driver.get("https://httpbin.org/ip");

Output in console:

1466694643996   Marionette  DEBUG   Marionette enabled via build flag and pref
1466694644107   Marionette  INFO    Listening on port 2828
1466694644199   Marionette  DEBUG   Marionette enabled via command-line flag
1466694644275   Marionette  DEBUG   Accepted connection conn0 from 127.0.0.1:64068
1466694644309   Marionette  TRACE   conn0 -> [0,1,"newSession",{"capabilities":{"desiredCapabilities":{"proxy":{"autodetect":false,"class":"org.openqa.selenium.Proxy","ftpProxy":null,"hCode":1297149880,"httpProxy":null,"noProxy":null,"proxyAutoconfigUrl":null,"proxyType":"MANUAL","socksPassword":null,"socksProxy":"localhost:22001","socksUsername":null,"sslProxy":null}},"requiredCapabilities":{}},"sessionId":null}]
1466694644310   Marionette  CONFIG  Changing capabilities: {"browserName":"Firefox","browserVersion":"47.0","platformName":"Darwin","platformVersion":"15.5.0","specificationLevel":0,"raisesAccessibilityExceptions":false,"rotatable":false,"acceptSslCerts":false,"takesElementScreenshot":true,"takesScreenshot":true,"proxy":{},"platform":"DARWIN","XULappId":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","appBuildId":"20160604131506","device":"desktop","version":"47.0"}
1466694645028   Marionette  DEBUG   loaded listener.js
1466694645030   Marionette  DEBUG   loaded listener.js
1466694645114   Marionette  TRACE   conn0 <- [1,1,null,{"sessionId":"d5e38640-d980-bb46-a667-37e8e39303cd","capabilities":{"browserName":"Firefox","browserVersion":"47.0","platformName":"Darwin","platformVersion":"15.5.0","specificationLevel":0,"raisesAccessibilityExceptions":false,"rotatable":false,"acceptSslCerts":false,"takesElementScreenshot":true,"takesScreenshot":true,"proxy":{},"platform":"DARWIN","XULappId":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","appBuildId":"20160604131506","device":"desktop","version":"47.0","command_id":1}}]
1466694645137   Marionette  TRACE   conn0 -> [0,2,"get",{"url":"https://httpbin.org/ip"}]
1466694645825   Marionette  TRACE   conn0 <- [1,2,null,{}]

Firefox 47.0, OS X 10.11.5.

So this Firefox via MarionetteDriver when opens https://httpbin.org/ip shows my IP, not the proxy.

When I input this proxy localhost:22001 in Firefox manually via Preferences -> Network manually it works fine.

It looks like geckodriver only looks for proxy settings in the "requiredCapabilities" parameter.

Specifying a proxy via desiredCapabilities (notice the return session capabilities shows no proxy settings):

[2016-06-28T17:40:27Z] [FINER] [webdriver.http.Executor] >>>
POST /session HTTP/1.1
accept: application/json; charset=utf-8

{"desiredCapabilities":{"browserName":"firefox","proxy":{"proxyType":"manual","httpProxy":"127.0.0.1:47881"}}}
[2016-06-28T17:40:31Z] [FINER] [webdriver.http.Executor] <<<
HTTP/1.1 200
connection: close
date: Tue, 28 Jun 2016 17:40:31 GMT
content-type: application/json
content-length: 489

{"sessionId":"49f138f9-ac88-4a9f-b12a-06cc2dc862d4","value":{"XULappId":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","acceptSslCerts":false,"appBuildId":"20160606114208","browserName":"Firefox","browserVersion":"47.0","command_id":1,"device":"desktop","platform":"LINUX","platformName":"Linux","platformVersion":"3.13.0-88-generic","proxy":{},"raisesAccessibilityExceptions":false,"rotatable":false,"specificationLevel":0,"takesElementScreenshot":true,"takesScreenshot":true,"version":"47.0"}}

Specifying a proxy using requiredCapabilities:

[2016-06-28T17:39:52Z] [FINER] [webdriver.http.Executor] >>>
POST /session HTTP/1.1
accept: application/json; charset=utf-8

{"desiredCapabilities":{"browserName":"firefox"},"requiredCapabilities":{"proxy":{"proxyType":"manual","httpProxy":"127.0.0.1:53477"}}}
[2016-06-28T17:39:55Z] [FINER] [webdriver.http.Executor] <<<
HTTP/1.1 200
content-length: 539
date: Tue, 28 Jun 2016 17:39:55 GMT
connection: close
content-type: application/json

{"sessionId":"4771d21f-bcd0-4b71-aaea-eb4723c62f57","value":{"XULappId":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","acceptSslCerts":false,"appBuildId":"20160606114208","browserName":"Firefox","browserVersion":"47.0","command_id":1,"device":"desktop","platform":"LINUX","platformName":"Linux","platformVersion":"3.13.0-88-generic","proxy":{"httpProxy":"127.0.0.1:53477","proxyType":"manual"},"raisesAccessibilityExceptions":false,"rotatable":false,"specificationLevel":0,"takesElementScreenshot":true,"takesScreenshot":true,"version":"47.0"}}

Yes, you are right[1]. We should work around this.

[1] https://dxr.mozilla.org/mozilla-central/source/testing/marionette/driver.js#601

I also noticed marionette requires host and port be specified separately: {httpProxy: "127.0.0.1", httpProxyPort: 1234}. The W3C is a bit ambiguous on this (chromedriver accepts {httpProxy: "127.0.0.1:1234})

Marionette is probably doing the right thing, but would it be possible for it to return an error if httpProxy is set but not httpProxyPort? (and likewise for other proxy types)

I believe Marionette (and the spec) is doing what FirefoxDriver used to do, and it looks like that only very recently changed by a commit from @juangj: SeleniumHQ/selenium@5d1741b

I don't think I changed how the proxy capabilities are read. As far as I can tell, FirefoxDriver has always read just the single 'httpProxy' value; I can't find any reference to 'httpProxyPort' in FirefoxDriver code, now or in the past.

The fact that ChromeDriver does the same thing makes me believe that this is just a difference between OSS and W3C, and not a behavior change in FirefoxDriver.

@jgraham When you say "We should work around this", is it something we can work around in Geckodriver, or should we wait until Marionette itself handles it?

Geckodriver can ensure that the proxy capability is set in the requiredCapabilities passed to marionette, regardless of where it is set in the new session command.

I suppose the downside of that would be that Marionette would return an error in cases where the user might prefer that it failed silently. Though I don't know what sort of user actually intends for proxy settings to be merely desired instead of required.

I don't suppose today's F2F discussions shed any light on this?

Is there any update to this issue? Or any suitable/temporary work-around? Can I set "requiredCapabilities" directly using Java bindings?

I was able to successfully work-around this by construction a JSONObject with all the necessary proxy information and setting the the desired capability "requiredCapabilities".

@andreastt Ahhh!!!! Missed the RemoteWebDriver constructor taking the requiredCapabilities! Thanks.

Of course, I should I add we hope to fix this soon. The WebDriver WG decided to go with an entirely different design than desired- and required capabilities, which gives us an opportunity to rip out the existing capabilities implementation in Marionette.

@andreastt Gotta love being on the bleeding edge :-)

@andreastt Well I gave this a shot using Selenium v3.0.0-beta4 and GeckoDriver v0.11.1:

DesiredCapabilities capabilities = DesiredCapabilities.firefox();
capabilities.setCapability(FirefoxDriver.PROFILE, profile);
DesiredCapabilities requiredCapabilities = new DesiredCapabilities();
requiredCapabilities.setCapability(CapabilityType.PROXY, proxy);
WebDriver webDriver new RemoteWebDriver(remoteAddress, capabilities, requiredCapabilities);

Didn't work:

I suspect that it is because the requiredCapabilities JSON is not getting constructed as needed by GeckoDriver:

{"requiredCapabilities": {proxy:{proxyType:manual,httpProxy:,httpProxyPort:}}}

@jleyba You Have metioned to set RequiredCapabilities , Can you please explain how to set Required capabilities .
I am trying the following code with selenium 3.0.1 and geckoDriver v0.10
FirefoxProfile firefoxPro = new FirefoxProfile();
firefoxPro.setPreference("browser.privatebrowsing.autostart", true);
firefoxPro.setPreference("network.proxy.type", 1);
firefoxPro.setPreference("network.proxy.http", "proxy.com");
firefoxPro.setPreference("network.proxy.http_port", 8080);
firefoxPro.setPreference("network.proxy.ssl", "proxy.com");
firefoxPro.setPreference("network.proxy.ssl_port", 8080);
System.setProperty("webdriver.gecko.driver", sPackageFldr + "geckodriver.exe");
DesiredCapabilities oCap = DesiredCapabilities.firefox();
oCap.setBrowserName("firefox");
oCap.setCapability("firefox_binary", firefoxPath);
oCap.setCapability("profile", firefoxPro );
URL sURL = new URL("http://localhost:5555/wd/hub");
driver = (AppiumDriver) new AndroidDriver(sURL, oCap);

Hi @schmidtkp and @andreastt and @jleyba,

Got it working with Selenium v3.0.0-beta4 and GeckoDriver v0.11.1

SeleniumHQ/selenium#2963

Here is the trick, no more Proxy object, just pass a json with the new Marionette proxy format

[{proxy={"proxyType":"MANUAL","httpProxy":"host.proxy","httpProxyPort":80,"sslProxy":"host.proxy","sslProxyPort":80}}]

`
DesiredCapabilities cap = DesiredCapabilities.firefox();
DesiredCapabilities required = new DesiredCapabilities();

    JsonObject json = new JsonObject();
    json.addProperty("proxyType", "MANUAL");
    json.addProperty("httpProxy", aHost);
    json.addProperty("httpProxyPort", aPort);
    json.addProperty("sslProxy", aHost);
    json.addProperty("sslProxyPort", aPort);

    required.setCapability("proxy", json);

    driver = new FirefoxDriver(service, cap, required);

`

Here is a class that should be added as the new example for selenium and firefox proxy instead of the deprecated one here

http://www.seleniumhq.org/docs/04_webdriver_advanced.jsp

` import java.io.File;
import java.io.IOException;

    import org.apache.commons.lang.SystemUtils;
    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.firefox.FirefoxBinary;
    import org.openqa.selenium.firefox.FirefoxDriver;
    import org.openqa.selenium.firefox.GeckoDriverService;
    import org.openqa.selenium.remote.DesiredCapabilities;

    import com.google.common.collect.ImmutableMap;
    import com.google.gson.JsonObject;

    public class TestProxy
    {
      public static void main(String[] args)
      { 
        if (args.length == 0)
        {
          System.out.println("usage: IP port");
          System.exit(-1);
        }

        String proxyServer = args[0];
        int proxyPort = Integer.parseInt(args[1]);

        try
        {
          TestProxy test = new TestProxy();
          test.TestDriver(proxyServer, proxyPort);
        } catch (IOException e)
        {
          e.printStackTrace();
        }    
      }

      private void TestDriver(String aHost, int aPort) throws IOException
      {
        WebDriver driver = null;
        GeckoDriverService service = null;

        if (SystemUtils.IS_OS_LINUX)
        {
          FirefoxBinary firefoxBinary = new FirefoxBinary(new File("/home/ubuntu/firefox/firefox"));

          service = new GeckoDriverService.Builder(firefoxBinary)
              .usingDriverExecutable(new File("/usr/bin/geckodriver"))
              .usingAnyFreePort()
              .usingAnyFreePort()
              .withEnvironment(ImmutableMap.of("DISPLAY",":20"))
              .build();
          service.start();      
        }
        else if (SystemUtils.IS_OS_WINDOWS)
        {
          FirefoxBinary firefoxBinary = new FirefoxBinary(new File("C:\\Program Files\\Mozilla Firefox\\firefox.exe"));

          service = new GeckoDriverService.Builder(firefoxBinary)
              .usingDriverExecutable(new File("C:\\Windows\\geckodriver.exe"))
              .usingAnyFreePort()
              .usingAnyFreePort()
              .build();
          service.start();      
        }
        else
        {
          System.out.println("Unknown operation system");
          System.exit(-1);
        }

        DesiredCapabilities cap = DesiredCapabilities.firefox();
        DesiredCapabilities required = new DesiredCapabilities();

        JsonObject json = new JsonObject();
        json.addProperty("proxyType", "MANUAL");
        json.addProperty("httpProxy", aHost);
        json.addProperty("httpProxyPort", aPort);
        json.addProperty("sslProxy", aHost);
        json.addProperty("sslProxyPort", aPort);

        required.setCapability("proxy", json);

        driver = new FirefoxDriver(service, cap, required);

        driver.navigate().to("https://api.ipify.org/?format=text");

        System.out.println(driver.getPageSource());

        driver.quit();
      }
    }

`

@smatei Yes, your approach is correct, however, it will not currently work if using RemoteWebDriver(urlAddress, cap, requiredCaps). Per Luke's comment in https://groups.google.com/forum/#!topic/selenium-developers/d8KpXpmDp2g it will be resolved in Selenium v3.1.

If you wish to use RemoteWebDriver(urlAddress, cap) in the meantime, you can do so by creating a similar JSON object and adding it to the cap using the key "requiredCapabilities".

Hi, sorry to up this issue. I migrated our integration test to use Selenium 3.0.1 and so GeckoDriver (0.11.1) to work with Selenium. I set the proxy in the desired capabilites as suggested, but Firefox still does not use it. It worked fine with Selenium 2.53.1.
So any update or work around on this issue?

@thibaut-sticky It currently only works if it is set as a required capability.

@andreastt Sorry, it was what I tried when I posted my message. And it didn't work. Proxy is not used.

@thibaut-sticky
Setting the proxy as required capability works. Please see my above example.
Or this one http://stackoverflow.com/questions/37774403/setup-proxy-in-firefox-browser-via-marionette-driver/40178974

@smatei I tried your Json Solution but getting compilation error while adding an integer value in the line
json.addProperty("httpProxyPort", aPort);
Note: aPort is of type Int
addproperty function doesn't accepts int

Solved , changed private void TestDriver(String aHost, int aPort) to this :
private void TestDriver(String aHost, Number aPort)

One more thing.. Is this possible with AndroidDriver? Android Driver doesn't take 3 arguments.
image

@smatei Still don't work.

 public static StickyDriver initDriverWith(Browser browser, Proxy proxy,
                                            BrowserSettings settings) {
    DesiredCapabilities capabilities = browser.getCapabilies(settings); // do DesiredCapabilities.firefox() behind
    String port = proxy.getHttpProxy().substring(proxy.getHttpProxy().indexOf(":") + 1);
    String host = proxy.getHttpProxy().substring(0, proxy.getHttpProxy().indexOf(":"));
    JsonObject json = new JsonObject();
    json.addProperty("proxyType", "MANUAL");
    json.addProperty("httpProxy", host);
    json.addProperty("httpProxyPort", port);
    json.addProperty("sslProxy", host);
    json.addProperty("sslProxyPort", port);

    capabilities.setCapability(CapabilityType.PROXY, json);

    URL hub = getHubAddress();

    RemoteWebDriver driver = new RemoteWebDriver(hub, capabilities, capabilities);

Here the JSON value:

{"proxyType":"MANUAL","httpProxy":"192.168.0.23","httpProxyPort":"58669","sslProxy":"192.168.0.23","sslProxyPort":"58669"}

Perhaps the issue is I use the remote webdriver?

@thibaut-sticky As is noted multiple times in this thread, you need to use requiredCapabilities. I will fix this as part of https://bugzilla.mozilla.org/show_bug.cgi?id=1326534.

@andreastt It's what I did, look my last line, the third parameter is the required capabilities.

@thibaut-sticky I believe the issue is that you did not set your proxy JSON to the "requiredCapabilities" key in your DesiredCapabilities object.

For example:

capabilities.setCapability("requiredCapabilities", proxy);

Also, you need to construct your proxy JSON as such:

{proxy:{proxyType:MANUAL ... }}

@schmidtkp Look at my code, it was what I did.
Anyway I tried also capabilities.setCapability("requiredCapabilities", proxy); but this is not recognized and crash the driver.

@thibaut-sticky You’re producing a desired capabilities object and passing that around to both ctor arguments, so I’m guessing you are seeing some double-wrapping. You should include a trace-level verbose geckodriver log so we can see what is going on.

So using the code I provide in my previous comment, here the log I got.

I've also tried given a required capabilities with only the proxy without success.

java -Dwebdriver.chrome.driver=chromedriver.exe -Dwebdriver.gecko.driver=geckodriver.exe -debug -jar selenium-server-standalone-3.0.1.jar 

11:29:45.675 INFO - Selenium build info: version: '3.0.1', revision: '1969d75'
11:29:45.675 INFO - Launching a standalone Selenium Server
2017-01-04 11:29:45.690:INFO::main: Logging initialized @232ms
11:29:45.737 INFO - Driver class not found: com.opera.core.systems.OperaDriver
11:29:45.737 INFO - Driver provider com.opera.core.systems.OperaDriver registrat                                                                                                                                                 ion is skipped:
Unable to create new instances on this machine.
11:29:45.737 INFO - Driver class not found: com.opera.core.systems.OperaDriver
11:29:45.737 INFO - Driver provider com.opera.core.systems.OperaDriver is not re                                                                                                                                                 gistered
11:29:45.753 INFO - Driver provider org.openqa.selenium.safari.SafariDriver regi                                                                                                                                                 stration is skipped:
 registration capabilities Capabilities [{browserName=safari, version=, platform                                                                                                                                                 =MAC}] does not match the current platform WIN10
2017-01-04 11:29:45.784:INFO:osjs.Server:main: jetty-9.2.15.v20160210
2017-01-04 11:29:45.800:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletC                                                                                                                                                 ontextHandler@643b1d11{/,null,AVAILABLE}
2017-01-04 11:29:45.831:INFO:osjs.ServerConnector:main: Started ServerConnector@                                                                                                                                                 29ee9faa{HTTP/1.1}{0.0.0.0:4444}
2017-01-04 11:29:45.831:INFO:osjs.Server:main: Started @368ms
11:29:45.831 INFO - Selenium Server is up and running
11:44:40.353 INFO - SessionCleaner initialized with insideBrowserTimeout 0 and clientGoneTimeout 1800000 polling every 180000
11:44:40.384 INFO - Executing: [new session: Capabilities [{proxy={httpProxy=192.168.0.23, sslProxyPort=64313, proxyType=MANUAL, httpProxyPort=64313, sslProxy=192.168.0.23}, browserName=firefox, version=, platform=ANY, firefox_profile=UEsDBBQACAgIAJRdJEoAAAAAAAAAA...}]])
11:44:40.494 INFO - Creating a new session for Capabilities [{proxy={httpProxy=192.168.0.23, sslProxyPort=64313, proxyType=MANUAL, httpProxyPort=64313, sslProxy=192.168.0.23}, browserName=firefox, version=, platform=ANY, firefox_profile=UEsDBBQACAgIAJRdJEoAAAAAAAAAA...}]
1483526680744   geckodriver     INFO    Listening on 127.0.0.1:38340
11:44:41.275 INFO - Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
1483526681306   mozprofile::profile     INFO    Using profile path C:\Users\QA\AppData\Local\Temp\rust_mozprofile.iwmxbIkb1FgA
1483526681322   geckodriver::marionette INFO    Starting browser C:\Program Files (x86)\Mozilla Firefox\firefox.exe
1483526681322   geckodriver::marionette INFO    Connecting to Marionette on localhost:64317
1483526681525   addons.manager  DEBUG   Application has been upgraded
1483526681564   addons.manager  DEBUG   Loaded provider scope for resource://gre/modules/addons/XPIProvider.jsm: ["XPIProvider"]
1483526681566   addons.manager  DEBUG   Loaded provider scope for resource://gre/modules/LightweightThemeManager.jsm: ["LightweightThemeManager"]
1483526681569   addons.manager  DEBUG   Loaded provider scope for resource://gre/modules/addons/GMPProvider.jsm
1483526681571   addons.manager  DEBUG   Loaded provider scope for resource://gre/modules/addons/PluginProvider.jsm
1483526681572   addons.manager  DEBUG   Starting provider: XPIProvider
1483526681572   addons.xpi      DEBUG   startup
1483526681573   addons.xpi      INFO    SystemAddonInstallLocation directory is missing
1483526681574   addons.xpi      INFO    Mapping aushelper@mozilla.org to C:\Program Files (x86)\Mozilla Firefox\browser\features\aushelper@mozilla.org.xpi
1483526681574   addons.xpi      INFO    Mapping e10srollout@mozilla.org to C:\Program Files (x86)\Mozilla Firefox\browser\features\e10srollout@mozilla.org.xpi
1483526681574   addons.xpi      INFO    Mapping firefox@getpocket.com to C:\Program Files (x86)\Mozilla Firefox\browser\features\firefox@getpocket.com.xpi
1483526681575   addons.xpi      INFO    Mapping webcompat@mozilla.org to C:\Program Files (x86)\Mozilla Firefox\browser\features\webcompat@mozilla.org.xpi
1483526681575   addons.xpi      INFO    Mapping {972ce4c6-7e08-4474-a285-3208198ce6fd} to C:\Program Files (x86)\Mozilla Firefox\browser\extensions\{972ce4c6-7e08-4474-a285-3208198ce6fd}.xpi
1483526681576   addons.xpi      DEBUG   checkForChanges
1483526681576   addons.xpi      DEBUG   Loaded add-on state from prefs: {}
1483526681577   addons.xpi      DEBUG   New add-on aushelper@mozilla.org in app-system-defaults
1483526681578   addons.xpi      DEBUG   getModTime: Recursive scan of aushelper@mozilla.org
1483526681578   addons.xpi      DEBUG   New add-on e10srollout@mozilla.org in app-system-defaults
1483526681578   addons.xpi      DEBUG   getModTime: Recursive scan of e10srollout@mozilla.org
1483526681579   addons.xpi      DEBUG   New add-on firefox@getpocket.com in app-system-defaults
1483526681579   addons.xpi      DEBUG   getModTime: Recursive scan of firefox@getpocket.com
1483526681580   addons.xpi      DEBUG   New add-on webcompat@mozilla.org in app-system-defaults
1483526681580   addons.xpi      DEBUG   getModTime: Recursive scan of webcompat@mozilla.org
1483526681580   addons.xpi      DEBUG   New add-on {972ce4c6-7e08-4474-a285-3208198ce6fd} in app-global
1483526681581   addons.xpi      DEBUG   getModTime: Recursive scan of {972ce4c6-7e08-4474-a285-3208198ce6fd}
1483526681581   addons.xpi      DEBUG   getInstallState changed: true, state: {"app-system-defaults":{"aushelper@mozilla.org":{"d":"C:\\Program Files (x86)\\Mozilla Firefox\\browser\\features\\aushelper@mozilla.org.xpi","st":1481246673000},"e10srollout@mozilla.org":{"d":"C:\\Program Files (x86)\\Mozilla Firefox\\browser\\features\\e10srollout@mozilla.org.xpi","st":1481246673000},"firefox@getpocket.com":{"d":"C:\\Program Files (x86)\\Mozilla Firefox\\browser\\features\\firefox@getpocket.com.xpi","st":1481246674000},"webcompat@mozilla.org":{"d":"C:\\Program Files (x86)\\Mozilla Firefox\\browser\\features\\webcompat@mozilla.org.xpi","st":1481246673000}},"app-global":{"{972ce4c6-7e08-4474-a285-3208198ce6fd}":{"d":"C:\\Program Files (x86)\\Mozilla Firefox\\browser\\extensions\\{972ce4c6-7e08-4474-a285-3208198ce6fd}.xpi","st":1481246673000}}}
1483526681588   addons.xpi-utils        DEBUG   Opening XPI database C:\Users\QA\AppData\Local\Temp\rust_mozprofile.iwmxbIkb1FgA\extensions.json
1483526681590   addons.xpi-utils        DEBUG   New add-on aushelper@mozilla.org installed in app-system-defaults
*** Blocklist::_loadBlocklistFromFile: blocklist is disabled
1483526681598   DeferredSave.extensions.json    DEBUG   Save changes
1483526681599   addons.xpi-utils        DEBUG   New add-on e10srollout@mozilla.org installed in app-system-defaults
1483526681601   DeferredSave.extensions.json    DEBUG   Starting timer
1483526681602   DeferredSave.extensions.json    DEBUG   Save changes
1483526681602   addons.xpi-utils        DEBUG   New add-on firefox@getpocket.com installed in app-system-defaults
1483526681609   DeferredSave.extensions.json    DEBUG   Save changes
1483526681609   addons.xpi-utils        DEBUG   New add-on webcompat@mozilla.org installed in app-system-defaults
1483526681614   DeferredSave.extensions.json    DEBUG   Save changes
1483526681615   addons.xpi-utils        DEBUG   New add-on {972ce4c6-7e08-4474-a285-3208198ce6fd} installed in app-global
1483526681618   DeferredSave.extensions.json    DEBUG   Save changes
1483526681618   addons.manager  DEBUG   Registering startup change 'installed' for aushelper@mozilla.org
1483526681625   addons.xpi      DEBUG   Loading bootstrap scope from C:\Program Files (x86)\Mozilla Firefox\browser\features\aushelper@mozilla.org.xpi
1483526681631   addons.xpi      DEBUG   Calling bootstrap method install on aushelper@mozilla.org version 1.0
1483526681631   addons.xpi-utils        DEBUG   Make addon app-system-defaults:aushelper@mozilla.org visible
1483526681631   DeferredSave.extensions.json    DEBUG   Save changes
1483526681632   addons.manager  DEBUG   Registering startup change 'installed' for e10srollout@mozilla.org
1483526681632   addons.xpi      DEBUG   Loading bootstrap scope from C:\Program Files (x86)\Mozilla Firefox\browser\features\e10srollout@mozilla.org.xpi
1483526681642   addons.xpi      DEBUG   Calling bootstrap method install on e10srollout@mozilla.org version 1.5
1483526681643   addons.xpi-utils        DEBUG   Make addon app-system-defaults:e10srollout@mozilla.org visible
1483526681644   DeferredSave.extensions.json    DEBUG   Save changes
1483526681644   addons.manager  DEBUG   Registering startup change 'installed' for firefox@getpocket.com
1483526681645   addons.xpi      DEBUG   Loading bootstrap scope from C:\Program Files (x86)\Mozilla Firefox\browser\features\firefox@getpocket.com.xpi
1483526681650   addons.xpi      DEBUG   Calling bootstrap method install on firefox@getpocket.com version 1.0.5
1483526681650   addons.xpi-utils        DEBUG   Make addon app-system-defaults:firefox@getpocket.com visible
1483526681650   DeferredSave.extensions.json    DEBUG   Save changes
1483526681650   addons.manager  DEBUG   Registering startup change 'installed' for webcompat@mozilla.org
1483526681651   addons.xpi      DEBUG   Loading bootstrap scope from C:\Program Files (x86)\Mozilla Firefox\browser\features\webcompat@mozilla.org.xpi
1483526681653   addons.xpi      DEBUG   Calling bootstrap method install on webcompat@mozilla.org version 1.0
1483526681653   addons.xpi-utils        DEBUG   Make addon app-system-defaults:webcompat@mozilla.org visible
1483526681653   DeferredSave.extensions.json    DEBUG   Save changes
1483526681653   addons.xpi-utils        DEBUG   Make addon app-global:{972ce4c6-7e08-4474-a285-3208198ce6fd} visible
1483526681654   DeferredSave.extensions.json    DEBUG   Save changes
1483526681654   addons.xpi      DEBUG   Updating XPIState for {"id":"aushelper@mozilla.org","syncGUID":"{4ed6db23-bce0-41c5-a31e-a9319eed7fe8}","location":"app-system-defaults","version":"1.0","type":"extension","internalName":null,"updateURL":null,"updateKey":null,"optionsURL":null,"optionsType":null,"aboutURL":null,"icons":{},"iconURL":null,"icon64URL":null,"defaultLocale":{"name":"Application Update Service Helper","description":"Sets value(s) in the update url based on custom checks.","creator":null,"homepageURL":null},"visible":true,"active":true,"userDisabled":false,"appDisabled":false,"descriptor":"C:\\Program Files (x86)\\Mozilla Firefox\\browser\\features\\aushelper@mozilla.org.xpi","installDate":1481246673000,"updateDate":1481246673000,"applyBackgroundUpdates":1,"bootstrap":true,"skinnable":false,"size":5975,"sourceURI":null,"releaseNotesURI":null,"softDisabled":false,"foreignInstall":false,"hasBinaryComponents":false,"strictCompatibility":false,"locales":[],"targetApplications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"50.1.0","maxVersion":"50.*"}],"targetPlatforms":[],"multiprocessCompatible":true,"seen":true}
1483526681654   addons.xpi      DEBUG   getModTime: Recursive scan of aushelper@mozilla.org
1483526681655   addons.xpi      DEBUG   Updating XPIState for {"id":"e10srollout@mozilla.org","syncGUID":"{ed2c2026-629f-490b-8ff5-df499de287f9}","location":"app-system-defaults","version":"1.5","type":"extension","internalName":null,"updateURL":null,"updateKey":null,"optionsURL":null,"optionsType":null,"aboutURL":null,"icons":{},"iconURL":null,"icon64URL":null,"defaultLocale":{"name":"Multi-process staged rollout","description":"Staged rollout of Firefox multi-process feature.","creator":null,"homepageURL":null},"visible":true,"active":true,"userDisabled":false,"appDisabled":false,"descriptor":"C:\\Program Files (x86)\\Mozilla Firefox\\browser\\features\\e10srollout@mozilla.org.xpi","installDate":1481246673000,"updateDate":1481246673000,"applyBackgroundUpdates":1,"bootstrap":true,"skinnable":false,"size":7210,"sourceURI":null,"releaseNotesURI":null,"softDisabled":false,"foreignInstall":false,"hasBinaryComponents":false,"strictCompatibility":false,"locales":[],"targetApplications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"50.1.0","maxVersion":"50.*"}],"targetPlatforms":[],"multiprocessCompatible":false,"seen":true}
1483526681655   addons.xpi      DEBUG   getModTime: Recursive scan of e10srollout@mozilla.org
1483526681655   addons.xpi      DEBUG   Updating XPIState for {"id":"firefox@getpocket.com","syncGUID":"{925f93ed-6732-4138-9476-f7e3eac756ef}","location":"app-system-defaults","version":"1.0.5","type":"extension","internalName":null,"updateURL":null,"updateKey":null,"optionsURL":null,"optionsType":null,"aboutURL":null,"icons":{},"iconURL":null,"icon64URL":null,"defaultLocale":{"name":"Pocket","description":"When you find something you want to view later, put it in Pocket.","creator":null,"homepageURL":null},"visible":true,"active":true,"userDisabled":false,"appDisabled":false,"descriptor":"C:\\Program Files (x86)\\Mozilla Firefox\\browser\\features\\firefox@getpocket.com.xpi","installDate":1481246674000,"updateDate":1481246674000,"applyBackgroundUpdates":1,"bootstrap":true,"skinnable":false,"size":917398,"sourceURI":null,"releaseNotesURI":null,"softDisabled":false,"foreignInstall":false,"hasBinaryComponents":false,"strictCompatibility":false,"locales":[],"targetApplications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"50.1.0","maxVersion":"50.*"}],"targetPlatforms":[],"multiprocessCompatible":false,"seen":true}
1483526681655   addons.xpi      DEBUG   getModTime: Recursive scan of firefox@getpocket.com
1483526681656   addons.xpi      DEBUG   Updating XPIState for {"id":"webcompat@mozilla.org","syncGUID":"{52ced52b-a8bc-459f-a447-d9e5dd77279e}","location":"app-system-defaults","version":"1.0","type":"extension","internalName":null,"updateURL":null,"updateKey":null,"optionsURL":null,"optionsType":null,"aboutURL":null,"icons":{},"iconURL":null,"icon64URL":null,"defaultLocale":{"name":"Web Compat","description":"Urgent post-release fixes for web compatibility.","creator":null,"homepageURL":null},"visible":true,"active":true,"userDisabled":false,"appDisabled":false,"descriptor":"C:\\Program Files (x86)\\Mozilla Firefox\\browser\\features\\webcompat@mozilla.org.xpi","installDate":1481246673000,"updateDate":1481246673000,"applyBackgroundUpdates":1,"bootstrap":true,"skinnable":false,"size":1502,"sourceURI":null,"releaseNotesURI":null,"softDisabled":false,"foreignInstall":false,"hasBinaryComponents":false,"strictCompatibility":false,"locales":[],"targetApplications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"50.1.0","maxVersion":"50.*"}],"targetPlatforms":[],"multiprocessCompatible":false,"seen":true}
1483526681656   addons.xpi      DEBUG   getModTime: Recursive scan of webcompat@mozilla.org
1483526681656   addons.xpi      DEBUG   Updating XPIState for {"id":"{972ce4c6-7e08-4474-a285-3208198ce6fd}","syncGUID":"{3d1e86d3-7f09-4993-9388-2f48291179f2}","location":"app-global","version":"50.1.0","type":"theme","internalName":"classic/1.0","updateURL":null,"updateKey":null,"optionsURL":null,"optionsType":null,"aboutURL":null,"icons":{"32":"icon.png","48":"icon.png"},"iconURL":null,"icon64URL":null,"defaultLocale":{"name":"Default","description":"The default theme.","creator":"Mozilla","homepageURL":null,"contributors":["Mozilla Contributors"]},"visible":true,"active":true,"userDisabled":false,"appDisabled":false,"descriptor":"C:\\Program Files (x86)\\Mozilla Firefox\\browser\\extensions\\{972ce4c6-7e08-4474-a285-3208198ce6fd}.xpi","installDate":1481246673000,"updateDate":1481246673000,"applyBackgroundUpdates":1,"skinnable":true,"size":21152,"sourceURI":null,"releaseNotesURI":null,"softDisabled":false,"foreignInstall":false,"hasBinaryComponents":false,"strictCompatibility":true,"locales":[],"targetApplications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"50.1.0","maxVersion":"50.1.0"}],"targetPlatforms":[],"seen":true}
1483526681656   addons.xpi      DEBUG   getModTime: Recursive scan of {972ce4c6-7e08-4474-a285-3208198ce6fd}
1483526681657   DeferredSave.extensions.json    DEBUG   Save changes
1483526681657   addons.xpi      DEBUG   Updating database with changes to installed add-ons
1483526681657   addons.xpi-utils        DEBUG   Updating add-on states
1483526681658   addons.xpi-utils        DEBUG   Writing add-ons list
1483526681662   addons.xpi      DEBUG   Registering manifest for C:\Program Files (x86)\Mozilla Firefox\browser\features\aushelper@mozilla.org.xpi
1483526681662   addons.xpi      DEBUG   Calling bootstrap method startup on aushelper@mozilla.org version 1.0
1483526681664   addons.xpi      DEBUG   Registering manifest for C:\Program Files (x86)\Mozilla Firefox\browser\features\e10srollout@mozilla.org.xpi
1483526681664   addons.xpi      DEBUG   Calling bootstrap method startup on e10srollout@mozilla.org version 1.5
1483526681664   addons.xpi      DEBUG   Registering manifest for C:\Program Files (x86)\Mozilla Firefox\browser\features\firefox@getpocket.com.xpi
1483526681665   addons.xpi      DEBUG   Calling bootstrap method startup on firefox@getpocket.com version 1.0.5
1483526681666   addons.xpi      DEBUG   Registering manifest for C:\Program Files (x86)\Mozilla Firefox\browser\features\webcompat@mozilla.org.xpi
1483526681667   addons.xpi      DEBUG   Calling bootstrap method startup on webcompat@mozilla.org version 1.0
1483526681669   addons.manager  DEBUG   Registering shutdown blocker for XPIProvider
1483526681669   addons.manager  DEBUG   Provider finished startup: XPIProvider
1483526681669   addons.manager  DEBUG   Starting provider: LightweightThemeManager
1483526681669   addons.manager  DEBUG   Registering shutdown blocker for LightweightThemeManager
1483526681669   addons.manager  DEBUG   Provider finished startup: LightweightThemeManager
1483526681669   addons.manager  DEBUG   Starting provider: GMPProvider
1483526681678   addons.manager  DEBUG   Registering shutdown blocker for GMPProvider
1483526681678   addons.manager  DEBUG   Provider finished startup: GMPProvider
1483526681678   addons.manager  DEBUG   Starting provider: PluginProvider
1483526681679   addons.manager  DEBUG   Registering shutdown blocker for PluginProvider
1483526681679   addons.manager  DEBUG   Provider finished startup: PluginProvider
1483526681680   addons.manager  DEBUG   Completed startup sequence
1483526681930   Marionette      INFO    Listening on port 64317
1483526682267   addons.manager  DEBUG   Starting provider: <unnamed-provider>
1483526682267   addons.manager  DEBUG   Registering shutdown blocker for <unnamed-provider>
1483526682267   addons.manager  DEBUG   Provider finished startup: <unnamed-provider>
1483526682445   addons.manager  DEBUG   Starting provider: PreviousExperimentProvider
1483526682445   addons.manager  DEBUG   Registering shutdown blocker for PreviousExperimentProvider
1483526682446   addons.manager  DEBUG   Provider finished startup: PreviousExperimentProvider
1483526682450   DeferredSave.extensions.json    DEBUG   Starting write
1483526682726   DeferredSave.extensions.json    DEBUG   Write succeeded
1483526682727   addons.xpi-utils        DEBUG   XPI Database saved, setting schema version preference to 17
11:44:43.849 INFO - Detected dialect: W3C
11:44:43.871 INFO - Done: [new session: Capabilities [{proxy={httpProxy=192.168.0.23, sslProxyPort=64313, proxyType=MANUAL, httpProxyPort=64313, sslProxy=192.168.0.23}, firefoxOptions=org.openqa.selenium.firefox.FirefoxOptions@1a5791ae, browserName=firefox, moz:firefoxOptions=org.openqa.selenium.firefox.FirefoxOptions@1a5791ae, version=, platform=ANY, firefox_profile=UEsDBBQACAgIAJRdJEoAAAAAAAAAA...}]]
11:44:44.133 INFO - Executing: [get: http://sandbox.stickyadstv.com/qa/bc-videocloud.html?zone=224609])
11:44:45.070 INFO - Done: [get: http://sandbox.stickyadstv.com/qa/bc-videocloud.html?zone=224609]
1483526743314   addons.productaddons    INFO    sending request to: https://aus5.mozilla.org/update/3/GMP/50.1.0/20161208153507/WINNT_x86-msvc-x64/en-US/release/Windows_NT%2010.0.0.0%20(x64)/default/default/update.xml
1483526743889   addons.productaddons    INFO    Completed downloading document
1483526745319   addons.productaddons    INFO    downloadXHR File download. status=200
1483526745322   addons.productaddons    INFO    Downloaded file will be saved to C:\Users\QA\AppData\Local\Temp\tmpaddon-96a724
1483526746233   addons.productaddons    INFO    downloadXHR File download. status=200
1483526746235   addons.productaddons    INFO    Downloaded file will be saved to C:\Users\QA\AppData\Local\Temp\tmpaddon-4bb238
1483526747583   addons.productaddons    INFO    downloadXHR File download. status=200
1483526747586   addons.productaddons    INFO    Downloaded file will be saved to C:\Users\QA\AppData\Local\Temp\tmpaddon-3ee0a8

You apparently didn’t read my comment properly. You need to include a verbose, trace-level log from geckodriver. You do that by either starting geckodriver with the -vv flag or passing it the {"moz:firefoxOptions: {"log": {"level": trace"}}} capability. See the README for the full documentation on configuring this.

Thx for your help. I thought debug was more verbose than trace.

So I tried to set the verbosity to trace, but apparently I don't do it correctly.

Caused by: org.openqa.selenium.WebDriverException: Firefox option was set, but is not a FirefoxOption: {log={level=trace}}
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:48:19 -0700'
System info: host: 'bluwin', ip: '192.168.0.23', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_92'
Driver info: driver.version: FirefoxDriver
 JsonObject options = new JsonObject();
JsonObject log = new JsonObject();
log.addProperty("level", "trace");
options.add("log", log);
capabilities.setCapability("moz:firefoxOptions", options);

I know there is also a FirefoxOptions class, but there is not way to set the log verbosity.

@thibaut-sticky That certainly looks like a bug in Selenium.

@thibaut-sticky What I see in your code is
capabilities.setCapability(CapabilityType.PROXY, json);
which is not the same as setting the key 'requiredCapabilities' with a value of your JSON object. It is setting the key CapabilityType.PROXY (which is the string "proxy") to your JSON object. Two different keys.

As for why your webdriver crashes when you try
capabilities.setCapability("requiredCapabilities", proxy)
I do not know. All I can say is this is what I'm doing and it is working for me.

Firefox option was set, but is not a FirefoxOption: {log={level=trace}} sounds like an internal Selenium type check. It isn’t really necessary, as geckodriver is the only reliable point of validation.

@andreastt Yes indeed, the error is raised in FirefoxDriver, they check if the object they get is an instance of FirefoxOptions. And of course it's not the case.

@schmidtkp Can you give me a link where I can see one of your example?

@thibaut-sticky I would file a bug against Selenium about that. Selenium should rely on geckodriver for validation.

I checked on the selenium repo, there is aleady a ticket about this: SeleniumHQ/selenium#3055

@thibaut-sticky I think I know why it might not be working for you, but I cannot explain why.

When I first attempted setting the requiredCapabilities key with the value being my proxy JsonObject, I was construction the JsonObject the same way you are (note: using the JsonObect().addProperty() method):

JsonObject json = new JsonObject();
json.addProperty("proxyType", "MANUAL");
json.addProperty("httpProxy", host);
json.addProperty("httpProxyPort", port);
json.addProperty("sslProxy", host);
json.addProperty("sslProxyPort", port);

This failed for me as well. I did not understand why (still don't), so I changed the way I constructed my JsonObject as such (note: It is being returned from a convenience/helper method in my code) :

return new JsonParser().parse("{proxy:{" +
        "proxyType:" + Proxy.ProxyType.MANUAL + "," +
        "httpProxy:\"" + host + "\"," +
        "httpProxyPort:" + port + "," +
        "sslProxy:\"" + host + "\"," +
        "sslProxyPort:" + port + "," +
        "ftpProxy:\"" + host + "\"," +
        "ftpProxyPort:" + port + "," +
        "socksProxy:\"" + host + "\"," +
        "socksProxyPort:" + port +
        "}}").getAsJsonObject();

The result from this method is used as the argument to the setCapability method, as such:

JsonObject proxy = ProxyServer.getProxyAsJson(host, port);
capabilities.setCapability("requiredCapabilities", proxy);

Like I said, I cannot explain why addProperty did not work for me, but I hope this solution/explanation helps you out.

I should note that setting proxy preferences in firefox profile fails too:

profile.setPreference("network.proxy.type", 1);
profile.setPreference("network.proxy.http", "localhost");
profile.setPreference("network.proxy.http_port", "8888");
FirefoxDriver driver = new FirefoxDriver(profile);

When I execute this code and watch about:config I see that network.proxy.type and network.proxy.http have the specified values, but network.proxy.http_port is equal to 0. Why so?

Following https://bugzilla.mozilla.org/show_bug.cgi?id=1326534 setting the proxy as a desired capability should work. The fix is available in Firefox 52 onwards.

I tried with FF 52 and 53. Proxy object is now well received. But, geckodriver complain about the type of the object:

org.openqa.selenium.SessionNotCreatedException: Expected [object String] "{"proxyAutoconfigUrl":null,"socksUsername":null,"socksPassword":null,"autodetect":false,"httpProxy":null,"proxyType":"UNSPECIFIED","noProxy":null,"ftpProxy":null,"socksProxy":null,"hCode":84538639,"class":"org.openqa.selenium.Proxy","sslProxy":null}" to be an object (WARNING: The server did not provide any stacktrace information)

And I'm correctly giving an object and not a String:

      String port = proxy.getHttpProxy().substring(proxy.getHttpProxy().indexOf(":") + 1);
      String host = proxy.getHttpProxy().substring(0, proxy.getHttpProxy().indexOf(":"));
      JsonObject json = new JsonObject();
      json.addProperty("proxyType", "MANUAL");
      json.addProperty("httpProxy", host);
      json.addProperty("httpProxyPort", port);
      json.addProperty("sslProxy", host);
      json.addProperty("sslProxyPort", port);


      capabilities.setCapability(CapabilityType.PROXY, json);

@thibaut-sticky That would be #490 you’re running in to. The WebDriver specification says that null is not an allowed value for most of the proxy settings.

I will dig into the spec to see if this is actually true and whether we need to make a change to it.

@andreastt Thanks for the issue number, I will keep an eye on it.

Selenium: 3.3.1
geckodriver 0.15 ( I tried each of v0.11, through v0.15)

After reading through all the comments above, I tried two assumed "working" suggestions to config proxy in capabilities, and both of them failed.

Can someone working on geockodriver/selenium confirm that geckodriver proxy doesn't work for selenium 3.3, as comment right above this one concluded?

-------results from option 1-------------------------------------------------
Capabilities [{moz:profile=/var/folders/v4/zwfz4yrs05sdr9sj_314fht1clzjvw/T/rust_mozprofile.FcQM80UDfzS9, rotatable=false, timeouts={implicit=0, page load=300000, script=30000}, pageLoadStrategy=normal, platform=ANY, proxy={proxyType=MANUAL}, specificationLevel=0, moz:accessibilityChecks=false, acceptInsecureCerts=false, browserVersion=52.0, platformVersion=16.5.0, moz:processID=21158, browserName=firefox, platformName=darwin}]

-----------results from option 2--------------
Capabilities [{moz:profile=/var/folders/v4/zwfz4yrs05sdr9sj_314fht1clzjvw/T/rust_mozprofile.T9lviJ5Q7Zn5, rotatable=false, timeouts={implicit=0, page load=300000, script=30000}, pageLoadStrategy=normal, platform=ANY, specificationLevel=0, moz:accessibilityChecks=false, acceptInsecureCerts=false, browserVersion=52.0, platformVersion=16.5.0, moz:processID=19297, browserName=firefox, platformName=darwin}]

--------------option 1--------------------------------------------------------
DesiredCapabilities required = new DesiredCapabilities();
JsonObject proxy = new JsonParser().parse("{proxy:{" +
"proxyType:" + Proxy.ProxyType.MANUAL + "," +
"httpProxy:"" + host + ""," +
"httpProxyPort:" + port + "," +
"sslProxy:"" + host + ""," +
"sslProxyPort:" + port + "," +
"ftpProxy:"" + host + ""," +
"ftpProxyPort:" + port + "," +
"socksProxy:"" + host + ""," +
"socksProxyPort:" + port +
"}}").getAsJsonObject();
required.setCapability("capabilities", proxy);

    System.setProperty("webdriver.gecko.driver", "/Users/hidden/Downloads/geckodriver");
    return new FirefoxDriver(new FirefoxBinary(), profile, capabilities, required);

-----------option 2----------------------------------
DesiredCapabilities required = new DesiredCapabilities();
JsonObject json = new JsonObject();
json.addProperty("proxyType", "MANUAL");
json.addProperty("httpProxy", host);
json.addProperty("httpProxyPort", port);
json.addProperty("sslProxy", host);
json.addProperty("sslProxyPort", port);
required.setCapability("proxy", json);
System.setProperty("webdriver.gecko.driver", "/Users/hidden/Downloads/geckodriver");
return new FirefoxDriver(new FirefoxBinary(), profile, capabilities, required);

@stone8 I suspect the issue you’re having is https://github.com/mozilla/webdriver-rust/issues/86.

Work in Selenium 3.14.2, Firefox 62, C# .NET 4.5

FirefoxDriverService service = FirefoxDriverService.CreateDefaultService(@"GeckoDriver19", "geckodriver.exe");
service.FirefoxBinaryPath = @"C:\Program Files\Mozilla Firefox\firefox.exe";

        FirefoxOptions firefoxOptions = new FirefoxOptions();
        firefoxOptions.SetPreference("network.proxy.type", 1);
        firefoxOptions.SetPreference("network.proxy.socks", "127.0.0.1");
        firefoxOptions.SetPreference("network.proxy.socks_port", 1080);

        IWebDriver driver = new FirefoxDriver(service, firefoxOptions);

        driver.Navigate().GoToUrl("https://www.hbus.com/register");