【问题标题】:Download and use file with Protractor e2e test下载并使用 Protractor e2e 测试文件
【发布时间】:2014-11-05 12:36:37
【问题描述】:

如何编写下载文件并将其发布到表单中的测试。

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

目前上传工作正常,但我之前如何下载文件并获取它的路径?

【问题讨论】:

    标签: protractor angularjs-e2e


    【解决方案1】:

    通过将文件添加到项目中来解决它并得到这样的绝对路径:

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

    【讨论】:

    • 这个答案只解决了问题的上传部分。下载是如何工作的?
    猜你喜欢
    • 2015-02-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-05-05
    • 2015-12-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多