Ejemplo n.º 1
0
        /// <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);
        }
Ejemplo n.º 2
0
 internal void AddStrategy(string strategyName, ILookupStrategy strategy)
 {
     lookupStrategies.Add(strategyName, strategy);
 }
Ejemplo n.º 3
0
 private IEnumerable <TValue> FilterLeftList(ILookupStrategy lookupStrategy, bool shouldBeInRightList)
 {
     return(_leftList.Where(v => lookupStrategy.Contains(_keyFunc(v)) ^ !shouldBeInRightList));
 }
Ejemplo n.º 4
0
 /// <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);
 }