Hi Soori, Try the followig code... after $ie.goto('http://localhost/') loadtime =$ie.down_load_time.to_s puts loadtime
Regards Rinku Garg On Jul 6, 11:54 am, Soori <sure...@gmail.com> wrote: > Hi All, > > I would like to monitor the load time of an web page once in a 15 mins > for 2hrs, i should log in a file if the load time of that web page > exceeds 20secs, I tried with following code, but sometimes my page > takes more than 100 secs to load, am getting that message after that > 100 sec, It would be better if i get the entry on log file immediately > after exceeding the 20 secs.Please help me in this front. Thanks in > advance for ur help. > > require 'watir' > mylog= File.new( Time.now.strftime("%d-%b-%y") + ".csv",'a') > $ie=IE.new > begin > startTime=Time.now > $ie.goto('http://localhost/') > x=Time.now-startTime > ltitle=$ie.title > if x > 20 > mylog.puts Time.now.strftime("%I:%M:%S%p").to_s + "," + "Taking > more time to respond" + "," + x.to_s > > elsif $ie.text.include?("Home") > mylog.puts Time.now.strftime("%I:%M:%S%p").to_s + "," + "Page > Loaded Successfully" + "," + x.to_s > else > mylog.puts Time.now.strftime("%I:%M:%S%p").to_s + "," + "Failed to > load the URL" + "," + ltitle.to_s > end > rescue => e > mylog.puts Time.now.strftime("%I:%M:%S%p").to_s + "," + "Failed to > load the URL" + "," + ltitle.to_s + "," + e.to_s > end > > /Soori --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---