Response ExtractForm Method (String, ActionType)C# API
Extracts an HTML Form with the specified formName from the response content, and take the specified failAction if no matching form can be found.

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

public Form ExtractForm(
	string formName,
	ActionType failAction
)

Parameters

formName
Type: System String
The name of the Form to look for in the response.
failAction
Type: Facilita.Fc.Runtime ActionType
The action to take if no matching form can be found.

Return Value

A Form with the specified formName.
Remarks

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

The following example demonstrates extracting a Form from a Response, changing the Form values and sending it back as another Request. If the Form cannot be found in response1 then a warning will be issued in the Virtual User event log.
Response response1 = request1.Send();
// Find the loginForm in the response, and store it in a variable
Form loginForm = response1.ExtractForm("loginForm", ActionType.ACT_WARNING);

...

// 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
request2.SetMessageBody(loginForm);
Response response2 = request2.Send();
See Also