Hi,
I tried Begin-Rescue but Rescue block is not catching Timeout exception.
Its coming out of the test throwing that exception.
 
My code:
$ie.Button("value:=Submit").click_without_blocking()
begin
   alert_win = $ie.Dialog("title:=Microsoft Internet Explorer")
   alert_label = alert_win.Label("index:=2")
   alert_text =  alert_label.display_text
   alert_win.Button("text:=OK").click
rescue
   puts"No alert window found"
ensure
  puts"ok"
end
 
 Its printing whatever is in ensure block.But its not entering rescue block..
 
Also I tried to reduce timeout to 5 seconds using
$ie.timeout = 5
But it throws the following exception:
undefined method `timeout=' for #<WET::Browser:0x31fb! c10> (NoMethodError)
 
 
Thanks
Amitha

Raghu Venkataramana <[EMAIL PROTECTED]> wrote:
Hi Amitha,

There is no method to directly do that. However you can
put the dilg = ie.Dialog("title:=Microsoft Internet Explorer")
statement inside a Begin-Rescue block and catch timeout
exception. In the current implementation, the code tries
for 10 seconds to find the popup and gives up after that (
by raising a Timeout error).

Thanks
Raghu



Amitha Shetty wrote:

> Hi Raghu,
> Thanks a lot." dilg.Label("index:=1")" works fine.
> I have one more query...
> Can we use exists?function for popup i.e Is there a method to
> confirm if popup has appeared..
>
> Thanks,
> Amitha
>
> */Raghu Venkataramana <[EMAIL PROTECTED]>/* wrote:
>
> OK. Now I see!!. I basically misguided you.
>
> win_label() is a method in the underlying win-objects library which
> can be used to control win32 UI (call it ruby based AutoIT but with
> limited options as of now.). This method has been wrapped in the
> ModalDialog class as Label(). So the correct syntax would be.
>
> dilg.Label("index:=1")
>
> Sorry for the confusion. Let me know if this works for you.
>
> Thanks
> Raghu
>
> Amitha Shetty wrote:
>
> > Hi,
> > I tried wi! th click_without_blocking().
> > It is throwing the following exception:
> > undefined method `win_label' for #
> > (NoMethodError)
> > I tried with different index..(1 to 6).But it threw the same
> exception.
> >
> > Thanks,
> > Amitha
> >
> > */Raghu Venkataramana /* wrote:
> >
> > Hi Amitha,
> >
> > This time you seemed to have used
> > ie.Button("value:=Submit").click
> > instead of
> > ie.Button("value:=Submit").click_without_blocking()
> >
> > Thanks
> > Raghu
> >
> >
> > Amitha Shetty wrote:
> >
> > > Hi Raghu,
> > > Thanks for the help.
> > > But Watir hangs when I use win_label and display_text methods.
> > > I am using 0.5.3(latest) version of WET and that has winobjects.
> > >
> > > The following is my code:
> > >
> > > require 'WET'
> > > include WET
> > >
> &! gt; > ie = nil
> > > ie = Browser("url:=LOGIN_URL <=LOGIN_URL>")
> > > sleep 2
> > > ie.Button("value:=Submit").click #Gives Alert window...
> > > dilg = ie.Dialog("title:=Microsoft Internet Explorer")
> > > lbl = dilg.win_label("index:=1")
> > > puts lbl.display_text
> > > It clicks on the button and alert window appears. But it hangs
> > after that.
> > > I tried include Wet::Winobjects.
> > > I tried with indexes 1,2,3,4.But even that didn't help
> > >
> > >
> > > Please help.
> > >
> > > Thanks,
> > > Amitha
> > > */Raghu Venkataramana /* wrote:
> > >
> > > Hi Amitha,
> > >
> > > Assuming that you are using the latest version of WET (0.5.3), you
> > > will
> > > have wet-winobjects
> > > installed on your machine. Using wet-winobjects, you will be able
> > > to do
> > > what you asked. For example,
> > > in your case, you can do :
> > >
&! gt; > > dlg = $ie.Dialog("title:=Microsoft Internet Explorer")
> > > lbl = dlg.win_label("index:=1") # Pl. Try index of 2, 3 - one of
> > > them works
> > > puts lbl.display_text
> > >
> > > will printout out
> > > Do You really want to .... (The text that is displayed on the
> > dialog)
> > >
> > > The dlg.win_label above retrieves a handle to the first 'Static'
> > > element
> > > in the dialog window.
> > > The display_text method of the win_label class gets the actual
> text
> > > being displayed by the
> > > label.
> > >
> > > Hope this helps.
> > >
> > > The wet-winobjects is a ruby gem including rdocs. The rdocs
> > describes
> > > all t! he wet-winboject
> > > class API.
> > >
> > > Cheers
> ! > > Raghu
> > >
> > >
> > > Ami! tha Shetty wrote:
> > >
> > > > Hi,
> > > > I am using WET to handle alert windows.I am able to dismiss the
> > > > alert window by clicking on the ' OK' button using
> > > > def_ok()
> > > > $ie.Button("value:=Submit").click_without_blocking()
> > > > $ie.Dialog("title:=Microsoft Internet
> > > Explorer").Button("text:=OK").click
> > > > end
> > > > But I want to retrieve the text in the alert window and verify
> > > if the
> > > > right alert message is displayed.
> > > > For Eg:An alert window saying 'Do You really want to do
> > > this".How do I
> > > > get the text? How can I use Label(*args) method to do this?
> > > >
> > > > Thanks,
> > > > Amitha> > > >
> > > >
> > >
> >
> ------------------------------------------------------------------------
> > > > Enjoy this Di! wali with Y! India Click here
> > > >
> > > >
> > >
> >
> >------------------------------------------------------------------------
> > > >
> > > >_______________________________________________
> > > >Wtr-general mailing list
> > > >[email protected]
> > > >http://rubyforge.org/mailman/listinfo/wtr-general
> > > >
> > > >
> > >
> > >
> > > --
> > > Qantom Software
> > >
> > > http://www.qantom.com
> > > Ph : 91-80-26799269 Xtn. 125
> > > sip : [EMAIL PROTECTED]
> > > --
> > >
> > > _______________________________________________
> > > Wtr-general mailing list
> > > [email protected]
> > > http://rubyforge.org/mailman/listinfo/wtr-general
> > >
> > >
> > >
> >
> ------------------------------------------------------------------------
> > > Enj! oy this Diwali with Y! India Click here
> > >
> > >
> >
> >------------------------------------------------------------------------
> > >
> > >_______________________________________________
> > >Wtr-general mailing list
> > >[email protected]
> > >http://rubyforge.org/mailman/listinfo/wtr-general
> > >
> > >
> >
> >
> > --
> > Qantom Software
> >
> > http://www.qantom.com
> > Ph : 91-80-26799269 Xtn. 125
> ! > sip : [EMAIL PROTECTED]
> > --
> >
> > _______________________________________________
> > Wtr-general mailing list
> > [email protected]
> > http://rubyforge.org/mailman/listinfo/wtr-general
> >
> >
> >
> ------------------------------------------------------------------------
> > Enjoy this Diwali with Y! India Click here
> >
> >
> >------------------------------------------------------------------------
> >
> >_______________________________________________
> >Wtr-general mailing list
> >[email protected]
> >http://rubyforge.org/mailman/listinfo/wtr-general
> >
> >
>
>
> --
> Qantom Software
>
> http://www.qantom.com
> Ph : 91-80-26799269 Xtn. 125
> sip : [EMAIL PROTECTED]
> --
>
> _______________________________________________
> Wtr-general mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/wtr-general
>
>
> ------------------------------------------------------------------------
> Enjoy this Diwali with Y! India Click here
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Wtr-general mailing list
>[email protected]
>http://rubyforge.org/mailman/listinfo/wtr-general
>
>


--
Qantom Software

http://www.qantom.com
Ph : 91-80-26799269 Xtn. 125
sip : [EMAIL PROTECTED]
--

_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general




Enjoy this Diwali with Y! India Click here
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to