How can i capture a dynamic created value and use it later on within the TRUE CLIENT functionality.

within the application a new dynamic unique record is created. for example 00001 

I want to use this number later on in my script to search this record and delete it.


How can i capture this value and use it later on within the TRUE CLIENT functionality.

Is it within the Verify functionality ? maybe someone already done this.........

  • I have the same question. Try to Capture an amount from the screen which is different for every user. I need an update on this amount which need to be a bigger value otherwise the application gives a war

    ning. So how do I capture this value when i enter the screen and give an higher value when i do an update ?

  • Hello!


    Try the following:



    AJAX TruClient - Correlation


    The following describes how to do some kind of correlation in AJAX TruClient protocol. The flow in my case is to create a new offer record, take the generated offer number from the screen, search for this number in the search dialog and change the record to be shure that the new record was processed and correlation worked as desired.


    Everything needs to be done in Firefox (Develop script)!


    Step 1

    After recording find the skript step where the offer number is shown on the screen. I think this should be the earliest step where the value appears at the first time.


    Step 2

    Open the Toolbox and drag the step "Verify" from the "Functions" area after the step located above.


    Step 3

    The new inserted step displays the value 'Click to choose an object'. Before this is clicked it is necessary to navigate in Firefox to the screen that contains the value that has to be correlated.


    Step 4

    Click the value 'Click to choose an object' in the new step and touch the value that has to be correlated in Firefox. The area of this value is highlited in green.

    The description of the script step changes to something like: '"Visible Text" contains "AP1-197269-01E"'.


    Step 5

    Expand the new step and open the "Step" area. Substitute the value for "Action" to use "Get Property" instead of "Verify"


    Step 6

    Open the "Arguments" area. Select the property "Visible Text" and enter the name for the variable. This name needs to be enclosed in double quotation marks. In this example it will be "Angebotsnummer".


    Step 7

    Open the "Object" area. Select the "ID Method" as "XPath". Then select in the drop down list for "XPath" field the value that does not contain the explicit value. For example i do NOT select this "//span[text()="AP1-197269-01E"]", i select this "/html/body/form/table[2]/tbody/tr[2]/td/table[6]/tbody/tr/td[2]/table/tbody/tr/td[2]/span[2]".


    Step 8

    To verify if the above configuration is correct, open the Toolbox again and add one more step. Drag the step "Evaluate JavaScript" from the "Miscellaneous" area after the step just created above.


    Step 9

    Expand the new step and open the "Arguments" area. Enter the command "window.alert(Angebotsnummer)" (without double quotes) in the field "Code".


    Step 10

    Execute the script to verify the success. The step created above will cause an alert window pop up that displays the value captured from the screen. This should be the same like in the application.


    Step 11

    Reuse the captured value as input for the search dialog to find the newly created offer number. To do this the according step where the number is used as input needs to be found. In my case the step contained the information 'Type "AP1-197269-01E" in Angebotsnummer textbox' was displayed in the step.


    Step 12

    Expand the step and open the "Arguments" area. Substitute the existing value "AP1-197269-01E" by the variable name "Angebotsnummer" (without double quotes).


    Step 13

    Delete the step where the alert pop up was inserted, because it will disturb the script flow.




    I do not know how to correlate values that are not displayed on the screen and i do not know if this is necessary in AJAX TruClient.





  • Hi,

    This works with AJAX True Client, but I can't use this approach, because object returns string: "Trade with number 10000069874 0 saved successfully".  I need to extract only trade number (10000069874) in order to enter this number in search box in later steps. Does anybody know how to do this?

  • I too have same challenge where I need to capture only "EXP3615736" in "Expense Report EXP3615736",I can capture dynamic value of "Expense Report EXP3615736" from Xpath.Please let me know solution  if you resolved the issue

  • Add a little javascript:

    Use xpath expression to get the text.

    Use other javascipt functions to extract what you need

    Save the result as a LR parameter, so you can use it in your script again.

    Note: watch the namespace(s) you have to use with javascript.

  • Hi JHF, 

    your suggestion is interesting. Can you explain me in details how can I save values in a parameter using TruClient? As XTom had explained, I've insered the correct step to catch the object to correlate (a bank code, for example) and in fact if I add a print message step I can see different values for different users. My doubt is: how can I create a new parameter, save all the possible values and re-use that ones? The problem is that the "object captored" is not a parameter but a variable, so I can't use TC.getParam function...

    Thanks in advance!


  • You can use java script to find objects and execute a step on an object. I had the situation that I had to wait till 6 graphs were updated. All contained in their own IFRAME. So I marked each graph by overwriting a value.

    A: First I identified number of graphs on my form. I used 'Evaluate JS on Object':
    Object referencing was:

    //Identify amount of Graphs
    // This call handles first found graph
    var descs = evalXPath("//desc[text() = 'Created with  2.0.1']");
    // Store the amount of graphs minus one in a global variable
    ArgsContext.Global.graphs = descs.length - 1;
    // LR Parameter Graphs contains number of graphs.
    ArgsContext.LR.setParam('Graphs', '' descs.length ); // Select first argument descs[0];

    Arguments was:

    // Change content as marker
    object.textContent = '*';

    B: Then I looped over the other Global.graphs entries with a for-loop with Arguments:
    Init: var i = 0
    Condition: i < Global.graphs
    Increment: i

    In the for loop I repeated the above mentioned code of A, except setting ArgsContext.Global.graphs

    C: Later I waited for Parameter Graphs' occurences with text() = 'Created with 2.0.1' again, so I know all graphs are updated with a Wail until ... exists:
    Object was a Descriptor with some properties and Object Ordinal was JS:


    With this it should not be difficult to capture your (list of) params. You can set P_1, P_2, .. P_N and then P_count=N to make an array paramater and use it later with array param functions. Or you skip Params and store all your data into JS Global-variables.

    Note however that you cannot save a reference to a DOM-object into a JS Global.var by using evalXPath(), but you can save data out of the returned references in JS Global.var or LR parameters.


  • Thanks JHF for your gentle response!

    I had used the lineup of operations suggested by XTom: after focusing on the object value to correlate, I had create a variable in the form "Variable"  from the target "Arguments" of a "Verify" step ("Property = Variable Text") and the replay of the script goes well. My doubt is that I can't use the variable like a parameter, so I can't use TC.getParam or similar functions to handle parameters. 

    Do you have any suggestions to use a variable in such way to capture all possible value for the object captured? Just like a Web HTTP-HTML correlation's parameter. 

    Thanks again, 


  • Hi Lorenzo ( ),

    I think that the elements are available in my post, but you have to start engineering with javascript.

    Unless you have a public available website that shows the structure and pattern you like to apply, this is all I can do at the moment.


Reply Children