If you comment out lines 5 and 6 from your example snippet (where you sleep,
then try to use the first browser window again), does your script still die
after the JSTypeError exception is raised?

Or does the exception not reproduce unless you perform the "@b.button(:name,
'Button').click" in the first browser window?

As mentioned earlier, I had some similar issues with self-closing Firefox
windows in 1.6.2 - but for me, those issues were fixed in Watir 1.6.5.

Can you paste the HTML of the link (and any JavaScript it invokes) that
closes the second browser window?  Specifically, this link:  @b2.link(:text,
'select ')

That might be useful in creating a repro environment.

Thanks
Bill

On Thu, Jun 17, 2010 at 3:40 PM, Chandrakala Shivappa <
[email protected]> wrote:

> Thanks for the reply.
>
> yep, that patch did not work for me.
> Of-course I have used caption of the browser for title, I just avoided
> showing it here.
> Here again mentioning my script:
>
> 1 >>> @b.image(:class, 'image1 ').click
> 2 >>> @b2 = Watir::Browser.attach(:title, 'browser2')
> 3 >>> sleep 3
> 4 >>> @b2.link(:text, 'select ').click
> 5 >>> sleep 3
> 6 >>> @b.button(:name, 'Button').click
>
> That error is displayed for line 4 at which point b2 is closed and has
> to carry on line 6 on b1.
>
> On Thu, Jun 17, 2010 at 3:26 PM, Bill Agee <[email protected]> wrote:
> > Actually, on second thought, the patch I posted will probably not help
> you.
> > The patch is for a different issue seen in some scenarios when the
> > FireWatir::Firefox "close" method is used in 1.6.5.  Sorry about that.
> >
> > I was curious about this line of code in your email:
> >
> > @b2 = Watir::Browser.attach(:title, '')
> >
> > I don't know if it will make a difference, but it might be worth trying
> to
> > attach to the second window using a title or URL value other than ''.
> >
> > Thanks
> > Bill
> >
> > On Thu, Jun 17, 2010 at 2:49 PM, Bill Agee <[email protected]> wrote:
> >>
> >> I had this problem too, when I wanted to attach to a Firefox window,
> then
> >> click a "Close" button in the attached window.
> >>
> >> I did a little investigation and put together the following monkey
> patch,
> >> which seemed to work for me:
> >>
> >> http://gist.github.com/442827
> >>
> >> You can try it out by pasting it into your script just after your
> "require
> >> 'watir'" line.
> >>
> >> If it works, please reply and let us know, and maybe it can be turned
> into
> >> a proper fix. :)
> >>
> >> Thanks
> >> Bill
> >>
> >>
> >> On Thu, Jun 17, 2010 at 2:17 PM, chandra <[email protected]>
> >> wrote:
> >>>
> >>> I am testing a website in Firefox on Windows 7. I am a fresher in
> >>> watir.
> >>> I have problem in testing this scenario:
> >>>
> >>> 1.On click of a Image button in first browser(b1), another instance of
> >>> browser(b2) opens up.
> >>> 2.Need to select a link in b2.
> >>> 3.On selection of link in b2, b2 closes by itself and enters the
> >>> selected value in the field in b1.
> >>>
> >>> All these 3 steps are done by watir but after this step, my script
> >>> doesnot run further(which is on b1).
> >>> Its giving this error:
> >>>
> >>> JsshSocket::JSTypeError:  window.getBrowser is not a function
> >>>    c:/ruby/lib/ruby/gems/1.8/gems/firewatir-1.6.5/lib/firewatir/
> >>> jssh_socket.rb:12:in `js_eval'
> >>>    c:/ruby/lib/ruby/gems/1.8/gems/firewatir-1.6.5/lib/firewatir/
> >>> firefox.rb:492:in `wait'
> >>>    c:/ruby/lib/ruby/gems/1.8/gems/firewatir-1.6.5/lib/firewatir/
> >>> element.rb:1118:in `wait'
> >>>    c:/ruby/lib/ruby/gems/1.8/gems/firewatir-1.6.5/lib/firewatir/
> >>> element.rb:1099:in `click'
> >>>
> >>> My script is like this:
> >>>
> >>> @b.image(:class, ' ').click
> >>> @b2 = Watir::Browser.attach(:title, '')
> >>> sleep 3
> >>> @b2.link(:text, ' ').click
> >>> sleep 3
> >>> @b.button(:name, 'Button').click
> >>>
> >>> I am not getting how to bring back the watir control to b1 and get rid
> >>> of this error.
> >>>
> >>> Can anyone please give inputs.
> >>>
> >>> Thanks,
> >>> Chandra
> >>>
> >>> --
> >>> Before posting, please read http://watir.com/support. In short: search
> >>> before you ask, be nice.
> >>>
> >>> You received this message because you are subscribed to
> >>> http://groups.google.com/group/watir-general
> >>> To post: [email protected]
> >>> To unsubscribe: 
> >>> [email protected]<watir-general%[email protected]>
> >>
> >
> > --
> > Before posting, please read http://watir.com/support. In short: search
> > before you ask, be nice.
> >
> > You received this message because you are subscribed to
> > http://groups.google.com/group/watir-general
> > To post: [email protected]
> > To unsubscribe: 
> > [email protected]<watir-general%[email protected]>
> >
>
> --
> Before posting, please read http://watir.com/support. In short: search
> before you ask, be nice.
>
> You received this message because you are subscribed to
> http://groups.google.com/group/watir-general
> To post: [email protected]
> To unsubscribe: 
> [email protected]<watir-general%[email protected]>
>

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

You received this message because you are subscribed to 
http://groups.google.com/group/watir-general
To post: [email protected]
To unsubscribe: [email protected]

Reply via email to