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
You need to handle the unexpected alerts using try catch blocks. Put your code in try block and catch the 'UnhandledAlertException'
Example:
try{ ..... ..... code here }catch(UnhandledAlertException e ){ driver.switchto().alert().dismiss(); }