LoadRunner Practitioners Forum
Showing results for 
Search instead for 
Do you mean 

How to use Additional Attributes

Occasional Advisor

How to use Additional Attributes

[ Edited ]

How can i use the value of an additional attribute (from the Run-time settings) in my TruClient Ajax IE script.

For instance to replace a part of an url with this value so the script can be used on another testenvironment.

 

P.S. This thread has been moved from Performance Center Support and News Forum to LoadRunner Support Forum. -HP Forum Moderator

7 REPLIES
Trusted Contributor

Re: How to use Additional Attributes

Hi,

In your RunTime Settings(RTS) under 'Additional Attributes' add a new argument name and a argument value. For example: argument name 'Test' with value 'Hello'

Use the statement lr_get_attrib_string("<Argument Name>") to retrieve the argument value.

In our example use: lr_get_attrib_string("Test") to retrieve the value 'Hello'.
NB: If this solves your problem / helps you on the way, consider acknowledging with Kudos. To kudo a post, select the thumbs up icon in the gray square by the post in the thread.
Occasional Advisor

Re: How to use Additional Attributes

In the additional attributes i add a entry called Url.

In the TruClient for IE browser i have a step navigate to.

In the navigation field i enter lr_get_attrib_string("Url").

When i excecute this step i get an error:

 

 

ReferenceError: 'lr_get_attrib_string' is undefined

Highlighted
Trusted Contributor

Re: How to use Additional Attributes

Hi,

Store it in a parameter: lr_save_string(lr_get_attrib_string("Url"), "Url");

I'am not familar with the TruClient Ajax IE script but this trick works on web/html scripts.
NB: If this solves your problem / helps you on the way, consider acknowledging with Kudos. To kudo a post, select the thumbs up icon in the gray square by the post in the thread.
Occasional Advisor

Re: How to use Additional Attributes

When i use this code in a Evaluate JavaScript (or C) block, both lr_save_string and lr_get_attrib_string are undefined.

I am using vewrsion 11.50 vuGen.

Occasional Advisor

Re: How to use Additional Attributes

Perhaps it just works different in the TruClient protocol.

Has anybody an idea how?

Visitor

Re: How to use Additional Attributes

In Truclient it is 

 

LR.getLRAttr("<attrib_name>")

 

It is discribed in Vugen help >> Vugen >> Protocols >> Ajax Truclient >> Enhancing Ajax Truclient Script >> Ajax Truclient Functions

Frequent Visitor

Re: How to use Additional Attributes

Hi Lisa,

We use Additional Attributes extensivly in all our Skripts on all protocols (TC FF, TC IE, RDP, HTML/HTTP/REST, ...)

The trick is, you need to use C-funtions.c to fill parameters and use them in yout TC-Skript:

e.g. 

// Get addtional Addtribute URL from runtimesetting and copy it to Parameter URL

// Called from Action

void getURL()
{
    lr_save_string(lr_get_attrib_string("URL"),"URL");
}
  

// Get addtional Addtributes VTS and Port from runtimesetting and connect to VTS

// Called from INIT
void connectVTS()
{
    char  *VTServer;
    int   VTSPort; 
    PVCI2 pvci = 0;
    lr_load_dll("SharedParameter.dll");
    VTServer = lr_get_attrib_string("DatenVTS");
    VTSPort = lr_get_attrib_long("DatenVTSPort"); 
    pvci = lrvtc_connect(VTServer,VTSPort,VTOPT_KEEP_ALIVE);
}
// Get first-row from VTS

// Called from Action
void getData()
{
  lrvtc_retrieve_row ();
}

In you TC-Skript, add "Evaluate C function" with Funtion Name "GetData"  without "()" 

Type-Step with Value LR.getParam("Email") (JavaScript) for inserting Email-Adresses