Download and use file with Protractor e2e test

时光怂恿深爱的人放手 提交于 2019-12-06 12:13:09

问题


How do I write a test that download a file, and post it in a form.

it "should support download and upload a file", ->
    upload = element(By.id 'UploadInput');
    upload.sendKeys 'C:\\path\\to\\file\\file.txt'

Currently the upload works, but how do I download a file before and get it's path?


回答1:


Solved it by adding the file to project and got the absolute path like this:

it "should support download and upload a file", ->
    upload = element(By.id 'UploadInput');
    upload.sendKeys path.resolve(__dirname, '../../assets/file.txt')


来源:https://stackoverflow.com/questions/26757383/download-and-use-file-with-protractor-e2e-test

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!