我正在尝试使用将在集线器/服务器 PC 上运行的控制台应用程序将远程 PC 设置为 Selenium 节点。
当程序在调试模式下运行时,我在“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...
服务器有 PsExec 在:D:\PSTools\PsExec.exe
服务器 IP:100.100.10.100
远程 IP:200.200.20.200
远程 PC 中的 jar 文件保存在:D:\Selenium\selenium-server-standalone.jar
要在远程 pc 中运行的命令是
D:\Selenium>java -jar selenium-server-standalone.jar -role node -hub http://100.100.10.100/grid/register
我在这里想念什么
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();
}