title: Selenium NoAlertPresentException
body: <p>I'm trying to handle dialog (Ok Cancel type) with selenium WebDriver. So my aim is to click "Ok" button.</p>
  
  <p>Scenario is:</p>
  
  <ol>
  <li><p>Click button for invoking dialog</p>
  
  <p><code>button.click()</code>;</p></li>
  <li><p>Try to accept</p>
  
  <p><code>webDriver.switchTo().alert().accept()</code>;</p></li>
  </ol>
  
  <p>But I'm always getting NoAlertPresentException and seeing that dialog closes almost immediately.
  It seems to me that Selenium automatically closes dialog and when I want to accept, there is nothing to accept.</p>
  
  <p>I'm sorry for my bad English.</p>