示例#1
0
        private IEnumerable <TUiElement> FindAll <TUiElement>(IUiElementFinder searchContext, IEnumerable <Locator> locators)
            where TUiElement : IUiElement
        {
            if (locators == null)
            {
                throw new ArgumentNullException(nameof(locators), "List of criteria may not be null");
            }

            var elements = new List <TUiElement>();

            foreach (var locator in locators)
            {
                elements.AddRange(searchContext.FindAll <TUiElement>(locator, null));
            }

            return(elements);
        }
示例#2
0
        private TUiElement FindElement <TUiElement>(IUiElementFinder searchContext, IEnumerable <Locator> locators)
            where TUiElement : IUiElement
        {
            if (locators == null)
            {
                throw new ArgumentNullException(nameof(locators), "List of criteria may not be null");
            }

            string errorString = null;

            foreach (var locator in locators)
            {
                try
                {
                    return(searchContext.Find <TUiElement>(locator, null));
                }
                catch (UiElementNotFoundException)
                {
                    errorString = (errorString == null ? "Could not find element by : " : errorString + ", or: ") + locator;
                }
            }

            throw new UiElementNotFoundException(errorString);
        }
示例#3
0
 public static void InitUiElements(IUiElementFinder finder, object page, IPageObjectDecorator decorator)
 => InitUiElements(page, new DefaultUiElementLocator(finder), decorator);
示例#4
0
 public static T InitUiElements <T>(IUiElementFinder finder)
 => InitUiElements <T>(new DefaultUiElementLocator(finder));
示例#5
0
 public DefaultUiElementLocator(IUiElementFinder elementFinder)
 {
     _uiElementFinder = elementFinder;
 }