Connecting to a pid rather than to a process
Previously I was using TC 12 and C#
Connect.Sys["Process"]("java", 900000);
rootNode = driver.WaitProcess("java");
to connect to my Java process I start up. But lately there have been multiple instances of Java. For instance when this tries to run on the Jenkins machine, there is a Jenkins java process.
I am using C# so I was able to get the PID of the Java Process (integer) to which I would like to connect.
But I am not sure how to do this. I tried
Connect.Sys["Pid"](javapid, 90000);
where javapid is the pid, but it gave me an unknown name error. So does anyone have any suggestions?
And please don't tell me to use TestLeft.
(
driver.waitProcess(processName) just does a
return Connect.Sys["WaitProcess"](processName, timeout);
)
Thanks
I'm not sure to understand the need but perhaps this do your job ?
function GetMyPID(ProcessName, ProcessId) { var p = Sys.FindChild("ProcessName", ProcessName); var result = -1; while (p.Exists) { if (p.Id == ProcessId) { result = p.Id; break; }
p = Sys.FindChild("ProcessName", ProcessName); } return result; }