Collection of Elements from Internet Explorer
상속: IDisposable
예제 #1
0
        /// <summary>
        /// Finds a list of elements that match the link text supplied
        /// </summary>
        /// <param name="linkText">Link text of element</param>
        /// <returns>ReadOnlyCollection of IWebElement object so that you can interact with those objects</returns>
        public ReadOnlyCollection <IWebElement> FindElementsByLinkText(string linkText)
        {
            SafeWebElementCollectionHandle collectionHandle = new SafeWebElementCollectionHandle();
            WebDriverResult result = NativeDriverLibrary.Instance.FindElementsByLinkText(handle, parent, linkText, ref collectionHandle);

            ResultHandler.VerifyResultCode(result, "FindElementsByLinkText");
            List <IWebElement> elementList = new List <IWebElement>();

            using (InternetExplorerWebElementCollection elements = new InternetExplorerWebElementCollection(driver, collectionHandle))
            {
                elementList = elements.ToList();
            }

            return(new ReadOnlyCollection <IWebElement>(elementList));
        }
예제 #2
0
        /// <summary>
        /// Find all the elements taht match the XPath
        /// </summary>
        /// <param name="xpath">XPath to the element</param>
        /// <returns>ReadOnlyCollection of IWebElement object so that you can interact that object</returns>
        public ReadOnlyCollection<IWebElement> FindElementsByXPath(string xpath)
        {
            SafeWebElementCollectionHandle collectionHandle = new SafeWebElementCollectionHandle();
            WebDriverResult result = NativeDriverLibrary.Instance.FindElementsByXPath(handle, parent, xpath, ref collectionHandle);
            ResultHandler.VerifyResultCode(result, "FindElementsByXPath");
            List<IWebElement> elementList = new List<IWebElement>();
            using (InternetExplorerWebElementCollection elements = new InternetExplorerWebElementCollection(driver, collectionHandle))
            {
                elementList = elements.ToList();
            }

            return new ReadOnlyCollection<IWebElement>(elementList);
        }
예제 #3
0
파일: Finder.cs 프로젝트: epall/selenium
        /// <summary>
        /// Find all elements that match the tag
        /// </summary>
        /// <param name="tagName">tagName of element on the page</param>
        /// <returns>ReadOnlyCollection of IWebElement object so that you can interact that object</returns>
        public ReadOnlyCollection<IWebElement> FindElementsByTagName(string tagName)
        {
            SafeWebElementCollectionHandle collectionHandle = new SafeWebElementCollectionHandle();
            WebDriverResult result = NativeMethods.wdFindElementsByTagName(handle, parent, tagName, ref collectionHandle);
            ResultHandler.VerifyResultCode(result, "FindElementsByTagName");
            List<IWebElement> elementList = new List<IWebElement>();
            using (InternetExplorerWebElementCollection elements = new InternetExplorerWebElementCollection(driver, collectionHandle))
            {
                elementList = elements.ToList();
            }

            return new ReadOnlyCollection<IWebElement>(elementList);
        }