client only knows session id of browser process.
in my case, i need to know the process id of a browser session to check cpu usage and terminate it if selenium failed to clean session(return browser process id to client).
so i hope selenium expose the process id to client.
selenium sometimes failed to close session such as(https://github.com/SeleniumHQ/selenium/pull/2031)
this depends on which language you're using of selenium. But if you're using the standalone-server, no it does not expose the pid of either the browser nor the driver service it may have started.
We have no intention of exposing the pid with the capabilities back to the client, it's a level of abstraction that shouldn't be necessary. (Thus I will close this issue).
If you have a particular scenario that often leads to the browser process not being terminated, please log that as a bug, be sure to include the relevant information for us to help, like OS version, Browser version, Selenium client binding languages used, if you're using the standalone server. Also if you're able to a test case (script) that demonstrates the issue you're seeing (even if intermittent).
This is braindamage: if you don't support some basic handling of browser functionality (ie opening a print dialog) then why not allow us to easily and rationally do it (via a pid) in some other way? Honestly, this level of obfuscation will help to obsolete--not complete your software. Playing nicely in the school yard will go a long way for adoption.
You can add command line arguments to get the process id , for the driver and and the browser, and then scan your process list to find your passed argument (let's say a guid), this can be used to find the pair of driver-browser pids.
Then , there are
OpenQA.Selenium.Chrome.ChromeDriverService ; OpenQA.Selenium.Firefox.FirefoxDriverService ... etc, and you can call .ProcessId to get the driver service;
But for the browser pid , i`m still using the first method (guid) ... exposing the pid is not a bad idea , it just makes Selenium more complete; but they work on it, so it's their call.
For C#/VB check this example https://stackoverflow.com/questions/2633628/can-i-get-command-line-arguments-of-other-processes-from-net-c;
combined with (FF as example)
firefoxOptions.AddArgument("-" + guidStringHere);
For the driver (eg.: geckodriver.exe) I had to modify OpenQA.Selenium.DriverService like this : http://prntscr.com/j60905 ; I had to use dnSpy to do it because for some strange reason, if i compile OpenQA myself , it has poor performace , it's very slow;
So now it's a matter of scanning your processes , get the command line args , find your guid , and your have your match of service-browser pids.
Most helpful comment
This is braindamage: if you don't support some basic handling of browser functionality (ie opening a print dialog) then why not allow us to easily and rationally do it (via a pid) in some other way? Honestly, this level of obfuscation will help to obsolete--not complete your software. Playing nicely in the school yard will go a long way for adoption.