Passing multiple files to input node with Watir (using Ruby)

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-02 06:40:58

Currently there doesn't seem to be a workaround for Firefox. If anybody knows of one, please post the answer as I couldn't find a solution anywhere. I figured I'd post the solution for Chrome here because resources are scarce on this.

If you need to test for multiple file uploads, have that particular instance load the Chrome driver with:

@browser = Watir::Browser.new :chrome, :prefs => profile

Then you're going to want to pass it a string that looks something like this:

paths = "path/to/first/file.json\npath/to/second/file.json\n...etc
file_field.send_keys paths
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!