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

标签 html css automated-tests e2e-testing testcafe

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

这里有以下 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>

最佳答案

如果你想使用 <input>元素与 type="file" attribute在你的测试中上传文件,你可以使用 setFilesToUpload行动。更多信息,请查看 this topic在 TestCafe 文档中。 如果您的场景不同,请更详细地描述它。

关于html - 如何在 TestCafé 的输入标签内上传文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56973506/

相关文章:

javascript - 错误: Cannot set property 'src' of null

javascript - 如何将类添加/切换到元素以便将汉堡菜单切换到 X 以便关闭并再次返回

javascript - 两个div固定位置,一个接一个在顶部

automated-tests - 您如何处理在开发过程中预计会失败的单元/回归测试?

webdriver - 在 TestNG 中自定义故障报告

java - 如何设置 selenium chrome 驱动程序的打字速度?

javascript - 使用JavaScript函数显示flash

html - 添加边距会导致姐妹元素具有相同的边距

html - 与停用 CSS 中的悬停效果相关的问题

css - Jenkins 的 LESS checkstyle