I am writing tests for a web App using selenium webDriver and came across a scenario where when I try to close the browser I get a popup saying \"Are you sure? The page is a
( ( JavascriptExecutor ) _driver ) .executeScript( "window.onbeforeunload = function(e){};" );
solved the issue for me