I'm using GeckoFx to click through a form on a webpage. There is a select element on the page of which I want to set the selected item. When a normal user selects an element, an event is triggered showing a secondary select list. When I select using the GeckoFx library it doesn't do that.
Any ideas what I can do to make my selection trigger that event as well?
My Code
var enquiryTypeCombo = (GeckoSelectElement)document.GetElementById("enquiry_type");
enquiryTypeCombo.Value = _stepController.EnquiryType;
enquiryTypeCombo.Click();
Thanks in advance !
You might need to trigger the event as well - so, for example, if your secondary select box is shown upon an 'onkeyup' event, try the following code
nsAStringBase eventType = (nsAStringBase)new nsAString("keyup");
var ev = browser.Document.CreateEvent("HTMLEvents");
ev.DomEvent.InitEvent(eventType, false, false);
enquiryTypeCombo.GetEventTarget().DispatchEvent(ev);
From my experience, the very 'click' does not trigger the events.
Good luck!