public bool TitleValueValidation(string entity) { if (!ReviewQuoteTitle.Exists()) { QuoteExpand.Click(); } JObject obj = JObject.Parse(JsonHelper.GetEntityFromJSONFile(entity));//"MultiquoteReviewQuote_Texts")); FieldInfo[] fieldInfos = this.GetType().GetFields(BindingFlags.Static | BindingFlags.NonPublic); foreach (var element in obj) { string nameOfElement = element.Key.ToString(); var fieldInfo = fieldInfos.FirstOrDefault(x => x.Name == nameOfElement); var webElement = fieldInfo?.GetValue(null); PropertyInfo propInfo = fieldInfo.FieldType.GetProperty("Text", BindingFlags.Public | BindingFlags.Instance); string jsonData = element.Value.ToString(); string pageData = (String)propInfo.GetValue(webElement); if (!String.Equals(jsonData, pageData)) { pageData = JsonHelper.ClearString(pageData); if (!String.Equals(jsonData, pageData)) { return(false); } } } return(true); }