Question

I have a Custom type, under which I have multiple TextBox controls. the problem is all the TextBox's doesn't have either an Automation Id or the Name. So, I wanted to retrieve all the textboxes in a list, so that, I can operate upon them. I know it's not a good practice to do so but I don't have any other option. The problem is how do I retrieve all the these TextBox's which are under a particular custom type in a List?

If anyone knows a better way around then please suggest.

No correct solution

OTHER TIPS

Condition condition = new PropertyCondition(AutomationElement.ClassNameProperty, "customclassname");
AutomationElementCollection TextBoxs = ListThatContainsTextBoxsAutomationElement.FindAll(TreeScope.Children, condition);
 Foreach(AutomationElement TextBox in TextBoxs) 
 {
    //Do something with the TextBoxs
 }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top