Issue
Using Eclipse and Selenium Webdriver
Im using this @AfterMethod to close my browser after each test.
@AfterMethod
public void closeBrowser(ITestResult result) {
result.getMethod().getMethodName();
endTest(testName);
getDriver().getCurrentUrl();
getDriver().quit(); // Close browser before each new test
}
However I get this message for both Chrome and IE
org.openqa.selenium.remote.UnreachableBrowserException: Error communicating with the remote browser. It may have died. Build info: version: '2.48.1', revision: 'd80083d', time: '2015-10-08 21:07:25'
I have closed out the old processes in the task manager as well and cleaned my output folder and I keep getting this error. Please help!
Solution
Try this to close the windows:
getDriver.close();
Furthermore for your second question, you can try to kill the background instances like:
try {
Runtime.getRuntime().exec("taskkill /F /IM IEDriverServer.exe");
} catch (IOException e) {
e.printStackTrace();
}
Answered By - Shah