Highlighted
Absent Member.. Absent Member..
Absent Member..
1428 views

Vugen scripting to include Java script functionality

Hi,

 

I have to create Vugen script for upload a document to amazon S3 from various systems/Applications, but the amazon SDK and the upload code they have provide is in Java script library. In this Java script uses, JQuery in many places to get the session token, document URL etc.

 

We have Web 2.0 license bundle for my client, I have created a script in Web (HTTP/HTML) and used the web_js_run() function to run the Java script and got the error ""TypeError: document is undefined"."

 

Then in the forum, I found that, "document is an object provided by browser. LR does not support that object. It's possible to provide a mock document object using scripting, but it can't behave like a real brower document object".

 

Please let me know how to create mock document and handle this situation.

 

 

0 Likes
12 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: Vugen scripting to include Java script functionality

Hi,

 

 

You can try TruClient protocol instead as during the execution of the script the browser is used. It is also included Web 2.0 license bundle.

 

You can use web_js_run()  to  write a Javascript code to calculate a value which  is dynamically generated on the client(browser) side and is expected by the server in the next requestand i.e  for values which are not send  from the server and which canot be correlated. In such cases it is better to use TruClient protocol. 

 

 

Kind regards,

Vesela

HPE Support
If you haven’t tried it yet, come and join us in our entitled forums at Support Customer Forums

If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution and give Kudos to the author for their assistance.
0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

Re: Vugen scripting to include Java script functionality

 

Thanks Vesela for you reply.

 

The Java script which amazon has provided generates Session token, accesskeyID dynamically.

 

I never used trueclient before, will that dynamic values get handled in Trueclient protocol?

 

 

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: Vugen scripting to include Java script functionality

Hi, 

 

Truclient  protocol uses the browser which executes the  javascript code of the application. 

There is no need of correlation in TruClient as the dynamic values are handled in the Browser.

 

The best wey is to try and check .  The protocol also allows to  write JavaScript code. 

 

Please find more details in the LoadRunner guide of the corresponding version of LR you are using.

For 12.50 you can check here: http://lrhelp.saas.hp.com/en/12.50/help/WebHelp/Content/TruClient/_tc_t_how_to_record_tc_scripts.htm

 

You can also find TruClient protocol videos in the following link:

https://hpln.hp.com/page/hp-loadrunner-and-performance-center-videos

 

 

Kind regards, 

Vesela 

HPE Support
If you haven’t tried it yet, come and join us in our entitled forums at Support Customer Forums

If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution and give Kudos to the author for their assistance.
0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

Re: Vugen scripting to include Java script functionality

Hi,

 

I am using LR 11.52. In this version, I dont see the "TruClent - Web" and have "TruClientAjax - Firefox,/IE/Mobile". Is this covered in Web 2.0 license bundle.

 

Also, I have trial version of 12.02 in my personal laptop, In that also, I dont see "TruClient - Web".

 

Can you please suggest me how to proceed in LR 11.52?

 

Thanks for your replying

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: Vugen scripting to include Java script functionality

Hi, 

 

The available TruClient protocols in the mentioned versions are the ones you see: TruClient for Firefox, for IE and Mobile. 

TruClient Web is available in LoadRunner 12.50.

 

 

Kind regards, 

Vesela 

HPE Support
If you haven’t tried it yet, come and join us in our entitled forums at Support Customer Forums

If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution and give Kudos to the author for their assistance.
0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

Re: Vugen scripting to include Java script functionality

Can you pleas suggest some option in R 11.52?

 

 

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: Vugen scripting to include Java script functionality

Hi, 

 

With Web 2.0 license bundle you have licenses for TruClient protocols. 

 

Please check the following document: https://softwaresupport.hp.com/group/softwaresupport/search-result/-/facetsearch/document/KM1412003

Web 2.0 contains: Web and Multimedia, Rich Internet Applications (RIA) and SOA 

 

Kind regards, 
Vesela 

HPE Support
If you haven’t tried it yet, come and join us in our entitled forums at Support Customer Forums

If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution and give Kudos to the author for their assistance.
Highlighted
Absent Member.. Absent Member..
Absent Member..

Re: Vugen scripting to include Java script functionality

Hi Vasela,

 

I used the truclient IE protocol in LR 11.52 to record the script and I am able to successfully record the script, but the file upload was not successful.

 

also, when I playback the script, the document is getting uploaded (document upload is done by javascript functionality)

 

Please help me out on this.

 

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

Re: Vugen scripting to include Java script functionality

Hi ,

 

I used the truclient IE protocol in LR 11.52 to record the script and I am able to successfully record the script, but the file upload was not successful.

 

also, when I playback the script, the document is NOT getting uploaded (document upload is done by javascript functionality)

 

Please help me out on this.

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: Vugen scripting to include Java script functionality

Hi, 

 

I have seen cases when TruClient was able to record file upload.

 

 

I am not sure if you have a step recorded which indicates the file location for example: 

truclient_step("2", "Set 'C:\\New Text Document.txt' on File filebox", 

 

You can try using  TruClient Firefox as well. 

 

If it is not working you can open a case with support. 

 

You should check if a pure javascript is used for the File upload or there are other technologies involved such as

Flash, Silverlight, ActiveX as TruClient has its limitations: 

https://softwaresupport.hp.com/group/softwaresupport/search-result/-/facetsearch/document/KM00515543

 

Kind regards, 
Vesela 

HPE Support
If you haven’t tried it yet, come and join us in our entitled forums at Support Customer Forums

If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution and give Kudos to the author for their assistance.
0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

Re: Vugen scripting to include Java script functionality

Thanks Vesela for you reply.

 

I am unable to record the upload script with TruClient - Firefox, since it is opening the firefox window and asking me to install various add on like Firebug, Adobe, Fiddler everytime when I try to develop the script.

 

Also, the below code is recorded in TruClient - IE mode. Even during recording, I saw the message of "document is uploading" for long time.

 

truclient_step("Set 'C:\\Users\\...\...sktop\\test.pdf' on FileToUpload filebox", "snapshot=Action_23.inf");

 

Also, Amazon has provided an SDK which is written in Javascript  (has JQuery code as well) to get the token, session and document Id for uploading the document to amazon S3.  

 

Please help me on resolving this.

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.