[Wtr-development] [JIRA] Commented: (WTR-166) Document how to use the add_checker method to add custom wait logic to Watir

Jeff Fry (JIRA) watirjira at gmail.com
Mon Oct 4 15:46:31 EDT 2010


    [ http://jira.openqa.org/browse/WTR-166?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=19896#action_19896 ] 

Jeff Fry commented on WTR-166:
------------------------------

Jarmo, in situations where what you're waiting for on each page is a different condition, that's the right choice...but there's another way to go, and that's what this was filed to handle.

If an application chooses to expose whether or not there's an XHR or timer running, as a testability feature, it's at least theoretically possible to just have Wait() Do The Right Thing. Doing this can make automation much simpler.

We've done this for Freebase.com. For an example, 
* go to http://www.sandbox-freebase.com/view/book/book
* open up firebug (FF) or Dev Tools (Chrome), and note the <body> tag
* start typing in one of the filter fields, e.g. type 'testing' into 'Filter by Name'
* note that there's now an 'ajax' attribute <body>. When an XHR or timer kicks off on the page, we set <body ajax='ajaxStart'>. When it completes, if this was the last ajax process running on the page, we set <body ajax='ajaxStop'>. This allows me to check for *one* condition, rather than guessing what are all the asych things that could be happening on the page.

Bret, if you've got a way to do this today, I think it's *absolutely* worth documenting it. I'm not using Watir for work currently, but would be happy to test the change on Freebase.


> Document how to use the add_checker method to add custom wait logic to Watir
> ----------------------------------------------------------------------------
>
>                 Key: WTR-166
>                 URL: http://jira.openqa.org/browse/WTR-166
>             Project: Watir
>          Issue Type: New Feature
>          Components: Wait
>    Affects Versions: 1.5.0/1.5.1
>         Environment: x
>            Reporter: Jeff Fry
>            Assignee: Bret Pettichord
>            Priority: Major
>             Fix For: Next
>
>
> Watir.wait() listens to whether IE thinks its done loading, and then checks to see that the main document and any sub documents/frames have finished loading. More and more, there are pages that on load also kick off various XHRs and timers. For me - and possibly for a growing number of folks, testing more AJAXy applications - it would be great to expand wait() to check if there are any XHRs or timers pending, in additional to the checks it currently makes. 
> Note, I don't know, but there may be applications where an XHR is intentionally left open at all times. If this happens I would guess that it's rare, but if we change the default behavior of watir.wait() to wait for pending XHRs and timers, we might want to give a config option that turns this off as well.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.openqa.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the Wtr-development mailing list