Exemplo n.º 1
0
        public List <ElementInfo> FindAll(ElementInfo ElementInfo, List <XpathPropertyCondition> conditions)
        {
            UIAElementInfo EI = (UIAElementInfo)ElementInfo;

            //FIXME - calc all conditions, meanwhile do the first
            PropertyId    AP   = GetPropertyIDByName(conditions[0].PropertyName);
            ConditionBase cond = new PropertyCondition(AP, conditions[0].Value);

            //---

            AutomationElement [] list = ((AutomationElement)EI.ElementObject).FindAll(TreeScope.Children, cond);

            if (list.Length == 0)
            {
                return(null);
            }

            List <ElementInfo> rc = new List <ElementInfo>();

            for (int i = 0; i < list.Length; i++)
            {
                UIAElementInfo EI1 = new UIAElementInfo()
                {
                    ElementObject = list[i]
                };
                rc.Add(EI1);
            }

            return(rc);
        }
Exemplo n.º 2
0
        ObservableList <Act> IWindowExplorerTreeItem.GetElementActions()
        {
            ObservableList <Act> list = new ObservableList <Act>();

            list.Add(new ActWindowsControl()
            {
                Description   = "Set " + UIAElementInfo.ElementTitle + " Value",
                Value         = "Sample Value",
                ControlAction = ActWindowsControl.eControlAction.SetValue
            });

            list.Add(new ActWindowsControl()
            {
                Description   = "Get " + UIAElementInfo.ElementTitle + " Value",
                ControlAction = ActWindowsControl.eControlAction.SetValue
            });

            //Add option to select the valid values
            List <ComboBoxElementItem> ComboValues = (List <ComboBoxElementItem>)UIAElementInfo.GetElementData();

            foreach (ComboBoxElementItem CBEI in ComboValues)
            {
                list.Add(new ActWindowsControl()
                {
                    Description   = "Set ComboBox Text of '" + this.UIAElementInfo.ElementTitle + "' to '" + CBEI.Text + "'",
                    ControlAction = ActWindowsControl.eControlAction.SetValue,
                    Value         = CBEI.Text
                });
            }
            return(list);
        }
Exemplo n.º 3
0
 public void UpdateRootElement()
 {
     CurrentWindowRootElement = new UIAElementInfo()
     {
         ElementName = GetControlPropertyValue(GetCurrentWindow(), "Name"), ElementObject = GetCurrentWindow()
     };
 }
Exemplo n.º 4
0
        public ElementInfo UseRootElement()
        {
            UIAElementInfo root = new UIAElementInfo();

            root.ElementObject = automation.GetDesktop();
            return(root);
        }
Exemplo n.º 5
0
        public ElementInfo GetElementParent(ElementInfo ElementInfo)
        {
            UIAElementInfo EI = (UIAElementInfo)ElementInfo;


            if (EI.ElementObject.Equals(CurrentWindow))
            {
                return(null);
            }

            ITreeWalker walker = ((AutomationElement)EI.ElementObject).Automation.TreeWalkerFactory.GetControlViewWalker();

            AutomationElement ParentAE = walker.GetParent((AutomationElement)EI.ElementObject);

            if (ParentAE.Equals(CurrentWindow))
            {
                return(null);                                // CurrentWindowRootElement;  // Since there are check done on root element we must return the same when found
            }
            if (ParentAE == null)
            {
                return(null);
            }

            UIAElementInfo RC = new UIAElementInfo()
            {
                ElementObject = ParentAE
            };                                                                        // return minimial EI

            return(RC);
        }
Exemplo n.º 6
0
        public void Find_Button1_ByName_Find_Anywhere()
        {
            //Arrange
            string            ElementName             = "button1";
            string            ExpectedElementFullPath = "/[AutomationId:tableLayoutPanel1]/[AutomationId:tableLayoutPanel2]/button1";
            string            Button1Xpath            = "button1"; // Simple control with name on the root, validate XPath that doesn't start with /
            PropertyCondition cond    = new PropertyCondition(AutomationElementIdentifiers.NameProperty, ElementName);
            AutomationElement button1 = AppWindow.FindFirst(TreeScope.Descendants, cond);
            //Act

            string AbsoluteXPath = UIA.GetElementAbsoluteXPath(button1);

            AutomationElement AEButton       = UIA.GetElementByXpath(Button1Xpath);
            string            AbsoluteXPath2 = UIA.GetElementAbsoluteXPath(AEButton);
            UIAElementInfo    EI             = new UIAElementInfo()
            {
                ElementObject = AEButton, WindowExplorer = UIA.WindowExplorer
            };
            string SmartXPath = mXPathHelper.GetElementXpathSmart(EI);

            //Assert
            Assert.AreEqual(ExpectedElementFullPath, AbsoluteXPath, "ExpectedElementFullPath=AbsoluteXPath");
            Assert.AreEqual(button1, AEButton, "button1=AEButton");
            Assert.AreEqual(SmartXPath, "button1[AutomationId:button1][LocalizedControlType:button1]", "SmartXPath");  // We expect the smart XPath to find the name is unique
        }
