public static WebElementViewModel CreateModelFromInfo(WebElementInfo info) { WebElementViewModel model = null; if (info is WebContext webContext) { model = new WebContextViewModel(); model.FillFromInfo(webContext); } else if (info is DropDownElementInfo dropDown) { model = new DropDownElementViewModel(); model.FillFromInfo(dropDown); } else if (info is RadioGroupElementInfo radioGroup) { model = new RadioGroupViewModel(); model.FillFromInfo(radioGroup); } else if (info is CombinedWebElementInfo combined) { model = new CombinedElementViewModel(); model.FillFromInfo(combined); } else { model = new WebElementViewModel(); model.FillFromInfo(info); } return(model); }
public static DropDownElementViewModel CreateDropDownElementModel() { var model = new DropDownElementViewModel(); model.ElementType = WebElementTypes.DropDown; CreateCombinedElementModel(model); model.Name += " DropDown"; var input = CreateWebElementModel(); input.Parent = model; input.Name = "DropDown Input"; input.InnerKey = DropDownElementInfo.Keys.Input; input.Description = "DropDown input, used to display curren selected value or to expand options by clicking"; model.Elements.Add(input); var option = CreateWebElementModel(); option.Parent = model; option.Name = "DropDown Option"; option.InnerKey = DropDownElementInfo.Keys.Option; option.Description = "DropDown option, used to select value in drop down"; model.Elements.Add(option); return(model); }