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); }
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); }
public static void InitUiElements(IUiElementFinder finder, object page, IPageObjectDecorator decorator) => InitUiElements(page, new DefaultUiElementLocator(finder), decorator);
public static T InitUiElements <T>(IUiElementFinder finder) => InitUiElements <T>(new DefaultUiElementLocator(finder));
public DefaultUiElementLocator(IUiElementFinder elementFinder) { _uiElementFinder = elementFinder; }