我已将 skybound gecckofx 集成到我的应用程序中。我能够填写文本框
GeckoElement username = null;
username = checkDoc.GetElementById("ctl00_contentPlaceHolder_txtUserName");
username.SetAttribute("value", "myemail@gmail.com");
但是我无法点击按钮
GeckoElement button1 = null;
button1 = checkDoc.GetElementById("ctl00_contentPlaceHolder_lbtnLogin");
button.click() // there is no function by the name on click on the button
最佳答案
检查您是否拥有 GeckoInputElement 类。如果不是,那么您可能需要 Skybount.Com 库。或者您可以使用最新版本的 gecko fx。将 GeckoFX 21 与 xulrunner 21 结合使用。 你可以从 ftp.mozila.org 得到
在 geckofx 21 中你可以试试这段代码
GeckoButtonElement button = new GeckoButtonElement(_webBrowser.Document.getElementById("your_button_id").DomObject);
button.Click();
就这么简单!
你也可以像这样使用 GeckoInputElement 将你的电子邮件地址输入到 html 元素
GeckoInputElement username = new GeckoInputElement(checkDoc.GetElementById("ctl00_contentPlaceHolder_txtUserName");
.DomObject);
username.Value = "myemail@gmail.com"
Τέλος! (完成)
关于geckofx 按钮点击,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15005216/