Alexandra
Alexandra

Reputation: 19

How to use confirm dialog handler?

I tried to use the confirm dialog handler to click ok, but it still doesn't make the click. Am I using it right? Here is the code:

var handler = new ReturnDialogHandler();
using (new UseDialogOnce(WebBrowser.Current.DialogWatcher, handler))
{
    WebBrowser.Current.AddDialogHandler(handler);
    WebBrowser.Current.Link("delete").ClickNoWait();
    handler.WaitUntilExists(5);
    handler.OKButton.Click();
    WebBrowser.Current.WaitForComplete();
}

Upvotes: 1

Views: 550

Answers (1)

Sean
Sean

Reputation: 282

In the unit tests for WatiN that handler is created like this:

var handler = ReturnDialogHandler.CreateInstance();

Upvotes: 1

Related Questions