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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Neumann, Carsten - ENCOWAY
Sent: Monday, August 08, 2005 11:36 AM
To: [email protected]
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
_______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general
