Randomly throwing “InvalidCastException” during te

2019-07-18 09:20发布

On WatiN UI tests, I'm having an issue where when running tests, an error will sometimes will throw the following error:

InvalidCastException was unhandled by user code" ... "Unable to cast COM object of type 'mshtml.HTMLDocumentClass' to interface type 'mshtml.IHTMLDocument2'. This operation failed because the QueryInterface call on the COM component for the interface with IID" ... "failed due to the following error. No such interface supported".

It doesn't appear to matter whether WatiN is finding an element on a page, or interacting with it (clicking or using the Eval method).

The errors happen on a frequency anywhere between all the time to some of the time. It's very inconsistent. It usually has a tendency to affect some elements more than others (in my case I had Javascript drop-down menus where it appeared to happen more often), but the error seems to be able to crop up almost anywhere.

Anyone experienced this, or have any ideas of how this issue might be solved?

Thanks

标签: watin
0条回答
登录 后发表回答