Follow a link from the previous request
Extracts and follows a link matching a dynamic definition. This option should be used when a scenario includes a click on a dynamically-generated link. The link from the results of the preceding request (referrer) are dynamically extracted and followed. The referrer may be changed by clicking on Change the referrer; note that the referrer must always be located earlier in the scenario than the current request.
When defining the link to be extracted, you may specify the HTML attributes of the link to be followed (name, id, link text, alt
), or define all the link elements (URL, parameters). A typical case is where one or more of the link parameters are dynamic.
Note: j98When 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 links 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. Each parameter in the definition must be present in the link to be extracted. NeoLoad will be able to use a link that contains additional parameters to those present in the definition.
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 link, you may automatically create NeoLoad variables containing the parameter values when the link is executed. This allows extracting the dynamic part of the link and using it in subsequent requests. If, for example, the application frequently uses the same dynamic parameter, you may define a Link 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 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:
-
The value must be an expression. The value expression may contain plain text and NeoLoad variables. The link that NeoLoad is going to extract must contain this parameter with this value. This implies that the value is static and that any link containing this parameter but with a different value should be ignored.
-
The parameter must exist, whatever its value. The link that NeoLoad is going to extract must contain this parameter, whatever its value. 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.
-
The value must match a regular expression. The link that NeoLoad is going to extract must contain the parameter and the value must match the regular expression. This generally implies that part of the parameter value is dynamic and is not known beforehand. The value used may then be placed in a NeoLoad variable by editing the Extract in variable column in the parameters table
Example
An interesting example may be a web application generating a search id named searchID
, and this id being transferred from page to page as a request parameter. The request recording looks like this:
During a test, NeoLoad will play back the request using the searchID that was recorded. Therefore, you need to replace the searchID with the appropriate value. The preceding page contains the following link: <a href="http://loadtestauth/loadtest/search/index.jsp?searchID=<mygoodsearchid>&page=2">Page2</a>
So this manual request must be changed to a "Follow a link from the previous request" type:
For example, the searchID
value is set at <MUST BE PRESENT>
, which means that the searchID
may have any kind of value. Using this configuration, NeoLoad will search for a link using:
-
the path:
/loadtests/search/index.jsp
. -
a page parameter with a value of 2.
-
a
searchID
parameter.
As the server response contains only one link matching the description, NeoLoad will use this link with the searchID
parameter value present in the server response.
You can also set the page parameter to <MUST BE PRESENT>
. If the response contains several links such as:
<a href="search.php?searchID=<mygoodsearchid>&page=2">page2</a>
<a href="search.php?searchID=<mygoodsearchid>&page=3">page3</a>
<a href="search.php?searchID=<mygoodsearchid>&page=4">page4</a>
All these links match the definition and NeoLoad will select either one at random or a specific occurrence, depending on how the parameter has been configured.