Exemplo n.º 1
0
        public static IEnumerable <By> CreateBys(ISearchContext context, MemberInfo member)
        {
            string platform   = GetPlatform(context);
            string automation = GetAutomation(context);

            IEnumerable <By>        defaultBys    = CreateDefaultLocatorList(member);
            ReadOnlyCollection <By> defaultByList = new List <By>(defaultBys).AsReadOnly();

            IEnumerable <By> nativeBys    = CreateNativeContextLocatorList(member, platform, automation);
            IList <By>       nativeByList = null;

            if (nativeBys == null)
            {
                nativeByList = defaultByList;
            }
            else
            {
                nativeByList = new List <By>(nativeBys).AsReadOnly();
            }

            Dictionary <ContentTypes, IEnumerable <By> > map = new Dictionary <ContentTypes, IEnumerable <By> >();

            map.Add(ContentTypes.HTML, defaultByList);
            map.Add(ContentTypes.NATIVE, nativeByList);
            ContentMappedBy by  = new ContentMappedBy(map);
            List <By>       bys = new List <By>();

            bys.Add(by);

            return(bys.AsReadOnly());
        }
Exemplo n.º 2
0
        public static IEnumerable<By> CreateBys(ISearchContext context, MemberInfo member)
        {
            string platform = GetPlatform(context);
            string automation = GetAutomation(context);

            IEnumerable<By> defaultBys = CreateDefaultLocatorList(member);
            ReadOnlyCollection<By> defaultByList = new List<By>(defaultBys).AsReadOnly();

            IEnumerable<By> nativeBys = CreateNativeContextLocatorList(member, platform, automation);
            IList<By> nativeByList = null;

            if (nativeBys == null)
                nativeByList = defaultByList;
            else
                nativeByList = new List<By>(nativeBys).AsReadOnly();

            Dictionary<ContentTypes, IEnumerable<By>> map = new Dictionary<ContentTypes, IEnumerable<By>>();
            map.Add(ContentTypes.HTML, defaultByList);
            map.Add(ContentTypes.NATIVE, nativeByList);
            ContentMappedBy by = new ContentMappedBy(map);
            List<By> bys = new List<By>();
            bys.Add(by);

            return bys.AsReadOnly();
        }
Exemplo n.º 3
0
        public static IEnumerable <By> CreateBys(ISearchContext context, MemberInfo member)
        {
            string platform   = GetPlatform(context);
            string automation = GetAutomation(context);

            IEnumerable <By> defaultBys = CreateDefaultLocatorList(member);
            IEnumerable <By> nativeBys  = CreateNativeContextLocatorList(member, platform, automation);

            if (defaultBys == null && nativeBys == null)
            {
                List <By> defaultList = new List <By>();
                defaultList.Add(new ByIdOrName(member.Name));

                List <By> nativeList = new List <By>();
                nativeList.Add(By.Id(member.Name));

                defaultBys = defaultList;
                nativeBys  = nativeList;
            }

            if (defaultBys == null)
            {
                List <By> defaultList = new List <By>();
                defaultList.Add(new ByIdOrName(member.Name));
                defaultBys = defaultList;
            }

            if (nativeBys == null)
            {
                nativeBys = defaultBys;
            }

            Dictionary <ContentTypes, IEnumerable <By> > map = new Dictionary <ContentTypes, IEnumerable <By> >();

            map.Add(ContentTypes.HTML, defaultBys);
            map.Add(ContentTypes.NATIVE, nativeBys);
            ContentMappedBy by  = new ContentMappedBy(map);
            List <By>       bys = new List <By>();

            bys.Add(by);

            return(bys.AsReadOnly());
        }
Exemplo n.º 4
0
        public static IEnumerable<By> CreateBys(ISearchContext context, MemberInfo member)
        {
            string platform = GetPlatform(context);
            string automation = GetAutomation(context);

            IEnumerable<By> defaultBys = CreateDefaultLocatorList(member);
            IEnumerable<By> nativeBys = CreateNativeContextLocatorList(member, platform, automation);

            if (defaultBys == null && nativeBys == null)
            {
                List<By> defaultList = new List<By>();
                defaultList.Add(new ByIdOrName(member.Name));

                List<By> nativeList = new List<By>();
                nativeList.Add(By.Id(member.Name));

                defaultBys = defaultList;
                nativeBys = nativeList;
            }

            if (defaultBys == null)
            {
                List<By> defaultList = new List<By>();
                defaultList.Add(new ByIdOrName(member.Name));
                defaultBys = defaultList;
            }

            if (nativeBys == null)
            {
                nativeBys = defaultBys;
            }

            Dictionary<ContentTypes, IEnumerable<By>> map = new Dictionary<ContentTypes, IEnumerable<By>>();
            map.Add(ContentTypes.HTML, defaultBys);
            map.Add(ContentTypes.NATIVE, nativeBys);
            ContentMappedBy by = new ContentMappedBy(map);
            List<By> bys = new List<By>();
            bys.Add(by);

            return bys.AsReadOnly();
        }