Yeah, but let's say you have some complex JS app, where DOM tree is being 
constantly regenerating. Let's say user types "Test" in search text field and 
autocomplete starts fetching results from server using Ajax. Then it starts 
appending results to autocomplete popup asynchronously, so there is delay 
between the first and the last are shown. Using `when_present`, you'll need to 
somehow find the last element (and `index: -1` won't work because it becomes 
stale in a second). However, if we attach handler to `DOMSubtreeModifier` event 
to parent element, we'll be able to proceed at the point subtree is finished 
modifying, i.e. all results are placed in DOM.

Once again, take a look at this [great art.sy 
blogpost](http://artsy.github.io/blog/2012/02/03/reliably-testing-asynchronous-ui-w-slash-rspec-and-capybara/)
 explaining why they did pretty much the same.

---
Reply to this email directly or view it on GitHub:
https://github.com/watir/watir-webdriver/issues/193#issuecomment-18412735
_______________________________________________
Wtr-development mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-development

Reply via email to