Looks like the problem is this line:

  $text=WinGetText(window_title, "")

In this situation, ruby doesn't know where to find the definition for
the 'WinGetText' method.  So it is probably attempting to invoke the
method on the special 'main' object, which fails, resulting in the
NoMethodError exception you saw.

Instead, try invoking WinGetText on your AutoIt OLE object:

  $text = save_dialog.WinGetText(window_title, "")

You should be able to use any of the AutoIt methods this way.

Thanks
Bill


On Tue, Jan 13, 2009 at 6:19 AM, zeng0...@gmail.com <zeng0...@gmail.com> wrote:
>
> Bill,
>
> Thank you very much for your replay. I tried the following:
>
> prompt_message = "Do you want to save this file?"
> window_title = "File Download"
> save_dialog = WIN32OLE.new("AutoItX3.Control")
> sleep 1
> $browser.div(:id,"contents").table(:index, "1")[1][2].table
> (:index,"12")[2][2].link(:text, "download").click_no_wait
>  $text=WinGetText(window_title, "")
>  if $text=~/omnicast/
>      $aFile.puts("Omnicast download passed")
> else
>      $aFile.puts("Omnicast download failed")
> end
>
> I put require 'watir/dialog' on top and registered AutoIt dll
> successfully. But I got "NoMethodError: undefined method `WinGetText'
> " error while I executing the code. Did I miss something?
>
>
> On Jan 12, 5:34 pm, "Bill Agee" <billa...@gmail.com> wrote:
>> AutoIt may be able to do what you want.  Check out the WinGetTitle 
>> andWinGetTextfunctions:
>>
>> http://www.autoitscript.com/autoit3/docs/functions/WinGetTitle.htm
>>
>> http://www.autoitscript.com/autoit3/docs/functions/WinGetText.htm
>>
>> There should be some code examples in the wtr-general archives showing
>> how to use those functions within Ruby scripts.  If you can't find
>> anything useful, just reply back and I'll see if I can write an
>> example.
>>
>> Thanks
>> Bill
>>
>> On Mon, Jan 12, 2009 at 1:35 PM, zeng0...@gmail.com <zeng0...@gmail.com> 
>> wrote:
>>
>> > I have a File download popup window looks the same as in
>> >http://wiki.openqa.org/display/WTR/File+Downloads
>>
>> > I wonder if there is a way to check the Name and Type text on this
>> > window.
>>
>> > Any suggestions are appreciated!
>>
>> > Jun
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---

Reply via email to