public void ControlSearcher_GetCondition() { AppModel.Initialize("UnitTestObjectModel1.json"); UIATestObject parentObject = (UIATestObject)AppModel.Current.GetTestObject("LAP (Running) - Microsoft Visual Studio"); //UIATestObject testObject = (UIATestObject)parentObject.FindRecursive(DescriptorKeys.NodeName, "Search"); Assert.IsNotNull(parentObject, "Should find the parent test object in the model"); UIACondition parentCondition = UIACondition.GetCondition(parentObject); UIACondition childCondition = ControlSearcher.GetCondition(parentCondition, ControlType.Edit, "Search"); Assert.IsNotNull(childCondition, "Should not be able to find the child condition"); }
public bool Exist(int time = 0) { _Logger.WriteLog("Check if the objest is exist in the Object list."); bool found = false; for (int i = 0; i <= time; i++) { if (found == true) { return(found); } else { try { if (_condition.AutomationElement == null) { found = false; } Rect value = _condition.AutomationElement.Current.BoundingRectangle; if (value.Right == 0 && value.Left == 0 && value.Top == 0 && value.Bottom == 0) { found = false; } else { found = true; } } catch { found = false; } } if (!found) { Console.WriteLine("This object is not exist and find it again: " + _condition.TestObject); //search it again UIACondition c = ControlSearcher.GetCondition(_condition.ParentCondition, _condition.TestObject, _condition.ControlType); if (c.AutomationElement != null) { _condition = c; found = true; } } } return(found); }
public IUIALink UIALink(string conditions, string conditions1 = "", string conditions2 = "", string conditions3 = "", string conditions4 = "", string conditions5 = "", string conditions6 = "", string conditions7 = "", string conditions8 = "", string conditions9 = "") { UIACondition cdition = ControlSearcher.GetCondition(_condition, ControlType.Hyperlink, conditions, conditions1, conditions2, conditions3, conditions4, conditions5, conditions6, conditions7, conditions8, conditions9); return((UIALink)UIACommonMethods.ObjectCreator(cdition)); }
public IUIARadioButton UIARadiobutton(string conditions, string conditions1 = "", string conditions2 = "", string conditions3 = "", string conditions4 = "", string conditions5 = "", string conditions6 = "", string conditions7 = "", string conditions8 = "", string conditions9 = "") { UIACondition cdition = ControlSearcher.GetCondition(this._condition, ControlType.RadioButton, conditions, conditions1, conditions2, conditions3, conditions4, conditions5, conditions6, conditions7, conditions8, conditions9); return((UIARadioButton)UIACommonMethods.ObjectCreator(cdition)); }
public IUIAScrollBar UIAScrollbar(string conditions, string conditions1 = "", string conditions2 = "", string conditions3 = "", string conditions4 = "", string conditions5 = "", string conditions6 = "", string conditions7 = "", string conditions8 = "", string conditions9 = "") { UIACondition cdition = ControlSearcher.GetCondition(this._condition, ControlType.ScrollBar, conditions, conditions1, conditions2, conditions3, conditions4, conditions5, conditions6, conditions7, conditions8, conditions9); return((UIAScrollBar)UIACommonMethods.ObjectCreator(cdition)); }