Jerome2606
Jerome2606

Reputation: 955

Watin C# NUnit IE COM Exception

I use Watin and Nunit for testing, All works fine on Windows 7. But now I need to share my test on a server Windows 2008. And It's a problem because I always get an exception when I try to Logout and then launch a new IE: System.Runtime.InteropServices.COMException (0x800704A6): Creating an instance of the COM component with CLSID {0002DF01-0000-0000-C000-000000000046} from the IClassFactory failed due to the following error: 800704a6. at WatiN.Core.IE.CreateNewIEAndGoToUri(Uri uri, IDialogHandler logonDialogHandler, Boolean createInNewProcess)

I try to update IE to IE 9, same problem I try to add some System.Threading.Thread.Sleep(4000), same problem. I get this exception on this line:

return new IE(Config.DefaultConfig.HomepageUrl);

Thanks for your help,

Jerome

Upvotes: 1

Views: 3327

Answers (2)

Jerome2606
Jerome2606

Reputation: 955

I found a way to don't have anymore this message:

return new IE(Config.DefaultConfig.HomepageUrl, true);

To launch in a new process And I add some

System.Threading.Thread.Sleep(4000); 

When Watin need to AttachBrowser.

But the problem is that now I get some COMException:

The object invoked has disconnected from its clients. (HRESULT: 0x80010108 RPC E DISCONNECTED)

this last message appear when I close a IE popup window. It don't find my mainpage after I close this popup window.

Thanks for your help,

Jerome

Upvotes: 0

t3hn00b
t3hn00b

Reputation: 912

I believe I had the same problem a while ago, but can't remember the exact solution so here is a couple of thinks you can try:

  1. Did you add a reference to Interop.SHDocVw and Microsoft.mshtml?
  2. And in their properties have you set Embed Interop Types to False?

Hope it helps. If some solution pops into my head I'll let you know.

Upvotes: 3

Related Questions