Hi,
Use threads,it may help.
some thing like this
t=Thread.new{
pop-up code
}
t.join

Thanks,
kiran.


On May 12, 10:13 am, SushilKarwa <sushil.ka...@gmail.com> wrote:
> Any help is much appreciated....
>
> Regards,
> S.K
>
> On May 11, 6:12 pm, SushilKarwa <sushil.ka...@gmail.com> wrote:
>
> > Hi Group,
> >     I am struggling to handle the JavaScript popups. Let me explain my
> > scenario to you guys.
> > In my web application am executing certain URL. Once that url is
> > executed it pops up a javaScript alert box.
> > From within the same browser window I need to click on the ok button
> > to get out of that box. But it doesnt seem to be happening.
> > My test is if I get a pop up then FAIL else PASS the test.
>
> > I have been using the following code in my main program.
>
> > test.goto("http://example.com/sample.do?param1=abc,param2=xyz";)
> > check_for_popup("Windows Internet Explorer","OK").should == false)
>
> > and my check_for_popup is something like this
>
> > def chk_for_popups(title,button)
> >       puts("In popups method...")
> >       autoit=WIN32OLE.new('AutoItX3.Control')
> >       ret=autoit.WinWait(title,"",1)
> >       if (ret==1)
> >            puts "There is pop up."
> >            autoit.WinActivate(title)
> >            button.downcase!
> >            if button.eql?("ok") || button.eql?("yes") || button.eql?
> > ("continue")
> >               autoit.Send("{Enter}")
> >               else
> >                   autoit.Send("{tab}")
> >                   autoit.Send("{Enter}")
> >               end
> >               return true
> >           elsif (ret==0)
> >               puts "No pop up."
> >               return false
> >           end
> >   end
>
> > Now the problem is when I execute the URL, its not entering the
> > check_for_popup(). Only when I manually click OK button on the alert
> > box, it enters this method, which is kind of confusing. Not sure why
> > is this happening...
>
> > Could anybody help me solving this issue..
>
> > Thanks in advance,
> > S.K
--~--~---------~--~----~------------~-------~--~----~
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