/// <summary> /// Remove a specific name/value pair. If the pair is in the collection more /// than once, this method will only remove one of them. /// </summary> public void Remove(string name, string value) { int i = IndexOf(name, value); WebAssert.True(i != -1, String.Format("Couldn't find form variable '{0}={1}' to remove in {2}", name, value, ToString())); variables.RemoveAt(i); }
private HtmlTagTester FindTagByForm() { XmlNodeList formNodes = browser.CurrentPage.Document.GetElementsByTagName("form"); WebAssert.True(formNodes.Count == 1, "The current page has more than one form. To test it, construct a WebFormTester and use it as the 'container' parameter for your other testers."); XmlElement formElement = (XmlElement)formNodes[0]; XmlAttribute id = formElement.Attributes["id"]; WebAssert.NotNull(id, "couldn't find web form's 'id' attribute"); return(new HtmlTagTester(id.Value)); }
/// <summary> /// Returns the only child (of a particular type) of this tag. If this tag has more /// that one child of the requested type, or if it has no children of the requested type, /// this method will throw an exception. Don't cache the results of this call. /// </summary> /// <param name="tag">The type of tag to look for. Don't include angle brackets.</param> public HtmlTagTester Child(string tag) { HtmlTagTester[] tags = Children(tag); WebAssert.True(tags.Length == 1, "Expected " + Description + " to have exactly one <" + tag + "> child tag."); return(tags[0]); }