Highlighted
Established Member..
Established Member..
3274 views

File upload

Hi,

I'm recording a file upload scenario. The file to be uploaded is .xlsx
The recording goes on fine and below are the two functions that get recorded for file upload.

web_custom_request("upload",
"URL=https://rp10.bench.ehc.adp.com/concerto/proxy/default/file/upload",
"Method=POST",
"TargetFrame=",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t7.inf",
"Mode=HTML",
"EncType=multipart/form-data; boundary=----------cH2GI3cH2ae0ae0KM7KM7Ef1Ij5gL6",
"Body=------------cH2GI3cH2ae0ae0KM7KM7Ef1Ij5gL6",
LAST);

web_submit_data("upload_2",
"Action=https://rp10.bench.ehc.adp.com/concerto/proxy/default/file/upload",
"Method=POST",
"EncType=multipart/form-data",
"TargetFrame=",
"RecContentType=text/html",
"Referer=",
"Snapshot=t8.inf",
"Mode=HTML",
ITEMDATA,
"Name=Filename", "Value=absence_en_jour-presents_07-2010.xlsx", ENDITEM,
"Name=token", "Value=4dd2769e75d69", ENDITEM,
LAST);

When I replay the script, it plays without any error msg, however, the file is not uplaoded into the application. I'm trying to correlate "cH2GI3cH2ae0ae0KM7KM7Ef1Ij5gL6", but unable to. Also, there are some dynamic cookies, but they dont get recorded in the script. I tried to add them manually, but no luck.

Pls suggest.

0 Likes
9 Replies
Highlighted
Absent Member.
Absent Member.

Re: File upload

Try replacing the custom request function with the below sample

web_submit_data("Ajax download file.aspx",
"Action={pUrl}mmt/ajaxuploadfile.aspx,// purl is the parameter file name from where the url is substituted during runtime
Method=POST,
EncType=multipath/formdata,
Targetframe=,
Reccontenttype=text/html,
Referer=,
Referer={pURL}mmt/ajaxdownloadfile.aspx,//this is the url recorded by the script which is the url in the Address bar during runtime once the download button is clicked
snapshot=t4.inf,
mode=html,
Itemdata
Name=_Eventtarget,value=,Enditem,
Name=_Eventargument,value=,Enditem,
Name=_Viewstate,value={siebelanalytic_viewstate7),
Name=FU_filedownload,value={pfilepath},file=yes,Enditem,//pfilepath is the parameter name which contains the path/location to download the file.
Name=Btn_add,value=Add, Enditem,
0 Likes
Highlighted
Established Member..
Established Member..

Re: File upload

Thanks for your reply.

I already tried the same and replaced WCR with:
web_submit_data("upload_2",
"Action=https://rp10.bench.ehc.adp.com/concerto/proxy/default/file/upload",
"Method=POST",
"EncType=multipart/form-data",
"TargetFrame=",
"RecContentType=text/html",
"Referer=",
"Snapshot=t8.inf",
"Mode=HTML",
ITEMDATA,
"Name=Filename", "Value=absence_en_jour-presents_07-2010.xlsx", ENDITEM,
"Name=token", "Value=4dd2769e75d69", ENDITEM,
LAST);

But the problem still persists.
0 Likes
Highlighted
Absent Member.
Absent Member.

Re: File upload

Have you pasted the file upload url in the Action part? Perform a manual operation and copy the file upload url and paste in the web_submit function and try. Give a try and see 🙂
0 Likes
Highlighted
Established Member..
Established Member..

Re: File upload

The function just above is;

web_url("317",
"URL=https://rp10.bench.ehc.adp.com/concerto/000004/transaction/idStep/949/idLastWorkStep/{stepID_1}/idStepActFrom/956/idMenu/342/idPopFilter/317",
"TargetFrame=",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t6.inf",
"Mode=HTML",
EXTRARES,
"URL=/concerto/flex/1.0.3.9/FileUpload.swf", ENDITEM,
"URL=/concerto/img/bts_loading.gif", ENDITEM,
LAST);

0 Likes
Highlighted
Established Member..
Established Member..

Re: File upload

I tried to record and check all the requests by using HTTPWatch.
When I click on Browse, no request gets recorded by httpwatch. It stays on the same page. The next request is generated when I click on Submit.
Could this be a reason why file is not getting uploaded?

Thanks in Advance.
0 Likes
Highlighted
Established Member..
Established Member..

Re: File upload

I don't think that in this way u can upload a file using LR, even though the script is passing without any error but if u look in the application side u amy or may not find that a file has been uploaded but of the size 0kb......the file will uploaded if while u r doing the browse and finding the file to upload, generates any event (before hitting submit button), otherwise u need to write some custom code.
0 Likes
Highlighted
Established Member..
Established Member..

Re: File upload

Thanks.

I'm sure that no events getting recorded while clicking browse is normal because its a pure client side activity.

Could you tell me what custom code you're talking about? Do you have any sample code?

Regards,
0 Likes
Highlighted
Established Member..
Established Member..

Re: File upload

http://motevich.blogspot.com/2008/04/loadrunner-how-to-record-pdf-file.html

Check the above link and make the necessary changes according to ur requirement... I hope that it will solve ur problem.

Thanks,
Prasenjit
0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

Re: File upload

hi,

You may want to try adding the bodyfilepath attribute as below.
Note bodyfilepath cannot be clubbed with other body attributes in the function call,so removed the body attribute.

web_custom_request("upload",
"URL= https://rp10.bench.ehc.adp.com/concerto/proxy/default/file/upload",
"Method=POST",
"TargetFrame=",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"bodyFilePath=C:\\test\\sample.xls"
"Snapshot=t7.inf",
"Mode=HTML",
"EncType=multipart/form-data; boundary=----------cH2GI3cH2ae0ae0KM7KM7Ef1Ij5gL6",
LAST);


let me know how it goes.
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.