none
List control Patterns not available in 2013 UIAComWrapper

    Question

  • I need some help.  My entire test project is fast becoming useless.  I can't run VS2012 on VS2013 test agent, so I'm forced to update to VS2013.  The code below no longer works because VS2013 does not make the same things available. 

    This is the code that I used in VS2012.  Now that UIAComWrapper has changed in VS2013, it doesn't work. ExpandCollapsePattern is not available anymore.  The selectionPattern sometimes works, and sometimes doesn't.  All of my list controls no longer work because of Patterns not being available.

    AutomationElement comboBox = null;

     comboBox = m_commonAuto.GetElementByAutomationID(mainwindow, comboBoxName);

     

    if(comboBox == null|| !comboBox.Current.ControlType.Equals(ControlType.ComboBox))

    {

        comboBox = m_commonAuto.GetElementByAutomationIDAndControlType(mainwindow,

    ControlType.ComboBox, comboBoxName);

    }

    AutomationPatternautomationPatternFromElement = m_commonAuto.GetSpecifiedPattern(comboBox, "ExpandCollapsePatternIdentifiers.Pattern");

    ExpandCollapsePatternexpandCollapsePattern = comboBox.GetCurrentPattern(automationPatternFromElement) asExpandCollapsePattern;

    expandCollapsePattern.Expand();

    AutomationElementcomboItem = comboBox.FindFirst(TreeScope.Descendants, newPropertyCondition(AutomationElement.NameProperty, item));

    if(comboItem != null)

    {

    SelectionItemPatternitemSelection = comboItem.GetCurrentPattern(SelectionItemPattern.Pattern) asSelectionItemPattern;

    itemSelection.Select();

    }


    closl

    Thursday, March 06, 2014 6:15 PM