Forum: Ruby How to handle popup dialog box

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
F3ea864ae7a1678e75a009efdfcec04d?d=identicon&s=25 Amruta (Guest)
on 2007-05-17 15:08
Hi,
 I'am new to Ruby.Please help me to get this done.
 After clicking on a button a popup dialog box appears on the
screen.Which is a login page having Username and Password text fields
and Ok button.I'am not able to get that dialog box and not able to set
text values.

ie.button(:id , "Sign In").click
def enabled_popup(timeout)

#popup=ie.Dialog("title:Login").text().to_s
hwnd=ie.enabled_popup(5)
if(hwnd)
  w=WinClicker.new
  w.makeWindowActive(hwnd)
  w.setTextBoxText(hwnd,"admin")
  w.clickWindowsButton_hwnd(hwnd,"Ok")
end
end

Thanks in advance.
B7168a8bcc7604c9dccf21ae5660877b?d=identicon&s=25 Yt Hu (ythu)
on 2008-09-10 02:05
Hi Amruta,
  try this function

   def startClicker( button , waitTime = 3)
    w = WinClicker.new
    shortName="C:\\ruby\\lib\\ruby\\gems\\1.8\\gems\\watir-1.5.3"
    c = "start ruby #{shortName }\\watir\\clickJSDialog.rb #{button }
#{waitTime} "
    puts "Starting #{c}"
    w.winsystem(c)
    w=nil
  end

you just need to change the path of shortName accordingly to point to
your clickJSDialog.rb file

good luck


Amruta wrote:
> Hi,
>  I'am new to Ruby.Please help me to get this done.
>  After clicking on a button a popup dialog box appears on the
> screen.Which is a login page having Username and Password text fields
> and Ok button.I'am not able to get that dialog box and not able to set
> text values.
>
> ie.button(:id , "Sign In").click
> def enabled_popup(timeout)
>
> #popup=ie.Dialog("title:Login").text().to_s
> hwnd=ie.enabled_popup(5)
> if(hwnd)
>   w=WinClicker.new
>   w.makeWindowActive(hwnd)
>   w.setTextBoxText(hwnd,"admin")
>   w.clickWindowsButton_hwnd(hwnd,"Ok")
> end
> end
>
> Thanks in advance.
This topic is locked and can not be replied to.