如何使用watir上传文件

问题描述

我是自动化测试新手,但我想让自动化测试使用 watir 上传照片,但照片无法上传且未显示任何错误,我使用的是 ruby​​ v2.7.4p191 和 watir v.6.19 .1.

这是html:

<div class="file-attachments">
</div>
<div class="dropzonePreview" id="dropzonePreview">

</div>
<div class="dropzoneAdd dz-clickable" id="dropzoneAdd">
<div class="addText">
<div class="fa fa-cloud-upload"></div>
Drop file to attach,or 
<span style="color:#22B5E7; text-decoration: underline">
browse
</span>
</div>
<div class="addText-detail">
max size 10 MB/file
</div>
</div>
<div class="dropzoneMaxFileReached" id="dropzoneMaxFileReached" style="display:none">
Maximum upload file has been reached
</div>

这是红宝石代码

@browser.file_field.set "C:banana.jpg"

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)