Esempio n. 1
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);
        }
Esempio n. 2
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");
        }