0
我正在使用mshtml命名空间访问由COM浏览器对象返回的DOM元素。在C中访问DOM元素#
我的代码大致如下
object missing = Type.Missing;
ie.Navigate("http://website.com", ref missing, ref missing, ref missing, ref missing);
mshtml.HTMLDocument theDoc = (mshtml.HTMLDocument)ie.Document;
mshtml.HTMLDivElement myDiv = (mshtml.HTMLDivElement)theDoc.getElementById("divID");
现在,到这一点,myDiv是的DivElement。
但是,网页本身包含“divID”下的更多DIV。也就是说,嵌套的DIV有很多层。
但myDIV对象的类型为mshtml.HTMLDivElement,它使我无法检索更多DIVS作为其子元素。
我能在这种情况下做什么?假设我有更多的DIV,我需要以嵌套的方式检索?
你是说你网页上的所有div都有“divID” – 2009-07-16 16:38:39