geckofx button click

Kinnan Nawaz picture Kinnan Nawaz · Feb 21, 2013 · Viewed 10.6k times · Source

i have integrated skybound gecckofx into my application . i am able to fill up textbox

GeckoElement username = null; 
username = checkDoc.GetElementById("ctl00_contentPlaceHolder_txtUserName");
username.SetAttribute("value", "[email protected]");

but i am unable to click the button

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

Answer

A. Zalonis picture A. Zalonis · Sep 7, 2013

Check if you have the class GeckoInputElement. If no then probably you need Skybount.Com libraries. Or you can use newest versio of gecko fx. Use GeckoFX 21 with xulrunner 21. you can get from ftp.mozila.org

in geckofx 21 you can try this code

GeckoButtonElement button = new GeckoButtonElement(_webBrowser.Document.getElementById("your_button_id").DomObject);
button.Click();

So simple!

Also you can use GeckoInputElement to input you email address to the html element like this

GeckoInputElement username = new GeckoInputElement(checkDoc.GetElementById("ctl00_contentPlaceHolder_txtUserName");
.DomObject);
username.Value = "[email protected]"

Τέλος! (Finish)