简体   繁体   English

TestCafe:无法使用单步上传控件上传文件

[英]TestCafe: Unable to upload file using single step upload control

We are trying to upload file using TestCafe code, but its not uploading the file.我们正在尝试使用 TestCafe 代码上传文件,但它没有上传文件。 There's no IFrame. The input control is inside simple div>label structure没有 IFrame。输入控件在简单的 div>label 结构中

Kindly suggest.请建议。 Thanks谢谢

<div>
<label>
  <div>..svg stuff..</div>
  <input aria-label="Upload an image" tabindex="0" type="file" multiple="" accept="image/jpeg, image/png" data-testid="imageInputTest" class="ImageInputstyles__Input-sc-7878w-7 aosVy">
</label>
</div>

Code snippet:代码片段:

fixture `Example`
.page `https://ourURL.com/YOUR PATH/`;

test('Upload Files test', async t => { await t.setFilesToUpload('.dx-fileuploader-input', 'path/to/file_to_be_uploaded/on/your/machine' ]); }); test('上传文件测试', async t => { await t.setFilesToUpload('.dx-fileuploader-input', 'path/to/file_to_be_uploaded/on/your/machine' ]); });

We also checked that- its not uploading to the server.我们还检查了——它没有上传到服务器。 More ref: https://devexpress.github.io/testcafe/documentation/reference/test-api/testcontroller/setfilestoupload.html更多参考: https://devexpress.github.io/testcafe/documentation/reference/test-api/testcontroller/setfilestoupload.html

try尝试

await t
        .setFilesToUpload(Selector('input').withAttribute('type', 'file'), [
            path
        ]);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM