Skip to main content

Downloads

Files are saved to Capybara.save_path, or to the :save_path driver option if given. page.driver.browser.downloads is Ferrum's downloads object for the current page.

wait(timeout = 5)​

Waits until the current download is finished. Pass a block that starts it.

page.driver.browser.downloads.wait { click_link "Export" }

files : Array<Hash>​

Returns information about files downloaded since the last reset.

page.driver.browser.downloads.files.last
# => {"url"=>"http://127.0.0.1/export.csv", "suggestedFilename"=>"export.csv", "totalBytes"=>4911,
# "receivedBytes"=>4911, "state"=>"completed", ...}

File.read(File.join(Capybara.save_path, "export.csv"))

The list is cleared at the end of every test, files on disk are not removed.