title: Timeout::Error in Rails application using Watir
body: <p>I am using Watir to browse pages and take screenshots of some pages in my application.</p>
  
  <p>However, getting a page from my server takes a while, and I get Timeout::Error.</p>
  
  <p>To fix this, I used a wait in my Watir browser instance, to check to see if a div with id 'content' exists, and to make it wait until it exists. However, it takes some time, and the page is loaded in the Watir browser. But after it is loaded, I get the <strong>Timeout::Error</strong> in my main browser window.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>@pages = Pages.all
  browser = Watir::Browser.new
  @pages.each do |page|
    page_url = app_root_url + 'pages/' + page.id.to_s
    browser.goto page_url
    Watir::Waiter::wait_until { browser.div(:id, 'content').exists? }
    file_save_path = pages_screenshot_path.to_s + page.id.to_s + '.png'
    browser.driver.save_screenshot(file_save_path)
  end
  browser.close
  </code></pre>
  
  <p>Each page contains a div with id 'content'. Still, it's not waiting I guess.</p>