无论我以何种方式编写以下代码,都会得到一个System.InvalidCastException: 'Specified cast is not valid.'异常。HtmlElementCollection Documents = WebBrowser1.Document.All;
在最初的代码中,它是foreach(htmlelement in webbrowser1.document.all)列表的一部分,但在重构代码使其像上面那样工作后,它开始给我这个异常。我
我在使用Windows服务with浏览器对象时遇到了一些问题。它试图将用户名和密码的值加载到站点,但总是失败,并抛出以下错误:
System.InvalidCastException: Specified cast is not valid.at System.Windows.Forms.UnsafeNativeMethods.IHTMLDocument2.GetLocation() at System.Windows.Forms.WebBrowser.get_Document() at My