public AT GetElementByIA(ATElementStruct iAElementStruct, bool returnNullWhenException = false) { if (iAElementStruct.IADescription != null) { return(this.ats.ToList().Find(d => iAElementStruct.IADescription.Equals(d.GetIAccessible().Description()))); } if (returnNullWhenException) { return(null); } throw new Exception($"No element with Description [{iAElementStruct.IADescription}]."); }
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 AT GetIAElementFromATS(ATElementStruct iAElementStruct, ATS ats, bool returnNullWhenException = false) { if (iAElementStruct.IADescription != null) { return(ats.GetATCollection().ToList().Find(d => iAElementStruct.IADescription.Equals(d.GetIAccessible().Description()))); //foreach (var at in ats.GetATCollection()) //{ // if (aTElementStruct.IADescription.Equals(at.GetIAccessible().Description())) // { // return at; // } //} } if (returnNullWhenException) { return(null); } throw new Exception($"No element with Description [{iAElementStruct.IADescription}]."); }
public AT GetElement(ATElementStruct aTElementStruct, int timeout = -1, string treeScope = TreeScope.Descendants, bool checkEnabled = false, bool returnNullWhenException = false) { return(GetElement(treeScope, aTElementStruct.Name, aTElementStruct.AutomationId, aTElementStruct.ClassName, aTElementStruct.FrameworkId, aTElementStruct.ControlType, aTElementStruct.FullDescriton, aTElementStruct.AccessKey, aTElementStruct.Index, timeout, checkEnabled, returnNullWhenException)); }
public ATS GetElements(ATElementStruct aTElementStruct, int timeout = -1, string treeScope = TreeScope.Children, bool returnNullWhenException = false) { return(GetElements(treeScope, aTElementStruct.Name, aTElementStruct.AutomationId, aTElementStruct.ClassName, aTElementStruct.FrameworkId, aTElementStruct.ControlType, aTElementStruct.FullDescriton, aTElementStruct.AccessKey, returnNullWhenException)); }
public AT GetElementFromDescendants(ATElementStruct aTElementStruct, int timeout = -1, bool checkEnabled = false, bool returnNullWhenException = false) { return(GetElement(aTElementStruct, timeout, TreeScope.Descendants, checkEnabled, returnNullWhenException)); }
public ATS GetElementsFromDescendants(ATElementStruct aTElementStruct, int timeout = -1, bool returnNullWhenException = false) { return(GetElements(aTElementStruct, timeout, TreeScope.Descendants, returnNullWhenException)); }
public ATS GetElementsFromChild(ATElementStruct aTElementStruct, int timeout = -1, bool returnNullWhenException = false) { return(GetElements(aTElementStruct, timeout, TreeScope.Children, returnNullWhenException)); }