[Wtr-general] open file with file_field

Zeljko Filipin zeljko.filipin at gmail.com
Mon Aug 8 05:56:30 EDT 2005


Try this (make sure you have 'file.txt' in 'C:\'):
 
require 'watir'
ie = Watir::IE.start('http://validator.w3.org/')
ie.file_field(:id,'uploaded_file').set('C:\file.txt')
 
There seems to be a bug when path contains spaces:
 
1) this works just fine
ie.file_field(:id,'uploaded_file').set('C:\Temp\file.txt')
 
2) this returns error (in pop up window with title 'Choose file') -
C:\Documents File not found. Please verify the correct file name was given.
ie.file_field(:id,'uploaded_file').set('C:\Documents and Settings\file.txt')
 
So, for now, until bug is removed, just make sure your files for upload do
not have spaces in path.
 
Zeljko

  _____  

From: wtr-general-bounces at rubyforge.org
[mailto:wtr-general-bounces at rubyforge.org] On Behalf Of Neumann, Carsten -
ENCOWAY
Sent: Monday, August 08, 2005 11:36 AM
To: wtr-general at rubyforge.org
Subject: [Wtr-general] open file with file_field



How can I open a file by using a file_field?

If I use:

ie.file_field(:name, fieldname).set(complete path)

I get the normal Windows- "Open file"-dialog. How can I now select a file,
or type the name using watir?

Or must I use something different?

Thanks!

Carsten Neumann

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20050808/ef70c723/attachment.html 


More information about the Wtr-general mailing list