Selenium: Getting chrome didn't shut down correctly

后端 未结 3 959
南笙
南笙 2021-01-20 05:44

I\'m getting the chrome didn\'t shut down correctly error message when I reopen a chrome browser in my selenium framework.

In the framework I\'m opening the browser

3条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-20 05:53

    This solution is in Python and works 100% but you should be able to implement this in Java as well. I just call the close_windows function every time I am finished using Selenium.

    def close_windows():
    
        windows = driver.window_handles
    
        for w in windows:
            driver.switch_to.window(w)
            driver.close()
    
        driver.quit()
    
    close_windows()
    

提交回复
热议问题