public IEnumerable <INativeElement> GetElementsWithQuerySelector(ICssSelector selector, DomContainer domContainer)
        {
            var container = "document";

            if (_element != null)
            {
                var elementTag = new ElementTag(_element.TagName);
                if (elementTag.Equals(new ElementTag("frame")) || elementTag.Equals(new ElementTag("iframe")))
                {
                    var frameHierarchy = _element.GetAttributeValue("data-watinFrameHierarchy");
                    container = frameHierarchy + ".document";
                }
                else
                {
                    var document = _element.AsHtmlElement.document;
                    var result   = new Expando(document).GetValue <string>("___WATINFRAMEHIERARCHY");

                    container = "";
                    if (result != null)
                    {
                        container = result;
                    }

                    if (!string.IsNullOrEmpty(container))
                    {
                        container += ".";
                    }

                    container += _element.GetJavaScriptElementReference();
                }
            }
            else
            {
                //container = CreateArray();
            }

            domContainer.RunScript(new ScriptLoader().GetSizzleInstallScript());

            var code = string.Format("document.___WATINRESULT = Sizzle('{0}', {1});", selector.Selector(true), container);

            domContainer.RunScript(code);

            return(new JScriptElementArrayEnumerator((IEDocument)domContainer.NativeDocument, "___WATINRESULT"));
        }
        public IEnumerator <INativeElement> GetEnumerator()
        {
            var result = new Expando(_ieDocument.HtmlDocument).GetValue(_fieldName);

            if (result == null)
            {
                yield break;
            }

            var resultAsExpando = new Expando(result);
            var length          = resultAsExpando.GetValue <int>("length");

            for (var i = 0; i < length; i++)
            {
                var element1 = resultAsExpando.GetValue(i.ToString()) as IHTMLElement;
                if (element1 != null)
                {
                    yield return(new IEElement(element1));
                }
            }
        }