Intern.js 中的文件上传

File upload in Intern.js

文档中写道,可以使用 intern 执行文件上传等操作。谁能举例说明如何做到这一点? 我搜索了示例和 LeadFoot 文档,但找不到任何内容。

谢谢。

您可以像最终用户一样与文件输入表单域进行交互,只是您只需“键入”您要从测试机上传的文件的绝对路径。

return this.remote.findById('fileInput').type('/path/to/file');

另见 How to click on <input type=file> across browsers using Selenium Webdriver?