Exemple #1
0
 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}].");
 }
Exemple #2
0
        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}");
            }
        }
Exemple #3
0
 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}].");
 }
Exemple #4
0
 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));
 }
Exemple #5
0
 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));
 }
Exemple #6
0
 public AT GetElementFromDescendants(ATElementStruct aTElementStruct, int timeout = -1, bool checkEnabled = false, bool returnNullWhenException = false)
 {
     return(GetElement(aTElementStruct, timeout, TreeScope.Descendants, checkEnabled, returnNullWhenException));
 }
Exemple #7
0
 public ATS GetElementsFromDescendants(ATElementStruct aTElementStruct, int timeout = -1, bool returnNullWhenException = false)
 {
     return(GetElements(aTElementStruct, timeout, TreeScope.Descendants, returnNullWhenException));
 }
Exemple #8
0
 public ATS GetElementsFromChild(ATElementStruct aTElementStruct, int timeout = -1, bool returnNullWhenException = false)
 {
     return(GetElements(aTElementStruct, timeout, TreeScope.Children, returnNullWhenException));
 }