I think the issue is that since it's being invoked by client-side
code, watir doesn't really know to expect a page load at that time

Have you by any chance tried to click that div as if it was a button,
using the ID to identify it?

Since I see some ajax in there, I guess the first question is, is the
system truely re-loading the page, or is it just updating it?  In
other words, does the browser actually act like a page is loading,
does it ever say anything but 'done' in the status bar?  do you see
any of the 'animations' done by the browser to indicate a page is
being loaded?   If it is only updating portions of the page, it makes
getting a load time a lot harder.

It's been a while since I've played with this (since I needed to) but
I could swear that in the past Watir was a little less obsessive about
elements exactly matching the specific element type when you were
identifying them by ID (I think the logic was that since there should
be only ONE thing on that page with that id value, if we found one, it
must be the one you wanted).

b.button(:id, "configure_access_left").click

The reason I say that is that doing that might cause watir to do it's
normal 'wait for the page to load' thing.   I'm not sure, but it might
be worth a shot.

(that or adding that command right after the one that does the mouseup
event, instead of a sleep)

Instead of sleeps, read up on waiting with watir.. in cases like this
it's sometimes easier to just have a small loop that waits for a
expected object to exist within the page, as an indication you are
ready to proceed.  (or conversely if the app displays some kind of
'loading' icon, you wait for that to go away)

On Mar 17, 3:29 am, vin <vinay...@gmail.com> wrote:
> Hi Guys,
>
> Debugging further shows that with "sleep" the response time and bytes
> recieved are proper but when "sleep" is removed the time and recieved
> bytes are "zero". Also, without "sleep" navigation to multiple pages
> is very fast (script will not wait until page is laoded).
>
> Script with sleep:
> ---------------------
> plugin.Clear()
> plugin.Log.EnableFilter(false)
> plugin.Record()
> ie.div(:id, "configure_access_left").fireEvent("onmouseup")   <<<1st
> page
> sleep 10          <<<
> ie.div(:id, "configure_nat_left").fireEvent("onmouseup")  <<<2nd page
> sleep 10          <<<
> plugin.Stop()
> if plugin.Log.Pages.Count != 0
>         page1= plugin.Log.Pages(0).Entries.Summary
>         printf "Total time to load page (secs):      %.3f\n", page1.Time
>         printf "Number of bytes received on network: %d\n",
> page1.BytesReceived
>
> end
>
> ## output with sleep
>
> Total time to load page (secs):      5.199
> Number of bytes received on network: 427
>
> ##Script without Sleep
> ....
>
> ie.div(:id, "configure_access_left").fireEvent("onmouseup")   <<<1st
> page
> ie.div(:id, "configure_nat_left").fireEvent("onmouseup")  <<<2nd page
> plugin.Stop()
> ....
> #ouptput:
> ---------
> Total time to load page (secs):      0.002
> Number of bytes received on network: 0
>
> Kindly let me know the cause for this behaviour and also better
> solution to use for page to laod before navigation to next page.
>
> On Mar 17, 1:06 am, vin <vinay...@gmail.com> wrote:
>
> > Hi,
>
> > I am using fireevent to click a div (button to navigate to a page) as
> > shown:
> > (ie.div(:id, "configure_access_left").fireEvent("onmouseup")
> > ###
> > irb(main):004:0* b = Watir::Browser.new
> > => #<Watir::IE:0x287a2d0 url="about:blank" title="">
> > irb(main):005:0>
> > irb(main):006:0* b.goto "http://abc-blue";
> > => 1.96875                         <<<<<<<<<<<<shows time
> > irb(main):007:0> b.div(:id,
> > "configure_access_left").fireEvent("onmouseup")
> > =>
> > nil
> > <<<<<<<<<<<<<<< shows as nill
> > irb(main):008:0>
>
> > By using above method, navigate to a required page is achieved but the
> > response shows as "nil" instead of the time. The scenario is server-
> > client and upon navigation to a page client will fetch the data from
> > the server. Here is the snippet captured with firebug:
>
> > POSThttp://abc-blue/jsdm/ajax/access.php200OK 571ms
> > sajax....(line 150)
> > ParamsHeadersPostPutResponseCacheHTMLXML
> > Response Headersview source
> > Date    Thu, 17 Mar 2011 04:57:44 GMT
> > Server  Mbedthis-Appweb/2.4.0
> > Cache-Control   no-store, no-cache, must-revalidate, post-check=0, pre-
> > check=0
> > Content-Type    text/xml; charset=UTF-8
> > Etag    "1368cc-296f-503300"
> > Content-Length  35
> > Connection      keep-alive
> > Keep-Alive      timeout=60, max=95
> > X-Powered-By    PHP/5.3.2
> > Expires Thu, 19 Nov 1981 08:52:00 GMT
> > Pragma  no-cache
> > Request Headersview source
> > Host    srx-blue
> > User-Agent      Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:
> > 1.9.2.12) Gecko/20101026 Firefox/3.6.12 (.NET CLR 3.5.30729)
> > Accept  text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
> > Accept-Language en-us,en;q=0.5
> > Accept-Encoding gzip,deflate
> > Accept-Charset  ISO-8859-1,utf-8;q=0.7,*;q=0.7
> > Keep-Alive      115
> > Connection      keep-alive
> > Method  POST /jsdm/ajax/access.php HTTP/1.1
> > Content-Type    application/x-www-form-urlencoded; charset=UTF-8
> > Refererhttp://abc-blue/login
>
> > Please let me know if i can achieve it from any other method.
>
> > Thanks,
> > Vin

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

Reply via email to