About the Data Selectors Panel
On the Data Selectors panel, you view and create data selectors – special rules for extracting data from server responses and saving this data to variables. You can then use the extracted values to parameterize subsequent requests or to check the response data.
LoadComplete uses the panel for these operations:
- Request (HTTP requests)
- WebSocket Connection (a request that establishes a WebSocket connection is a regular HTTP request that includes WebSocket-specific data.)
- WebSocket Server Message
Here are sample views of the panel:
By default, the Data Selectors panel is on the Response page
WebSocket Server Messages
Child items of a selector correspond to requests or client messages that use the data extracted by the selector. You can also view these requests and client messages in the Provides Data For panel displayed by default side-by-side with the Data Selectors list (see the image above).
You can double-click a request or client message under the selector to open a data replacer that inserts the extracted data to the request or client message.
Using Data Selectors
More information on creating data selectors:
|Rule||How the data selector was created:
Specifies the part of the response, from which the selector will extract data:
Used for HTTP requests only. For WebSocket messages, this column is hidden.
|Expression||Specifies the search pattern the data selector will use to find data. You can enter the search pattern manually, or specify one or multiple variables that form the needed pattern. See below for details.
The value you specify in the Expression column depends on what you set in the Area column:
Same as for the Body (RegExp) area of the HTTP request. That is, either a regular expression, or one or multiple variables. See above.
Note on setting the cell value
You can either enter the search expression in the cell, specify a single variable that contains the expression, or specify a combination of variables that form the needed expression.
To specify a variable, use the following syntax:
To concatenate variable values and data, use the
|Attributes||This column is used if the Area column has the Body (RegExp) or Header (RegExp) value, that is, if you create a regular expression for response body or header (or for a WebSocket message). For Cookie, Body (Path), and Header (Path) areas, the Attributes column is ignored.
If you specify a regular expression in the Expression column, then the Attributes column specifies a subexpression (or group) that points to the smaller piece of extracted data to be saved to the variable. Subexpressions (groups) are part of the regular expression enclosed in parentheses, for example:
The Attributes value should specify the subexpression in the format
|Variable||The variable, to which LoadComplete will save the extracted value. You can specify any variable available in your project, that is, the variable can be defined in the scenario you are editing, or in any other scenario of your project, or in any wizard. If the specified variable does not exist, LoadComplete will create it. If you specify an existing variable, LoadComplete will overwrite its value.|
|Convert||Specifies whether LoadComplete will encode or decode data after extracting them from the response. The variable, to which you save the extracted data, will store converted value. This is needed, for example, if you want to insert a variable to a header or cookie of the subsequent request, and this header’s or cookie’s value requires data in a different format than extracted data. A typical example is replacing URL-encoded characters (like %20, %2B, and others) and HTML entities (like &, <, >, and others) with their textual presentation, or vice versa. You choose the decoding or encoding format from the drop-down list. For more information on conversion, see Converting Correlation Data.|
Creating, Editing, and Deleting Data Selectors
You can create a data selector using a wizard or manually.
To create with a wizard:
Right-click anywhere within the Response tabbed page and choose Create data selector with wizard from the context menu. This will invoke the Create Data Selector wizard that will assist you in creating data selectors.
Follow the wizard instructions to create a data selector. LoadComplete will add the data selector to the selectors list.
To create manually:
Right-click anywhere within the Data Selectors list and choose New Item from the context menu. This will add a new row to the list.
Specify the desired values in the Area, Expression, Attributes, and Convert cells.
By default, when you create a data selector, LoadComplete automatically creates a variable that will store the extracted data. If needed, enter another variable name in the column. If the specified variable does not exist, LoadComplete will create it. You can also click in the column and select the needed variable in the resulting dialog.
Select the data selector you want to modify.
To edit a cell, right-click it and choose Edit from the context menu.
– or –
Select the cell and press F2.
– or –
Select the cell and then simply click it again.
Press Enter to confirm the changes, or press Esc to cancel them.
Right-click a data selector in the panel and select Delete from the context menu.