private KeyValuePair <EntryFieldType, string> PopulateFieldValue <T>(EntryFieldType entryField, T indexOrText, bool useContains = false) { string fieldType = entryField.GetString(true); Type argType = indexOrText.GetType(); object argValue = null; bool isValidArg = false; KeyValuePair <EntryFieldType, string> fieldValuePair; string fieldValue = string.Empty; try { if (argType == typeof(string)) { isValidArg = true; argValue = ConvertToType <string>(indexOrText); } else if (argType == typeof(int)) { isValidArg = true; argValue = ConvertToType <int>(indexOrText); } if (isValidArg) { switch (fieldType) { case TEXT: case DATE: case FUTUREDATE: if (!((string)argValue).HasValue()) { if (fieldType.Equals(DATE) || fieldType.Equals(FUTUREDATE)) { argValue = fieldType.Equals(DATE) ? GetShortDate() : GetFutureShortDate(); } else { //argValue = GetVarForEntryField(entryField); argValue = GetVar(entryField); int argValueLength = ((string)argValue).Length; By inputLocator = GetInputFieldByLocator(entryField); int elemMaxLength = int.Parse(PageAction.GetAttribute(inputLocator, "maxlength")); argValue = argValueLength > elemMaxLength ? ((string)argValue).Substring(0, elemMaxLength) : argValue; } fieldValue = (string)argValue; } PageAction.EnterText(By.Id(entryField.GetString()), fieldValue); break; case DDL: case MULTIDDL: if ((argType == typeof(string) && !((string)argValue).HasValue()) || (int)argValue < 1) { argValue = 1; } bool isMultiselectDDList = false; if (fieldType.Equals(MULTIDDL)) { isMultiselectDDList = true; } PageAction.ExpandAndSelectFromDDList(entryField, argValue, useContains, isMultiselectDDList); break; case RDOBTN: case CHKBOX: PageAction.SelectRadioBtnOrChkbox(entryField); break; case UPLOAD: PageAction.UploadFile(); break; default: break; } } else { log.Error($"Argument type ({argType}) is not supported : {indexOrText.ToString()}"); } } catch (Exception e) { log.Error(e.StackTrace); } return(fieldValuePair = new KeyValuePair <EntryFieldType, string>(entryField, fieldValue)); }