/// <summary> /// Finds an element. /// </summary> /// <param name="driver">The <see cref="IWebDriver"/> to use in finding the elements.</param> /// <param name="locator">The locator string describing how to find the element.</param> /// <returns>An <see cref="IWebElement"/> described by the locator.</returns> /// <exception cref="SeleniumException">There is no element matching the locator.</exception> internal IWebElement FindElement(IWebDriver driver, string locator) { IWebElement result; ILookupStrategy strategy = this.FindStrategy(locator); string use = DetermineLocator(locator); try { result = strategy.Find(driver, use); } catch (NoSuchElementException) { throw new SeleniumException("Element " + locator + " not found."); } return(result); }
internal void AddStrategy(string strategyName, ILookupStrategy strategy) { lookupStrategies.Add(strategyName, strategy); }
private IEnumerable <TValue> FilterLeftList(ILookupStrategy lookupStrategy, bool shouldBeInRightList) { return(_leftList.Where(v => lookupStrategy.Contains(_keyFunc(v)) ^ !shouldBeInRightList)); }
/// <summary> /// Adds a strategy to the dictionary of known lookup strategies. /// </summary> /// <param name="strategyName">The name used to identify the lookup strategy.</param> /// <param name="strategy">The <see cref="ILookupStrategy"/> used in finding elements.</param> internal void AddStrategy(string strategyName, ILookupStrategy strategy) { this.lookupStrategies.Add(strategyName, strategy); }