public override bool Compare(Interfaces.IAttributeBag attributeBag)
        {
            // Get a reference to the element which is probably a TextField, Checkbox or RadioButton
            IHTMLElement   element  = ((ElementAttributeBag)attributeBag).IHTMLElement;
            IHTMLDocument2 document = (IHTMLDocument2)element.document;

            // Only supports input and textarea elements
            if (element.tagName != ElementsSupport.InputTagName && element.tagName != "textarea")
            {
                return(false);
            }

            // Get all text and filter this for the phrase, building a bounding box for each instance
            verifyLabelElements(document);

            // If no matching text then this there is no field
            if (labelElements == null || labelElements.Count == 0)
            {
                return(false);
            }

            // Get all the form field elements
            verifyFieldElements(document);

            // If no form field elements where found then there is not match
            if (fieldElements == null || fieldElements.Count == 0)
            {
                return(false);
            }

            // Measure the 'proximity' of each valid text node to the input elements and find the closest form element
            if (nearestFormElement == null)
            {
                findNearestFormElement(document);
            }

            // If no form field elements where found to be 'near' the tex then there's no match
            // NB: This can't really happen at this point unless there's something really screwy going on
            if (nearestFormElement == null)
            {
                return(false);
            }

            // Is this the form element we're looking for?
            bool elementFound = false;

            if (element.id == nearestFormElement.id)
            {
                elementFound = true;
            }

            return(elementFound);
        }
        /// <summary>
        /// This method expects an <see cref="ElementAttributeBag"/> which it will use
        /// to determine if the element wrapped by the <see cref="ElementAttributeBag"/> is
        /// the element for which a label is specified with the searched for innertext.
        /// </summary>
        /// <param name="attributeBag">Value to compare with</param>
        /// <returns>
        ///     <c>true</c> if the searched for value equals the given value
        /// </returns>
        protected override bool DoCompare(Interfaces.IAttributeBag attributeBag)
        {
            // Get a reference to the element which is probably a TextField, Checkbox or RadioButton
            IHTMLElement element = ((ElementAttributeBag)attributeBag).IHTMLElement;

            // Get all elements and filter this for Labels
            if (labelIdsWithMatchingText == null)
            {
                InitLabelIdsWithMatchingText(element);
            }

            return(labelIdsWithMatchingText.Contains(element.id));
        }