public PageObjectValidationBase <T> SetExceptionField(Func <T, By> selector) { T page = (T)Convert.ChangeType(PageBase, typeof(T)); ExceptionFields.Add(selector(page)); return(this); }
public PageObjectValidationBase <T> SetExceptionField(string fieldLabel) { var props = PageBase.GetType().GetProperties(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public).Where(p => Attribute.IsDefined(p, typeof(DescriptionAttribute))).ToList(); var property = props.FirstOrDefault(p => { var descAttrib = (DescriptionAttribute)Attribute.GetCustomAttribute(p, typeof(DescriptionAttribute)); return(descAttrib != null && descAttrib.Description.Equals(fieldLabel)); }); if (property != null) { ExceptionFields.Add(property.GetValue(PageBase) as By); } return(this); }
public PageObjectValidationBase <T> ClearExceptionFields() { ExceptionFields.Clear(); return(this); }