title: How to handle the "unexpected alert open"?
body: <p>I got an issue with Selenium throwing <code>timeout exception</code> because of a pop up window  </p>
  
  <pre><code>  unexpected alert open
    not provide any stacktrace information)
    Command duration or timeout: 5 milliseconds
  </code></pre>
  
  <p>The alert has <code>OK</code> and <code>CANCEL</code> buttons. I know two ways to handle this</p>
  
  <hr>
  
  <p>The first way is reopen a new session</p>
  
  <pre><code>driver.quit();
  driver = new ChromeDriver();
  </code></pre>
  
  <hr>
  
  <p>Second way is using Robot class</p>
  
  <pre><code>Robot r = new Robot();
  r.keyPress(KeyEvent.VK_ENTER);
  r.keyRelease(KeyEvent.VK_ENTER);
  </code></pre>
  
  <p>However, this methods are not time efficient. Is there any better way?</p>