Does anyone know how to get the process id of the browser launched by Selenium WebDriver from the Ruby script that runs the WebDriver?
The answer of Ben did not work for me, I had to adjust it to the following:
driver = Selenium::WebDriver.for :chrome
bridge = driver.instance_variable_get(:@bridge)
service = bridge.instance_variable_get(:@service)
process = service.instance_variable_get(:@process)
process.pid
# => 22656
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With