public static synchronized void closeDriver() { Long callingThreadID = new Long(Thread.currentThread().getId()); if (browserMap.containsKey(callingThreadID)) { DriverWrapper driver = browserMap.get(callingThreadID).driver; if (driver != null) { try { // Some times IE does'nt close, in that case we have to // kill the browser driver.close(); driver.quit(); driver = null; logger.debug("Destroying browser for Thread ID " + callingThreadID + " and thread name " + Thread.currentThread().getName()); } catch (Exception exp) { System.out .println("Unexpected fault while closing the browser -> " + exp.getMessage()); System.out.println(driver.toString() + " from thread " + callingThreadID + " || test run context of " + Thread.currentThread().getName() + " is not closing. Killing it"); logger.debug(driver.toString() + " from thread " + callingThreadID + " || test run context of " + Thread.currentThread().getName() + " is not closing. Killing it"); WindowsUtils.tryToKillByName("IEDriverServer.exe"); } } browserMap.remove(callingThreadID); logger.debug("Removed sucessfully browser for Thread ID " + callingThreadID + " and thread name " + Thread.currentThread().getName()); } }
private static String getPid() { return first(where(tryGetResult(WindowsUtils::procMap), el -> el.getKey() != null && (el.getKey().contains("Winium.Desktop.Driver") || el.getKey().contains("WindowsPhoneDriver.OuterDriver") || el.getKey().contains("Winium.StoreApps.Driver")))); }
private static String getPid() { return first(where(tryGetResult(WindowsUtils::procMap), el -> el.getKey() != null && (el.getKey().contains("firefox") && el.getKey().contains("-foreground")) | el.getKey().contains("chromedriver") | el.getKey().contains("IEDriverServer"))); }
private static String getPid() { return first(where((Map<String, String>)tryGetResult(WindowsUtils::procMap), el -> el.getKey() != null && (el.getKey().contains("firefox") && el.getKey().contains("-foreground")) | el.getKey().contains("chromedriver") | el.getKey().contains("IEDriverServer"))); }
private static String getPid() { return first(where(tryGetResult(WindowsUtils::procMap), el -> el.getKey() != null && (el.getKey().contains("Android") && el.getKey().contains("Appium")))); }