# View testing (rspec/selenium) - test if a file link works

**URL:** <https://www.ruby-forum.com/t/view-testing-rspec-selenium-test-if-a-file-link-works/168302>\
**Category:** Rails\
**Created:** [May 19, 2009, 12:00pm UTC](https://www.ruby-forum.com/t/view-testing-rspec-selenium-test-if-a-file-link-works/168302 "2009-05-19T12:00:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cmaxvv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/85f322/32.png) [@cmaxvv](https://www.ruby-forum.com/u/cmaxvv)\
**Post date:** [May 19, 2009, 12:00pm UTC](https://www.ruby-forum.com/t/view-testing-rspec-selenium-test-if-a-file-link-works/168302/1 "2009-05-19T12:00:06Z")

</div>

I have a ‘download’ link on one page that causes a zip to be built and  
then pushes it back as a file to the browser. I want to write a test to  
verify that it does actually push a zip file back but i can’t work out  
how - can anyone help?

I’m using rspec and selenium. The line to click the download link looks  
like this:

@browser.wait\_for\_then\_click “//p[@id=‘zip-download’]/a[2]/em”

So i guess i’m looking for something along these lines (i have no idea  
of the right syntax):

@browser.element(//file/\*.zip).should be\_true

Any advice welcome!  
max
