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 void Should_be_equal_when_comparing_lower_with_uppercase_tagname() { // GIVEN var tagLowerCase = new ElementTag("frame"); var tagUpperCase = new ElementTag("FRAME"); // WHEN var isEqual = tagLowerCase.Equals(tagUpperCase); // THEN Assert.IsTrue(isEqual, "Casing should not be relavent"); }
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"); }