(:id, "uploaded_file") is how you can access file field at
http://validator.w3.org/, it is just an example.

That cmd window showing all windows should be there for a few seconds, and
then it dissapears, and the file is selected. Try example from my previous
post and wait for cmd window to close (about 10 seconds at my box).

Zeljko
________________________________

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Neumann, Carsten -
ENCOWAY
Sent: Monday, August 08, 2005 4:00 PM
To: [email protected]
Subject: AW: [Wtr-general] open file with file_field



What do you mean with:

(:id, "uploaded_file")?  

If I use (:index, 2) (I can't use the name here) I get the "Choose
file"-dialog box and a DOS-cmd-box showing all windows he finds (?). Thats
all, I have to select a file by myself. There are no spaces in path, as far
as I see.

Carsten N.
  

________________________________

Von: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Im Auftrag von Zeljko Filipin
Gesendet: Montag, 8. August 2005 11:57
An: [email protected]
Betreff: RE: [Wtr-general] open file with file_field

 

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

Reply via email to