Submit a form from the previous request

Extracts and submits a form from a form in the previous request. This option should be used when a scenario includes the submission of a form containing a dynamic hidden field. The form from the results of the preceding request (referrer) are dynamically extracted, allowing the dynamically extracted values to be submitted.

Using this option allows defining a target form on which to work. Selecting the form is done through the button in the Extracted Form section, which displays a new window with further options. Once the form has been selected, the forms various elements can be used in the request to be submitted (URL, parameter value).

Define the form to be extracted

The form to be extracted must be present in the response to the referring request. You may change the referrer by clicking the Change the referrer button; note that the referrer must always be located earlier in the scenario than the current request. Three options are available when defining the form to be extracted:

  • Form id or name HTML attribute. This field may contain a regular expression.

  • Form occurrence within the page (e.g. extract the 2nd form in the server response).

  • Form matching the following definition: URL and parameter names are required (NeoLoad will not be able to use a link that contains additional parameters to those present in the definition).

Note: When using a regular expression for the HTML attribute or for the path, the regular expression special characters must be escaped. The following characters must be escaped using "\" : [ ] ^ \ { } ( )

Where several forms in the server response match the definition, the last option in the panel allows extracting a link randomly or specifying the occurrence to be extracted.

Request parameters

Parameter definition is used to define, in particular, the request dynamic parameters.

Editing a parameter name or value is done in a dedicated window. Double-click on a name or value in the parameters table to open the window.

When extracting a form, you may automatically create NeoLoad variables containing the parameter values when the form is submitted. This allows extracting a dynamic parameter in a form and using it in subsequent requests. If, for example, the application frequently uses the same dynamic parameter, you may define a Form Extractor at the parameter first use and use the variable in all the other requests that use that same parameter. This avoids multiplying searches in the server response pages and results in better Load Generator performance.

Parameter Name

The name may contain plain text or a NeoLoad variable. When the Encode name box is checked, the specified name is encoded in MIME application/x-www-form-urlencoded format before being submitted (e.g. spaces are encoded as %20). Clear the check box if the name is already encoded.

Parameter Value

Three options are available for the parameter value:

  • Use an expression. The value expression may contain plain text and NeoLoad variables. The value may comprise several lines.

  • Use value from extracted form. NeoLoad will use the value from the extracted form for the parameter. This generally implies that the parameter value is dynamic and is not known beforehand. This dynamic value may then be placed in a NeoLoad variable by editing the Extract in variable column in the parameters table. Each Submit a form from the previous request-type request is presumed to contain at least one parameter of this type.

  • Use an extracted value. This option allows defining a value extracted from a previous server response. It should be used typically in cases where a dynamic value generated by the server does not appear in the form HTML code (otherwise the Use value from extracted form option is more appropriate). Usually, if the parameter value is generated in JavaScript, the value must be extracted using a Variable Extractor.

The extractor to be used can be modified manually using the Edit button. Clicking the button displays the Variable Extractors interface, giving you the additional option of selecting the request on which the extraction should be carried out. If no configuration is applied, NeoLoad offers the option of configuring the extractor automatically. For more information, see Variable extractors.

The Add to framework button allows moving the Variable Extractor as a Framework parameter and carrying out a dynamic parameter search.

Clicking the Automatic configuration button starts a search for the parameter in the previous requests. NeoLoad searches the previous requests for the parameter value and for the best regular expression to extract it. If one of the tested configurations works, NeoLoad will replace the existing extractor with the one found.

Example

An interesting example may be an application with a search form such as this one:

<form name="searchform" method="POST" action="search.jsp">
<input type="text" name="name" size="30" value="">
<input type="text" name="city" size="30" value="NY">
<select name="country" id="country">
<option value="US">US</option>
<option value="Canada">Canada</option>
<option value="China">China</option>
<option value="France">France</option>
<option value="UK">UK</option>
</select>
<input type="radio" name="fastsearch" value="YES">
<input type="radio" name="fastsearch" value="NO">
<input type="hidden" name="computedValue" value="4235">
<input type="submit" name="Submit" value="Submit">
</form>

For example, the computedValue hidden field is generated server-side and is different for each call.

The recorded request looks like this:

During a test, NeoLoad will play back the request using the value for the computedValue parameter as recorded. It needs to be replaced with the appropriate value, so the manual request type must be changed into a Submit a form from the previous request type:

Using <FORM VALUE> as the value for computedValue allows extracting the value generated by the server.

Furthermore, using <FORM VALUE> for the country field means you can choose a random value among those available for this option. Likewise, the fastsearch field will have a random YES or NO value during the test.

Therefore, the Form Extractor not only allows extracting the dynamic values generated by the server, it also allows using the various form choices in a random manner.