Пример #1
0
 public WebElementWithReferenceViewModel(FrameWebElementInfo frameWebElement)
     : base(frameWebElement)
 {
     ReferenceBreadString        = frameWebElement.TreePathToInnerElement;
     ReferencedWebElement        = WebElementsViewModelsHelper.CreateModelFromInfo(frameWebElement.InnerElement);
     ReferencedWebElement.Parent = this;
     Elements = new ObservableCollection <WebElementInfoViewModel>();
     Elements.Add(ReferencedWebElement);
 }
 public WebSearchInfoModel(WebSearchInfo webSearchInfo = null)
 {
     if (webSearchInfo != null)
     {
         LocatorType  = webSearchInfo.LocatorType;
         LocatorValue = webSearchInfo.LocatorValue;
         if (webSearchInfo.ParentSearch != null)
         {
             ParentSearch = WebElementsViewModelsHelper.CreateWebSearchModelFromInfo(webSearchInfo.ParentSearch);
         }
     }
 }
Пример #3
0
        public WebElementWithReferenceViewModel(WebElementReference webElementReference)
            : base(webElementReference)
        {
            ReferenceBreadString        = webElementReference.TreePathToReferencedElement;
            HasLocator                  = webElementReference.Locator != null;
            ReferencedWebElement        = WebElementsViewModelsHelper.CreateModelFromInfo(webElementReference.ReferencedElement);
            ReferencedWebElement.Parent = this;

            if (ReferencedWebElement is CombinedWebElementInfoViewModel cmb)
            {
                if (cmb.Elements != null)
                {
                    Elements = new ObservableCollection <WebElementInfoViewModel>();
                    foreach (var c in cmb.Elements)
                    {
                        Elements.Add(c);
                        c.Parent = this;
                    }
                }
            }
        }
Пример #4
0
        public WebElementInfoViewModel(WebElementInfo webElementInfo = null)
        {
            _sourceWebElement = webElementInfo ?? new WebElementInfo();

            Name        = _sourceWebElement.Name;
            Description = _sourceWebElement.Description;
            ElementType = _sourceWebElement.ElementType;
            InnerKey    = _sourceWebElement.InnerKey;
            IsKey       = _sourceWebElement.IsKey;

            if (_sourceWebElement.Tags != null)
            {
                Tags = new ObservableCollection <string>(_sourceWebElement.Tags);
            }

            if (webElementInfo == null ||
                !(webElementInfo.ElementType == WebElementTypes.Reference &&
                  (webElementInfo as WebElementReference).Locator == null))
            {
                Locator = WebElementsViewModelsHelper.CreateLocatorModel(_sourceWebElement.Locator);
            }
        }
Пример #5
0
        public CombinedWebElementInfoViewModel(CombinedWebElementInfo combinedWebElement = null)
            : base(combinedWebElement ?? new CombinedWebElementInfo())
        {
            Elements = new ObservableCollection <WebElementInfoViewModel>();
            var items = (_sourceWebElement as CombinedWebElementInfo).Elements;

            if (items != null)
            {
                Elements = new ObservableCollection <WebElementInfoViewModel>();
                foreach (var item in items)
                {
                    var model = WebElementsViewModelsHelper.CreateModelFromInfo(item);
                    model.Parent = this;
                    Elements.Add(model);
                }
            }

            if (ElementType == WebElementTypes.Directory)
            {
                Locator = null;
            }
        }