예제 #1
0
        public static ReadOnlyCollection <IWebElement> GetAllByTagNameAndLocation(this IWebDriver webDriver, ButtonQuery locationDescription)
        {
            try
            {
                var result = webDriver.RunLibraryScript($"return sortByLocation(" +
                                                        $"{locationDescription.IsFromRight.ToString().ToLower()}, " +
                                                        $"getElementsByTagName(\"{locationDescription.TagName}\"));");

                return((ReadOnlyCollection <IWebElement>)result);
            }
            catch (Exception e)
            {
                throw new ApplicationException($"No Element was found by looking for '{locationDescription}'.");
            }
        }
예제 #2
0
        public static IWebElement GetByTagNameAndLocation(this IWebDriver webDriver, ButtonQuery locationDescription)
        {
            var elements = GetAllByTagNameAndLocation(webDriver, locationDescription);

            return(elements.ElementAt(locationDescription.OneBasedOrder - 1));
        }