Created
July 9, 2012 21:35
-
-
Save drewB/3079141 to your computer and use it in GitHub Desktop.
helper for waiting that all dom manipulation had completed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#will wait until all dom elements are rendered | |
def wait_for_dom(timeout = Capybara.default_wait_time) | |
uuid = SecureRandom.uuid | |
page.find(:xpath, "//body") | |
page.evaluate_script <<-EOS | |
_.defer(function() { | |
$('body').append("<div id='#{uuid}'></div>"); | |
}); | |
EOS | |
wait_until(timeout) {page.find(:xpath, "//div[@id='#{uuid}']")} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment