toamitkumar's Code Blog

Ruby, Rails, RubyMotion, Chef, Puppet, Play and others. Opinions expressed here are my own and do not reflect those of my employer.

Playing With Watir - File Upload/Download Component

| Comments

In my last post I talked about WATIR integration with Rspec.

In our project, we had excel report download component. The challenge with Watir was to be able to download the excel file, save it and validate data against DB. Thanks to David Brown for his Excel Interface class library which is easy to implement. Next thing was to be able to save the file at any given location (always). None of the documented steps worked. The autoit dll supported by Watir was at the rescue. Au3Info.exe helps to identify IE control IDs. The following code snippet explains the rest:



After conquering file download, next was file upload. It was much easier coz Au3Info.exe was always their to figure IE control IDs. Using AutoIt documentation simplified it further.



WATIR rocks !!

Comments

Amit Kumar
I agree but it solves the problem on windows platform efficiently… for those platform selenium can give you what u want..
with selenium2 released things have become much simpler…
Gonzalo
The big issue with that implementation is the use of AutoIt, what happen if the tests are run in Linux or Mac?, that just doesn't work.

Comments