Исходный код вики Сценарии
Версия 1.3 от Alexandr Fokin на 2022/12/08 08:34
Скрыть последних авторов
| author | version | line-number | content |
|---|---|---|---|
| |
1.3 | 1 | | |(% style="width:847px" %){{code language="c#"}}// Change html attribute |
| |
1.2 | 2 | var usernameInput = geckoWebBrowser1.Document.GetElementById("j_username"); |
| 3 | usernameInput.SetAttribute("value", "abc"); | ||
| 4 | |||
| 5 | // ButtonClick | ||
| 6 | var buttonElement = geckoWebBrowser1.Document.GetElementById("button"); | ||
| 7 | new GeckoButtonElement(buttonElement.DOMElement).Click(); | ||
| 8 | |||
| 9 | // FormSubmit | ||
| 10 | var form = geckoWebBrowser1.Document.GetElementById("loginForm"); | ||
| 11 | (form as GeckoFormElement).submit(); | ||
| 12 | |||
| 13 | // Execute JS | ||
| 14 | using (AutoJSContext context = new AutoJSContext(geckoWebBrowser1.Window)) | ||
| 15 | { | ||
| 16 | var result1 = context.EvaluateScript( | ||
| 17 | "(() => { return 2; })()", | ||
| 18 | (nsISupports)geckoWebBrowser1.Window.DomWindow, | ||
| 19 | out res | ||
| 20 | ); | ||
| 21 | |||
| 22 | var result2 = context.EvaluateScript( | ||
| 23 | "document.getElementById('loginForm').submit()", | ||
| 24 | (nsISupports)geckoWebBrowser1.Window.DomWindow, | ||
| 25 | out res | ||
| 26 | ); | ||
| |
1.3 | 27 | }{{/code}}|(% style="width:625px" %)((( |
| 28 | geckofx button click | ||
| 29 | [[https:~~/~~/stackoverflow.com/questions/15005216/geckofx-button-click>>url:https://stackoverflow.com/questions/15005216/geckofx-button-click]] | ||
| |
1.2 | 30 | |
| |
1.3 | 31 | Submit web form on a GeckoWebBrowser? (GeckoFX) |
| 32 | [[https:~~/~~/stackoverflow.com/questions/20755971/submit-web-form-on-a-geckowebbrowser-geckofx>>url:https://stackoverflow.com/questions/20755971/submit-web-form-on-a-geckowebbrowser-geckofx]] | ||
| 33 | |||
| 34 | Gecko 45 c# winform add script to document | ||
| 35 | [[https:~~/~~/stackoverflow.com/questions/34993941/gecko-45-c-sharp-winform-add-script-to-document>>url:https://stackoverflow.com/questions/34993941/gecko-45-c-sharp-winform-add-script-to-document]] | ||
| 36 | ))) | ||
| 37 | | |(% style="width:847px" %) |(% style="width:625px" %) | ||
| 38 | | |(% style="width:847px" %) |(% style="width:625px" %) | ||
| 39 | |||
| |
1.2 | 40 |