Пример #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;
 }