Skip to content

Instantly share code, notes, and snippets.

@qcam
Created May 20, 2014 02:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qcam/1cb3d12ceb4742270b56 to your computer and use it in GitHub Desktop.
Save qcam/1cb3d12ceb4742270b56 to your computer and use it in GitHub Desktop.
Capybara - Wait for ajax to complete

##Capybara - Wait for ajax to complete

def wait_for_ajax
  Timeout.timeout(Capybara.default_wait_time) do
    loop do
      active = page.evaluate_script('jQuery.active')
      break if active == 0
    end
  end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment