Исходный код вики GeckoFX. Сценарии
Редактировал(а) Alexandr Fokin 2022/12/08 08:38
Последние авторы
| author | version | line-number | content |
|---|---|---|---|
| 1 | | |(% style="width:847px" %){{code language="c#"}}// Change html attribute | ||
| 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 | ); | ||
| 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]] | ||
| 30 | |||
| 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" %)((( | ||
| 38 | Geckofx60.64 | ||
| 39 | [[https:~~/~~/www.nuget.org/packages/Geckofx60.64/>>url:https://www.nuget.org/packages/Geckofx60.64/]] | ||
| 40 | |||
| 41 | Запуск: | ||
| 42 | |||
| 43 | 1. Создать проект | ||
| 44 | 1. Выставить для проекта разрядность x64 | ||
| 45 | 1. В точке входа вызвать Xpcom.Initialize("Firefox64"); | ||
| 46 | )))|(% style="width:625px" %) | ||
| 47 | | |(% style="width:847px" %) |(% style="width:625px" %) | ||
| 48 | |||
| 49 |