geckofx按钮点击
我已将skybound gecckofx集成到我的应用程序中。我能够填补文本geckofx按钮点击
GeckoElement username = null;
username = checkDoc.GetElementById("ctl00_contentPlaceHolder_txtUserName");
username.SetAttribute("value", "[email protected]");
,但我无法点击按钮
GeckoElement button1 = null;
button1 = checkDoc.GetElementById("ctl00_contentPlaceHolder_lbtnLogin");
button.click() // there is no function by the name on click on the button
你有没有尝试过这样的事情?
function performClick(buttonElement)
{
var evt = document.createEvent("MouseEvents");
evt.initEvent("click", true, true);
buttonElement.dispatchEvent(evt);
}
检查您是否拥有GeckoInputElement类。如果没有,那么你可能需要Skybount.Com库。或者你可以使用壁虎FX的最新版本。使用GeckoFX 21 xulrunner的21 您可以从geckofx 21 ftp.mozila.org
让你可以试试这个代码
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 = "[email protected]"
Τέλος! (完成)
你能帮我找到一个直接的链接来获得这些更新版本的GeckoFX和xulrunner的?我无法找到它。 – Micro 2014-07-03 13:31:33
在这里你可以找到所有版本的xulrunner http://ftp.mozilla.org/pub/mozilla.org/xulrunner/releases/和GeckFX这里https://bitbucket.org/geckofx/geckofx-18.0/overview – 2014-07-25 08:37:53
我有这样
Gecko.GeckoHtmlElement Btn = (Gecko.GeckoHtmlElement)browse.DomDocument.GetElementById("btnPrint");
Btn.Click();
//浏览做过= Gecko
浏览器控件
Document.getHtmlelementbyid(字符串ID)的名称;或者具有点击功能。 – Tearsdontfalls 2013-02-21 16:26:06
我检查过,GeckoElement上没有点击事件。我使用skybound.gecko dll作为参考 – 2013-02-21 18:18:39
你使用哪个版本?下载最新的,并会有一个事件https://bitbucket.org/geckofx/geckofx-18.0/downloads/GeckoFx-Windows-18.0-0.1.zip – Tearsdontfalls 2013-02-21 19:13:41