For the information - i tried to improve the automatic retrying in
https://github.com/bret/watir/commit/86dc14d838dd9a9ee23fbb0801a61fe5dfa4c512

It will be available in the next version, but it would be great if you
could give these changes a try already to see if that makes any
difference. Don't forget to disable your monkey-patches before :)

Jarmo Pertman
-----
IT does really matter - http://www.itreallymatters.net


On Feb 8, 11:38 am, Stephen Mc Gowan <[email protected]> wrote:
> Hey,
>
> Thanks for the reply, this looks like a much better solution. But you're
> right it would be good if we could pass firefox arguments in Browser.new().
>
> Anyone have any ideas?
>
> Cheers,
> Stephen
>
>
>
>
>
>
>
>
>
> On Tue, Feb 8, 2011 at 12:30 AM, Bill Agee <[email protected]> wrote:
> > Hi,
>
> > Since posting that suggestion for that hack to rescue/retry a failed
> > Firefox launch, I tried another approach which worked a little better. :)
>
> > To give the Firefox browser instance more time to initialize before
> > FireWatir tries to drive it, you can pass an optional wait time value (at
> > least if you're using Firefox.new directly).  This makes FireWatir sleep
> > after launching the browser:
>
> >   ff = FireWatir::Firefox.new( { :waitTime => 10 } )
>
> > 10 seconds seems to be enough to get rid of any errors on my FireWatir
> > machines, no matter how slow and clunky they are...I haven't seen any FF
> > launch problems since increasing this wait value.
>
> > My guess at where the problem lies:
>
> > It looks like Firefox#launch_browser contains a default sleep time of 2
> > seconds to allow FF to initialize before trying to drive it.
>
> > But in my experience, on slow Vista/Win7 machines (and even some XP
> > machines), 2 seconds isn't enough, and so exceptions often occur at launch,
> > apparently due to FF not being ready when FireWatir plows ahead and tries to
> > drive the browser.
>
> > This may be the cause of the infamous "JsshSocket::JSTypeError:
> > this.docShell is null" exception when launching Firefox.
>
> > Side note: It would be nice if the launch_browser method could poll Firefox
> > to determine when the browser is ready, rather than sleeping using the wait
> > time value.
>
> > Also, there's one complication to this technique - I haven't been able to
> > figure out how to make Browser.new accept any Firefox options.
>
> > Does anybody know how to define Firefox options (like :waitTime) before
> > starting Firefox with Browser.new?  I experimented with the source of
> > commonwatir a bit, but I wasn't successful in setting the :waitTime option
> > and having Firefox actually use it.
>
> > In the meantime, to increase the default Firefox startup wait time while
> > also using Browser.new to launch FF, I'm using a hack of monkeypatching
> > Firefox#launch_browser to increase the default wait time:
>
> >     def launch_browser(options = {})
>
> >       <snip unrelated code>
>
> >       bin = path_to_bin()
> >       @t = Thread.new { system("#{bin} -jssh #{profile_opt}") }
> >       #FIXME: Original line:
> >       #sleep options[:waitTime] || 2
> >       sleep options[:waitTime] || 10
>
> > But monkeypatching this entire method is bad...I need to find a better way
> > that will not complicate Watir upgrades.
>
> > Thanks
> > Bill
>
> > On Thu, Feb 3, 2011 at 6:13 AM, Stephen Mc Gowan <[email protected]>wrote:
>
> >> Hi,
>
> >> I'm seeing an intermittent watir issue with firefox. I really don't know
> >> whats causing it, I can't seem to cause it to happen reliably. I've seen a
> >> thread from last may discussing something similar and a really hacky work
> >> around:http://osdir.com/ml/watir-general/2010-05/msg00134.html
>
> >> I guess I'm hoping some better solution might have popped up in the
> >> meantime.
>
> >> It's giving me the following error.
>
> >> C:/Ruby186/lib/ruby/gems/1.8/gems/firewatir-1.6.7/lib/firewatir/jssh_socket
> >>  .rb:19:in
> >> `js_eval': this.docShell is null (JsshSocket::JSTypeError)
>
> >> C:/Ruby186/lib/ruby/gems/1.8/gems/firewatir-1.6.7/lib/firewatir/firefox.rb:
> >>  194:in
> >> `set_browser_document'
>
> >> C:/Ruby186/lib/ruby/gems/1.8/gems/firewatir-1.6.7/lib/firewatir/firefox.rb:
> >>  52:in
> >> `initialize'
>
> >> C:/Ruby186/lib/ruby/gems/1.8/gems/firewatir-1.6.7/lib/watir/browser.rb:65:i
> >>  n
> >> `new'
>
> >> C:/Ruby186/lib/ruby/gems/1.8/gems/firewatir-1.6.7/lib/watir/browser.rb:65:i
> >>  n
> >> `new'
> >>     from ./Ruby/goto.rb:7
>
> >> and goto.rb is here:
>
> >> require "rubygems"
> >> require "watir"
>
> >> puts('ruby: Using firefox')
> >> Watir::Browser.default = 'firefox'
> >> puts('ruby: Starting browser')
>
> >> b = Watir::Browser.new
> >> puts('ruby: Browser started')
> >> b.maximize
> >> b.goto(ARGV[0])
>
> >> Any ideas?
>
> >> Cheers,
> >> --
> >> Stephen Mc Gowan.
>
> >>  --
> >> Before posting, please readhttp://watir.com/support. In short: search
> >> before you ask, be nice.
>
> >> [email protected]
> >>http://groups.google.com/group/watir-general
> >> [email protected]
>
> >  --
> > Before posting, please readhttp://watir.com/support. In short: search
> > before you ask, be nice.
>
> > [email protected]
> >http://groups.google.com/group/watir-general
> > [email protected]
>
> --
> Stephen Mc Gowan.

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

[email protected]
http://groups.google.com/group/watir-general
[email protected]

Reply via email to