Search code examples
c#watin

WatiN: automate Web Page dialog


I use WatiN to automate my testing but how could I handle Web Page dialog window? I can connect to it but can't see source code of it.


Solution

  • If you want to handle popup dialog use

      ConfirmDialogHandler handler = new ConfirmDialogHandler();
      using (new UseDialogOnce(browser.DialogWatcher, handler))
      {
          browser.Link(Find.ByClass("Your class")).ClickNoWait(); //The action that triggers the dialog
          handler.WaitUntilExists(60);
          handler.OKButton.Click();
      }