我正在使用 web http 协议在 Pega 应用程序上编写性能脚本,有一个步骤可以在用户流程中浏览和附加一个 excel 文件。但是在录制时,脚本中不会捕获文件名或位置路径。特定发布请求中的 itemdata 部分为空白。有没有人遇到同样的问题&有任何解决方案 LR 版本 12.02 Pega 版本:Pega 7
1 回答
您正在混合两件事,浏览文件和发送文件内容。浏览文件的操作是浏览器的一项功能,而不是 HTTP 操作。选择文件后,浏览器会将文件的内容传递给网站。因此,此操作不会被捕获为从磁盘获取特定文件并发送它。
您可以在脚本中执行的操作相当于浏览文件并发送文件,即使用多部分文件发送。例如:
web_submit_data("do something",
"Action=<url of your website>",
"Method=POST",
"EncType=multipart/form-data",
"TargetFrame=",
"RecContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTML",
ITEMDATA,
"Name=name_of_files", // form field name
"Value=c:/dummy/dummy.doc", // value in Content-Disposition parameter of multipart message
"File=Yes",
"ContentType=text/special", // value in Content-Type parameter of multipart message
"FilePath=dummy.txt", // source path of upoaded file
"ContentTransferEncoding=free", // value in Content-Transfer-Encoding parameter of multipart message
ENDITEM,
LAST);