/// <summary> /// /// </summary> public static List <string> GetCoordinateObj() { Point _Point = new Point(); _Point.X = Control.MousePosition.X; _Point.Y = Control.MousePosition.Y; AT at = new AT(AutomationElement.FromPoint(_Point)); ATS items = at.GetElements(TreeScope: AT.TreeScope.Descendants, ControlType: AT.ControlType.ListItem); List <string> list = new List <string>(); foreach (AT item in items.GetATCollection()) { list.Add(item.GetElementInfo().Name()); } return(list); }
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}]."); }