Ejemplo n.º 1
0
        public virtual object Decorate(FieldInfo field)
        {
            if (!(typeof(IWebElement).IsAssignableFrom(field.FieldType) ||
                  IsDecoratableList(field)))
            {
                return(null);
            }

            IElementLocator locator = factory.CreateLocator(field);

            if (locator == null)
            {
                return(null);
            }

            if (typeof(IWebElement).IsAssignableFrom(field.FieldType))
            {
                return(ProxyForLocator(locator));
            }
            else if (typeof(IList).IsAssignableFrom(field.FieldType))
            {
                return(ProxyForListLocator(locator));
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 2
0
        public static T InitElements <T>(IWebDriver driver, IElementLocatorFactory locatorFactory)
        {
            if (locatorFactory == null)
            {
                throw new ArgumentNullException("locatorFactory", "locatorFactory cannot be null");
            }

            return(InitElements <T>(locatorFactory.CreateLocator(driver)));
        }
Ejemplo n.º 3
0
        public static void InitElements(ISearchContext driver, object page, IElementLocatorFactory locatorFactory)
        {
            if (locatorFactory == null)
            {
                throw new ArgumentNullException("locatorFactory", "locatorFactory cannot be null");
            }

            InitElements(page, locatorFactory.CreateLocator(driver));
        }