WATIN giving "Dialog not available within n seconds" error

120 views Asked by At

I'm using WATIN with IE 10. The alert dialog box shows up, but WATIN doesn't seem to be able to find it.

var driver = new IE(true);
driver.GoTo("site-url");
driver.WaitForComplete();
var alert = new AlertDialogHandler();
using (new UseDialogOnce(driver.DialogWatcher, alert))
    {
        driver.Button("btnSearch").ClickNoWait();
        alert.WaitUntilExists(5); // <-- error here
        alert.OKButton.Click();
        driver.WaitForComplete();
     }
1

There are 1 answers

0
Melvin On

This might help, I've had the same problem:

var driver = new IE(true);
driver.GoTo("site-url");
driver.WaitForComplete();
var alert = new AlertDialogHandler();
driver.AddDialogHandler(alert);
using (new UseDialogOnce(driver.DialogWatcher, alert))
    {
        driver.Button("btnSearch").ClickNoWait();
        alert.WaitUntilExists(5); // <-- error here
        alert.OKButton.Click();
        driver.WaitForComplete();
     }

The key is adding the DialogHandler to the IE instance.