private ClickResult htmlElement_Clicked(HtmlElement element) { switch (element.TagName.ToLower()) { case "a": return(ClickLink(element.Element)); case "input": switch (element.InputType) { case "radio": return(CheckRadioButton(element.Element)); case "checkbox": return(CheckCheckbox(element.Element)); case "image": case "button": case "submit": return(element.SubmitForm() ? ClickResult.SucceededNavigationComplete : ClickResult.SucceededNavigationError); default: return(ClickResult.SucceededNoNavigation); } case "button": switch (element.InputType) { case "submit": return(element.SubmitForm() ? ClickResult.SucceededNavigationComplete : ClickResult.SucceededNavigationError); default: return(ClickResult.SucceededNoNavigation); } } return(ClickResult.SucceededNoNavigation); }
/// <summary> /// This method can be used on any element contained within a form, or the form element itself. The form will be /// serialized and submitted as close as possible to the way it would be in a normal browser request. In /// addition, any values currently in the ExtraFormValues property of the Browser object will be submitted as /// well. /// </summary> /// <param name="url">Optional. If specified, the form will be submitted to this URL instead.</param> public void SubmitForm(string url = null) { AssertElementExists(); AssertElementIsNotDisabled(); _browser.Log("Submitting parent/ancestor form of: " + HttpUtility.HtmlEncode(XElement.ToString()), LogMessageType.Internal); _current.SubmitForm(url); }
private ClickResult htmlElement_Clicked(HtmlElement element) { switch(element.TagName.ToLower()) { case "a": return ClickLink(element.Element); case "input": switch(element.InputType) { case "radio": return CheckRadioButton(element.Element); case "checkbox": return CheckCheckbox(element.Element); case "image": case "button": case "submit": return element.SubmitForm() ? ClickResult.SucceededNavigationComplete : ClickResult.SucceededNavigationError; default: return ClickResult.SucceededNoNavigation; } case "button": switch (element.InputType) { case "submit": return element.SubmitForm() ? ClickResult.SucceededNavigationComplete : ClickResult.SucceededNavigationError; default: return ClickResult.SucceededNoNavigation; } } return ClickResult.SucceededNoNavigation; }