public override void DoExecute() { switch (PlaybackObject.action) { case "SetText": try { if (UiElement.AsComboBox().IsEditable.Equals(true)) { UiElement.AsTextBox().Enter(PlaybackObject.text); Result = true; } else { Result = false; } } catch (Exception) { Result = false; } break; case "Select": try { //AutomationElement a = UiElement.AutomationElement; //ExpandCollapsePattern expandCollapsePattern = a.GetCurrentPattern(ExpandCollapsePattern.Pattern) as ExpandCollapsePattern; //expandCollapsePattern.Expand(); //var cbxEditItems = UiElement.FindAll(TreeScope.Subtree, new System.Windows.Automation.PropertyCondition(AutomationElement.ClassNameProperty, "ComboBoxItem")); //cbxEditItems[PlaybackObject.itemIndex].AutomationElement.SelectionItemPattern().Select(); //expandCollapsePattern.Collapse(); UiElement.AsComboBox().Select(PlaybackObject.itemIndex); UiElement.AsComboBox().Collapse(); Result = true; } catch (Exception) { Result = false; } break; default: Result = false; break; } }