public static IO2HtmlPage submit(this IO2Browser o2Browser, IO2HtmlForm form) { /*"submiting form:{0}".format(form.name()).info(); * " to :{0}".format(form.action()).debug(); * " with:{0}".format(form.formData()).debug(); */ return(o2Browser.POST(form.action(), form.formData())); }
public static List <string> fieldNamesAndValues(this IO2HtmlForm form) { var fieldNames = new List <string>(); foreach (var field in form.FormFields) { fieldNames.Add("{0} = {1}".format(field.Name, field.Value)); } return(fieldNames); }
public static List <string> fieldNames(this IO2HtmlForm form) { var fieldNames = new List <string>(); foreach (var field in form.FormFields) { fieldNames.Add(field.Name); } return(fieldNames); }
public static Dictionary <string, IO2HtmlFormField> fields(this IO2HtmlForm form) { var fields = new Dictionary <string, IO2HtmlFormField>(); foreach (var field in form.FormFields) { fields.Add(field.Name, field); } return(fields); }
public static IO2HtmlFormField formField(this IO2HtmlForm form, string name, string type, string value, bool enabled) { return(new IE_Form_Field { Form = form, Name = name, Type = type, Value = value, Enabled = enabled }); }
public static string name(this IO2HtmlForm form) { if (form.Name.valid()) { return(form.Name); } if (form.Id.valid()) { return(form.Id); } return(""); }
public static string formData(this IO2HtmlForm form) { var formData = new StringBuilder(); foreach (var field in form.FormFields) { formData.Append(string.Format("{0}={1}&", field.Name, WebEncoding.urlEncode(field.Value))); } formData.removeLastChar(); return(formData.ToString()); }
public static string action(this IO2HtmlForm form) { // this is just a first pass at trying to map this value // maybe see if I can get IE to resolve this for me if (form.Action.starts(form.uri().page())) { return(form.uri().OriginalString); } return(form.Action); }
public static string get(this IO2HtmlForm form, string fieldName) { var fields = form.fields(); if (fields.ContainsKey(fieldName)) { return(fields[fieldName].Value); } PublicDI.log.error("the provided IO2HtmlForm.form did not contain the field: {0}", fieldName); return(""); }
public static IO2HtmlForm remove(this IO2HtmlForm form, string name) { var fields = form.fields(); if (fields.ContainsKey(name)) { form.FormFields.Remove(fields[name]); } else { "in IO2HtmlForm form.remove(), could not find field: {0}".format(name).error(); } return(form); }
public static IO2HtmlFormField formField(this IO2HtmlForm form, object data) { /*"form field type: {0}".format(data.comTypeName()).error(); * foreach(var prop in data.type().properties()) * " p: {0}".format(prop.Name).debug();\*/ try { object name = null; object type = null; object value = null; object disabled = null; if (data is HTMLSelectElementClass) { name = data.prop("name"); type = data.prop("type"); value = data.prop("value"); disabled = data.prop("disabled"); } else if (data is DispHTMLInputElement) { name = ((DispHTMLInputElement)data).name; type = ((DispHTMLInputElement)data).type; value = ((DispHTMLInputElement)data).value; disabled = !((DispHTMLInputElement)data).disabled; } else { name = data.prop("name"); type = data.prop("type"); value = data.prop("value"); disabled = data.prop("disabled"); } return(new IE_Form_Field { Form = form, Name = (name != null) ? name.ToString() : "", Type = (type != null) ? type.ToString() : "", Value = (value != null) ? value.ToString() : "", Enabled = (disabled != null) ? !bool.Parse(disabled.ToString()) : false }); } catch (Exception ex) { ex.log("in formField"); return(null); } }
public static IO2HtmlForm set(this IO2HtmlForm form, string fieldName, string value) { try { var fields = form.fields(); if (fields.ContainsKey(fieldName)) { fields[fieldName].Value = value; } else { PublicDI.log.error("the provided IO2HtmlForm.form did not contain the field: {0}", fieldName); } return(form); } catch (Exception ex) { PublicDI.log.ex(ex, "in IO2HtmlForm.set"); return(null); } }
public static IO2HtmlPage submit(this IO2Browser o2Browser, IO2HtmlForm form) { /*"submiting form:{0}".format(form.name()).info(); " to :{0}".format(form.action()).debug(); " with:{0}".format(form.formData()).debug(); */ return o2Browser.POST(form.action(), form.formData()); }
public static string formDetails(this IO2HtmlForm form) { return(form.fieldNamesAndValues().str()); }
public static Uri uri(this IO2HtmlForm form) { return(form.PageUri); }