Python 检查chrome驱动程序是否处于活动状态

Python 检查chrome驱动程序是否处于活动状态,python,selenium,google-chrome,selenium-webdriver,Python,Selenium,Google Chrome,Selenium Webdriver,我正在尝试编写一些代码来检查chrome驱动程序是否仍然处于活动状态,以及是否要关闭它,但是我的代码似乎确实可以工作。有人有什么想法吗 #check if the chrome driver has been killed while driver.quit() == False: driver.quit() time.sleep(3) print("Driver was closed successfully ") 再次感谢:)您可以研究的另一种方

我正在尝试编写一些代码来检查chrome驱动程序是否仍然处于活动状态,以及是否要关闭它,但是我的代码似乎确实可以工作。有人有什么想法吗

#check if the chrome driver has been killed
while driver.quit() == False:
    driver.quit()
    time.sleep(3)
    print("Driver was closed successfully ")

再次感谢:)

您可以研究的另一种方法是在创建chrome驱动程序时存储其PID,并使用
os
或相关软件包检查其存在/杀死它。