Example #1
0
        public static void AssertSelected(AutomationElement element, bool expected)
        {
            SelectionItemPattern currentPattern = AutomationPatternHelper.GetSelectionItemPattern(element);
            bool isSelected = currentPattern.Current.IsSelected;

            if (expected != isSelected)
            {
                throw new Exception(string.Format("Selected is not as expected. Expected: {0}, Actual: {1}. ({2})", expected, isSelected, element.ToString()));
            }
        }
Example #2
0
 // Methods
 public static void AddToSelection(AutomationElement element)
 {
     AutomationPatternHelper.GetSelectionItemPattern(element).AddToSelection();
 }
Example #3
0
 public static void Select(AutomationElement element)
 {
     AutomationPatternHelper.GetSelectionItemPattern(element).Select();
 }