Where to block for asynchronous calls

15 views
Skip to first unread message

Danny Leblond

unread,
Aug 5, 2009, 9:52:08 AM8/5/09
to webdriver
Hey all,
I've been debating heavily on the best location to block while waiting
for an Ajax call to complete returning new elements. For context, I
have a modal box that loads a standard 'empty' box then the Ajax call
fills in the required elements depending on the requirements of the
specific modal. My question is should I block on the 'modalOpen'
command waiting for a final element to appear (or what I expect to be
the final element), which means the modalOpen would have to have some
knowledge of whats expected to be loaded, or should I block on the
actions within the the modal (so if I'm typing in three boxes each
element would poll the ui exponentially until the element is found or
timesout).

Is one of these two options generally accepted or used more then the
other? Are there any negatives to either which I may be overlooking?

Thanks in advance,
Danny

Rick Mugridge

unread,
Aug 17, 2009, 2:31:48 AM8/17/09
to webd...@googlegroups.com
Hi Danny,

In such a case, I've polled in turn for each element to arise and updated it. The polling code is very simple and general purpose and it worked fine for me. That way, I'd not need to wait longer than necessary and I'd be sure the element was there when I acted on it (such as adding text).

Cheers, Rick

Danny Leblond

unread,
Aug 17, 2009, 9:34:24 AM8/17/09
to webd...@googlegroups.com
Thanks, I figured this was the best location just wanted to confirm. :)
Danny
Reply all
Reply to author
Forward
0 new messages