You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

WebDriverManager 5.x及以上版本中未调用driver.quit()/close()浏览器自动关闭是否为新增特性?

WebDriverManager 5.x+ 浏览器自动关闭:确实是新特性!

Hey there! Your observation is spot-on — this automatic browser closure is absolutely a new feature introduced in WebDriverManager 5.x and above. Let me break down the details for you:

  • What’s this feature all about? Starting from version 5.x, WebDriverManager added an auto-cleanup mechanism for WebDriver instances. The core goal here is to eliminate lingering browser/driver processes that can hog system resources when developers accidentally forget to call driver.quit() or driver.close() explicitly.
  • When does it trigger? By default, this feature activates when the JVM shuts down (like when your test suite finishes running). It automatically invokes driver.quit() for any active WebDriver instances, making sure browsers close cleanly without you having to remember manual cleanup steps.
  • Can you turn it off? If you need browsers to stay open post-test (for debugging purposes, for example), you can disable this behavior with a quick configuration line:
    // Disable automatic WebDriver quit functionality
    WebDriverManager.config().setAutoQuit(false);
    
    // Proceed with your driver setup as usual
    WebDriverManager.chromedriver().setup();
    WebDriver driver = new ChromeDriver();
    

So your experience with version 5.2.1 is exactly how this feature is designed to work — no unexpected bugs, just intentional behavior to streamline test environment cleanup!

内容的提问来源于stack exchange,提问作者user2044296

火山引擎 最新活动