title: C# WPF Webbrowser msHTML - Explore DOM - Find Elements
body: <p>I'm actually working on a personal project in C# using WPF and WPF WebBrowser. I really need to explore html DOM Elements as we used to do in javascript or php..etc</p>
  
  <p>In my MainWindow I have this variable :</p>
  
  <pre><code>private mshtml.HTMLDocument mainDocument = new mshtml.HTMLDocument();
  </code></pre>
  
  <p>In my webBrowser LoadComplete callback I have this :</p>
  
  <pre><code>mainDocument = (mshtml.HTMLDocument) mainBrowser.Document;
  </code></pre>
  
  <p>Ok, so this is nice, it's working.</p>
  
  <p>Now if I do this :</p>
  
  <pre><code>mshtml.IHTMLElement elem = mainDocument.getElementById("MY_ID");
  </code></pre>
  
  <p>it's also very nice, can do elem.innerHTML or somes stuff like that.</p>
  
  <p>BUT my problem is only HTMLDocument have methodes to find elements by ID, by tagnames..etc </p>
  
  <p>I don't know how to find elements in IHTMLElement. I tried some stuff like casting IHTMLElement to IHTMLElement2..etc but nothing have worked.</p>
  
  <p>Please if you have any ideas. A lot of people talks about hosting winforms webbrowser but I think it must have a way to do that only with mshtml.</p>
  
  <p>Thanks a lot,
  If you need more information, please feel free to ask me</p>
  
  <p>ps : I'm french so I'm sorry about my Engish skills</p>