Brian Mitchell
Brian Mitchell

Reputation: 383

Issue with Selenium Grid

I am trying to get selenium grid working for the first time.

In the setup i have the following

            Driver = new ChromeDriver(AppDomain.CurrentDomain.BaseDirectory + "../../../Drivers");

            DesiredCapabilities capabilities = new DesiredCapabilities();
            capabilities = DesiredCapabilities.Chrome();
            capabilities.SetCapability(CapabilityType.BrowserName, "chrome");
            capabilities.SetCapability(CapabilityType.Platform, new Platform(PlatformType.Windows));

            Driver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), capabilities);

This is in c# using XUNIT and executed using resharper.

I get the error in visual studio

OpenQA.Selenium.WebDriverException
Unexpected error. 
at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response 
errorResponse)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String 
driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities 
desiredCapabilities)
at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor 
commandExecutor, ICapabilities desiredCapabilities)
at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(Uri remoteAddress, 
ICapabilities desiredCapabilities)
at MoneyUITests.Methods.General.StartBrowserDriver() in 
C:\Projects\Money_AT\MoneyUITests\Methods\General.cs:line 276
at MoneyUITests.Tests.Navigation.NavigationExecuteTests..ctor() in 
C:\Projects\XXXX\XXXX\Tests\Navigation\NavigationTests.cs:line 
36

In the console, i get the following error

2017-11-06 17:08:35.821:WARN:osjs.HttpChannel:qtp22982090-131: 
/wd/hub/session
java.io.IOException: org.openqa.grid.common.exception.GridException: Cannot 
extract a capabilities from the request: {"desiredCapabilities":{"browserName":"chrome","version":"","platform":"WINDOWS","javascriptEnabled":true},"capabilities":{"firstMatch":[{"browserName":"chrome","javascriptEnabled":true}]}}
    at org.openqa.grid.web.servlet.DriverServlet.process(DriverServlet.java:135)

and

Caused by: org.openqa.grid.common.exception.GridException: Cannot extract a capabilities from the request: {"desiredCapabilities":{"browserName":"chrome","version":"","platform":"WINDOWS","javascriptEnabled":true},"capabilities":{"firstMatch":[{"browserName":"chrome","javascriptEnabled":true}]}}

and

Caused by:java.lang.IllegalArgumentException: Illegal key values seen in w3c capabilities: [javascriptEnabled]

This is my first attempt to work with selenium grid, any guides or tips will be extremely appreciated.

I followed this guide - https://seleniumautomation84.wordpress.com/2014/08/06/selenium-grid-fundamentals-implemented-in-c/

Thanks in advance

Upvotes: 1

Views: 1267

Answers (1)

Brian Mitchell
Brian Mitchell

Reputation: 383

I found this

https://github.com/SeleniumHQ/selenium/issues/4461

After updating selenium to 3.7.0 I was no longer getting this error.

Apparently, there is an issue with Selenium Grid 2 and Selenium 3.4/5 so updating your NuGet package the latest version will fix this issue.

Upvotes: 1

Related Questions