【发布时间】:2018-03-28 17:48:20
【问题描述】:
当我在我的 selenium 框架中重新打开 chrome 浏览器时,我收到 chrome 没有正确关闭错误消息。
在框架中,我使用以下代码在每个测试用例的开头打开浏览器实例
if (browserType.equalsIgnoreCase("Chrome")) {
try {
System.setProperty("webdriver.chrome.driver", curProj+"\\drivers\\chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("useAutomationExtension", false);
options.addArguments("disable-infobars");
//options.addArguments("user-data-dir=C:/Users/xw20/AppData/Local/Google/Chrome/User Data");
options.addArguments(chromeProfile);
webdriver = new ChromeDriver(options);
logger.info("getWebDriver - Setting webdriver.chrome.driver system property as: " + System.getProperty("webdriver.chrome.driver"));
}
catch(IllegalStateException e) {
logger.error("The path to the driver executable must be set by the webdriver.chrome.driver system property. ",e.fillInStackTrace());
throw new IllegalStateException("The path to the driver executable must be set by the webdriver.chrome.driver system property.");
}
并使用下面的代码在最后关闭
driver.close();
driver.quit();
但是当我为第二个测试用例打开浏览器时,我收到“chrome 没有正确关闭”弹出消息。
我尝试在 chrome 配置文件的 Preferences 文件中更新以下内容,但没有成功
exit_type:Crashed
exited_cleanly:true
配置:
Chrome 版本: 版本 64.0.3282.186(官方构建)(32 位)
硒版本: 3.11.0
【问题讨论】:
标签: java google-chrome selenium selenium-webdriver selenium-chromedriver