How to emulate scroll down to specified element?

Tao Guan

Пользователь
Регистрация
24.05.2018
Сообщения
73
Благодарностей
0
Баллы
6
As title, how to emulate scroll down to specified element?
I have tried this C# code as below, but no move:

HtmlElement he = instance.ActiveTab.MainDocument.FindElementByAttribute("div", "id", "7_0", "text", 0);
if (!he.IsVoid)
{
he.ScrollIntoView();
instance.ActiveTab.MouseClick(he.DisplacementInTabWindow.X + 10, he.DisplacementInTabWindow.Y + 10, "left", "click");
instance.SendText("It's just example. If you see this text then all work correctly. Don't forget to buy one more ZennoPoster.", 75);
}
 

lokiys

Moderator
Регистрация
01.02.2012
Сообщения
4 771
Благодарностей
1 184
Баллы
113
Hello.

This is exactly method what scrolls to element he.ScrollIntoView();
But first You have to focus or click inside Active tab, to activate browser window.

Your code should do more than just scroll down to your element.
 
  • Спасибо
Реакции: Tao Guan

Tao Guan

Пользователь
Регистрация
24.05.2018
Сообщения
73
Благодарностей
0
Баллы
6

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)