Select and double click a table item


  • I have just started using UI Automation to try and auomate testing of our in house applications.

    I have managed to identify the various items in a table:

    AutomationElementCollectiontableItem = tableList.FindAll(TreeScope.Descendants, newPropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Custom));                  


    AutomationElement[] itemListArray = newAutomationElement[tableItem.Count];




    intitemIndex = 0;


    intaeIndex = 0;


    foreach(AutomationElementae initemListArray)



    if(ae.Current.Name.ToString().Contains("New Application Wizard"))


                                    itemIndex = aeIndex;






    AutomationElementitemToSelect = tableItem[itemIndex];

    The last line returns the required entry in the table. I need to be able to select and double click on this item.

    Monday, March 17, 2014 4:00 PM

All replies

  • Does itemToSelect have SelectionItemPattern? If it does, you can get this pattern and call Select() method successively two times.

    SelectionItemPattern pattern = itemToSelect.GetCurrentPattern(SelectionItemPattern.Pattern) as SelectionItemPattern;
    if (pattern != null)

    Thursday, March 20, 2014 7:19 PM
  • I have since discovered that it doesn't hence my inability to get a usable pattern!
    Thursday, March 27, 2014 1:31 PM