Current state of setting Firefox proxy via DesiredCapabilities

35 views
Skip to first unread message

Kendall Schmidt

unread,
Apr 21, 2017, 11:29:36 AM4/21/17
to Selenium Developers
I've searched through the various Selenium/GeckoDriver issues and it is not clear to me the state of being able to set a proxy via DesiredCapabilities for Firefox. I'm hopefully someone in this group can provide some clarity.

I'm currently use the following:

Selenium v3.3.1 (Java bindings)
Firefox v52.0.2
GeckoDriver v0.15.0

Prior, with Selenium v3.0.1 (and an older version of GeckoDriver - maybe v0.11.0 or v0.12.0?), I could successfully set a proxy in Firefox using DesiredCapabilities. At that time I had to do so by finagling it a bit by setting the key "requiredCapabilities" in the DesiredCapabilities object to the proxy as an Object, as such:

Object 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();
DesiredCapabilities capabilities = DesiredCapabilities.firefox();
capabilities
.setCapability("requiredCapabilities", proxy);

Prior to Selenium v3.x (ie. v2.x) I simply did:

capabilities.setCapability(CapabilityType.PROXY, org.openqa.selenium.Proxy);

Today I noticed with Selenium v3.3.1 and GeckoDriver v0.15.0 the proxy is not being set anymore in Firefox nor is there any error.

Selenium/GeckoDriver issues have been closed indicated all is resolved so I no longer need to do the "requiredCapabilities" hokie-pokie, but obviously I'm missed some important change that I need to make on my end.

Does anyone know what I need to change?

Thanks,
Kendall
Reply all
Reply to author
Forward
0 new messages