tags:

views:

25

answers:

1

I'm trying to add ConfirmDialogHandler to dialog handler and i get NullReferenceException. This happens on FF 3.6 with latest watin version, the same code works on IE7 and 8.

   ConfirmDialogHandler confirmDialogHandler = new ConfirmDialogHandler();
   browser.AddDialogHandler(confirmDialogHandler); // --> exception here

Any ideas?

+1  A: 

Found the problem.

The DialogWatcher was not initialized when FF session was created added this line to watin code:

    private void CreateFireFoxInstance(string url)
    {
        Logger.LogAction("Creating FireFox instance");

        UtilityClass.MoveMousePoinerToTopLeft(Settings.AutoMoveMousePointerToTopLeft);

        var clientPort = GetClientPort();
        clientPort.Connect(url);
        _ffBrowser = new FFBrowser(clientPort);
        StartDialogWatcher();  // <-- Added line
        WaitForComplete();
    }
alonp