title: How to add wait condition in capybara scenarios?
body: <p>I am using capybara for testing my rails application for integration testing.
  In my application there are many Lightbox and Ajax and js calls.</p>
  
  <pre><code> @javascript   
    Scenario: I agree functionatilty
     Given I go to the create account page
     When I click on button which is given as image "lnkTerms2"
     And I follow "i_agree"
     Then I go to the create account page
  </code></pre>
  
  <p>Here in above code lnkTerms2 is and id which will help in calling js function to open a lightbox.
  And i am getting an error as </p>
  
  <pre><code>   Element is not currently visible and so may not be interacted with (Selenium::WebDriver::Error::ElementNotDisplayedError)
        [remote server] resource://fxdriver/modules/atoms.js:9519:in `unknown'
        [remote server] file:///tmp/webdriver-profile20111117-6876-18cfcfp/extensions/fxdriver@googlecode.com/components/nsCommandProcessor.js:256:in `unknown'
        [remote server] file:///tmp/webdriver-profile20111117-6876-18cfcfp/extensions/fxdriver@googlecode.com/components/nsCommandProcessor.js:305:in `unknown'
        [remote server] file:///tmp/webdriver-profile20111117-6876-18cfcfp/extensions/fxdriver@googlecode.com/components/nsCommandProcessor.js:320:in `unknown'
        [remote server] file:///tmp/webdriver-profile20111117-6876-18cfcfp/extensions/fxdriver@googlecode.com/components/nsCommandProcessor.js:197:in `unknown'
        (eval):2:in `send'
        (eval):2:in `click_link'
        ./features/step_definitions/web_steps.rb:300:in `/^I click on button which is given as image "([^"]*)"$/'
        features/Sign_up_process.feature:61:in `When I click on button which is given as image "lnkTerms2"'
  </code></pre>
  
  <p>The problem is as this function called in webdriver, it is not getting time to load javascript and ajax calls.
  And lightbox is not opening.
  So Please suggest me any solution.</p>
  
  <p>Also if suppose i write the line </p>
  
  <pre><code>When I click on button which is given as image "lnkTerms2"
  </code></pre>
  
  <p>after 4 to 5 statements then it is working fine as it gets time to load js.</p>