AJAX TruClient – Parameterization, Text Verification and Object Identification

Everyday I see at least one discussion or thread related to Ajax TruClient protocol. Many performance engineers across the world are starting to use this protocol to test their web apps. Most of the questions on TruClient technology are based on three primary steps of scripting – Parameterization, Text Verification and Corelation. In this article, I will walk you through the steps required to incorporate these features in the scripts.


1) Create a parameter file in the TruClient script (eg. CityName)

2) Click on ‘Develop Script’ button of VUgen and open the TruClient script integrated with Mozilla Firefox.

3) Click on ‘Toolbar’ on the left pane and drag ‘Evaluate Javascript’ to the list of transactions.

4) Enter following Javascript code to store a value from the parameter file, in a variable.

Please note – LR.getParam() and LR.setParam() functions are available only after Patch 2 released on 11th version of LR. (V 11.02). If you have initial version, you will see ‘LR.getParam not defined error.’

5) To check if the correct value is stored in the variable, use either of the following javascript codes



A window popup will open during script replay. This will show the value stored in window.City OR abc.

6) To use the value in the argument section, just replace the text with the parameter name. However if you want to replace text in object section of a request, you make the replacement as mentioned below –

Original string :

Parameterized string:

Text Verification (Content Check)

As every performance intivar cream reviews tester knows, this is one of the most important steps in the scripting process. During replay, the tool should be able to identify if the request made to the server gives the intended response/output. We use content check functions to incorporate this scenario. AJAX TruClient also support text check feature –

From the functions section of toolbar, drag ‘Verify’ function and place it just after the web-request function.

The text in verification can also be parameterized. If you wish to replace the name in argument section, just replace ‘NewYork’, by ‘CityName’. However if replacing the name in argument section fails, then one might have to replace the name in ‘object’ section where using ‘window.’ suffix will be required before the variable name.

Object Identification

In Web 2.0 applications, the object properties change everytime the application is accessed and many times handling these dynamic changes using normal web protocol’s co-relation feature is challenging. In AJAX TruClient protocol scripts, one can very easily handle these dynamic changes using object identification capabilities. Thus minimizing the requirement of using a separate function for corelation.

Steps to perform object identification –

1) From ‘miscellaneous section’ of Toolbox, select ‘Evaluate JS on object’ –

2) Drag it to the page on which you want to perform object identification. Paste it below that page request.

3) Click on ‘Click to choose an object’ and choose the object. The script will select the right object for every replay. If it fails in any replay, just change the value of ‘Id Method’ in object section to Javascript.

14 thoughts on “AJAX TruClient – Parameterization, Text Verification and Object Identification

  1. Excellant blog. Your blog helped me solve most of my scripting issues pertaining to TrueClient and served as a great learning material. Thanks for such a wonderful post and keep posting.

  2. Is there a way to surround a group of Actions with an IF block?

    IF () {

    I realize I can make each action optional but then you have to wait for the timeout of each step. I have situations where if the first object is not available, then none of the objects that are the targets of the other Actions will also not be available.

  3. Can you provide tip on how to test for the existence of an object using the IF block of Ajax TruClient?

    I’ve tried the following as the Condition Argument in my IF block:
    (typeof document.idName != undefined) && (typeof document.idName != null))

    Which fails with:
    ** 5: If ([Exception]) ** failed – an argument is invalid: ‘Condition’: JavaScript exception ‘SyntaxError: missing ; before statement’ during evaluation

  4. BTW, My first comment of 8/28, and this comment, can be deleted/not approved for posting.

    As you can see, I’m continuing to try to figure out how to do this conditional testing.

  5. Hi.. your blog was so helpful. I am working with LR 11.0 and I am facing couple of issues using truclient protocol.
    1) Web resource graphs such as hits per second, throughput,etc are not being generated. It says “no data” while analysing the results

    2)Report is not being generated in MS Word format.

    3) and mainly, Parameterization doesn’t work.

    Do you think it’s a license issue? Please advice

  6. Hi..
    Can you please guide me on how to print a value after co-relating it? I have captured a value dynamically as per your steps, but I am unable to print it.
    Thank you.

  7. Hi..
    My question is: Is there any way to handle a dynamic text on a web page? For example, everytime I access a page, it has the customer’s name printed on the top and I want to print it. For every login, the customer name changes. Is there any way I can capture it and print?
    Thank you.

  8. Hi Swaraj,

    Thanks for writing this article. This is very helpful. What i was trying to do is that on one page i get 10-12 links and i want to randomly click on any one of these links. The same links will be displayed on the page everytime (in addition to other links). I know the text of the links so i created a Parameter in VuGen LinkText and add the values. Now in AjaxTruCient script, i read the value and store it in

    sMyLinkText = window.LinkText = LR.getParam(“LinkTest”)

    and when i print this value using LR.log, it gets printed correctly. Now on the step where i want to click on the link, i change the ID method “Automatic”—>”JavaScript”. In object Identification Original Text was

    i changed it to


    When i run this script in interactive mode, i keep getting following error.

    ** failed – target object was not found.

    I have not changed anything in “Step” and “Argument” subsection of this Step. Am i missing something here?

  9. Hi Swaraj,

    Excellent and very informative blog!
    In other scripts I use the hostname of the BPM machine ‘lr_get_host_name();’ to set different transaction names.
    Only two of the four BPM machines are to be used in SLA, so if the right hostname is found I append ‘_SLA’ to all transaction names.
    Is something like this possible in AJAX TruClient?

    Also, How can I add a line containing the contents of a variable to the logfile?

    Any help is much appreciated!

  10. Did you ever get the parametrization to work correctly? My parametrization works find in Load Runner but when I try run it using Performance Center it looks like it does not pull the value out of the parameter correctly.
    Here is a chunk from the Log file:
    t=00038540ms: ** 3.1: Evaluate JS DEI=LR.getParam(“DEI”) ** successfully completed [MsgId: MMSG-204250] [MsgId: MMSG-204250]
    t=00038540ms: ** 3.2: Type DEI in textbox (4) textbox ** started [MsgId: MMSG-204251] [MsgId: MMSG-204251]
    t=00058419ms: Error -203256: ** 3.2: Type DEI in textbox (4) textbox ** failed – target object was not found. [MsgId: MERR-203256] [MsgId: MERR-203256]
    End auto log messages stack. [MsgId: MMSG-10544]

    I would have expected a value to follow the Type DEI phrase.


  11. I have recorded and enhance the scripts in loadrunner 12.53 using truclient protocol.In developing mode all scripts are passing multiple iterations, but same scripts once you can reply in vugen then all scripts are failed and throw the error is “failed target object is not found”. And am also using “wait” and “wait for on object ” in my scipts. how can resolve this error?

  12. Hi,

    I new to this protocol i dont no full info about this Can you please tell me how to record the script in ajax true-client Lr(12.55).

    As of my knowledge i recorded the script and replay.while i am replaying getting error like this(Object not found)

    can you please suggest how to rectify this.

Leave a Reply

Your email address will not be published. Required fields are marked *