private void HighlightObjectThread()
 {
     UIATestObject testObject = (UIATestObject)_condition.TestObject;
     if (!UIAHighlight.SearchAndHighlight(testObject))
     {
         MessageBox.Show(StringResources.LPSpy_SpyMainWindow_CannotFindObjectMsg);
     }
 }
        public void UIAHighlight_SearchandHighlight_UIA()
        {
            UIATestObject testObject = descriptor.GetObject() as UIATestObject;

            bool result = UIAHighlight.SearchAndHighlight(testObject);

            Assert.IsTrue(result);
        }
        public void UIAHighlight_SearchandHighlight_ProgramRestarted()
        {
            UIATestObject testObject = descriptor.GetObject() as UIATestObject;

            AutomationElement firstElement = testObject.AutomationElement;

            //close and start another calculator
            TestUtility.ExitQTCalculator();
            TestUtility.LaunchQTCalculator();

            //this should also succeed
            bool result = UIAHighlight.SearchAndHighlight(testObject);

            Assert.IsTrue(result);
        }
        public void UIAHighlight_SearchandHighlight_Virtual()
        {
            UIATestObject testObject = descriptor.GetObject() as UIATestObject;

            VirtualTestObject virtualButton7 = new VirtualTestObject("button7", new Rect(76, 139, 34, 34));
            VirtualTestObject virtualButton4 = new VirtualTestObject("button4", new Rect(74, 177, 36, 40));

            testObject.AddChild(virtualButton7);
            testObject.AddChild(virtualButton4);


            //this should also succeed
            bool result = UIAHighlight.SearchAndHighlight(virtualButton7);

            Assert.IsTrue(result);
            result = UIAHighlight.SearchAndHighlight(virtualButton4);
            Assert.IsTrue(result);
        }
Esempio n. 5
0
        private void HighlightObjectThread(object param)
        {
            try
            {
                TestObjectNurse nurseObject = param as TestObjectNurse;
                if (nurseObject == null)
                {
                    return;
                }

                ITestObject testObject = nurseObject.TestObject;

                SetStatusText(StringResources.LPSpy_SpyMainWindow_Identifying);


                //Check whether the WebDriver Host exist or not
                if (testObject.ControlTypeString.StartsWith("Web"))
                {
                    SETestObject seTestObject = testObject as SETestObject;
                    if (seTestObject.SEWebElement == null)
                    {
                        //look for WebPage
                        TreeNode    parentNode   = nurseObject.TreeNode;
                        ITestObject parentObject = null;


                        do
                        {
                            parentObject = TestObjectNurse.FromTreeNode(parentNode).TestObject;
                            if (parentObject.ControlTypeString.Equals("WebPage"))
                            {
                                //seTestObject = parentObject as SETestObject;
                                break;
                            }
                        }while (null != (parentNode = parentNode.Parent));

                        if (null != parentObject)
                        {
                            //check the WebDriverHost existing
                            if (null == _webDriverHost)
                            {
                                _webDriverHost = new WebDriverHost();
                                _webDriverHost.GotoUrl(parentObject.Properties[WebControlKeys.URL]);
                            }
                            else
                            {
                                _webDriverHost.SwithToURL(parentObject.Properties[WebControlKeys.URL]);
                            }
                            WebRefreshNodeTag(parentNode);
                        }
                    }

                    Rectangle rc = _webDriverHost.GetElementRectangle(seTestObject);

                    UIAHighlight.HighlightRect(rc);
                    return;
                }


                if (!UIAHighlight.SearchAndHighlight(testObject))
                {
                    MessageBox.Show(StringResources.LPSpy_SpyMainWindow_CannotFindObjectMsg);
                }
            }
            finally
            {
                SetStatusText("");
            }
        }