问题
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