Python Selenium: How to check whether the WebDriver did quit()?

前端 未结 7 1012
一个人的身影
一个人的身影 2021-02-08 12:26

I want to control whether my WebDriver quit but I can\'t find a method for that. (It seems that in Java there\'s a way to do it)

from selenium impor         


        
7条回答
  •  旧时难觅i
    2021-02-08 12:49

    I ran into the same problem and tried returning the title - this worked for me using chromedriver...

    from selenium.common.exceptions import WebDriverException
    
    try:
        driver.title
        print(True)
    except WebDriverException:
        print(False)
    

提交回复
热议问题