selenium icon indicating copy to clipboard operation
selenium copied to clipboard

Cannot set 'no proxy' with IEDriverServer

Open schmidtkp opened this issue 9 years ago • 2 comments

Meta -

OS: Windows Server 2016 Selenium Version: 3.6.0 (Java client), 3.6.0 (IEDriverServer, 32-bit) Browser: Internet Explorer Browser Version: 11

Expected Behavior -

Should be able to specify 'no proxy'/direct connection via Proxy.setProxyType(ProxyType.DIRECT)

Actual Behavior -

The following exception is thrown:

org.openqa.selenium.SessionNotCreatedException: Invalid capabilities in alwaysMatch: a proxy type named direct is specified, but proxy type must be 'pac', 'noproxy', 'autodetect', 'system', or 'manual'
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'EC2AMAZ-28BU9KM', ip: '10.110.67.178', os.name: 'Windows Server 2016', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_144'
Driver info: driver.version: unknown
remote stacktrace: 
Build info: version: '3.6.0', revision: '6fbf3ec767', time: '2017-09-27T15:28:36.4Z'
System info: host: '157dc50ca717', ip: '172.17.0.3', os.name: 'Linux', os.arch: 'amd64', os.version: '4.9.32-15.41.amzn1.x86_64', java.version: '1.8.0_141'

Steps to reproduce -

Proxy proxy = new Proxy();
proxy.setProxyType(Proxy.ProxyType.DIRECT);
DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
capabilities.setCapability(CapabilityType.PROXY, proxy);
WebDriver webddriver = new RemoteWebDriver(<HUB_URL>, capabilities);

NOTE -

This same code for setting 'no proxy'/direct connection has worked successfully for IEDriverServer up until v3.6.0 (possibly failing since v3.4.0).

This also leaves the IEDriverServer.exe process running on the node. We have a test suite that runs approx 20 tests, therefore leaving 20 IEDriverServer.exe processes running on the node. Since the call to new RemoteWebDriver throws the exception, we do not get a WebDriver object back in which we can call WebDriver.quit() and clean things up. Also we don't know which node in the grid the IEDriverServer was started on, again, unable to do any fordable kill of the orphaned processes.

schmidtkp avatar Oct 30 '17 20:10 schmidtkp

This looks like a problem with IEDriver, because according to specification direct proxy type is a valid type, while noproxy is not.

As far as I can tell from source, that can be easily fixed with the following patch:

diff --git a/cpp/iedriver/CommandHandlers/NewSessionCommandHandler.cpp b/cpp/iedriver/CommandHandlers/NewSessionCommandHandler.cpp
index f19893f9fa..e5cfa1a9c6 100644
--- a/cpp/iedriver/CommandHandlers/NewSessionCommandHandler.cpp
+++ b/cpp/iedriver/CommandHandlers/NewSessionCommandHandler.cpp
@@ -716,7 +716,7 @@ bool NewSessionCommandHandler::ValidateCapabilities(
             }
             std::string proxy_type = proxy[proxy_setting].asString();
             if (proxy_type != "pac" &&
-                proxy_type != "noproxy" &&
+                proxy_type != "direct" &&
                 proxy_type != "autodetect" &&
                 proxy_type != "system" &&
                 proxy_type != "manual") {
@@ -724,7 +724,7 @@ bool NewSessionCommandHandler::ValidateCapabilities(
                                capability_set_name + ": " +
                                "a proxy type named " + proxy_type +
                                " is specified, but proxy type must be " +
-                               "'pac', 'noproxy', 'autodetect', 'system', " +
+                               "'pac', 'direct', 'autodetect', 'system', " +
                                "or 'manual'";
               return false;
             }

It would be great if @jimevans or somebody who can build and test IEDriver can take a look.

p0deje avatar Nov 01 '17 03:11 p0deje

The current code in trunk shows that the suggestion was committed a while ago. This should not be an issue anymore, please feel free to open a new issue with all the information requested by the template in case it still happens.

diemol avatar Sep 13 '20 21:09 diemol