Highlighted
Contributor.
Contributor.
904 views

Ajax True Client evalXPath Error "LR is not defined"

Jump to solution

I have a true client script where on a page a table with links appear. I want to randomly click on a link. I have used  javascript to capture the value and then save it in a parameter using TC.saveParam("param1", value);

In the following event i am using " Generic browser action"  - > " click" -> Javascript. Here I am trying to use evalXpath to evaluate xpath and click on it. 

Script runs fine if I hard code the value

evalXPath("//a[text()=" + "\"XXXVALUE\"" + "]");

but it fails when i use TC.getParam OR LR.getParam

evalXPath("//a[text()=" + LR.getParam("param1")+ "]");

Following error is generated,

** 24.2: Click on XXXVALUE** failed - target object was not found. Reason: Exception occurred in the JavaScript code: ReferenceError: LR is not defined.

 

Kindly suggest

Tags (1)
0 Likes
1 Solution

Accepted Solutions
Highlighted
Contributor.
Contributor.

Re: Ajax True Client evalXPath Error "LR is not defined"

Jump to solution

This is resolved, I eventually removed all LR.saveParam and LR.getParam from the script.

Instead just saved the captured string in a javascript variable and used it in second step using

evalXPath("//a[text()=" + ArgsContext.myvariable + "]"); 

View solution in original post

0 Likes
1 Reply
Highlighted
Contributor.
Contributor.

Re: Ajax True Client evalXPath Error "LR is not defined"

Jump to solution

This is resolved, I eventually removed all LR.saveParam and LR.getParam from the script.

Instead just saved the captured string in a javascript variable and used it in second step using

evalXPath("//a[text()=" + ArgsContext.myvariable + "]"); 

View solution in original post

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.