none
Select and double click a table item

    Question

  • 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];

                            tableItem.CopyTo(itemListArray,0);

                        

                           

    intitemIndex = 0;

                           

    intaeIndex = 0;

                           

    foreach(AutomationElementae initemListArray)

                            {

                               

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

                                {

                                    itemIndex = aeIndex;

                                }

                                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)
       {
            pattern.Select();
            pattern.Select();
        }

    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