コード例 #1
0
        /// <summary>
        /// Creates an element finder.
        /// </summary>
        /// <param name="domContainer">The DOM container</param>
        /// <param name="factory">The factory to get the element(s) to search in</param>
        /// <param name="elementTags">The element tags considered by the finder, or null if all tags considered</param>
        /// <param name="constraint">The constraint used by the finder to filter elements, or null if no additional constraint</param>
        public NativeElementFinder(NativeElementCollectionFactory factory, DomContainer domContainer, IList<ElementTag> elementTags, Constraint constraint)
            : base(elementTags, constraint)
        {
            if (factory == null)
                throw new ArgumentNullException("factory");
            if (domContainer == null)
                throw new ArgumentNullException("domContainer");

            this.factory = factory;
            this.domContainer = domContainer;
        }
コード例 #2
0
        public static NativeElementFinder CreateNativeElementFinder <TElement>(NativeElementCollectionFactory factory, DomContainer domContainer, Constraint constraint)
            where TElement : Element
        {
            var finder = new NativeElementFinder(factory, domContainer, ElementFactory.GetElementTags <TElement>(), constraint);

            if (!typeof(TElement).Equals(typeof(Element)))
            {
                finder.WrapNativeElementFactory = (dom_container, native_element) => { return(ElementFactory.CreateElement <TElement>(dom_container, native_element)); };
            }

            return(finder);
        }
コード例 #3
0
        /// <summary>
        /// Creates an element finder.
        /// </summary>
        /// <param name="domContainer">The DOM container</param>
        /// <param name="factory">The factory to get the element(s) to search in</param>
        /// <param name="elementTags">The element tags considered by the finder, or null if all tags considered</param>
        /// <param name="constraint">The constraint used by the finder to filter elements, or null if no additional constraint</param>
        public NativeElementFinder(NativeElementCollectionFactory factory, DomContainer domContainer, IList <ElementTag> elementTags, Constraint constraint)
            : base(elementTags, constraint)
        {
            if (factory == null)
            {
                throw new ArgumentNullException("factory");
            }
            if (domContainer == null)
            {
                throw new ArgumentNullException("domContainer");
            }

            this.factory      = factory;
            this.domContainer = domContainer;
        }