Response ExtractForms Method C# API
Extracts all the HTML Form objects from the response content.

Namespace: Facilita.Web
Assembly: clrWebBrowser (in clrWebBrowser.dll) Version: (

public List<Form> ExtractForms()

Return Value

All the HTML Form objects in the response.

The usual reason for extracting a form is because some of the data on the form is needed in a subsequent request.

The following example demonstrates extracting multiple forms from a HTML Response.
Response response1 = request1.Send();
// Find a form in the response, and store it in a variable
List<Form> forms = response1.ExtractForms();

// This is a dynamic page, sometimes the login form is the second on the page
Form loginForm = null;
if (forms.Count == 2)
    loginForm = forms[1];
    loginForm = forms[0];


// Create a POST request that will send the modified loginForm back to the server
Request request2 = WebBrowser.CreateRequest(HttpMethod.POST, url2, 2);

// Fill in the form by specifying a username/password 
loginForm.GetInputElement("username").Value = "Bob Jones";
loginForm.GetInputElement("password").Value = "Pa55word";

// Attach the form to the request and send it to the server
Response response2 = request2.Send();
See Also