TruClient Parameter from Site

Hello,

 

Is is possible to set a parameter from values on a page that TruClient navigates to?  I have a page with the following:

 

FirstName

LastName

Email

GUID

 

All are input boxes.  I want to pull the values from these boxes and write them to a parameter.

 

Any help is appreciated.

 

Thanks!

Cody-

  • Verified Answer

    Hi,

     

    You can get the text from these input fields and store them into a runtime parameters or a regular JavaScript variables. In both cases you will be able to use them during the current Vuser run. If you wish to store the values to a later use you will need to save the data to a file.

     

    How to get the text from the input fields

    1. Add a "Generic Object Action" step from the toolbox

    2. Choose the object from which you wish to get the text

    3. Change the action of the step from Click to "Get Property"

    4. Expand the Arguments section of the step and select "Visible Text"

    5. In the variable field give a variable name (e.g. strFirstName) to which TruClient will save the data (now you can use this variable later on your script

    6. If you wish to save the data to a runtime parameter, add an "Evaluate JavaScript" step from the toolbox and in the code section write: TC.setParam("prmFirstName", strFirstName); 

     

    If you wish to save the data to a file as a design time parameter it is more complex since this functionality does not exists in LoadRunner in any protocol. It can be done using TruClient IO functions but you will need to understand the inner structure ofLoadRunner parameter file (the script prm file). I do not recommend going there.

     

    Regards,

    Shlomi

  • Hi Shlomi,

     

    After I set the parameter by using the Get Property, how can I use it the following step?  Or do I need to set it as a Runtime parameter first?

     

    I have this in a navigate step, JS, and it doesn't work right now.

     

    "">mysite/Activate TC.getParam("strEmail") "&code=" TC.getParam("strGUID")

     

    Thanks,

    Cody-

  • Before the navigate step, did you add javascript step to TC.setParam("strEmail", strEmail);  TC.setParam("strGUID", strGUID); ?

     

    It's better you verify the runtime parameter value is set correctly.

    After the step to set parameter, you can add another javascript step  TC.log(TC.getParam("strEmail"));