Ejemplo n.º 1
0
        public static String GetValue(this IWebElement element, ChromeDriver driver = null, String attribute = "", String defaultValue = "")
        {
            String value = defaultValue;

            if (String.IsNullOrEmpty(attribute))
            {
                if (!element.Displayed && driver != null)
                {
                    value = driver.ExecuteScript("return arguments[0].textContent", element).ToString();
                }
                else
                {
                    value = element.Text;
                }
            }
            else
            {
                value = element.GetAttribute(attribute);
            }
            if (!String.IsNullOrEmpty(value))
            {
                value = WebExtension.DecodeHtml(value);
                value = WebExtension.DecodeUrl(value);
            }
            return(value);
        }
Ejemplo n.º 2
0
        public static String GetValue(this HtmlNode nodeParent, String xPath, String attribute = "", String defaultValue = "", Boolean removeReturn = true)
        {
            String   returnValue = defaultValue;
            HtmlNode node        = String.IsNullOrEmpty(xPath) ? nodeParent : nodeParent.SelectSingleNode(xPath);

            if (node != null)
            {
                returnValue = WebExtension.DecodeHtml(node.getValue(attribute), removeReturn: removeReturn);
            }
            return(returnValue);
        }
Ejemplo n.º 3
0
        public static String GetInnerText(HtmlNode nodeParent, String xPath)
        {
            String   returnValue = String.Empty;
            HtmlNode node        = nodeParent.SelectSingleNode(xPath);

            if (node != null)
            {
                returnValue = WebExtension.DecodeHtml(node.InnerText.Trim());
            }
            return(returnValue);
        }
Ejemplo n.º 4
0
 private static String getValue(this HtmlNode node, String attribute = "")
 {
     return(String.IsNullOrEmpty(attribute) ? WebExtension.DecodeHtml(node.InnerText.Trim()) : node.GetAttributeValue(attribute, "").Trim());
 }