Inserting Variables Into Cookies

Applies to LoadComplete 4.97, last modified on May 20, 2019

You can use data replacers to replace recorded cookies in requests with variables that contain data extracted from preceding responses or that LoadComplete generates or gets from external files.

Note: Make sure that LoadComplete uses real-time cookies; otherwise, it will ignore cookie replacers during scenario simulation.

Why insert variables into cookies

Web applications can use cookies to maintain user or session information. You need to pass a proper cookie to the server to get access to the server resources.

Inserting variables into cookies

  1. Open your scenario in the Scenario editor. To do this, double-click the scenario in the Project Explorer.

  2. To insert data into all requests, select the top-level node in the scenario and switch to the Data Replacers page.

    To insert data into an individual request, select the needed request and switch to the Data Replacers tab at the bottom of the page.

  3. Add a new data replacer:

    • In the Area column, select Cookie.

      Note: To replace cookie values, we recommend using the Cookie value in the Area column rather than Header (Path) or Header (RegExp).

    • In the Expression column, enter the name of the cookie whose value you want to replace with the variable. You can also specify a variable that contains the desired value:

      • Click and select a variable that contains the cookie name,

        – or –

      • Enter the variable name manually, in the \vVariableName\v or @VariableName format.

        If you want to concatenate a variable with another variable or arbitrary data, use the \vVariableName\v syntax:


        @VariableName values cannot be concatenated in place.

    • In the Attributes column, enter cookie attributes (if needed).

    • In the Variable column, select the needed variable.

    Using Variable to Specify a Cookie

    Click the image to enlarge it.

Select File > Save from the main menu to save the changes you have made.

See Also

Data Correlation
Parameterizing Requests
Using Variables
Extracting Data From Responses
Managing Cookies

Highlight search results