By default, when using celerity and celerity, there is no handler for file downloads. If your action in your scenario results in being served a file with a mime type you don’t understand it will end up being unceremoniously lost.

You can’t read “page.body” because that will return the page you are on, not the file you want to download.

You have a link to the action that will result in the file getting served to you:


When /^I press "([^"]*)" and download the file$/ do |element_id|

@file = page.find_by_id(element_id).click.getWebResponse.getContentAsStream.to_io.read

end

That will read the results of your click in to the @file variable that you can then parse in later steps.