在柏树中上传文件
I want to upload a .txt file using Cypress. Is there a way to make Cypress choose the file or do I have to manually select the file every time?
The 'window pops up' is where I want cypress to select a file, is it possible?
Thanks for all the help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 selectfile 从cypress中的方法来上传文件。
You can use the selectFile method from cypress to upload the file.
您需要定位
input [type =“ file”]
才能将文件添加到输入或查找标签并使用
sibling()
移至输入You need to target the
input[type="file"]
to add the file to the inputor by finding the label and using
sibling()
to move to the input