File Uploads

File Uploads

Watir now has a mechanism to support file uploads. Use the file_field method. Run and view the Ruby source in filefield_test.rb in the unit tests folder for usage.

If you are given the option to upload a file from a web page, this is the dialog that will be shown. It would normally appear when using the <input type=file> html tag

See http://msdn2.microsoft.com/en-us/library/ms535263.aspx

Simple example (file image.png should be in the root directory of C: drive):

ie.goto "tinypic.com"
ie.file_field(:id, "the_file").set("C:\\image.png")
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.