Exemplo n.º 7
0
        public override ElementInfo GetElementInfoFor(object element)
        {
            AutomationElement AE = (AutomationElement)element;
            UIAElementInfo    EI = new UIAElementInfo();

            EI.ElementObject  = AE;
            EI.WindowExplorer = WindowExplorer;
            return(EI);
        }
Exemplo n.º 8
0
        public override string GetElementAbsoluteXPath(object obj)
        {
            UIAElementInfo EI = new UIAElementInfo(); //Create small simple EI

            EI.ElementObject  = obj;
            EI.WindowExplorer = WindowExplorer;
            string XPath = mXPathHelper.GetElementXpathAbsulote(EI);

            return(XPath);
        }
Exemplo n.º 9
0
        public override object FindElementByLocator(eLocateBy eLocatorType, string LocateValue)
        {
            AutomationElement CurAE = null;

            switch (eLocatorType)
            {
            case eLocateBy.ByName:
                ConditionBase CurCond2 = new PropertyCondition(AutomationObjectIds.NameProperty, LocateValue);
                CurAE = this.CurrentWindow.FindFirst(TreeScope.Subtree, CurCond2);

                //For old compativity where Name was the text we fail over to search by Text, PB Only, it is slower as it scan the tree and call win api to get the text
                if (Object.ReferenceEquals(CurAE, null) && mPlatform == ePlatform.PowerBuilder)
                {
                }
                break;

            case eLocateBy.ByXPath:
                UIAElementInfo e = (UIAElementInfo)mXPathHelper.GetElementByXpath(LocateValue);
                CurAE = (AutomationElement)e.ElementObject;
                break;

            case eLocateBy.ByAutomationID:
                ConditionBase CurCond3 = new PropertyCondition(val.AutomationId, LocateValue);
                CurAE = CurrentWindow.FindFirst(TreeScope.Subtree, CurCond3);
                break;

            case eLocateBy.ByClassName:
                ConditionBase CurCond4 = new PropertyCondition(val.ClassName, LocateValue);
                CurAE = CurrentWindow.FindFirst(TreeScope.Subtree, CurCond4);
                break;

            case eLocateBy.ByXY:
                double   xx = 0, yy = 0;
                bool     statusFlag;
                string[] str = LocateValue.Split(',');
                xx = Convert.ToDouble(str[0]);
                yy = Convert.ToDouble(str[1]);
                xx = xx + Convert.ToInt32(CurrentWindow.Properties.BoundingRectangle.Value.X);
                yy = yy + Convert.ToInt32(CurrentWindow.Properties.BoundingRectangle.Value.Y);
                System.Windows.Point point = new System.Windows.Point(xx, yy);
                statusFlag = WinAPIAutomation.SetForeGroundWindow(CurrentWindow.Properties.ProcessId);
                if (statusFlag == false)
                {
                }
                CurAE = CurrentWindow.Automation.FromPoint(point);
                break;

            default:
                throw new Exception("Locator not implement - " + eLocatorType.ToString());
            }
            return(CurAE);
        }
Exemplo n.º 10
0
        public override List <ElementInfo> GetElementChilderns(object obj)
        {
            List <ElementInfo> list    = new List <ElementInfo>();
            AutomationElement  element = (AutomationElement)obj;

            AutomationElement [] elementList = element.FindAllChildren();

            foreach (AutomationElement elementNode in elementList)
            {
                UIAElementInfo WEI = (UIAElementInfo)GetElementInfoFor(elementNode);
                WEI.WindowExplorer = WindowExplorer;
                list.Add(WEI);
            }
            return(list);
        }
