This has been making me work overtime and I still don't have much clues. I have a web application that is locally installed (pseudo-desktop app) that does the following:
- Starts an SSH tunnel
- directly runs ssh if on Mac OS X
- uses PuTTy executable if on Windows
- Opens Firefox or Chrome configured to use Socks5 proxy using the tunnel (localhost:port) via Selenium webdrivers.
For 1:
I have used both Runtime.getRuntime().exec(command);
and Process proc = new ProcessBuilder(arguments).start();
, and even gave Desktop dt = Desktop.getDesktop(); dt.open(f);
a try. But nothing happens, no command prompt opens.
For 2: I have tried using both Firefox:
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("network.proxy.type", 1);
profile.setPreference("network.proxy.socks", "localhost");
profile.setPreference("network.proxy.socks_port", 8088);
driver = new FirefoxDriver(profile);
And Chrome:
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability("chrome.switches", Arrays.asList("--proxy-server=socks5://localhost:8088"));
driver = new ChromeDriver(capabilities);
But similar to 1, no firefox or chrome windows open.
Note that this application works perfectly on Mac OS X Mavericks.
After several hours of debugging, I noticed that the processes are there. All the processes, from PuTTy, to Chrome, to Firefox. There were a lot of those already running in the background. The odd thing is that the user column of these processes is set to SYSTEM, while the normal browser sessions, for example, the user is set to "IT", which is my current Windows user account.
I have been trying to manually change the user in which these processes are invoked, but no luck so far.
So apparently, my application works in Windows as well, just not as I intended. All the processes, regardless if it's a command line script or a desktop application like firefox or chrome, they just don't appear but they run in the background under the user "SYSTEM". And I don't have any idea why. It sure doesn't look like it's supposed to be the default behavior. So if anyone have any idea, I'd really appreciate it.
Thanks.