Example #1
0
        public SearchResult FindNativeElement(IElementLocator locator)
        {
            if (locator.Index.HasValue)
            {
                var elements = browserDriver.FindElements(locator);
                if (locator.Index > elements.Count)
                {
                    throw new Exception($"Browser.FindNativeElement : Not enough elements. You want element number {locator.Index} but only {elements.Count} were found.");
                }

                return(SearchResult.Create(elements[locator.Index.Value], elements.Count));
            }
            else
            {
                //TODO: make this right by always using FindElements !
                return(SearchResult.Create(browserDriver.FindElement(locator), 1));
            }
        }