コード例 #1
0
        public List <ElementInfo> GetElementChildren(ElementInfo ElementInfo)
        {
            List <ElementInfo> list = new List <ElementInfo>();

            if (mUIAutomationHelper.IsWindowValid(ElementInfo.ElementObject))
            {
                if (ElementInfo.GetType() == typeof(UIAElementInfo))
                {
                    if (mUIAutomationHelper.GetControlPropertyValue(ElementInfo.ElementObject, "ClassName").Equals("Internet Explorer_Server"))
                    {
                        mUIAutomationHelper.InitializeBrowser(ElementInfo.ElementObject);


                        ElementInfo htmlRootEI = new ElementInfo();
                        htmlRootEI.XPath          = "/";
                        htmlRootEI.WindowExplorer = ElementInfo.WindowExplorer;

                        list = mUIAutomationHelper.GetHTMLHelper().GetElementChildren(htmlRootEI);
                    }
                    else
                    {
                        list = mUIAutomationHelper.GetElementChilderns(ElementInfo.ElementObject);
                    }
                }
                else
                {
                    list = mUIAutomationHelper.GetHTMLHelper().GetElementChildren(ElementInfo);
                }
            }

            return(list);
        }
コード例 #2
0
 public ObservableList <ControlProperty> GetElementProperties(ElementInfo ElementInfo)
 {
     if (ElementInfo.GetType() == typeof(HTMLElementInfo))
     {
         ObservableList <ControlProperty> list = ((HTMLHelper)mUIAutomationHelper.GetHTMLHelper()).GetHTMLElementProperties(ElementInfo);
         return(list);
     }
     return(null);
 }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
        public void HighLightElement(ElementInfo ElementInfo)
        {
            if (ElementInfo.GetType() == typeof(UIAElementInfo))
            {
                mUIAutomationHelper.HiglightElement(((UIAElementInfo)ElementInfo));
            }
            else if (ElementInfo.GetType() == typeof(HTMLElementInfo))
            {
                //TODO:Handle mshtml-element & HtmlAgilityPack-node generically
                HTMLElementInfo htmlInfo = (HTMLElementInfo)ElementInfo;
                string          elemType = htmlInfo.ElementObject.GetType().ToString();

                if (elemType.Contains("HtmlAgilityPack"))
                {
                    mUIAutomationHelper.GetHTMLHelper().HighLightElement(ElementInfo.ElementObject);
                }
                if (elemType.ToLower().Contains("mshtml"))
                {
                    mUIAutomationHelper.GetHTMLHelper().HighLightElement(((IHTMLElement)ElementInfo.ElementObject));
                }
            }
        }