public void ShouldFindAllMatchingItemsIfRequested() { var window = LaunchPetShopWindow(); var tabs = window.FindAll <Tab>(FindBy.ControlType(ControlType.TabItem)); var tabTitles = tabs.Select(t => t.Title).ToList(); Assert.Contains("Registration", tabTitles); Assert.Contains("History", tabTitles); Assert.Contains("Basket", tabTitles); Assert.Contains("Accessories", tabTitles); }
public void ShouldFindAnElementBasedOnAProperty() { var window = LaunchPetShopWindow(); var basket = window.Find <Tab>(FindBy.WpfText("Basket")); AutomationElement comboBoxElement = window.Element.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.ClassNameProperty, typeof(ComboBox).Name)); string comboBoxName = comboBoxElement.GetCurrentPropertyValue(AutomationElement.AutomationIdProperty).ToString(); var wrapperFactory = new Mock <IWrapAutomationElements>(); var comboBox = new ComboBox(comboBoxElement, "aComboBox"); wrapperFactory.Setup(x => x.Wrap <ComboBox>(comboBoxElement, comboBoxName)).Returns(comboBox); var finder = new ConditionBasedFinder(wrapperFactory.Object, new Mock <IDescribeConditions>().Object); finder.Find <ComboBox>(basket, FindBy.ControlType(ControlType.ComboBox), Assert.Fail); }
public void ShouldFindWindowByCondition() { Application application = new ApplicationLauncher().LaunchOrRecycle(EXAMPLE_APP_NAME, EXAMPLE_APP_PATH, Assert.Fail); Window window = application.FindWindow(new AndCondition( FindBy.WpfName("petShopWindow"), FindBy.ControlType(ControlType.Window))); Assert.IsNotNull(window.Element); }