I am running a local BrowerStack test, for which I must instantiate a connection with the local server and BrowserStack. The instructions for this type of test are found here.
I am trying to declare the process to a variable
Process serverConnection = new ProcessBuilder("C:\\Users\\folder\\BrowserStackLocal.exe","**Password**", serverURL + ",80").start();
Looking at the task manager, I see that this line creates two BrowserStackLocal.exe processes, which I think is due to how they manage logging in. Is there a way I can reference the second BrowserStackLocal.exe process?
In my cleanup I call
serverConnection.destroy();
But this only ends one of the processes. Right now I also call
Runtime.getRuntime().exec("taskkill /F /IM BrowserStackLocal.exe");
Which successfully ends the other instance, but I would much prefer to hold a reference and call .destroy().
Any suggestions for how to accomplish this would be greatly appreciated.
EDIT: I am almost sure that the reason for the two processes is the logging in functionality, as when I call the wrong password only one window opens. The second process appears to be the one doing all the computing based on its CPU usage.
EDIT 2: Further testing with BrowserStackLocal confirms that it is the process of logging in which creates an additional process. A solution could identify a way to trace the instantiation of this second process from the first process.
Edit 3: The processes appear to be linked, as when I exit one of them from the task manager, sometimes the other one will close automatically.
Turns out that is how BrowserStack handles the login process, and its unavoidable.