/// <summary> /// Submits a HTML form to the server /// </summary> /// <param name="client">HTTP client to use for submitting the form.</param> /// <param name="form">HTML Form to submit.</param> /// <returns>Returns the HTTP response received after submitting the form.</returns> public static Task <HttpResponseMessage> SubmitFormAsync(this HttpClient client, IHtmlFormElement form) { if (form == null) { throw new ArgumentNullException(nameof(form)); } var submitButton = form.QuerySelector("[type=submit]") as IHtmlElement; return(SubmitFormAsync(client, form, submitButton)); }