0

I'm trying to scroll a website (x and y) without scrollbar. I tryed a lot of codes, but it doesn't work. Can you help me please?

Samsquanch
  • 8,042
  • 12
  • 50
  • 86

2 Answers2

0

To My Knowledge you cannot do this from C# side.

You can however run something in javascript like

window.scrollTo(xPos,yPos);

and if you really want to do this from C#, I'd suggest looking into registering scripts to run on the client, Although this can get messy fast. As Comments are suggesting it is hard to help you on your exact problem because we would need to see some code for what you have tried and where you problem domain lies.

Steven Dall
  • 166
  • 2
  • 12
0

I Found a method to do that.

        HtmlElement head = webBrowser1.Document.GetElementsByTagName("head")[0];
        HtmlElement s = webBrowser1.Document.CreateElement("script");
        s.SetAttribute("text", "function functionName() { /* Code to Execute in JS */ }");
        head.AppendChild(s);
        webBrowser1.Document.InvokeScript("functionName");

Remember to execute this code after about five second that the website correctly load. A special thank to Steven Dall