Sapui5 opa5 如何使用 opa5 脚本上传文件 [英] Sapui5 opa5 How to upload a file using opa5 script

查看:43
本文介绍了Sapui5 opa5 如何使用 opa5 脚本上传文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用 OPA5 脚本上传文件时遇到问题.你能帮我吗.

im facing an issue in Uploading a file using OPA5 Script. Can you please help me.

请看我的代码..

xml::

<sap.ui.unified:FileUploader
                    id="fileUploader"
                    name="myFileUpload"
                    uploadUrl="upload/"
                    width="400px"
                    tooltip="Upload your file to the local server"
                    />

OPA 脚本 ::

When.waitFor({
                            id: "fileUploader",
                            viewName: sViewName,
                            //actions: new Press(),
                            success : function (oFirstItem) {
                                oFirstItem.$().trigger("tap");
                                Opa5.assert.ok(true, "Upload Dialog got opened");
                            },
                            errorMessage: "Form Was not Submitted"
                        });

你能帮我应用正确的代码来使用 OPA 脚本上传文件吗.

Can you please help me to apply right code to upload a file using OPA script.

提前致谢

推荐答案

如果您真的不想上传真实文件,您可以将参数传递给 fireChange 函数.您可以使用操作:

If you don't really want to upload a real file, you can pass parameters to the fireChange function. You can use action:

 actions: function (oFileUploader) {
                            var mParameters = {
                                files: {
                                    "0": {
                                        "name": "something",
                                        "type": "application/gzip",
                                        "size": 123,
                                        "lastModifiedDate": "2013-08-14T09:42:09.000Z",
                                        "webkitRelativePath": ""
                                    },
                                    "length": 1
                                },
                                newValue: "\"newValueOfTheFile.tgz\" "
                            };

                            oFileUploader.fireChange(mParameters);
                        }

然后您可以在同一个操作或另一个操作中使用 fireUploadComplete 函数(告诉上传已完成)(如果您想在上传"文件时检查某些内容.

Then you can use fireUploadComplete function (to tell that upload is finished) in the same action, or in another (if you want to check something while "uploading" the file.

这篇关于Sapui5 opa5 如何使用 opa5 脚本上传文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