Scroll Down [GeckoFx + Javascript]

你。 提交于 2019-12-24 00:34:46

问题


I'm trying to scroll down a page with GeckoFx v33 and Javascript. My C# code is the following:

        private void scrollWb() {
        string command = "window.scrollTo(0, document.body.scrollHeight);";
        using (Gecko.AutoJSContext context = new AutoJSContext(wb.Window.JSContext))
        {
            var result = context.EvaluateScript(command, wb.Window.DomWindow);

        }

My code doesn't work... Can anyone help me please? Thanks.


回答1:


Scrolling is handled using the methods of the Window object:

Alternatively, you can use a .ScrollIntoView() property of a GeckoHtmlElement to get to a specific element.



来源:https://stackoverflow.com/questions/37548216/scroll-down-geckofx-javascript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!