public void CloseMasterPlus(int timeout = 10) { var buttonClose = GetMasterPlusMainWindow().GetElementFromChild(MPObj.CloseMasterPlusButton); buttonClose.DoClickPoint(1); UtilWait.ForTrue(() => !UtilProcess.IsProcessExistedByName(this.SwProcessName), timeout); }
public void Load() { if (app == null) { UtilProcess.KillProcessByName(System.IO.Path.GetFileName(_appPath)); UtilTime.WaitTime(1); var p = UtilProcess.StartProcessReturn(_appPath); UtilWait.ForTrue(() => p.MainWindowHandle != IntPtr.Zero, 3); app = new AT().GetElementFromHwnd(p.MainWindowHandle); } }
public void WaitForVanishedBySearch(ATElementStruct aTElementStruct, int timeout = -1, string treeScope = TreeScope.Descendants) { try { UtilWait.ForTrue(() => (GetElement(treeScope, aTElementStruct.Name, aTElementStruct.AutomationId, aTElementStruct.ClassName, aTElementStruct.FrameworkId, aTElementStruct.ControlType, aTElementStruct.FullDescriton, aTElementStruct.AccessKey, aTElementStruct.Index, -1, false, true) == null), timeout); //UtilWait.ForTrue(() => //{ // return (GetElement(TreeScope, ATElementStruct.Name, ATElementStruct.AutomationId, ATElementStruct.ClassName, ATElementStruct.FrameworkId, ATElementStruct.ControlType, ATElementStruct.Index, -1, false, true) == null); //}, Timeout); } catch (Exception ex) { throw new Exception($"This element still exists. {ex.Message}"); } }
public void SelectTab(ATElementStruct whichTab) { var currentTabbar = GetMasterPlusMainWindow().GetElement(new ATElementStruct() { ControlType = ATElement.ControlType.Tab }); //var tabs = currentTab.GetElementsAllChild(); //tabs.GetATCollection()[GetTabIndexByTabCount(tabs.GetATCollection().Length)].DoClickPoint(1); var targetTab = currentTabbar.GetElementFromChild(whichTab); if (targetTab.GetElementInfo().ToggleState().Equals("Off")) { targetTab.DoClickPoint(1); UtilWait.ForTrue(() => targetTab.GetElementInfo().ToggleState().Equals("On"), 3, 1); } }