【问题标题】:Cucumber Selenium-Webdriver Content-DispositionCucumber Selenium-Webdriver Content-Disposition
【发布时间】:2016-09-08 13:17:25
【问题描述】:

当使用 selenium-webdriver 和 cucumber/ruby 时,有什么方法可以确认文件的下载过程?

在无头运行时,我使用一个简单的 rspec-expectation expect(response_headers['Content-Disposition']).to include("attachment;filename#{pdf_filename}")

当我在 Selenium (Chrome) 中运行时,这不再有效。我得到了错误:

Capybara::NotSupportedByDriverError: Capybara::Driver::Base#response_headers

通过 Selenium 运行时,我有什么方法可以实现这一点?

【问题讨论】:

    标签: ruby selenium rspec cucumber capybara


    【解决方案1】:

    您可以检查下载目录中是否存在您期望的文件:

    File.exists? "/Users/mesutgunes/Downloads/#{pdf_filename}"
    

    【讨论】:

    • 非常感谢
    猜你喜欢
    • 2020-11-21
    • 2016-09-20
    • 2015-07-08
    • 2011-06-21
    • 1970-01-01
    • 2015-07-23
    • 2012-02-27
    • 2011-05-09
    相关资源
    最近更新 更多