A collection of HTML form variables. These form variables are sent to the server when you submit or postback a form. They consist of a name/value pair and are not required to be unique. You may include duplicate names or even duplicate name/value pairs in this collection. When writing custom testers, ReplaceAll and RemoveAll are typically the most appropriate methods to use.
コード例 #1
0
        internal FormVariables VariablesFor(string formHtmlId)
        {
            if (formVariables == null)
            {
                ParsePageText();
            }
            FormVariables result = (FormVariables)formVariables[formHtmlId];

            WebAssert.NotNull(result, "form ID '" + formHtmlId + "' not found on current page");
            return(result);
        }
コード例 #2
0
        private void ParseInitialFormValues(XmlElement formElement)
        {
            string id = formElement.GetAttribute("id");

            if (id == null)
            {
                return;
            }

            formVariables[id] = new FormVariables();
            ParseFormElementValues(id, "//input[@type='file']", "@name", "");
            ParseFormElementValues(id, "//input[@type='password']", "@name", "");
            ParseFormElementValues(id, "//input[@type='text']", "@name", "");
            ParseFormElementValues(id, "//input[@type='hidden']", "@name", "");
            ParseFormElementValues(id, "//input[@type='radio'][@checked]", "@name", "on");
            ParseFormElementValues(id, "//input[@type='checkbox'][@checked]", "@name", "on");
            ParseFormElementValues(id, "//textarea", "@name", null);
            ParseFormElementValues(id, "//select/option[@selected]", "../@name", null);
        }