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);
            }
        }
        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));
                }
            }
        }
Exemple #3
0
        private void TestElementButtonClicked(object sender, RoutedEventArgs e)
        {
            if (!ValidateDriverAvalability())
            {
                return;
            }

            ElementInfo CurrentEI = (ElementInfo)MainElementsGrid.CurrentItem;

            if (mSelectedLocator != null)
            {
                var testElement = new ElementInfo();
                testElement.Path     = CurrentEI.Path;
                testElement.Locators = new ObservableList <ElementLocator>()
                {
                    mSelectedLocator
                };

                //For Java Driver Widgets

                if (WorkSpace.Instance.Solution.GetTargetApplicationPlatform(mPOM.TargetApplicationKey).Equals(ePlatformType.Java))
                {
                    if (mSelectedElement.GetType().Equals(typeof(GingerCore.Drivers.Common.HTMLElementInfo)))
                    {
                        var htmlElementInfo = new GingerCore.Drivers.Common.HTMLElementInfo()
                        {
                            Path = testElement.Path, Locators = testElement.Locators
                        };
                        testElement            = htmlElementInfo;
                        testElement.Properties = CurrentEI.Properties;
                    }
                }

                mWinExplorer.TestElementLocators(testElement);
            }
        }