Beispiel #1
0
        /// <summary>
        /// Submits the given form by using the dictionary which contains name
        /// value pairs of input fields to submit.
        /// </summary>
        /// <param name="form">The form to submit.</param>
        /// <param name="fields">The fields to use as values.</param>
        /// <param name="createInputIfNoFound">What to do if some field/s have not found in the form. If true, then new input will be created.
        /// If false, KeyNotFoundException will be thrown.
        /// The default is false.
        /// </param>
        /// <returns>The task eventually resulting in the response.</returns>
        public static Task <IDocument> Submit(this IHtmlFormElement form, IDictionary <String, String> fields, bool createInputIfNoFound = false)
        {
            if (form == null)
            {
                throw new ArgumentNullException("form");
            }

            if (fields == null)
            {
                throw new ArgumentNullException("fields");
            }

            form.SetFieldsValues(fields, createInputIfNoFound);
            return(form.Submit());
        }