Reputation: 2437
I'm trying to set a remote PC as a Selenium node, using a console app that will run on the hub/server PC.
When the program's run in debug mode, I get the following text in 'errorMessage'
The handle is invalid.
Connecting to 200.200.20.200:5555...
Couldn't access 200.200.20.200:5555
Connecting to 200.200.20.200:5555...
The server has PsExec at : D:\PSTools\PsExec.exe
Server IP : 100.100.10.100
Remote IP : 200.200.20.200
The jar file in remote PC is saved at : D:\Selenium\selenium-server-standalone.jar
The command to be run in remote pc is
D:\Selenium>java -jar selenium-server-standalone.jar -role node -hub http://100.100.10.100/grid/register
what am i missing here
private static void StartSeleniumNode()
{
Process p = new Process();
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.FileName = @"D:\PSTools\PsExec.exe";
p.StartInfo.Arguments = @"\\200.200.20.200:5555 -u xyz -p abc123 -i -w D:\Selenium java -jar selenium-server-standalone.jar -role node -hub http://100.100.10.100:4444/grid/register";
p.Start();
string output = p.StandardOutput.ReadToEnd();
string errormessage = p.StandardError.ReadToEnd();
p.WaitForExit();
}
Upvotes: 1
Views: 10709
Reputation: 17868
You should be able to piece this out yourself
You've given us: p.StartInfo.Arguments = @"\\200.200.20.200"; \\what should go here
Well you have the command you want to run
java -jar selenium-server-standalone.jar -role node -hub http://100.100.10.100/grid/register
You know the PC you want to run it on.. You have psexec to get the parameters of what you need to send it.
So, it would go something like
D:\PSTools\PsExec.exe psexec \\remotepc -i -w D:\Selenium java -jar selenium-server-standalone.jar -role node -hub http://100.100.10.100/grid/register
Try running that from your command line and when you get the command line working. You are ready to code it (Lets just assume that works.)
Your code would then be
p.StartInfo.FileName = @"D:\PSTools\PsExec.exe";
p.StartInfo.Arguments = @"\\remotepc -i -w D:\Selenium java -jar selenium-server-standalone.jar -role node -hub http://100.100.10.100/grid/register";
Upvotes: 2