Get PID of Browser launched by Selenium.

We can PID of browsers launched by Selenium webdriver. First of all, we have to create an object of the webdriver. Next, for example, to launch the browser in the Firefox browser, we have to take the help of webdriver.Firefox() class.

The location of the geckodriver.exe file is passed as a parameter to that class. This is done by setting the path to executable_path property. Then, the browser shall be launched with the get method.

Finally, to obtain the PID of the browser, we shall use the method.


s =


from selenium import webdriver
#path of geckodriver.exe
driver = webdriver.Firefox(executable_path="C:\geckodriver.exe")
#launch browser
driver.get ("")
#obtain PID of browser
s =
#close browser


Updated on: 30-Jan-2021

1K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started