LoadRunner User Discussions
cancel

TruClient protocol - How do you upload a file?

Highlighted
Jayblah Trusted Contributor.
Trusted Contributor.

TruClient protocol - How do you upload a file?

I've recorded a script using the TruClient protocol in which part of the business process for the web-app under test requires uploading a .pdf file. To initiate the upload, you click on the "Upload file" button found on the page, which produces the Windows' filepicker. The file is selected and then uploaded to the application.

Upon playing this script back in VUGen, the script timesout at the upload file transaction. Does anyone know a workaround to this? I want this step to succeed, and I want the selected file to be uploaded. I have verified that the path in the TruClient script is correct.

I'm using Loadrunner VUGen 12.55.

Thank you.

17 REPLIES
Honored Contributor.. lb1 Honored Contributor..
Honored Contributor..

Re: TruClient protocol - How do you upload a file?

Hi Jayblah, 

I've never meet this matter, but maybe the article below can help you with this problem: 

https://community.softwaregrp.com/t5/LoadRunner-User-Discussions/Ajax-TruClient-not-able-to-capture-the-PDF-file-opening-load/td-p/585809

Let me know if this is enough to fix the script!

Lorenzo

Jayblah Trusted Contributor.
Trusted Contributor.

Re: TruClient protocol - How do you upload a file?

Thanks for the response. Unfortunately, that does not resolve me issue. I am trying to find a way to upload the file to the web-page using the filepicker.

Honored Contributor.. lb1 Honored Contributor..
Honored Contributor..

Re: TruClient protocol - How do you upload a file?

I recovered an old script with an upload step on TruClient protocol: you must to record your web navigation, including the part in which the upload pop-up appears; then the software shows the step as a "Set" option (like the image below). A "Set" option contains the localhost path of the file to upload. It's important to have the same path and the same file to all generators involved in the test, if you doesn't use the localhost only

If the software doesn't record the upload step as a "Set" option, you can modified it managing the single step of the web browsing. 

image001.png

Let me know again if this can fix the issue, 

Lorenzo

Honored Contributor.. lb1 Honored Contributor..
Honored Contributor..

Re: TruClient protocol - How do you upload a file?

In alternative, I found this fast video with some suggestion in TruClient protocol: 

https://www.youtube.com/watch?v=kdQSYTSPpag

Lorenzo

Jayblah Trusted Contributor.
Trusted Contributor.

Re: TruClient protocol - How do you upload a file?

Thanks again for your reply, Lorenzo. Appreciate the help you are providing. My "Action" in the "Step" is assigned to "Set". The path of the file is also correct. Unfortunately, it just doesn't select the file and upload it. See screenshots:

2018-10-22_10-50-04.png2018-10-22_10-51-21.png
Upon replaying the step, it just times out here. The upload never occurs.

Micro Focus Frequent Contributor
Micro Focus Frequent Contributor

Re: TruClient protocol - How do you upload a file?

Hi,

Currently the identification method is set to "xpath", I would suggest to change it to "Automatic". You can change the identification method by opening the "Object" section and selecting "Automatic" in the "ID Method".

Also, before replaying please make sure that the object is being identified correctly, you can do that by presing the "highlight" button in the "Object" section, and see if the correct object is highlighted.

Please update if it solved the issue,

Thanks,

Einat.

Honored Contributor.. lb1 Honored Contributor..
Honored Contributor..

Re: TruClient protocol - How do you upload a file?

Hi  Jayblah,

I had an idea: have you tried with Web HTTP-HTML protocol? In alternative to TruClient, you can record the web browsing and insert a web_submit_data() function to load easily a file into a form. Below a simple example:

     web_submit_data("stepName", 

    "Action=http://...URLofTheFormPage...",

    "Method=POST",

    "EncType=multipart/form-data",

    "RecContentType=text/html",

    "Mode=HTML",

    ITEMDATA,

    "Name=userFileExample",

    "Value=C:\\...filePath...",

    "File=yes",

    ENDITEM, LAST);

You can also insert other options in ITEMDATA space for a detailed file loading. Can you try to record your navigation with this approach? I think you have just to record in Web HTTP-HTML, including the uploading phase, and after handle the interested step via bytecode in the VuGen IDE. 

You can find some more suggestions here: http://loadrunner-traning.blogspot.com/2015/09/how-to-upload-files-in-scripting-load.html.

Let me know if this can fix the issue, 

Lorenzo

Jayblah Trusted Contributor.
Trusted Contributor.

Re: TruClient protocol - How do you upload a file?

Thanks for your reply, Elnat. I have tried multiple identification methods, including Automatic. Unfortunately, this did not change the result (still timed out).

I've also verified that the correct element(s) are being highlighted.

Jayblah Trusted Contributor.
Trusted Contributor.

Re: TruClient protocol - How do you upload a file?

Hi Lorenzo, thank you for taking the time to help.

I initially tried recording the script in WebHTTP, but it was proving to be very challenging to have the entire script work using this protocol. As my time for a turnaround is limited, I opted to use TruClient instead. The application is an "eBiz" application (Bizflow), and I've historically had problems using the WebHTTP protocol with this software.

Thank you.

Honored Contributor.. lb1 Honored Contributor..
Honored Contributor..

Re: TruClient protocol - How do you upload a file?

Ok so we can focus on TruClient registration only

I believe the error is in identifying the file, as the error message of the "Set" option say. So, can you try to put a TC property in your script? This is my suggestion: changing the "Path" argument of the function with the JavaScript snipped bytecode below, 

   TC.scriptDir+"\pathFile.ext";

Be sure to add the file to the 'Extra Files' tree node in VuGen, to make sure the file is sent to the load-generator along with the script.

Let me know if this can fix the issue!
Lorenzo

Jayblah Trusted Contributor.
Trusted Contributor.

Re: TruClient protocol - How do you upload a file?

Thanks for your continued attempts to help. I tried your suggestion but it doesn't appear to work. See screenshot:

 

2018-10-24_9-14-00.png

Please note that I did add the file "sampledocument.pdf" to Extra Files. Any additional advice? Also, I tried using the JS argument for the Path as well, and it also did not work.

Honored Contributor.. lb1 Honored Contributor..
Honored Contributor..

Re: TruClient protocol - How do you upload a file?

Sorry Jayblah, in the image I see that the "Path" argument is in text form, you have to choose <JS> form from the dart pointing down at the right of the form. 

Can you please try with this ultimate suggestion? Thanks, 

Lorenzo

Jayblah Trusted Contributor.
Trusted Contributor.

Re: TruClient protocol - How do you upload a file?

Hi Lorenzo,

 

I tried changing from text to JS but it still didn't work.

2018-10-24_9-59-57.png

Jayblah Trusted Contributor.
Trusted Contributor.

Re: TruClient protocol - How do you upload a file?

Lorenzo and others, if it helps, this is what the application that I am scripting for looks like.

 

The first screenshot shows the web-applications "Choose File", which produces the Windows OS filepicker (shown in the second screenshot). I want to select the "sampledocument.pdf" file from the filepicker and click "Open" to have it added to the web-application.

2018-10-24_13-15-53.png2018-10-24_13-16-12.png