0

I want to scroll a div via Gecko and C#

My code is

GeckoDivElement div1 = new GeckoDivElement(icdIFrameElement.ContentDocument.GetHtmlElementById("t1::scroller").DomObject);
GeckoElementCollection divs = div1.GetElementsByTagName("div");
GeckoDivElement div = new GeckoDivElement(divs[0].DomObject);
div.ScrollIntoView(true);
div.ScrollTop += 10;

but it does not work.

Can someone help me please?

Soner Gönül
  • 97,193
  • 102
  • 206
  • 364
A. Zalonis
  • 1,599
  • 6
  • 26
  • 41

1 Answers1

0

I found solution. My code is correct but to works I used theads and delegates. So I found below solution

public delegate void geckoWebBrowserDelegate();

public void scrollWithTheads()
{
   Thread oThread = new Thread(new geckoWebBrowserDelegate(scrollWithThread));
   oThread.Start();
}

private void scrollWithThread()
{
  _myGeckoWebBrowser.Invoke("scroll");
}

private void scroll()
{
 GeckoDivElement div1 = new  GeckoDivElement(_myGeckoWebBrowser.Document.GetElementById("t1::scroller").DomObject);
 GeckoElementCollection divs = div1.GetElementsByTagName("div");
 GeckoDivElement div = new GeckoDivElement(divs[0].DomObject);
div.ScrollIntoView(true);
div.ScrollTop += 10;
}
A. Zalonis
  • 1,599
  • 6
  • 26
  • 41