Example #1
0
        /// <summary>
        ///
        /// </summary>
        public static HtmlElement GetElementByID(this HtmlWindow elFrame, string value)
        {
            if (elFrame.IsNull() ||
                elFrame.Document.IsNull())
            {
                return(null);
            }

            return(elFrame.Document.GetElementById(value));
        }
Example #2
0
        public static HtmlWindow GetWindowFrame(this HtmlWindow frame, string frameName)
        {
            if (!frame.IsNull() &&
                !frame.Document.IsNull() &&
                !frame.Document.IsNull() &&
                !frame.Document.Body.IsNull() &&
                !frame.Document.Body.OuterHtml.IsNull() &&
                frame.Document.Body.OuterHtml.Contains(frameName))
            {
                return(frame.Document.Window.Frames[frameName]);
            }

            return(null);
        }
Example #3
0
        public static HtmlElement GetElementByTag(this HtmlWindow elFrame, string tagName, string value)
        {
            if (elFrame.IsNull() ||
                elFrame.Document.IsNull())
            {
                return(null);
            }

            HtmlElementCollection elCol = elFrame.Document.GetElementsByTagName(tagName);

            foreach (HtmlElement elItem in elCol)
            {
                if (elItem.GetData().Contains(value))
                {
                    return(elItem);
                }
            }

            return(null);
        }
Example #4
0
        public static HtmlElement GetElementByTag(this HtmlWindow elFrame, string tagName, string attributeName, string value, HtmlElement el = null, bool contains = false)
        {
            if (elFrame.IsNull() ||
                elFrame.Document.IsNull())
            {
                return(null);
            }

            HtmlElementCollection elCol = el.IsNull()
                                          ? elFrame.Document.GetElementsByTagName(tagName)
                                          : el.GetElementsByTagName(tagName);

            foreach (HtmlElement elItem in elCol)
            {
                if (elItem.HasAttributeData(attributeName, value, contains))
                {
                    return(elItem);
                }
            }

            return(null);
        }