gpt4 book ai didi

java - driver.quit() 导致 'Firefox to stop working'

转载 作者:太空宇宙 更新时间:2023-11-04 11:42:33 26 4
gpt4 key购买 nike

driver.quit() 导致“Firefox 停止工作”

  1. 测试不会失败,但每次调用 driver.quit 时浏览器都会崩溃,如下图所示。
  2. 我的代码:

    public void quitDriver() throws Exception {
    if (null != webdriver) {
    getDriver().manage().deleteAllCookies();
    webdriver.quit();
    webdriver = null;
    }
    }

工厂类:

case "firefox":
if (null == webdriver) {
System.setProperty("webdriver.gecko.driver", Constant.GECKO_DRIVER_DIRECTORY);
webdriver = new FirefoxDriver();
}

enter image description here

enter image description here

    <dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.0.1</version>
</dependency>

最佳答案

查看此mozilla/geckodriver releases页。

v0.14.0

Changed

Firefox process is now terminated and session ended when the last window is closed
WebDriver library updated to version 0.20.0

您在调用退出之前关闭了最后一个窗口吗?

此外,geckodriver 仍然存在风险。尝试移动到:

  • Webdriver v3.3.1
  • geckodriver v0.15.0

关于java - driver.quit() 导致 'Firefox to stop working',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42647142/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com