背景, 我在用C#开发软件来操作IE上的页面元素对应的事件(页面可以是百度)
发现在IE中我获得了 mshtml.IHTMLDocument2 接口后,
无法使用类似“getElementsByTagName”的函数来获取某页个元素
因为 “getElementsByTagName” 只存在于 "System.Windows.Forms.HTMLDocument" 中,
这句话的位置:
“http://www.cnblogs.com/kissdodog/p/3725774.html”
-- 中的
“3.操作”
-- 中的
“HTMLDocumentClass doc2 = Browser.Document as HTMLDocumentClass;”
改为:
HTMLDocumentClass doc2 = (HTMLDocumentClass)Browser.Document;
C# 4.0以上可以用dynamic来做后期绑定
dynamic doc = webBrowser1.Document;
var item = doc.body.getelementbytag("xxx");
坐等看楼主直播吃翔,直播时通知我