Randomly throwing “InvalidCastException” during tests

為{幸葍}努か 提交于 2019-12-10 23:13:52

问题


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

来源:https://stackoverflow.com/questions/11540886/randomly-throwing-invalidcastexception-during-tests

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!