I'm running into an issue when using Selenium Grid and trying to register a node with a specific version of IE and then call the Grid Hub for an instance of that browser. My setup:
- Selenium 3.0.1 with C# bindings
- One class library defining my page objects/framework and one class library with my NUnit 3.5 tests
- One VM running Server 2008 hosting a database and my Selenium Grid Hub, started with "java -jar C:\Selenium\selenium-server-standalone-3.0.1.jar -role hub -maxSession 20"
- One VM running Windows 7 with IE9 with my webdriver node
I start my node with (line breaks added by me for readability, it's one line in the bat file):
java -Dwebdriver.ie.driver=C:\Selenium\IEDriverServer.exe -Dwebdriver.chrome.driver=C:\Selenium\chromedriver.exe -jar C:\Selenium\selenium-server-standalone-3.0.1.jar -role webdriver -hub http://10.10.1.20:4444/grid/register -port 5566 -maxSession 20
-browser "browserName=internet explorer,version=9,maxInstances=1,platform=ANY,seleniumProtocol=WebDriver"
-browser "browserName=chrome,maxInstances=5"
-browser "browserName=firefox,maxInstances=5"
My code to call RemoteWebDriver is:
caps = new DesiredCapabilities();
caps.SetCapability("browserName", "internet explorer");
caps.SetCapability("version", "9");
WebDriver = new RemoteWebDriver(new System.Uri("http://10.10.1.20:4444/wd/hub"), caps);
When I run this code, when the code creates the new RemoteWebDriver the hub returns:
INFO - Got a request to create a new session: Capabilities [{browserName=internet explorer, version=9}]
Visual Studio then shows the following error returned:
System.InvalidOperationException : Error forwarding the new session cannot find : Capabilities [{browserName=internet explorer, version=9}] TearDown : System.NullReferenceException : Object reference not set to an instance of an object.
I've tried setting the node and my code to use "9.0" instead of "9" and setting the browserName to "iexplore" instead of "internet explorer" as some posts I've found online suggested, with no success. I've spent two hours digging through Google and through the Selenium docs but no one seems to even have an enumeration of the format expected for the "version" capability for various browsers, so I can't even be sure I'm using the right values. If I remove the version flag from the node startup batch and the setCapability call to version in my C# code, the browser launches fine. However, I'm going to have a grid with multiple IE variants for testing and need to be able to specify which version of IE I want. Can anyone assist me in the right way to launch a node for a specific version of IE, register that node to a hub, and call into it with a RemoteWebDriver?