title: How to click ok button in alert dialog box using watin?
body: <p>I am trying to automate one website, in my project after clicking on 'submit' button, one alert message with ok button will come. I want to click that ok button.</p>
  
  <p>I tried with these two codes seperatly but these are not working</p>
  
  <pre><code>                    AlertDialogHandler AlertDialog = new AlertDialogHandler();
                      ie.AddDialogHandler(AlertDialog);
                      ie.Button(Find.ByValue("Submit")).ClickNoWait();
                      AlertDialog.WaitUntilExists();
                      AlertDialog.OKButton.Click();
                      ie.WaitForComplete();
                      ie.RemoveDialogHandler(AlertDialog);
  
  
                      var AlertDialogHandler = new AlertDialogHandler();
                      using (new UseDialogOnce(ie.DialogWatcher, AlertDialogHandler))
                      {
                          ie.Button(Find.ByValue("Submit")).ClickNoWait();
                          AlertDialogHandler.WaitUntilExists(50);
                          var message = AlertDialogHandler.Message;
                          AlertDialogHandler.OKButton.Click();
                          ie.WaitForComplete();
                      }
  </code></pre>
  
  <p>While using these two codes, I got the same exception 'dialog not available within 30 seconds'.</p>
  
  <p>Any help will be deeply appreciated. Thank You :)</p>