public override Act GetPlatformActionByElementInfo(ElementInfo elementInfo, ElementActionCongifuration actConfig) { Act elementAction = null; if (elementInfo != null) { ElementTypeData elementTypeOperations = GetPlatformElementTypesData().Where(x => x.ElementType == elementInfo.ElementTypeEnum).FirstOrDefault(); if (actConfig != null) { if (string.IsNullOrWhiteSpace(actConfig.Operation)) { actConfig.Operation = SetElementOperation(elementInfo.ElementTypeEnum, actConfig); } } if ((elementTypeOperations != null) && ((elementTypeOperations.ElementOperationsList != null)) && (elementTypeOperations.ElementOperationsList.Count > 0)) { if (elementTypeOperations.ActionType == typeof(ActBrowserElement)) { elementAction = new ActBrowserElement() { Description = string.IsNullOrWhiteSpace(actConfig.Description) ? "Browser Action : " + actConfig.Operation + " - " + elementInfo.ItemName : actConfig.Description, ControlAction = (ActBrowserElement.eControlAction)System.Enum.Parse(typeof(ActBrowserElement.eControlAction), actConfig.Operation), LocateBy = (eLocateBy)System.Enum.Parse(typeof(eLocateBy), Convert.ToString(actConfig.LocateBy)), Value = actConfig.ElementValue, LocateValue = actConfig.LocateValue }; } else if (elementTypeOperations.ActionType == typeof(ActUIElement)) { elementAction = new ActUIElement() { Description = string.IsNullOrWhiteSpace(actConfig.Description) ? "UI Element Action : " + actConfig.Operation + " - " + elementInfo.ItemName : actConfig.Description, ElementAction = (ActUIElement.eElementAction)System.Enum.Parse(typeof(ActUIElement.eElementAction), actConfig.Operation), ElementLocateValue = actConfig.LocateValue, Value = actConfig.ElementValue }; if (actConfig.AddPOMToAction) { elementAction.Description = actConfig.Operation + " - " + elementInfo.ElementName; PropertyInfo pLocateBy = elementAction.GetType().GetProperty(nameof(ActUIElement.ElementLocateBy)); if (pLocateBy != null) { if (pLocateBy.PropertyType.IsEnum) { pLocateBy.SetValue(elementAction, Enum.Parse(pLocateBy.PropertyType, nameof(eLocateBy.POMElement))); } } PropertyInfo pLocateVal = elementAction.GetType().GetProperty(nameof(ActUIElement.ElementLocateValue)); if (pLocateVal != null) { pLocateVal.SetValue(elementAction, string.Format("{0}_{1}", actConfig.POMGuid, actConfig.ElementGuid)); } PropertyInfo pElementType = elementAction.GetType().GetProperty(nameof(ActUIElement.ElementType)); if (pElementType != null && pElementType.PropertyType.IsEnum) { pElementType.SetValue(elementAction, ((ElementInfo)actConfig.LearnedElementInfo).ElementTypeEnum); } } } } } else { elementAction = new ActUIElement() { Description = string.IsNullOrWhiteSpace(actConfig.Description) ? "UI Element Action : " + actConfig.Operation + " - " + elementInfo.ItemName : actConfig.Description, ElementLocateBy = (eLocateBy)System.Enum.Parse(typeof(eLocateBy), Convert.ToString(actConfig.LocateBy)), ElementAction = (ActUIElement.eElementAction)System.Enum.Parse(typeof(ActUIElement.eElementAction), actConfig.Operation), ElementLocateValue = actConfig.LocateValue, ElementType = (eElementType)System.Enum.Parse(typeof(eElementType), Convert.ToString(actConfig.Type)), Value = actConfig.ElementValue }; } return(elementAction); }