Hi Super kevy,

Thanks for your help. However the points mentioned above did not work here
because of the following point:-

--> There is no text field prior to the file upload element where i can set
the file name.

Coding of the button which is reflected using firebug is displayed below:-

<object id="----" type="-----" data="----">        (Note:- Here a flash file
is embedded like "plugins/application/flash.swf")
<param name = "----" value = "----">
<param name = "----" value = "----">
<param name = "----" value = "----">
</object>

Here object tag represent the button "Upload File" button and if you click
on it a pop-up will display.

Also i try the button click method as:---
button(:xpath,"xpath of the object tag").click
then function of button click gets executed properly however the pop-up to
upload file didn't show up.

Please help on this as it is urgently required.

Thanks in advance...

On Fri, May 13, 2011 at 8:55 AM, Super Kevy
<[email protected]>wrote:

> Hope this helps
>
> First: HTML for a file upload field will resemble something like this
> where the attribute "type" dictates that its a file upload file.  A
> built-in attribute of the input is that it will automatically give you
> the "BROWSE" button
> <input tabindex="101" name="uploadfile" size="30" maxlength=""
> onchange="setvalue(this);" value="" type="file">
>
>
> To click the file upload button all you need to do is click in the
> field or the button.  It can be done using autoIT.
> 1. Assume the name of the file upload element is 'uploadfile' and
> there is a text_field  (with the id sample) prior to it which is
> exactly 1 tab click from it.
> 2. Set focus to the field immediately before the 'uploadfile' by using
> standard WATIR ie.text_field(:id,'sample').click. (See sample code
> below)
> 3. Next using autoIT TAB to the next field ('uploadfile) and press
> ENTER to open the popup
> 4. Run the popup form fill using AutoIT
> 5. Return to the main and continue
>
>
> Step 1 Set Focus to the element 1 Tab keypress before the file upload
> element
>   myAutoIT = WIN32OLE.new("AutoitX3.Control")
>   ie.text_file(:id,"Sample").click   # SET FOCUS TO field 1 tab click
> before uploadfile element
>
> Step 2. Use TAB and ENTER Keys to move to the upload input and open
> the POPUP
>  myAutoIT.Send("{TAB}") # Tab to the upload field
>  myAutoIT.Send("{ENTER}") # Press the enter key to open the popup
>
> Step 3. The POPUP is Open so fill it in with what we want
>   myAutoIT.WinWaitActive("File Upload","",15) # Set focus to the
> popup
>   myAutoIT.Send("{ALT}n") # Move to the file name field in the popup
>  myAutoIT.Send(sFileName) # Enter the Path and File Name
>  myAutoIT.ControlClick("File Upload","","&Open")
>
> Step 4. Back in the main application
>  ... etc
>
>
>
>
>
> On May 12, 1:07 pm, sumit kumar <[email protected]> wrote:
> > Hi Super Kevy,
> >
> > Thanks for your help. Please ignore the above mentioned query which i
> > have posted as i was doing it wrongly at my end.
> >
> > Please see below the updated query:-----
> >
> > There is no file field where i can set the value of the uploaded
> > file.......
> > In this case there is only a button and if user click that button then
> > "File Upload dialog" box gets opened.
> > The problem in this case which i am facing is:-
> > ----- I am unable to click on the button using any property and the
> > "File Upload Dialog" box did not appear.
> > Details: <object> tag is used to create the button and a flash file is
> > uploaded in it.........
> > So is there any way from which i can click on it and "File Upload
> > Dialog" box appear correctly....
> >
> > Thanks in advance......
> >
> > On May 12, 6:27 am, Super Kevy <[email protected]> wrote:
> >
> >
> >
> > > The preferred method is to use the file_field, but this is an
> > > alternative
> > > BTW: What error are you getting when you try to set using file_field?
> >
> > > Basic AutoIT sample
> > >   ie.text_field(:id,'document_name').click # Open the popup
> > >   myAutoIT = WIN32OLE.new("AutoitX3.Control")
> > >   myAutoIT.WinWaitActive("File Upload","",15) # Set focus to the
> > > popup
> > >   ##myAutoIT.ControlSetText("File Upload","",1148,sFileName)  # 1148
> > > is the id found by the AutoIt Finder/Didnt work
> > >   myAutoIT.Send("{ALT}n") # Move to the file name field in the popup
> > >   myAutoIT.Send(sFileName) # Enter the Path and File Name
> > >   myAutoIT.ControlClick("File Upload","","&Open")
> >
> > > On May 2, 4:36 pm, chaand <[email protected]> w
> >
> > > On May 12, 3:09 am, sumit kumar <[email protected]> wrote:
> >
> > > > Ok, my problem is to do with handling a windows ***file upload dialog
> box*.
> >
> > > > I'm trying to write some code that will click the *file upload*
> button,
> > > > navigate to path where the file is stored and after selecting a file
> click
> > > > "Open" button of the* file upload dialog box*.
> > > > ie.button(:id, "_______").click_no_wait
> > > > ie.send_keys("c:\__________")
> > > > ie.send_keys("{ENTER}")
> >
> > > > Unfortunately click_no_wait just flashes the *dialog box and *does
> not pop
> > > > up the Dialog Box. I've tried click by itself and that opens the
> *dialog box
> > > > * but the rest of the script does not execute.
> >
> > > > In this case i cannot use the file upload method:-
> > > > $ie.file_field(:name, "").set("your file.txt")
> > > > As there is no text field for setting the file name in the textboxes.
> >
> > > > Application Functionality:-
> > > > There is "Select File" button and on clicking it, shows "File Upload"
> Dialog
> > > > box and if user select a file and press enter the file automatically
> starts
> > > > uploading....
> >
> > > > Any Ideas on this?- Hide quoted text -
> >
> > - Show quoted text -
>
> --
> Before posting, please read http://watir.com/support. In short: search
> before you ask, be nice.
>
> [email protected]
> http://groups.google.com/group/watir-general
> [email protected]<http://groups.google.com/group/watir-general%[email protected]>
>

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

[email protected]
http://groups.google.com/group/watir-general
[email protected]

Reply via email to