0

I've executed the following hub and node commands in my windows command prompts. I can see this is working as I get the grid console when browsing http://localhost:4441/grid/console

C:\seleniumserver\java -jar selenium-server-standalone-3.4.0.jar -role hub -port 4441

C:\seleniumserver\java -jar selenium-server-standalone-3.4.0.ja -role wd -hub http://localhost:4441/grid/register

My automation code has the following C# code.

C# code snippet

var capabilities = DesiredCapabilities.Chrome();
capabilities.Platform = Platform.CurrentPlatform;
IWebDriver driver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), capabilities);

When I run run the automation I get the following error message

Error message received

An exception of type 'OpenQA.Selenium.WebDriverException' occurred in WebDriver.dll but was not handled in user code

Additional information: The HTTP request to the remote WebDriver server for URL http://localhost:4444/wd/hub/session timed out after 60 seconds.

Any suggestions what I'm doing wrong please? First time setting this up

Many thanks,

Update after comments

made the following change

        var capabilities = DesiredCapabilities.Chrome();
        capabilities.Platform = Platform.CurrentPlatform;
        IWebDriver driver = new RemoteWebDriver(new Uri("http://localhost:4441/wd/hub"), capabilities);

Error message

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 myfile.ctor() in C:\Projects\UAT Automation\myfile.cs:line 43 at ....ctor() in C:\Projects\UAT Automation...cs:line 21

user7558986
  • 65
  • 2
  • 8

1 Answers1

1

You are starting your hub in the port 4441 but you are trying to connect to 4444 using

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

Please change your instantiation code to

IWebDriver driver = new RemoteWebDriver(new Uri("http://localhost:4441/wd/hub"), capabilities);

and try again.

Krishnan Mahadevan
  • 14,121
  • 6
  • 34
  • 66
  • i get an error, i've added the error message into my question, see "update after comments section" – user7558986 Aug 03 '17 at 08:19
  • shall I try a different version of selenium? – user7558986 Aug 03 '17 at 08:44
  • Do you know if your chromedriver is available in your PATH of the machine wherein your node is running ? Did you take a look at the logs of the node to see what you see ? Btw, please accept my answer, since it answered your original question of facing `Connection timeout` problems. – Krishnan Mahadevan Aug 03 '17 at 08:44
  • to check the path is that my personal path or the system path? – user7558986 Aug 03 '17 at 08:47
  • I am referring to the PATH variable. Not sure what do you mean by personal path or system path – Krishnan Mahadevan Aug 03 '17 at 09:04
  • within the environment variables dialog i have two PATHS, one for "user variable for me" and another for "system variables" - not sure which one to update with "C:\chromedriver.exe" – user7558986 Aug 03 '17 at 09:31
  • Most often updating User level PATH variables is easy. It doesnt matter which one you update. To be on the safer side, please do reboot the machine as well (If things dont work) – Krishnan Mahadevan Aug 03 '17 at 09:32
  • ok thanks, and then to test the change in the command prompt i can just type "chromedriver" I assume? – user7558986 Aug 03 '17 at 09:35
  • Yes. Also make sure you type the command `chromedriver` from a command prompt by switching to some other directory. Another quick way would be to open up a command prompt and type `echo %PATH%` and check whether in the output you see the directory which contains the `chromedriver` binary. – Krishnan Mahadevan Aug 03 '17 at 09:37
  • I'll create a new question to focus on this new problem. many thanks – user7558986 Aug 03 '17 at 10:24