Beispiel #1
0
 public ComponentsList(
     FindStrategy by,
     IWebElement parenTComponent,
     bool shouldCacheFoundElements)
     : this(by, parenTComponent)
 {
     _shouldCacheFoundElements = shouldCacheFoundElements;
 }
Beispiel #2
0
 public ComponentsList(
     FindStrategy by,
     IWebElement parenTComponent)
 {
     _by = by;
     _parenTComponent = parenTComponent;
     _foundElements   = new List <TComponent>();
     WrappedDriver    = ServicesCollection.Current.Resolve <IWebDriver>();
 }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #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);
        }