如何在 TestCafé 的输入标签内上传文件

How to upload file within input tag in TestCafé

是否可以使用 TestCafe 在网页的 <input> 标签内上传文件?

这里有以下HTML结构:

<div class="MuiButtonBaseroot-0-4-1362 MuiListItemroot-0-4-1365 MuiListItemdefault-0-4-1368 MuiListItemgutters-0-4-1373 MuiListItembutton-0-4-1374" tabindex="0" role="button" data-test="upload-file" data-uic="list-item">
  <div class="MuiListItemIconroot-0-4-1495" data-uic="list-item-icon"><svg width="16" height="16" viewBox="0 0 14 14" fill="currentColor"><path d="M6"></path></svg></div>
  <div class="MuiListItemTextroot-0-4-1489" data-uic="list-item-text"><span class="MuiTypographyroot-0-4-1413 MuiTypographybody1-0-4-1422 MuiListItemTextprimary-0-4-1492"><span>Upload files</span></span>
  </div>
</div>

如果您想在 TestCafe 文档中将 <input> 元素与 type="file" attribute to upload files in your tests, you can use the setFilesToUpload action. For additional information, please check this topic 一起使用。 如果您的情况不同,请更详细地描述。