private bool HasElement(IElementContainer elementContainer, string tagName, string text) { return(elementContainer.ElementsWithTag(new List <ElementTag> { new ElementTag(tagName) }) .Filter(Find.ByText(text)) .Any()); }
static public ElementCollection GetElementsByTag(this IElementContainer container, string tagName, Constraint constraint) { string[] parameters = null; if (tagName.ToLower() == "input") { parameters = new string[] { "checkbox", "text", "hidden", "radio", "password", "button", "submit", "reset", "file", "image" }; } ElementCollection elements = null; elements = container.ElementsWithTag(tagName, parameters); if (constraint != null) { elements = elements.Filter(constraint); } if (!elements.Any()) { Browser browser = container as Browser; if (browser != null) { foreach (var frame in browser.Frames) { elements = frame.ElementsWithTag(tagName, parameters); if (constraint != null) { elements = elements.Filter(constraint); } if (elements.Any()) { break; } } } } return(elements); }