【发布时间】:2013-03-27 23:07:06
【问题描述】:
我添加了 Microsoft.mshtml 作为对我的项目的引用,并且走到了这一步:
mshtml.IHTMLDocument2 document = (mshtml.IHTMLDocument2)webbrowser.Document;
string username = document.all["username"].GetAttribute("value");
但第二行不起作用。它说
“错误 CS0021:无法使用 [] 将索引应用于类型表达式 'mshtml.IHTMLElementCollection'"
当悬停在“全部”上时。如何访问所有元素?
【问题讨论】: