问题
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