Showing posts with label WatiN. Show all posts
Showing posts with label WatiN. Show all posts

Monday, June 07, 2010

WatiN on Windows Server 2008 / IE8

Got to the bottom of my WatiN issues when trying to run a simple test on our Windows Server 2008 development machine with IE8. I kept getting the following error:

System.Runtime.InteropServices.COMException : The interface is unknown. (Exception from HRESULT: 0x800706B5)

Thankfully SO can to the rescue again: http://stackoverflow.com/questions/1014815/how-do-you-get-watin-to-work-on-windows-server-2008-with-ie8

Run VS as Administrator!

Monday, April 19, 2010

WatiN: Confirmation Dialog Handler

An example of using the ConfirmDialogHandler:

using WatiN.Core;
using WatiN.Core.DialogHandlers;

[TestMethod()]
public void ConfirmOKTest()
{
using (IE ie = new IE("http://localhost/confirmtest.htm"))
{
ConfirmDialogHandler handler = new ConfirmDialogHandler();
using (new UseDialogOnce(ie.DialogWatcher, handler))
{
ie.Button("myButton1").ClickNoWait();
handler.WaitUntilExists();
handler.OKButton.Click();
}
ie.WaitForComplete();
Assert.AreEqual("Clicked OK", ie.Button("myButton1").Text);
}
}

Source: http://www.codeproject.com/KB/testing/WatiNConfirmDialogs.aspx