Exemplo n.º 11
0
        public ElementInfo GetNextSibling(ElementInfo EI)
        {
            ITreeWalker       walker      = ((AutomationElement)EI.ElementObject).Automation.TreeWalkerFactory.GetRawViewWalker();
            AutomationElement elementNode = walker.GetNextSibling((AutomationElement)EI.ElementObject);

            if (elementNode == null)
            {
                return(null);
            }
            UIAElementInfo RC = new UIAElementInfo()
            {
                ElementObject = elementNode
            };

            return(RC);
        }
Exemplo n.º 12
0
        object IWindowExplorer.GetElementData(ElementInfo ElementInfo, eLocateBy elementLocateBy, string elementLocateValue)
        {
            object obj = null;

            if (ElementInfo.GetType().Equals(typeof(HTMLElementInfo)))
            {
                HTMLElementInfo EI = (HTMLElementInfo)ElementInfo;
                obj = mUIAutomationHelper.GetHTMLHelper();
                obj = EI.ElementObject;
            }
            else if (ElementInfo.GetType().Equals(typeof(UIAElementInfo)))
            {
                UIAElementInfo EI = (UIAElementInfo)ElementInfo;
                obj = mUIAutomationHelper.GetElementData(EI.ElementObject);
            }
            return(obj);
        }
        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);
        }
