To get time response of two events

F

Fan Jin

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
 
J

Jeremy Bopp

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
 
F

Fan Jin

Jeremy Bopp wrote in post #969594:
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.
 
J

Jeremy Bopp

Jeremy Bopp wrote in post #969594:

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.

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top