Raghavendra Bankapur
Raghavendra Bankapur

Reputation: 903

Selenium grid hub console is returning 500

I have setup a selenium grid with port 4444 for hub and node with port 5555. When I try to access console of the hub by http://localhost:4444/wd/hub/console I am getting the below logs.

enter image description here

When i tried to access the session http://localhost:4444/wd/hub/session of my grid getting below errors. enter image description here

enter image description here

enter image description here

I am using C#.net for my test and from my test when I try to initilaize the remotedriver instance, I am getting error

   at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse) in D:\SeleniumCode\selenium\dotnet\src\webdriver\Remote\RemoteWebDriver.cs:line 1384
   at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters) in D:\SeleniumCode\selenium\dotnet\src\webdriver\Remote\RemoteWebDriver.cs:line 1187
at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities) in D:\SeleniumCode\selenium\dotnet\src\webdriver\Remote\RemoteWebDriver.cs:line 1114 
at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities) in D:\SeleniumCode\selenium\dotnet\src\webdriver\Remote\RemoteWebDriver.cs:line 141  
at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(Uri remoteAddress, ICapabilities desiredCapabilities, TimeSpan commandTimeout) in D:\SeleniumCode\selenium\dotnet\src\webdriver\Remote\RemoteWebDriver.cs:line 128  
at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(Uri remoteAddress, ICapabilities desiredCapabilities) in D:\SeleniumCode\selenium\dotnet\src\webdriver\Remote\RemoteWebDriver.cs:line 117

Below is the code.

` var driverContext = new WebDriverContext();

        DesiredCapabilities capability = DesiredCapabilities.Chrome();
        capability.Platform = new Platform(PlatformType.Windows);
        try
        {
            driverContext.Driver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), capability);
            driverContext.Driver.Navigate().GoToUrl(url);
            context = driverContext;
        }
        catch(Exception ex)
        {

        }
        return driverContext;`

Upvotes: 2

Views: 2204

Answers (1)

Krishnan Mahadevan
Krishnan Mahadevan

Reputation: 14746

There are three issues that have been mentioned in this post.

  1. Grid console url problem.

You are hitting an invalid Grid console URL. The correct URL is http://localhost:4444/grid/console.

  1. How to get the session details for a particular session in Grid.

For you to be able to access the details of a session, you should be hitting the URL http://localhost:4444/grid/api/testsession?session=%s where %s represents the session id that you obtain from RemoteWebDriver. SessionId

  1. Encountering an issue when trying to instantiate RemoteWebDriver.

W.r.t the error that you are getting when you are trying to instantiate a new RemoteWebDriver instance, I can't seem to find anything that stands out (I am Java guy so I can't read C# full fledgely, but looking at the code snippet nothing stands out).

The exception however suggests

at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse) in D:\SeleniumCode\selenium\dotnet\src\webdriver\Remote\RemoteWebDriver.cs:line 1384
   at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters) in D:\SeleniumCode\selenium\dotnet\src\webdriver\Remote\RemoteWebDriver.cs:line 1187
at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities) in D:\SeleniumCode\selenium\dotnet\src\webdriver\Remote\RemoteWebDriver.cs:line 1114 

that you may have an issue with the ChromeDriver binary not being available in the PATH variable. Please check to see if its available in your path and if it can be spun off by running chromedriver from a command prompt ? Also you might want to cross check its presence in the PATH variable by running echo %PATH% and then scanning the output to see if it includes the directory in which chromedriver exists.

Upvotes: 1

Related Questions