Java 类org.openqa.selenium.os.WindowsUtils 实例源码

项目:OptimusPrime    文件:ParallelBrowserFactory.java   
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());
    }
}
项目:JDI    文件:TestNGBase.java   
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"))));
}
项目:gga-selenium-framework    文件:WebDriverUtils.java   
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")));
}
项目:gga-selenium-framework    文件:WebDriverUtils.java   
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")));
}
项目:gga-selenium-framework    文件:WebDriverUtils.java   
private static String getPid() {
    return first(where(tryGetResult(WindowsUtils::procMap), el -> el.getKey() != null
            && (el.getKey().contains("Android") && el.getKey().contains("Appium"))));
}