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 ?
Thanks
On 12/20/2010 05:12 AM, Fan J. 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
Jeremy B. wrote in post #969594:
On 12/20/2010 05:12 AM, Fan J. 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.
On 12/20/2010 07:10 PM, Fan J. wrote:
=> Mon Dec 20 10:39:57 -0600 2010
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.
Could you go into more detail regarding how that method fails to meet
your needs? Somewhere in your code you are performing the button click
and then waiting for a result. Before that code, capture the starting
time in t1, and then capture the ending time just after that code in t2.
Without knowing more about your code, I can’t suggest much more than
this.
-Jeremy