InteropServices.COMException while executing WatiN tests

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

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

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

This is a 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 this could be?

/ Joachim

+4
source share
6 answers

Try running Visual Studio as an administrator.

+6
source

I also encounter the same problem, but stranger to me.

I only have a server for "user interface testing", and for many applications, the WatiN test is no problem.

This error occurs only for one application and only in CruiseControl (with nant), but not when running a test using NUnitGUI ...

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

+5
source

Another fix is ​​"Enable Protected Mode in IE" as described here

+3
source

Each time IE.Quit is called by WatiN, IE stops responding and then tries to recover. Running as administrator fixed the problem for me.

+2
source

Another comment says:

Try running Visual Studio as an administrator

In fact, NUnit needs to be run as an administrator (at least in Windows 7), but the thinking is right.

+2
source

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

Access Error (Visual Studio and WatiN)

0
source

All Articles