示例#1
0
 public ComponentsList(
     FindStrategy by,
     IWebElement parenTComponent,
     bool shouldCacheFoundElements)
     : this(by, parenTComponent)
 {
     _shouldCacheFoundElements = shouldCacheFoundElements;
 }
示例#2
0
 public ComponentsList(
     FindStrategy by,
     IWebElement parenTComponent)
 {
     _by = by;
     _parenTComponent = parenTComponent;
     _foundElements   = new List <TComponent>();
     WrappedDriver    = ServicesCollection.Current.Resolve <IWebDriver>();
 }
示例#3
0
        public dynamic CreateElementThatIsFound(FindStrategy by, IWebElement webElement, Type newElementType, bool shouldCacheElement)
        {
            DetermineElementAttributes(out var elementName, out var pageName);

            dynamic element = Activator.CreateInstance(newElementType);

            element.By                 = by;
            element.WrappedElement     = webElement;
            element.ElementName        = string.IsNullOrEmpty(elementName) ? $"control ({by})" : elementName;
            element.PageName           = pageName ?? string.Empty;
            element.ShouldCacheElement = shouldCacheElement;

            return(element);
        }
示例#4
0
        public TElementType CreateElementThatIsFound <TElementType>(FindStrategy by, IWebElement webElement, bool shouldCacheElement)
            where TElementType : Element
        {
            DetermineElementAttributes(out var elementName, out var pageName);

            var element = Activator.CreateInstance <TElementType>();

            element.By                 = by;
            element.WrappedElement     = webElement;
            element.ElementName        = string.IsNullOrEmpty(elementName) ? $"control ({by})" : elementName;
            element.PageName           = pageName ?? string.Empty;
            element.ShouldCacheElement = shouldCacheElement;

            return(element);
        }
示例#5
0
        public TComponentType CreateComponentWithParent <TComponentType>(FindStrategy by, IWebElement parenTComponent, IWebElement foundElement, int elementsIndex, bool shouldCacheElement)
            where TComponentType : Component
        {
            DetermineComponentAttributes(out var elementName, out var pageName);

            var element = Activator.CreateInstance <TComponentType>();

            element.By = by;
            element.ParentWrappedElement = parenTComponent;
            element.WrappedElement       = foundElement;
            element.ElementIndex         = elementsIndex;
            element.ComponentName        = string.IsNullOrEmpty(elementName) ? $"control ({by})" : elementName;
            element.PageName             = pageName ?? string.Empty;
            element.ShouldCacheElement   = shouldCacheElement;

            return(element);
        }