Get PID of Browser launched by selenium

前端 未结 9 1565
闹比i
闹比i 2020-11-30 07:15

I would like to get the PID of the browser launched by selenium. Is there any way to get it done?

9条回答
  •  日久生厌
    2020-11-30 08:07

    If you're using PhantomJS then you can get the PID from the process Popen object:

    from selenium import webdriver
    browser = webdriver.PhantomJS()
    print browser.service.process.pid  
    

提交回复
热议问题