How to know a search result is successfully displayed through its source codes

I am working on a project where need to search a keyword by using simple
search. Once you type a keyword in the search field, the "submit" button
is clicked, then the matched search result is returned. Who can tell me
how can I get the time of response for that event? Thanks:>

···

--
Posted via http://www.ruby-forum.com/.

This seems to be basically the same question you asked a couple days
ago. If you describe what you're doing in more detail, you will likely
get more help. For instance, what library are you using to carry out
this operation? Are you using Watir?

-Jeremy

···

On 12/21/2010 01:24 AM, Fan Jin wrote:

I am working on a project where need to search a keyword by using simple
search. Once you type a keyword in the search field, the "submit" button
is clicked, then the matched search result is returned. Who can tell me
how can I get the time of response for that event? Thanks:>

Jeremy Bopp wrote in post #969808:

···

On 12/21/2010 01:24 AM, Fan Jin wrote:

I am working on a project where need to search a keyword by using simple
search. Once you type a keyword in the search field, the "submit" button
is clicked, then the matched search result is returned. Who can tell me
how can I get the time of response for that event? Thanks:>

This seems to be basically the same question you asked a couple days
ago. If you describe what you're doing in more detail, you will likely
get more help. For instance, what library are you using to carry out
this operation? Are you using Watir?

-Jeremy

Yes, the library I am using here is watir, but the two times which I
caught from click and result return are properly not right, they are
identical even the interface's response time is longer than 2s.
The method I used here was ping the HTTP server, once the result was
returned, the happened time was caught.
Need your more help, thanks :>

--
Posted via http://www.ruby-forum.com/\.

Two ideas:
1) The time difference between the two actions actually *is* negligible.
2) The resolution of your system clock is too high to capture the time
accurately, and thus the delta between T1 and T2 results in 0.

You could check for two by trying sleep with ever smaller increments
(1000 for a second, 500 for half a second, and so on), and see when
you stop getting a shorter sleep() interval.

···

On Wed, Dec 22, 2010 at 3:02 AM, Fan Jin <jeff_yq@yahoo.com.au> wrote:

Yes, the library I am using here is watir, but the two times which I
caught from click and result return are properly not right, they are
identical even the interface's response time is longer than 2s.
The method I used here was ping the HTTP server, once the result was
returned, the happened time was caught.
Need your more help, thanks :>

--
Phillip Gawlowski

Though the folk I have met,
(Ah, how soon!) they forget
When I've moved on to some other place,
There may be one or two,
When I've played and passed through,
Who'll remember my song or my face.

If you post some code, folks might be better able to help you.

···

On Tue, Dec 21, 2010 at 8:02 PM, Fan Jin <jeff_yq@yahoo.com.au> wrote:

Jeremy Bopp wrote in post #969808:

Yes, the library I am using here is watir, but the two times which I
caught from click and result return are properly not right, they are
identical even the interface's response time is longer than 2s.
The method I used here was ping the HTTP server, once the result was
returned, the happened time was caught.
Need your more help, thanks :>

Gordon Thiesfeld wrote in post #970057:

Jeremy Bopp wrote in post #969808:

Yes, the library I am using here is watir, but the two times which I
caught from click and result return are properly not right, they are
identical even the interface's response time is longer than 2s.
The method I used here was ping the HTTP server, once the result was
returned, the happened time was caught.
Need your more help, thanks :>

If you post some code, folks might be better able to help you.

The codes I wrote was following:
  #set a key word in search field, then click the search button.
  browser.text_field(:id, 'simpleSearchInput').set('test')
  browser.link(:id,'simpleSearchSubmit').click
  t1 = Time.now # get the time when button is clicked.
  Watir::Wait.until{browser.div(:id, 'srpWrapper').exists?}#wait until
the search result list is loaded, here I used div(:id) to ensure that
result is finish loading.
  t2 = Time.now # give the time t2.
  t = t2 - t1 # This is the system responding time.
  puts "the system response time is: " + t.to_s

Although the codes run well, the time it returns is almost
the same. I think there is a method in watir which can get the time of
response directly after a new webpage was loaded. Need folks help.Thanks

Jin Fan

···

On Tue, Dec 21, 2010 at 8:02 PM, Fan Jin <jeff_yq@yahoo.com.au> wrote:

--
Posted via http://www.ruby-forum.com/\.

Some resources for you:

http://wiki.openqa.org/display/WTR/How+to+wait+with+Watir

The click method waits for the page to load. That's why you're not
seeing any time difference between t1 and t2. The page is already
loaded, so Watcher::Wait.until returns immediately.

Also, the click method returns the load time, so you could write it like this:

    browser.text_field(:id, 'simpleSearchInput').set('test')
    t = browser.link(:id,'simpleSearchSubmit').click

    puts "the system response time is: #{t.to_s}"

···

On Thu, Dec 23, 2010 at 12:11 AM, Fan Jin <jeff_yq@yahoo.com.au> wrote:

Gordon Thiesfeld wrote in post #970057:

On Tue, Dec 21, 2010 at 8:02 PM, Fan Jin <jeff_yq@yahoo.com.au> wrote:

Jeremy Bopp wrote in post #969808:

Yes, the library I am using here is watir, but the two times which I
caught from click and result return are properly not right, they are
identical even the interface's response time is longer than 2s.
The method I used here was ping the HTTP server, once the result was
returned, the happened time was caught.
Need your more help, thanks :>

If you post some code, folks might be better able to help you.

The codes I wrote was following:
#set a key word in search field, then click the search button.
browser.text_field(:id, 'simpleSearchInput').set('test')
browser.link(:id,'simpleSearchSubmit').click
t1 = Time.now # get the time when button is clicked.
Watir::Wait.until{browser.div(:id, 'srpWrapper').exists?}#wait until
the search result list is loaded, here I used div(:id) to ensure that
result is finish loading.
t2 = Time.now # give the time t2.
t = t2 - t1 # This is the system responding time.
puts "the system response time is: " + t.to_s

Although the codes run well, the time it returns is almost
the same. I think there is a method in watir which can get the time of
response directly after a new webpage was loaded. Need folks help.Thanks

Jin Fan

--
Posted via http://www.ruby-forum.com/\.

#set a key word in search field, then click the search button.
    browser.text_field(:id, 'simpleSearchInput').set('test')
    t = browser.link(:id,'simpleSearchSubmit').click

    puts "the system response time is: #{t}"

Sorry, I'm tired.

···

On Thu, Dec 23, 2010 at 12:54 AM, Gordon Thiesfeld <gthiesfeld@gmail.com> wrote:

Also, the click method returns the load time, so you could write it like this:

Gordon Thiesfeld wrote in post #970235:

···

On Thu, Dec 23, 2010 at 12:54 AM, Gordon Thiesfeld > <gthiesfeld@gmail.com> wrote:

Also, the click method returns the load time, so you could write it like this:

    #set a key word in search field, then click the search button.
    browser.text_field(:id, 'simpleSearchInput').set('test')
    t = browser.link(:id,'simpleSearchSubmit').click

    puts "the system response time is: #{t}"

Sorry, I'm tired.

Thanks, it was working now:>

--
Posted via http://www.ruby-forum.com/\.