//private CaptureElement captureElement = new CaptureElement(); /// <summary> /// /// </summary> /// <param name="rootAutomationElement"></param> /// <returns></returns> public List <IElement> Analyzing( AutomationElementCollection listRootAutomationElement, ElementDiscoverManual elementDiscorerManual) { //logger.Debug("Start Analyze....."); List <IElement> re = new List <IElement>(); Thread.Sleep(DELAY_INSPECTING_TIME); foreach (AutomationElement rootAutoElement in listRootAutomationElement) { IElement newElement = Analyzing(rootAutoElement, elementDiscorerManual); if (newElement != null) { re.Add(newElement); } } //logger.Debug("Finish Analyze....."); return(re); }
public IElement Analyzing(AutomationElement rootAutoElement, ElementDiscoverManual elementDiscorerManual) { //TODO: fix bound //captureElement.WindowBound = rootAutoElement.Current.BoundingRectangle; //logger.Debug("Start Window....."); try { rootAutoElement.SetFocus(); } catch (InvalidOperationException) { logger.Error("Element: " + rootAutoElement.Current.Name + ", id: " + rootAutoElement.Current.AutomationId + ", type: " + rootAutoElement.Current.LocalizedControlType + "cannot receive focus"); } IElement rootEle = Convert(rootAutoElement, null, new Dictionary <string, int>()); //logger.Debug("Start add struct change event....."); elementDiscorerManual.AddEvent(rootAutoElement); //logger.Debug("Finish Window....."); return(rootEle); }