Highlighted
Absent Member.. Absent Member..
Absent Member..
1977 views

TruClient Parameter from Site

Jump to solution

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-

0 Likes
1 Solution

Accepted Solutions
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: TruClient Parameter from Site

Jump to solution

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

View solution in original post

0 Likes
4 Replies
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: TruClient Parameter from Site

Jump to solution

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

View solution in original post

0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

Re: TruClient Parameter from Site

Jump to solution

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.

 

"https://mysite/Activate?email=" + TC.getParam("strEmail") + "&code=" + TC.getParam("strGUID")

 

Thanks,

Cody-

0 Likes
Highlighted
Absent Member.
Absent Member.

Re: TruClient Parameter from Site

Jump to solution

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"));

0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

Re: TruClient Parameter from Site

Jump to solution

Got it working, thanks for your help!

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.