【发布时间】:2019-10-13 01:58:03
【问题描述】:
我在测试中遇到一个问题。我正在尝试上传 APK 文件,但到了这一步,什么也没有发生。
我已经尝试了带有文件路径的简单 sendKeys 并使用 AutoIT 脚本,但它们都不起作用。
这里是输入:
<button uib-tooltip-html="uploadTooltip" ng-if="(privileges.update && !uploadForm.$visible) || createNew" ng-click="this.value = null;" ng-file-select="uploadFile($files, uploadForm)" class="btn btn-xs btn-default ng-scope ng-isolate-scope" ng-disabled="status.disabled || progressPercentage" type="button" style="overflow: hidden;">
<i class="fa fa-fw fa-upload"></i>
<input type="file" tabindex="-1" ng-file-generated-elem="true" style="width: 1px; height: 1px; opacity: 0; position: absolute; padding: 0px; margin: 0px; overflow: hidden;">
<input type="file" tabindex="-1" ng-file-generated-elem="true" style="width: 1px; height: 1px; opacity: 0; position: absolute; padding: 0px; margin: 0px; overflow: hidden;">
</button>
我尝试过的(也使用带有完整路径的字符串作为 sendKeys):
String filePath = System.getProperty("user.dir") + "src\\test\\APK\\com.airbnb.android.apk";
tryToClearAndSendKeysForSeconds(5, UPLOAD_FILE_BUTTON, filePath); // method for sendKeys with wait, locator and string
Runtime.getRuntime().exec("C:\\Users\\IdeaProjects\\Automated_Tests\\src\\test\\APK\\FileUpload.exe");
汽车信息技术:
ControlFocus(“Open”,””,”Edit1″)
ControlSetText(“Open”,””,”Edit1″,”D:\HDimage\profile.jpeg”)
ControlClick(“Open”,””,”Button1″)
当涉及到 sendKeys 时,我不确定是否应该在发送文件之前单击上传按钮,但是当我这样做时(我使用的是 win 10 btw):
将不胜感激!
【问题讨论】:
标签: java html angularjs selenium automated-tests