コード例 #1
0
ファイル: ATS.cs プロジェクト: HuangLuffy/ezTesting
 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}].");
 }
コード例 #2
0
ファイル: AT.cs プロジェクト: HuangLuffy/ezTesting
        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}");
            }
        }
コード例 #3
0
ファイル: AT.cs プロジェクト: HuangLuffy/ezTesting
 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}].");
 }
コード例 #4
0
ファイル: AT.cs プロジェクト: HuangLuffy/ezTesting
 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));
 }
コード例 #5
0
ファイル: AT.cs プロジェクト: HuangLuffy/ezTesting
 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));
 }
コード例 #6
0
ファイル: AT.cs プロジェクト: HuangLuffy/ezTesting
 public AT GetElementFromDescendants(ATElementStruct aTElementStruct, int timeout = -1, bool checkEnabled = false, bool returnNullWhenException = false)
 {
     return(GetElement(aTElementStruct, timeout, TreeScope.Descendants, checkEnabled, returnNullWhenException));
 }
コード例 #7
0
ファイル: AT.cs プロジェクト: HuangLuffy/ezTesting
 public ATS GetElementsFromDescendants(ATElementStruct aTElementStruct, int timeout = -1, bool returnNullWhenException = false)
 {
     return(GetElements(aTElementStruct, timeout, TreeScope.Descendants, returnNullWhenException));
 }
コード例 #8
0
ファイル: AT.cs プロジェクト: HuangLuffy/ezTesting
 public ATS GetElementsFromChild(ATElementStruct aTElementStruct, int timeout = -1, bool returnNullWhenException = false)
 {
     return(GetElements(aTElementStruct, timeout, TreeScope.Children, returnNullWhenException));
 }