Hi venky, I use firewatir too and ended up tweaking the wait method in firefox.rb so that it uses busyflags.
when the wait method times out (300 seconds) then it should raise and exception. if rescue the exception you can try to load the url again with ff.goto (url) - generally the page will then load properly. here my wait method. def wait(last_url = nil) #puts "In wait function " isLoadingDocument = "" start = Time.now while isLoadingDocument != "0" # puts "WWWW #{BROWSER_VAR}=#{WINDOW_VAR}.getBrowser(); # {BROWSER_VAR}.selectedBrowser.webProgress.busyFlags" isLoadingDocument = js_eval("#{BROWSER_VAR}=# {WINDOW_VAR}.getBrowser(); # {BROWSER_VAR}.selectedBrowser.webProgress.busyFlags") # isLoadingDocument = js_eval("#{BROWSER_VAR}=# {WINDOW_VAR}.getBrowser(); # {BROWSER_VAR}.webProgress.isLoadingDocument;") # puts "Is browser still loading page: #{isLoadingDocument}" #puts "Is browser still loading page: #{isLoadingDocument}" sleep(0.25) # Derek Berner 5/16/08 # Raise an exception if the page fails to load if (Time.now - start) > 300 raise "Page Load Timeout" end end # Derek Berner 5/16/08 # If the redirect is to a download attachment that does not reload this page, this # method will loop forever. Therefore, we need to ensure that if this method is called # twice with the same URL, we simply accept that we're done. $jssh_socket.send("#{BROWSER_VAR}.contentDocument.URL;\n", 0) url = read_socket() if(url != last_url) # Check for Javascript redirect. As we are connected to Firefox via JSSh. JSSh # doesn't detect any javascript redirects so check it here. # If page redirects to itself that this code will enter in infinite loop. # So we currently don't wait for such a page. # wait variable in JSSh tells if we should wait more for the page to get loaded # or continue. -1 means page is not redirected. Anyother positive values means wait. jssh_command = "var wait = -1; var meta = null; meta = # {BROWSER_VAR}.contentDocument.getElementsByTagName('meta'); if(meta != null) { var doc_url = # {BROWSER_VAR}.contentDocument.URL; for(var i=0; i< meta.length;++i) { var content = meta[i].content; var regex = new RegExp(\"^refresh$\", \"i\"); if(regex.test(meta[i].httpEquiv)) { var arrContent = content.split(';'); var redirect_url = null; if(arrContent.length > 0) { if(arrContent.length > 1) redirect_url = arrContent[1]; if(redirect_url != null) { regex = new RegExp(\"^.*\" + redirect_url + \"$\"); if(!regex.test(doc_url)) { wait = arrContent[0]; } } break; } } } } wait;" #puts "command in wait is : #{jssh_command}" jssh_command = jssh_command.gsub(/\n/, "") $jssh_socket.send("#{jssh_command}; \n", 0) wait_time = read_socket(); #puts "wait time is : #{wait_time}" begin wait_time = wait_time.to_i if(wait_time != -1) sleep(wait_time) # Call wait again. In case there are multiple redirects. $jssh_socket.send("#{BROWSER_VAR} = # {WINDOW_VAR}.getBrowser(); \n",0) read_socket() wait(url) end rescue end end set_browser_document() run_error_checks() return self end On 9 Jun., 13:14, venky <venkatesh...@gmail.com> wrote: > Hi, > > How to handle page load time out error in FireWatir.? > > And how to get status of the browser in FireWatir? > > Kindly help in this > > Thanks, > Venkathttp://www.prog2impress.com --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---