public void stop ( ) { if ( isStarted ( ) ) { log . info ( "Stopping browser " + webDriver . getCurrentUrl ( ) ) ; try { log . info ( "Trying to close the browser " + webDriver + " ..." ) ; webDriver . quit ( ) ; } catch ( UnreachableBrowserException e ) { // It happens for Firefox. It's ok: browser is already closed. log . warn ( "Browser is unreachable" , e ) ; } catch ( WebDriverException e ) { log . error ( "Failed to close browser" , e ) ; } webDriver = null ; } else { log . warn ( "Browser already stopped" ) ; } }
Stop the browser when started .