Highlighted
Absent Member.
Absent Member.
6551 views

Parameterize URL in AJAX TruClient?

Jump to solution

Is it possible to parameterize the URL in a TruClient script?

 

Would like to be able to replace the URL throughout a script in order to reuse it for other FQDNs (i.e. www.example.com and staging.example.com).  Something like this in the step editor:

 

1. Evaluate JavaScript URL=LR.GetParam('ScriptURL')

2. Navigate to "http://" + URL + "/index.html"

 

...but it does not work.  the Navigate to function doesn't seem to be able to evaluate JS inline.

 

Surely someone has solved this problem...?

1 Solution

Accepted Solutions
Highlighted
Absent Member.
Absent Member.

Oops...actually it does work just as I'd hoped.  There was something wrong with my parameter definition, but once that was corrected, the "Navigate to" truclient function worked just fine with the inline javascript, e.g.

URL=LR.GetParam('URL')

Location: 'http://' + URL + '/index.html'

View solution in original post

0 Likes
6 Replies
Highlighted
Absent Member.
Absent Member.

Oops...actually it does work just as I'd hoped.  There was something wrong with my parameter definition, but once that was corrected, the "Navigate to" truclient function worked just fine with the inline javascript, e.g.

URL=LR.GetParam('URL')

Location: 'http://' + URL + '/index.html'

View solution in original post

0 Likes
Highlighted
Absent Member.
Absent Member.

Hey, 

I am trying to Parameterize URL in Ajax TruClient, but  I am not able to do it. ANybody no what is the proper way to do it. 
When I am creating the parameter it adding LR.GEt Param("URL") function but when trying to run it getting error. 

 

 

if anybody has solution please let me know.

 

 

thanks.

 

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

You should see Navigate as action step which has Arguments as Location. You need to select all and right click for the value of Location Argument and select replace with parameter > Create New parameter from Selection.

Once you create new parameter change what your URL you want in your parameter file and test it. It should work.

 

Please make sure to save the script before running.

 

You can post the error or screenshot you get if above doesn't work.

 

 

Thanks!

0 Likes
Highlighted
Absent Member.
Absent Member.

Hi,

I was envolved to doing other works, didn't try again, but now I need to use parameter in my scripts on AJAX TruClient. I tried the way you suggest but not working. getting the error:

 

Error: Navigate to [Exception] ** failed - an argument is invalid:
 'Location': JavaScript exception 'SyntaxError: Expected ';'' during evaluation    [MsgId: MERR-203253]

 

 

Any other suggestion.

so you are saying in the Action navigate has to be selected that I am having and select the whole url and click replace with parameter and ......

 

 

But not working. attached error screenshot.

 

Plz help out on this

 

Thanks

 

 

 

 

0 Likes
Highlighted
Absent Member.
Absent Member.

Hi,

  1. No attachments
  2. Please send a snippet of your problematic area in the script.

Thanks.

Guy Rosenthal
Network Virtualization PM
0 Likes
Highlighted
Trusted Contributor.
Trusted Contributor.

Great K.phil . helped me out 🙂

Regards

Vishal

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.