Exemplo n.º 14
0
        public ElementInfo FindFirst(ElementInfo ElementInfo, List <XpathPropertyCondition> conditions)
        {
            UIAElementInfo EI = (UIAElementInfo)ElementInfo;

            //FIXME - calc all props
            PropertyId    AP   = GetPropertyIDByName(conditions[0].PropertyName);
            ConditionBase cond = new PropertyCondition(AP, conditions[0].Value);

            AutomationElement AE = ((AutomationElement)EI.ElementObject).FindFirst(TreeScope.Children, cond);

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

            UIAElementInfo RC = (UIAElementInfo)GetElementInfoFor(AE);

            return(RC);
        }
        public ObservableList <ElementLocator> GetElementLocators(ElementInfo ElementInfo)
        {
            if (ElementInfo.GetType() == typeof(UIAElementInfo))
            {
                UIAElementInfo UIEI = (UIAElementInfo)ElementInfo;

                return(mUIAutomationHelper.GetElementLocators(UIEI));
            }
            else if (ElementInfo.GetType().Equals(typeof(HTMLElementInfo)))
            {
                HTMLElementInfo HtmlEI = (HTMLElementInfo)ElementInfo;

                return(mUIAutomationHelper.GetHTMLHelper().GetHTMLElementLocators(HtmlEI));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 16
0
        public AppWindow GetAppWinodowForElement(object window, string title, AppWindow.eWindowType windowType)
        {
            AppWindow AW = new AppWindow();

            AW.Title = title;

            if (IsWindowValid(window))
            {
                UIAElementInfo WEI = new UIAElementInfo();
                WEI.ElementTitle   = title;
                WEI.ElementObject  = window;
                WEI.WindowExplorer = WindowExplorer;
                WEI.XCordinate     = double.Parse(GetControlPropertyValue(window, "XOffset"));
                WEI.YCordinate     = double.Parse(GetControlPropertyValue(window, "XOffset"));
                AW.RefObject       = WEI;
                AW.WindowType      = windowType;
            }
            return(AW);
        }
Exemplo n.º 17
0
        public void Find_Butto1_XPath_Using_Full_Absolutue_Path()
        {
            //Arrange
            string            ElementName  = "button1";
            string            Button1Xpath = "/[AutomationId:tableLayoutPanel1]/[AutomationId:tableLayoutPanel2]/button1"; // Simple control with name on the root
            PropertyCondition cond         = new PropertyCondition(AutomationElementIdentifiers.NameProperty, ElementName);
            AutomationElement button1      = AppWindow.FindFirst(TreeScope.Subtree, cond);
            //Act

            UIAElementInfo EI = new UIAElementInfo()
            {
                ElementObject = button1, WindowExplorer = UIA.WindowExplorer
            };
            string            XPath    = mXPathHelper.GetElementXpathAbsulote(EI);
            AutomationElement AEButton = UIA.GetElementByXpath(Button1Xpath);

            //Assert
            Assert.AreEqual(XPath, Button1Xpath, "XPath");
            Assert.AreEqual(button1, AEButton, "button1=AEButton");
        }
Exemplo n.º 18
0
        public string GetElementProperty(ElementInfo ElementInfo, string PropertyName)
        {
            UIAElementInfo EI = (UIAElementInfo)ElementInfo;

            if (EI.ElementObject == null)
            {
                throw new Exception("Error: GetElementProperty received ElementInfo with AutomationElement = null");
            }
            //FIXME
            AutomationElement element = (AutomationElement)EI.ElementObject;

            if (PropertyName.ToUpper() == "XPATH")
            {
                return(GetElementAbsoluteXPath(element));
            }
            if (PropertyName.ToUpper() == "VALUE")
            {
                return(GetControlValue(element));
            }

            return(GetControlPropertyValue(element, PropertyName));
        }
Exemplo n.º 19
0
        public void HiglightElement(ElementInfo ei)
        {
            if (IsWindowValid(GetCurrentWindow()))
            {
                //TODO: FIXME there is still glitch in refresh when highlighing form system menu
                UIAElementInfo WEI = (UIAElementInfo)ei;
                //First remove the last highlight if exist
                if (LastHighLightHWND != 0)
                {
                    // Remove the highlighter by asking the window to repaint
                    // Better repain the whole window, caused some glitched when trying to repaint just the control window
                    HandlePaintWindow(GetCurrentWindow());
                    RedrawWindow((IntPtr)LastHighLightHWND, IntPtr.Zero, IntPtr.Zero, 0x0400 /*RDW_FRAME*/ | 0x0100 /*RDW_UPDATENOW*/ | 0x0001 /*RDW_INVALIDATE*/);
                }

                if (WEI.ElementObject == null)
                {
                    return;
                }

                Rect r = new Rect();
                r = GetElementBoundingRectangle(WEI.ElementObject);

                int hwnd = GetElementNativeWindowHandle(GetCurrentWindow());  // AE.Current.NativeWindowHandle;
                                                                              // hwnd = (TreeWalker.ContentViewWalker.GetParent(AE)).Current.NativeWindowHandle;
                LastHighLightHWND = hwnd;

                // If user have multiple screens, get the one where the current window is displayed, resolve issue of highlighter not working when app window on secondary monitor
                System.Windows.Forms.Screen scr = System.Windows.Forms.Screen.FromHandle((IntPtr)hwnd);
                HighlightRect(r, scr, WEI);
            }
            else
            {
                Reporter.ToUser(eUserMsgKey.ObjectUnavailable, "Selected Object is not available, cannot highlight the element");
            }
        }
Exemplo n.º 20
0
 public UIAElementPage(UIAElementInfo EI)
 {
     InitializeComponent();
     mUIAElementInfo = EI;
     ShowInfo();
 }
Exemplo n.º 21
0
        object IWindowExplorer.GetElementData(ElementInfo ElementInfo, eLocateBy elementLocateBy, string elementLocateValue)
        {
            UIAElementInfo EI = (UIAElementInfo)ElementInfo;

            return(mUIAutomationHelper.GetElementData(EI.ElementObject));
        }
Exemplo n.º 22
0
        public static PBControlTreeItemBase GetMatchingPBTreeItem(ElementInfo elementInfo)
        {
            if (elementInfo == null || elementInfo.ElementObject == null)
            {
                return(null);
            }

            string elementControlType = ((PBDriver)elementInfo.WindowExplorer).mUIAutomationHelper.GetElementControlType(elementInfo.ElementObject);
            string elmentClass        =
                ((PBDriver)elementInfo.WindowExplorer).mUIAutomationHelper.GetControlPropertyValue(
                    elementInfo.ElementObject, "ClassName");

            PBControlTreeItemBase treeItem;

            if (General.CompareStringsIgnoreCase(elementControlType, "button"))
            {
                treeItem = new PBButtonTreeItem();
            }
            else if (General.CompareStringsIgnoreCase(elementControlType, "edit"))
            {
                treeItem = new PBTextBoxTreeItem();
            }
            else if (General.CompareStringsIgnoreCase(elementControlType, "title bar"))
            {
                treeItem = new PBTitleBarTreeItem();
            }
            else if (General.CompareStringsIgnoreCase(elementControlType, "pane") && General.CompareStringsIgnoreCase(elmentClass, "SysDateTimePick32"))
            {
                treeItem = new PBDatePickerTreeItem();
            }

            //TODO:For grids need to implement generic way, independent of class name.This is breaking other pane controls which are not actually Grids.
            //else if (elementNode.Current.LocalizedControlType == "pane" && elementNode.Current.ClassName == "pbdw126")
            //{
            //    PBDataGridTreeItem DGTI = new PBDataGridTreeItem();
            //    DGTI.AEControl = elementNode;
            //    Childrens.Add(DGTI);
            //}

            else if (General.CompareStringsIgnoreCase(elementControlType, "pane") && General.CompareStringsIgnoreCase(elmentClass, "PBTabControl32_100"))
            {
                treeItem = new PBTabTreeItem();
            }
            //TODO: Find a Better way to distinguish a grid control
            else if (General.CompareStringsIgnoreCase(elementControlType, "pane") && (elmentClass.StartsWith("pbd")))// && (elementNode.Current.Name=="")
            {
                treeItem = new PBDataGridTreeItem();
            }
            else if (elmentClass.Equals("Internet Explorer_Server"))
            {
                treeItem = new PBBrowserTreeItem();
            }
            else if (General.CompareStringsIgnoreCase(elementControlType, "text"))
            {
                treeItem = new PBTextTreeItem();
            }
            else if (General.CompareStringsIgnoreCase(elementControlType, "scroll bar"))
            {
                treeItem = new PBScrollBarTreeItem();
            }
            else if (General.CompareStringsIgnoreCase(elementControlType, "menu bar"))
            {
                treeItem = new PBMenuBarTreeItem();
            }
            else if (General.CompareStringsIgnoreCase(elementControlType, "menu item"))
            {
                treeItem = new PBMenuItemTreeItem();
            }
            else if (General.CompareStringsIgnoreCase(elementControlType, "check box"))
            {
                treeItem = new PBCheckBoxTreeItem();
            }
            else if (General.CompareStringsIgnoreCase(elementControlType, "radio button"))
            {
                treeItem = new PBRadioButtonTreeItem();
            }
            else if (General.CompareStringsIgnoreCase(elementControlType, "combo box"))
            {
                treeItem = new PBComboBoxTreeItem();
            }
            else if (General.CompareStringsIgnoreCase(elementControlType, "list"))
            {
                treeItem = new PBListBoxTreeItem();
            }
            else if (General.CompareStringsIgnoreCase(elementControlType, "list item"))
            {
                treeItem = new PBListItemTreeItem();
            }
            else if (General.CompareStringsIgnoreCase(elementControlType, "Dialog"))
            {
                treeItem = new PBDialogBoxTreeItem();
            }
            //TODO: Add special handling for table controls. Don't display table fields as child, instead create similar table on Explorer pages using these values
            else if (General.CompareStringsIgnoreCase(elementControlType, "table"))
            {
                treeItem = new PBTableTreeItem();
            }
            else if (General.CompareStringsIgnoreCase(elementControlType, "document") || (elementControlType == ""))
            {
                treeItem = new PBDocumentTreeItem();
            }
            else
            {
                treeItem = new PBControlTreeItemBase();
            }

            // we need to put all the minimal attr so calc when needed
            UIAElementInfo EI = new UIAElementInfo();

            EI.ElementObject        = elementInfo.ElementObject; // The most important, the rest will be lazy loading
            treeItem.UIAElementInfo = EI;

            return(treeItem);
        }
Exemplo n.º 23
0
        public static void HighlightRect(System.Windows.Rect r, System.Windows.Forms.Screen scr, UIAElementInfo WEI)
        {
            FontFamily CurrentFontFamily = null;

            for (int i = 0; i < System.Drawing.FontFamily.Families.Count(); i++)
            {
                CurrentFontFamily = System.Drawing.FontFamily.Families[i];
                if (CurrentFontFamily.Name == "Courier New")
                {
                    break;
                }
            }

            int      hdc      = CreateDC(scr.DeviceName, null, null, IntPtr.Zero);
            Graphics graphics = Graphics.FromHdc((IntPtr)hdc);

            System.Drawing.Rectangle CalculatedRect = new System.Drawing.Rectangle();
            CalculatedRect.X      = (int)r.Left - scr.Bounds.X - 1;
            CalculatedRect.Y      = (int)r.Top - scr.Bounds.Y - 1;
            CalculatedRect.Width  = (int)r.Width;
            CalculatedRect.Height = (int)r.Height;

            graphics.DrawRectangle(new System.Drawing.Pen(System.Drawing.Color.Red, 2), CalculatedRect);

            // Find the font to draw only once
            if (CurrentFontFamily == null)
            {
                for (int i = 0; i < System.Drawing.FontFamily.Families.Count(); i++)
                {
                    CurrentFontFamily = System.Drawing.FontFamily.Families[i];
                    if (CurrentFontFamily.Name == "Courier New")
                    {
                        break;
                    }
                }
            }

            System.Drawing.Font  font = new System.Drawing.Font(CurrentFontFamily, 8);
            System.Drawing.Brush b    = System.Drawing.Brushes.DarkRed;
            System.Drawing.Point p    = new System.Drawing.Point(CalculatedRect.X, CalculatedRect.Y - 18);
            graphics.DrawString(WEI.ElementTitle, font, b, p);

            graphics.Dispose();
        }
Exemplo n.º 24
0
        private void WindowsComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            AppWindow AW = (AppWindow)WindowsComboBox.SelectedItem;

            if (AW == null)
            {
                return;
            }
            mWindowExplorerDriver.SwitchWindow(AW.Title);

            switch (AW.WindowType)
            {
            case AppWindow.eWindowType.Windows:
                WindowsWindowTreeItem WWTI = new WindowsWindowTreeItem();
                UIAElementInfo        WEI  = (UIAElementInfo)AW.RefObject;
                WEI.WindowExplorer  = mWindowExplorerDriver;
                WWTI.UIAElementInfo = WEI;
                WWTI.UIAElementInfo.ElementObject = WEI.ElementObject;
                break;

            case AppWindow.eWindowType.PowerBuilder:
                PBWindowTreeItem WTI  = new PBWindowTreeItem();
                UIAElementInfo   PBEI = (UIAElementInfo)AW.RefObject;
                PBEI.WindowExplorer = mWindowExplorerDriver;
                WTI.UIAElementInfo  = PBEI;
                break;

            case AppWindow.eWindowType.ASCFForm:
                ASCFFormTreeItem AFTI = new ASCFFormTreeItem();
                AFTI.Name = AW.Title;
                AFTI.Path = AW.Path;
                break;

            case AppWindow.eWindowType.SeleniumWebPage:
                HTMLPageTreeItem HPTI = new HTMLPageTreeItem();
                HTMLElementInfo  EI   = new HTMLElementInfo();
                EI.ElementTitle   = AW.Title;
                EI.XPath          = "html";
                EI.WindowExplorer = mWindowExplorerDriver;
                HPTI.ElementInfo  = EI;
                break;

            case AppWindow.eWindowType.JFrmae:
                JavaWindowTreeItem JWTI = new JavaWindowTreeItem();
                JavaElementInfo    JEI  = new JavaElementInfo();
                JEI.ElementTitle     = AW.Title;
                JEI.Path             = AW.Title;
                JEI.XPath            = "/";
                JEI.IsExpandable     = true;
                JWTI.JavaElementInfo = JEI;
                JEI.WindowExplorer   = mWindowExplorerDriver;
                break;

            case AppWindow.eWindowType.Appium:
                AppiumWindowTreeItem AWTI = new AppiumWindowTreeItem();

                AppiumElementInfo AEI = new AppiumElementInfo();
                AEI.WindowExplorer = mWindowExplorerDriver;
                AEI.XPath          = "/";
                string      pageSourceString = ((SeleniumAppiumDriver)mWindowExplorerDriver).GetPageSource();
                XmlDocument pageSourceXml    = new XmlDocument();
                pageSourceXml.LoadXml(pageSourceString);
                AEI.XmlDoc  = pageSourceXml;
                AEI.XmlNode = pageSourceXml.SelectSingleNode("/");

                AWTI.AppiumElementInfo = AEI;
                break;

            case AppWindow.eWindowType.AndroidDevice:
                AndroidWindowTreeItem ADTI = new AndroidWindowTreeItem();

                AndroidElementInfo AWI = new AndroidElementInfo();
                AWI.WindowExplorer = mWindowExplorerDriver;
                AWI.XPath          = "/";
                string      pageSourceString2 = ((AndroidADBDriver)mWindowExplorerDriver).GetPageSource();
                XmlDocument pageSourceXml2    = new XmlDocument();
                pageSourceXml2.LoadXml(pageSourceString2);
                AWI.XmlDoc  = pageSourceXml2;
                AWI.XmlNode = pageSourceXml2.SelectSingleNode("/hierarchy");

                ADTI.AndroidElementInfo = AWI;
                break;

            case AppWindow.eWindowType.Mainframe:
                MainframeTreeItemBase MFTI = new MainframeTreeItemBase();
                MFTI.Name = AW.Title;
                MFTI.Path = AW.Path;
                break;

            default:
                MessageBox.Show("Unknown Window type:" + AW.WindowType);
                break;
            }
        }