geckofx按钮单击

Kin*_*waz 3 geckofx

我已将skybound gecckofx集成到我的应用程序中.我能够填满文本框

GeckoElement username = null; 
username = checkDoc.GetElementById("ctl00_contentPlaceHolder_txtUserName");
username.SetAttribute("value", "myemail@gmail.com");
Run Code Online (Sandbox Code Playgroud)

但我无法点击按钮

GeckoElement button1 = null;
button1 = checkDoc.GetElementById("ctl00_contentPlaceHolder_lbtnLogin");
button.click() // there is no function by the name on click on the button 
Run Code Online (Sandbox Code Playgroud)

A. *_*nis 6

检查您是否有类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();
Run Code Online (Sandbox Code Playgroud)

很简单!

您也可以使用GeckoInputElement将电子邮件地址输入到html元素中

GeckoInputElement username = new GeckoInputElement(checkDoc.GetElementById("ctl00_contentPlaceHolder_txtUserName");
.DomObject);
username.Value = "myemail@gmail.com"
Run Code Online (Sandbox Code Playgroud)

Τέλος!(完)