Both answers did not work for me, because it is part of a private api.
Checkout on github
require "selenium-webdriver"
Note:
For those trying to access the browser using pid, for example. to execute the kill -9 $pid command. This may be wrong because I came across a better solution.
In args commands we can pass custom attrs. I use it as follows
@buid = SecureRandom.hex[0..15] # browser unique identifier options = Selenium::WebDriver::Firefox::Options.new( args: [ '-headless', "-buid=#{@buid}", ] )
So you can grep and kill both browsers and geckodriver. By exec
$ps aux | awk '/-buid=$generated_pid/ {print $2}' | xargs kill -9
Hope this helps!
source share