Search code examples
javaselenium-webdriversubprocesspid

Get subprocess ID of Firefox Flash plugin using Selenium in Java


I am using a Selenium Firefox WebDriver from a java app and I need to know the PID of the external plug-ins that the browser uses (or more accurately the PID of a flash player plug-in). I understand that this is not "easy" to do in java as java do not nativity support access to system information outside the JVM, but maybe any of you know a way to do it with the Firefox/selenium API.

My current workaround is as follows: - Get my own PID: Integer my_pid =Integer.valueOf(ManagementFactory.getRuntimeMXBean().getName().split("@")[0]);

  • Run external program "pslist" (from windows pstools).

  • Parse the output and and get your children (with "my_pid" as the reference).

I hate using external programs for trivial tasks. Any ideas?


Solution

  • You have no choice but to use an external program for this. There is a bug report that was opened to Sun regarding this issue 10 years ago and it is not yet handled.