TestAutomationEssentials.Selenium.ElementsContainer.GetSearchContext C# (CSharp) Méthode

GetSearchContext() protected méthode

protected GetSearchContext ( ) : ISearchContext
Résultat ISearchContext
        protected internal virtual ISearchContext GetSearchContext()
        {
            return DOMRoot.Browser.GetWebDriver();
        }

Usage Example

        private static IWebElement GetWebElement(ElementsContainer elementsContainer, By by, Func <IReadOnlyCollection <IWebElement>, IWebElement> selector, string description)
        {
            if (elementsContainer == null)
            {
                throw new ArgumentNullException("elementsContainer");
            }
            if (by == null)
            {
                throw new ArgumentNullException("by");
            }
            if (selector == null)
            {
                throw new ArgumentNullException("selector");
            }

            var searchContext    = elementsContainer.GetSearchContext();
            var matchingElements = searchContext.FindElements(by);
            var selectedElement  = selector(matchingElements);

            if (selectedElement == null)
            {
                throw new NoSuchElementException(string.Format("Element '{0}' could not be found or is not available", description));
            }

            return(selectedElement);
        }
All Usage Examples Of TestAutomationEssentials.Selenium.ElementsContainer::GetSearchContext