-1

There are 2 PCs(server & node). The Selenium hub is up & running. The notifications are seen in its cmd window. Now, I'm trying to set up another PC as a Selenium node. To do that I need to run 2 commands from the server PC command prompt.It works when done manually.Failing to do so programatically.

Here is what I have so far.

private static void StartSeleniumNode()
  {
    string Command1 = "/C cmdkey.exe /add:ABCDES181 /user:abc /pass:abc@123 & ";
    string Command2 = "psexec.exe \\ABCDES181 -i -w D:\\Selenium java -jar selenium-server-standalone-2.47.1.jar -role node -hub http://someip:4444/grid/register";
    Process.Start(cmd.exe, Command1 + Command2);

 }

When run, a cmd window just pops up and closes. There would be a notification if a node is registered, but nothing of that sort here. I think it is the syntax to run 2 commands that is the issue here.

sukesh
  • 2,379
  • 12
  • 56
  • 111

1 Answers1

1

The way to tell cmd to run multiple commands is to chain them using &&.

For ex, you could get your command prompt to do this:

echo hello && echo world

In your case, try using this statement:

Process.Start(Constants.CommandPrompt, string.Format("{0} && {1}", Command1,Command2));
Srikanth Venugopalan
  • 9,011
  • 3
  • 36
  • 76