List of usage examples for org.openqa.selenium.remote RemoteWebDriver quit
@Override public void quit()
From source file:selenium.ThreadSafeDriver.java
License:Open Source License
static SeleniumDriver makeThreadSafe(final RemoteWebDriver driver) { Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() { @Override//from www. jav a2 s . com public void run() { try { driver.quit(); } catch (UnreachableBrowserException e) { // Ignore. The browser was killed properly } } })); return (SeleniumDriver) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), findInterfaces(driver), new InvocationHandler() { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if (method.getName().equals("quit")) { return null; // We don't want anybody to quit() our (per thread) driver } try { return method.invoke(driver, args); } catch (InvocationTargetException e) { throw e.getCause(); } } }); }