Hi All,
We could overcome this particular issue by introducing a little
polling interval in the part of my code that opens the Browser.
code:-
# FUNCTION TO BE CALLED
def call(browser,url)
$ie=FireWatir::Firefox.new
$ie.maximize
$ie.goto url
$sessionHwnd=$ie.title();
end
# MAIN CODE
begin
i = 0
call(browser,url)
rescue Exception => ex
if i <5
sleep(5)
i = i+1
call(browser,url)
else
puts "Could not open Browser. Retry."
end
end
In case such an exception is encountered the code will retry to open
the browser 5 times again at the max.
Thanks a lot for all the ideas.
-Betsy Joy.
On May 1, 9:54 pm, Pallavi Sharma <[email protected]> wrote:
> Thanks a lot for sharing this, this would help definitely.
>
> Regards
>
> Pallavi.
>
>
>
>
>
> On Sat, May 1, 2010 at 2:02 AM, joedio <[email protected]> wrote:
> > Oops,
>
> > The code for the display of the Global variables I previously posted
> > was a cut 'n paste mistake. The correct code is:
>
> > # Variables
> > puts2("\nRuby Global Variables: ")
> > aRubyGlobalVars = global_variables() # Populate array with the Ruby
> > Global variables
> > aRubyGlobalVars.each do |key| # Loop through the Ruby Global
> > variables
> > if(eval(key).class.to_s == "String")
> > puts2(" #{key.to_s} = \"" + eval(key).to_s + "\",\t
> > Class: " + eval(key).class.to_s)
> > else
> > puts2(" #{key.to_s} = " + eval(key).to_s + ",\t Class:
> > " + eval(key).class.to_s)
> > end
> > end # End of Variables loop
>
> > On Apr 30, 9:43 am, joedio <[email protected]> wrote:
> > > Betsy,
>
> > > One of the things to do is to gather info on the execution
> > > environment. Perhaps somewhere during the scripts execution of the
> > > first (working) and second (failing) attempt, something is either
> > > trying to require or include safariwatir, or the browser type
> > > (Watir.options[:browser]) is getting set incorrectly.
>
> > > Below is code to gather a lot of that info. It prints out info on
> > > Ruby, the O/S, the files Ruby has loaded, and each of the Global
> > > variables defined in Ruby, at that point in the scripts execution.
> > > Temporarily put it into your failing script, once just before the
> > > first (working) invocation of the browser, and then again just before
> > > the second time (the one that raises the safariwatir message). Perhaps
> > > you can't spot a difference. Post the output back here if you wish,
> > > and someone may be able to use it to further assist with this issue.
>
> > > Also, presuming that you are using Watir1.6.5 is there a reason you
> > > are starting the browser with:
> > > require 'firewatir'
> > > include FireWatir
> > > $ie=FireWatir::Firefox.new
>
> > > instead of the newer (As described in the CommonWatir Rdoc for the
> > > class Watir::Browser):
> > > require 'watir'
> > > $browser = Watir::Browser.new # Of course you can still name
> > > the global browser $ie instead if $browser if you prefer, as I switch
> > > between IE & FF I prefer to use $browser
>
> > > You might want to switch over to the newer one and see if that has any
> > > bearing on the issue.
>
> > > Here's the code I was mentioning:
>
> > > # Collect information on the execution environment
>
> > > # Ruby & Browser
> > > puts("RUBY_VERSION: " + RUBY_VERSION)
> > > puts("RUBY_PLATFORM: " + RUBY_PLATFORM)
> > > puts("Browser: " + Watir.options[:browser])
>
> > > # O/S
> > > puts("\nOS ENV Variables: ")
> > > ENV.each do |key, value| # Loop through the O/S Env variables
> > > puts(" #{key} = #{value}") # Display each variable and its
> > setting
> > > end # End of O/S loop
>
> > > # Loaded Files
> > > puts("\nRuby Loaded files: ")
> > > $LOADED_FEATURES.each do |value| # Loop through the files
> > > puts(" #{value}") # Display each file
> > > end # End of Files loop
>
> > > # Global Variables
> > > puts("\nRuby Global Variables: ")
> > > aRubyGlobalVars = global_variables() # Populate array with the Ruby
> > > Global variables
> > > aRubyGlobalVars.each do |key, value| # Loop through the Ruby Global
> > > variables
> > > puts(" #{key} = #{value}") # Display each variable and its
> > > setting
> > > end # End of Variables loop
>
> > > On Apr 29, 6:13 am, Betsy <[email protected]> wrote:
>
> > > > Hi,
>
> > > > Still waiting for a way out of this FireWatir issue.
>
> > > > -Betsy
>
> > > > On Apr 21, 2:51 pm, Željko Filipin <[email protected]>
> > > > wrote:
>
> > > > > On Wed, Apr 21, 2010 at 11:35 AM, Betsy <[email protected]> wrote:
> > > > > > include FireWatir
>
> > > > > Remove this and let me know if there is any improvement.
>
> > > > > > The problem with this issue is that it does not come up every time.
>
> > > > > That would make it hard to debug.
>
> > > > > Željko
>
> > > > > --
> > > > > Before posting, please readhttp://watir.com/support. In short:
> > search before you ask, be nice.
>
> > > > > You received this message because you are subscribed tohttp://
> > groups.google.com/group/watir-general
> > > > > To post: [email protected]
>
> > > > --
> > > > Before posting, please readhttp://watir.com/support. In short: search
> > before you ask, be nice.
>
> > > > You received this message because you are subscribed tohttp://
> > groups.google.com/group/watir-general
> > > > To post: [email protected]
> > > > To unsubscribe:
> > > > [email protected]<watir-general%2bunsubscr...@goog
> > > > legroups.com>
>
> > > --
> > > Before posting, please readhttp://watir.com/support. In short: search
> > before you ask, be nice.
>
> > > You received this message because you are subscribed tohttp://
> > groups.google.com/group/watir-general
> > > To post: [email protected]
> > > To unsubscribe:
> > > [email protected]<watir-general%2bunsubscr...@goog
> > > legroups.com>
>
> > --
> > Before posting, please readhttp://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%2bunsubscr...@goog
> > legroups.com>
>
> --
> Before posting, please readhttp://watir.com/support. In short: search before
> you ask, be nice.
>
> You received this message because you are subscribed
> tohttp://groups.google.com/group/watir-general
> To post: [email protected]
> To unsubscribe: [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]