От версии 1.1 >
отредактировано Alexandr Fokin
на 2020/10/17 17:08
К версии < 2.1 >
отредактировано Alexandr Fokin
на 2020/10/17 17:19
>
Изменить комментарий: К данной версии нет комментариев

Комментарий

Подробности

Свойства страницы
Содержимое
... ... @@ -1,0 +1,34 @@
1 +{{code language="c#"}}
2 +
3 +// Change html attribute
4 + var usernameInput = geckoWebBrowser1.Document.GetElementById("j_username");
5 + usernameInput.SetAttribute("value", "abc");
6 +
7 +
8 +// ButtonClick
9 + var buttonElement = geckoWebBrowser1.Document.GetElementById("button");
10 + new GeckoButtonElement(buttonElement.DOMElement).Click();
11 +
12 +
13 +// FormSubmit
14 + var form = geckoWebBrowser1.Document.GetElementById("loginForm");
15 + (form as GeckoFormElement).submit();
16 +
17 +
18 +// Execute JS
19 + using (AutoJSContext context = new AutoJSContext(geckoWebBrowser1.Window))
20 + {
21 + var result1 = context.EvaluateScript(
22 + "(() => { return 2; })()",
23 + (nsISupports)geckoWebBrowser1.Window.DomWindow,
24 + out res
25 + );
26 +
27 + var result2 = context.EvaluateScript(
28 + "document.getElementById('loginForm').submit()",
29 + (nsISupports)geckoWebBrowser1.Window.DomWindow,
30 + out res
31 + );
32 + }
33 +
34 +{{/code}}