title: Auto scroll a button into view with Capybara and Selenium
body: <p>Sometime last month (June 2013), several of our Capybara tests started failing mainly because the buttons they are trying to click are not in view. Ideally, I'd like to figure out what changed. We're currently on selenium-webdriver 2.33 but I've tried going back to 2.29 and it still doesn't work. We're running against Firefox only at the moment and maybe it's due to a newer version of Firefox.</p>
  
  <p>Barring that, I can't figure out how to scroll the buttons into view. From what I gather, I can use scrollIntoView but not sure how to call it in the Capybara step. I tried variations on:</p>
  
  <pre><code> Capybara.current_session.driver.execute_script("arguments[0].scrollIntoView(true;)", find_button(button).native)
  </code></pre>
  
  <p>But with no luck because find_button itself doesn't work.</p>
  
  <p>Note: we are selecting based on the button's text. Selecting based on ID is possible but will require a lot of changes to our UI tests so we'd like to avoid it.</p>