/// <summary> /// Recursively builds the innerText of this element and all its child elements. /// </summary> private string GetInnerTextRecursively(bool showHidden) { if (showHidden == false) { HtmlElementAttributeReader attributes = GetAttributes(); if (attributes.Style.Display == Display.None || attributes.Style.Visibility == Visibility.Hidden) { return(""); } } StringBuilder childrensInnerText = new StringBuilder(_innerText); for (int i = 0; i < this.ChildElements.Count; i++) { childrensInnerText.Append(" " + this.ChildElements[i].GetInnerTextRecursively(showHidden)); } return(childrensInnerText.ToString().Trim()); }
/// <summary> /// Returns whether this element is visible on the browser /// </summary> public bool IsVisible() { HtmlElementAttributeReader attributes = this.GetAttributes(); return(attributes.Style.Display != Display.None && attributes.Style.Visibility != Visibility.Hidden); }
/// <summary> /// Method that refreshes the latest attribute dictionary for this element /// </summary> public HtmlElementAttributeReader GetAttributes() { this.RefreshAttributesDictionary(); _attributeReader = new HtmlElementAttributeReader(this); return(_attributeReader); }