正在执行使用WatiN的自动化。使用几个并发线程来测试应用程序。很少线程失败并且日志报告/堆栈跟踪显示以下内容。System.InvalidCastException:指定的转换无效
System.InvalidCastException: Specified cast is not valid.
at SHDocVw.IWebBrowser2.get_HWND()
at WatiN.Core.Native.InternetExplorer.IEBrowser.get_hWnd()
at WatiN.Core.Browser.get_hWnd()
at WatiN.Core.DomContainer.StartDialogWatcher()
at WatiN.Core.IE.CreateNewIEAndGoToUri(Uri uri, IDialogHandler logonDialogHandler, Boolean createInNewProcess)
at WatiN.Core.IE..ctor(Boolean createInNewProcess)
at Core.BaseWatinTestWrapper.Run()
在此之后的异常有被提出,即
System.Runtime.InteropServices.COMException Retrieving the COM class factory for component with CLSID {0002DF01-0000-0000-C000-000000000046} failed due to the following error: 80080005.
请提供一些帮助其他异常。提前致谢。
自从我们切换到64位计算机后,我们也遇到了这个错误。我们的测试已经在正确的公寓状态下运行。 – Lodewijk 2011-10-05 12:32:52
窗口句柄在COM互操作中很困难,它们在64位操作系统上是64位值。将主项目的Platform目标更改为x86。 – 2011-11-03 06:01:10