Пример #1
0
        List <ITreeViewItem> ITreeViewItem.Childrens()
        {
            List <ITreeViewItem> list      = new List <ITreeViewItem>();
            List <ElementInfo>   Childrens = base.UIAElementInfo.WindowExplorer.GetElementChildren(base.UIAElementInfo);

            foreach (ElementInfo EI in Childrens)
            {
                ITreeViewItem TVI = null;
                if (EI.GetType() == typeof(UIAElementInfo))
                {
                    EI.WindowExplorer = UIAElementInfo.WindowExplorer;
                    PBControlTreeItemBase treeItem = GetMatchingPBTreeItem(EI);
                    treeItem.UIAElementInfo.WindowExplorer = UIAElementInfo.WindowExplorer;

                    double XOffset =
                        double.Parse(((UIAutomationDriverBase)UIAElementInfo.WindowExplorer).mUIAutomationHelper
                                     .GetControlPropertyValue(EI.ElementObject, "XOffset"));
                    double YOffset =
                        double.Parse(((UIAutomationDriverBase)UIAElementInfo.WindowExplorer).mUIAutomationHelper
                                     .GetControlPropertyValue(EI.ElementObject, "YOffset"));
                    treeItem.UIAElementInfo.XCordinate = XOffset - base.UIAElementInfo.XCordinate;
                    treeItem.UIAElementInfo.YCordinate = YOffset - base.UIAElementInfo.YCordinate;

                    TVI = treeItem;
                }
                else
                {
                    TVI = HTMLElementInfoConverter.GetHTMLElementTreeItem(EI);
                }
                list.Add(TVI);
            }
            return(list);
        }
Пример #2
0
        List <ITreeViewItem> GetHTMLControlsAsTreeItems(List <PayLoad> controls)
        {
            List <ITreeViewItem> items = new List <ITreeViewItem>();

            foreach (PayLoad pl in controls)
            {
                ElementInfo CI = JavaDriver.GetHTMLElementInfoFromPL(pl);
                CI.WindowExplorer = JavaElementInfo.WindowExplorer; // pass the driver down to elements to use
                ITreeViewItem tvi = HTMLElementInfoConverter.GetHTMLElementTreeItem(CI);
                items.Add(tvi);
            }
            return(items);
        }
        public static ITreeViewItem GetTreeViewItemForElementInfo(Amdocs.Ginger.Common.UIElement.ElementInfo EI)
        {
            if (EI == null)
            {
                return(null);            // can happen when grid is filtered
            }
            //TODO: make it OO style avoid the if else if
            ITreeViewItem TVI = null;

            if (EI is JavaElementInfo)
            {
                TVI = JavaElementInfoConverter.GetTreeViewItemFor(EI);
            }
            else if (EI is UIAElementInfo)
            {
                UIAElementInfo UEI = (UIAElementInfo)EI;
                if (UEI.WindowExplorer.GetType() == typeof(PBDriver))
                {
                    //TODO:  Below will work for now. But need to Implement element info
                    TVI = PBControlTreeItemBase.GetMatchingPBTreeItem(UEI);
                }
                else
                {
                    TVI = WindowsElementConverter.GetWindowsElementTreeItem(EI);
                }
            }
            else if (EI is AppiumElementInfo)
            {
                TVI = AppiumElementInfoConverter.GetTreeViewItemFor(EI);
            }
            else if (EI is HTMLElementInfo)
            {
                TVI = HTMLElementInfoConverter.GetHTMLElementTreeItem(((HTMLElementInfo)EI));
            }
            else if (EI.ElementObject is XmlNode)
            {
                TVI = AppiumElementInfoConverter.GetTreeViewItemFor(EI);
            }
            else
            {
                //TODO: err?
                return(null);
            }

            return(TVI);
        }