UI-Automation cmdlet not finding the control

Posted by sc_ray on Stack Overflow See other posts from Stack Overflow or by sc_ray
Published on 2010-04-19T20:10:47Z Indexed on 2010/04/19 20:13 UTC
Read the original article Hit count: 498

Filed under:
|
|
|
|

Hi,

I am trying to test a WPF application using the UI-Automation framework that MSFT provides. There were a few powershell scripts written that invoked the cmdlets created to manipulate the visual controls of the application.

There is a DropDown within my application that has an entry 'DropDownEntry'. In my cmdlet, I am trying to do something as follows:

 AutomationElement getItem = DropDown.FindFirst(TreeScope.Descendants,
 new AndCondition(
 new PropertyCondition(AutomationElement.ControlTypeProperty,ControlType.ListItem),
 new PropertyCondition(AutomationElement.NameProperty, "DropDownEntry",PropertyConditionFlags.IgnoreCase)));

The above given snippet returns 'null' upon execution which essentially means that the above given logic was unable to find my dropdown entry.

Can somebody tell me why this might be happening? I checked the name of my control and the values. Everything seems to be in order. I am not sure why this would be happening. Any help would be much appreciated.

Thanks

© Stack Overflow or respective owner

Related posts about ui-automation

Related posts about c#