コード例 #1
0
        protected By GetNewLocatorFromField(FieldInfo field)
        {
            By  byLocator    = null;
            var locatorGroup = AppVersion;

            if (locatorGroup == null)
            {
                return(FindByAttribute.Locator(field) ?? field.GetFindsBy());
            }
            var jFindBy = field.GetAttribute <JFindByAttribute>();

            if (jFindBy != null && locatorGroup.Equals(jFindBy.Group))
            {
                byLocator = jFindBy.ByLocator;
            }
            return(byLocator ?? (FindByAttribute.Locator(field) ?? field.GetFindsBy()));
        }
コード例 #2
0
 private static By GetNewLocator(FieldInfo field)
 {
     return(ActionWithException(() =>
     {
         var locatorGroup = AppVersion;
         if (locatorGroup != null)
         {
             string groupName;
             By byLocator;
             JFindByAttribute.Get(field, out byLocator, out groupName);
             if (groupName != null && locatorGroup.Equals(groupName) && byLocator != null)
             {
                 return byLocator;
             }
         }
         return FindByAttribute.FindsByLocator(field) ?? FindByAttribute.Locator(field);
     }, ex => $"Error in get locator for type '{field.Name + ex.FromNewLine()}'"));
 }