public void finishFetching() { driver.quit(); service.stop(); }
private static void initializeSeleniumDriver() throws IOException { if (null == DRIVERSERVICE) { final String theChromeDriverBinary = System.getenv("CHROMEDRIVER_BINARY"); if (null == theChromeDriverBinary || theChromeDriverBinary.isEmpty()) { throw new RuntimeException("No chromedriver binary found! Please set CHROMEDRIVER_BINARY environment variable!"); } ChromeDriverService.Builder theDriverService = new ChromeDriverService.Builder(); theDriverService = theDriverService.withVerbose(false); theDriverService = theDriverService.usingDriverExecutable(new File(theChromeDriverBinary)); DRIVERSERVICE = theDriverService.build(); DRIVERSERVICE.start(); Runtime.getRuntime().addShutdownHook(new Thread(() -> DRIVERSERVICE.stop())); } }
private static void initializeSeleniumDriver() throws IOException { if (null == DRIVERSERVICE) { final String theChromeDriverBinary = System.getenv("CHROMEDRIVER_BINARY"); if (null == theChromeDriverBinary || theChromeDriverBinary.isEmpty()) { throw new RuntimeException("No chromedriver binary found! Please set CHROMEDRIVER_BINARY environment variable!"); } ChromeDriverService.Builder theDriverService = new ChromeDriverService.Builder(); theDriverService = theDriverService.withVerbose(false); theDriverService = theDriverService.usingDriverExecutable(new File(theChromeDriverBinary)); DRIVERSERVICE = theDriverService.build(); DRIVERSERVICE.start(); Runtime.getRuntime().addShutdownHook(new Thread(() -> DRIVERSERVICE.stop())); } }
@Override public void quitBrowser(final ChromeDriver browser) { super.quitBrowser(browser); final ChromeDriverService service = services.remove(currentThreadName()); if (service != null && service.isRunning()) { service.stop(); } }
theDriverService.stop();