tags:

views:

1183

answers:

6

Hi all, When I run WatiN tests on our build server they all throw this InteropServices.COMException:

MyTestClassName.MyTestMethodName: System.Runtime.InteropServices.COMException : Creating an instance of the COM component with CLSID {0002DF01-0000-0000-C000-000000000046} from the IClassFactory failed due to the following error: 80004005.

I get the same result wether I run them through TeamCity or I run them manually on the server as an administrator using NUnit GUI (2.5).

This is some sample code:

[TestFixture] public class MyTestClassName { private string pageUrl;

[TestFixtureSetUp]
public void TestFixtureSetUp()
{
    pageUrl = ConfigurationManager.AppSettings["SiteURL"] + "/Pages/MyPage.aspx";

    Settings.MakeNewIeInstanceVisible = false;
}

[Test]
public void MyTestMethodName()
{
    using (var ie = new IE(pageUrl))
    {
        ie.SelectList(new Regex(@"^*DropDownList1*$")).Option("TheOption").Select();

        ie.SelectList(new Regex(@"^*DropDownList2*$")).Option("AnOption").Select();

        ie.SelectList(new Regex(@"^*DropDownList3*$")).Option("OtherOption").Select();

    }
}
}

Any ideas what it can be?

/Joakim

A: 

I think that the select list is not yet fully loaded and ready, and this is another symptom of the same problem described in this question:

http://stackoverflow.com/questions/959150/access-is-denied-error/

Bruce McLeod
Unfortunately it is not - all our WatiN tests fail with the same Exception.
A: 

I am also getting the same error. Any solutions you found yet

A: 

I also have the same problem and no idea how to solve it, so if anybody has a solution it would be great

+2  A: 

I also meet the same problem but more strange for me.

I've got a server only for "UI testing" and for many application de WatiN test runs without any problem.

This error only happens for one application and only in CruiseControl (with nant) but not when runing the test with NUnitGUI...

I Finnaly found a solution this morning: I replaced all my call new IE(); to new IE(true) WatiN release note And didn't get the error anymore.

Pitming
+2  A: 

Try running Visual Studio as Administrator.

zA