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 instance at the beginning for each of my test case using the below code
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.");
}
and closing at the end using the below code
driver.close();
driver.quit();
But when I open a browser for the second test case I'm getting "chrome didn't shut down correctly" popup message.
I tried updating the below in the Preferences file of chrome profile but no luck
exit_type:Crashed
exited_cleanly:true
Configuration :
Chrome Version: Version 64.0.3282.186 (Official Build) (32-bit)
Selenium Version: 3.11.0
As per your code it would be tough to analyze the reason behind the error chrome didn't shut down correctly without knowing your framework structure. Perhaps a more details about how code block was invoked (i.e. main() or TestNG) would have helped us.
Having said that there still seems some more factors to look at as follows :
As you are using an existing Chrome Profile through user-data-dir as per the documentation ChromeDriver - WebDriver for Chrome the path should point the profile directory as follows :
Here you can find a detailed discussion at How to open a Chrome Profile through Python
driver.close();
and always invokedriver.quit()
withintearDown(){}
method to close & destroy the WebDriver and Web Client instances gracefully.@Test
.Did you set exit_type:Normal, I'm currently doing that before the test start, and or after the test ends and it Works.