Scrolling to view, finding element via innerhtml C#

bambinou

Client
Регистрация
22.08.2011
Сообщения
434
Благодарностей
21
Баллы
18
Hello,

Only started to play with C# since using the latest version of Zenno.
I am just trying to find out how to scroll to view to an element.

In this example, I have the outerhtml of the element. I tried to pass it as project.Variables["croll_to_view"].Value to instance.ActiveTab.MainDocument.FindElementByAttribute

// try find the html element
HtmlElement he = project.Variables["scroll_to_view_outerhtml"].Value;

// if html element was found
if (!he.IsVoid)
{
// scroll view of tab to the html element
he.ScrollIntoView();

// performs the click inside tab by coordinates
instance.ActiveTab.MouseClick(he.DisplacementInTabWindow.X + 10, he.DisplacementInTabWindow.Y + 10, "left", "click");

}

But the error I get is:
Compile code of Error in action "CS0029" "Cannot implicitly convert type 'string' to 'ZennoLab.CommandCenter.HtmlElement'". [Row: 1; Column: 18]

What is the best way with c# to scrolltoview with the outer html please?

Thank you.
 

bambinou

Client
Регистрация
22.08.2011
Сообщения
434
Благодарностей
21
Баллы
18
I actually tried in JS, I was expecting it to work but nothing:
element.scrollTop = {-Variable.scroll_to_view-};

I have an integer of 198 get a red cross and no errors....
 

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