LoadRunner Truclient Ajax failed – an argument is invalid: ‘Code’: JavaScript exception ‘ReferenceError: LR is not defined’ during evaluation

  • Questions
  • Load/Performance Testing
  • LoadRunner Truclient Ajax failed - an argument is invalid: 'Code': JavaScript exception 'ReferenceError: LR is not defined' during evaluation
Question ID: 104256
0
0

Using the new TruClient Protocol, the Development Environment Stopped idenifing LR.getParam and other Javascript commands. It seems to have completely lost the libraries for these commands. The error in the replay log says: Evaluate JS Username=LR.getParam("ParameterName1") ** failed – an argument is invalid: ‘Code’: JavaScript exception ‘ReferenceError : LR is not defined’ during evaluation

Marked as spam
Posted by (Questions: 36, Answers: 3)
Asked on October 21, 2010 4:35 pm
143 views
Answers (9)
3
Private answer

LR 11.0 only supports the version of FireFox that is distributed with LR, FireFox 3.6.3. If the installation has been updated LR won't work properly with it.

Marked as spam
Posted by (Questions: 6, Answers: 167)
Answered on October 22, 2010 11:45 pm
2
Private answer

The Firefox upgrade is one cause for this error. There is another I will describe here that I've encountered.

LR. is only defined in two places that I have found, Evalute Javascript blocks and when entering data via 'Type' style entry in the Arguments Value box. If you want to use LR. inside the 'Object' section of a step, then you have to be clever about it.

1. First add a Evaluate JavaScript step to your script. Make sure it comes after the navigate step. In this step have something like:
**`window.myGlobalVar = LR.getParam(''somevariable'');`**
2. Now in your Object section of a step or anywhere you should change the 'ID Method' to JavaScript. This will autocreate an 'evalXPath statement'. You would modify it to match your global variable name in the earlier JS step. Example:
**evalXPath(''//div[text()='''' + window.myGlobalVar + '''']'');**

Marked as spam
Posted by (Questions: 1, Answers: 3)
Answered on June 3, 2011 1:10 pm
1
Private answer

Use LR.getParam("ParamName") instead

Marked as spam
Posted by (Questions: 0, Answers: 2)
Answered on October 26, 2010 8:43 am
I did, that was just a typo in the question asked here. The solution ended up being to not upgrade the firefox 3.6.3 that is installed with LR. I had made it my default browser and subsequently let it update. This made LR stop working in interactive mode.
( at October 26, 2010 1:46 pm)
1
Private answer

Evaluate JS Username=LR.getParam(''ParameterName1'') ** failed - an argument is invalid: 'Code': JavaScript exception 'ReferenceError : LR is not defined' during evaluation

It seems that you are trying to replay a single step with parameter. It doesn't work in this way. Parameters will work only if you will replay entire script.

Marked as spam
Posted by (Questions: 0, Answers: 1)
Answered on May 1, 2011 9:53 am
0
Private answer

Did you find an answer to this, I am experiencing the same exact problem. Please post solution if you find it.

Marked as spam
Posted by (Questions: 0, Answers: 1)
Answered on October 22, 2010 5:19 pm
0
Private answer

How do I capture data from the application screen, during AJAX Truclient processing?
classic WEB_REG... not allowed.

Marked as spam
Posted by (Questions: 2, Answers: 1)
Answered on February 10, 2011 2:49 pm
0
Private answer

its not working for me...i followed same steps but still it shows this error:
Evaluate JS Username=LR.getParam(''ParameterName1'') ** failed - an argument is invalid: 'Code': JavaScript exception 'ReferenceError : LR is not defined' during evaluation

Marked as spam
Posted by (Questions: 4, Answers: 5)
Answered on April 3, 2012 7:08 am
0
Private answer

You will find the answers you are looking for here: SQAForums SWales - TruClient Knowledgebase
[link text][1]

[1]: http://www.sqaforums.com/showflat.php?Cat=0&Number=664213&an=0&page=0#Post664213

You have to prefact it with ArgsContext to call LR functions.

Marked as spam
Posted by (Questions: 0, Answers: 3)
Answered on May 7, 2012 5:31 pm
0
Private answer

Don't run the step as single step... you must use ''Run from this step'', or run whole script.

Marked as spam
Posted by (Questions: 0, Answers: 1)
Answered on July 9, 2012 10:09 am