Iam using UI automation APi for automating ASP.Net controls on Web page.
Iam trying to identify the text box using Automation ID .The following code is intermittently working.
aeWindow = aeDesktop.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.NameProperty, WindowName));
aeText = aeWindow.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.AutomationIdProperty, TextBoxName));
Some times Iam getting the text box and sometimes it is returning null.
Is there any specific reason for not identifying the controls? Why it is inconsistently behaving?