向下滚动[GeckoFx + Javascript] [英] Scroll Down [GeckoFx + Javascript]
本文介绍了向下滚动[GeckoFx + Javascript]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用GeckoFx v33和Javascript向下滚动页面。
我的C#代码如下:
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.
推荐答案
滚动是使用Window对象的方法来处理的:
Scrolling is handled using the methods of the Window object:
或者,您可以使用GeckoHtmlElement的.ScrollIntoView()属性来获取到特定元素。
Alternatively, you can use a .ScrollIntoView() property of a GeckoHtmlElement to get to a specific element.
这篇关于向下滚动[GeckoFx + Javascript]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文