From: Fan Jin Date: 2010-12-21T10:10:15+09:00 Subject: Re: To get time response of two events Jeremy Bopp wrote in post #969594: > On 12/20/2010 05:12 AM, Fan Jin wrote: >> Hi: >> I have two parameters which were defined as t1 and t2. In this case, t1 >> should be related to the time on which a search button click within a >> webpage; t2 should be related to the time on which the search result is >> turned out. Then I need to get the time response of the search which >> defined as t = t2 - t1. How can I get system time t1 and t2 ? > > irb(main):001:0> t1 = Time.now > => Mon Dec 20 10:39:57 -0600 2010 > irb(main):002:0> t2 = Time.now > => Mon Dec 20 10:40:07 -0600 2010 > irb(main):003:0> t = t2.to_i - t1.to_i > => 10 > > -Jeremy Thanks for your reply. I've applied your method, but the result is not I want. Here, I have a click button event which codes include: browser.link(:id,'simpleSearchSubmit').click I need the method to get the time while this button is clicked; and when the search result is published, I also need the method to get the time when the result is published: if browser.text.include? "50428 Keywords " #Get the time here. -- Posted via http://www.ruby-forum.com/.