2

I have a WebBrowser-Control where I load a HTML-Document. In the HTML-Document there are several entries like <tr class="uierror">.

To get the content of the WebBrowser I use:

if(webBrowser.Document != null)
{
   mshtml.HTMLDocument htmlDocument = webBrowser.Document as mshtml.HTMLDocument;
   if(htmlDocument != null)
   {

   }
}

But now I have no idea how to scroll to the first occurence of <tr class="uierror">. How can I do this?

Ok. I've managed it to get the IHTMLElement to the <tr class="uierror"> with

IHTMLElementCollection elements = htmlDocument.getElementsByTagName("tr");
foreach(IHTMLElement element in elements)
{
   if(element.className == "uierror")
   {

   }
}

Now how can I scroll to this position?

Tomtom
  • 9,087
  • 7
  • 52
  • 95
  • I think Javascript can give you a solution, check following link: http://stackoverflow.com/questions/4801655/how-to-go-to-a-specific-element-on-page – Max Feb 04 '14 at 15:14
  • And how can I execute a javascript to my webBrowser-Control in c#? – Tomtom Feb 04 '14 at 15:20

1 Answers1

1

Ok. I managed it. The IHTMLElement has a method scrollIntoView. That's it.

Tomtom
  • 9,087
  • 7
  • 52
  • 95