title: ReferenceError: Can't find variable: jQuery with Poltergeist/Capybara
body: <h2>What I'm trying to Do</h2>
  
  <p>I'm trying to use capybara with poltergeist to log into amazon at this URL...</p>
  
  <pre><code>https://developer.amazon.com/rp/sales.html
  </code></pre>
  
  <p>Simple enough, except that when I try to submit the form, I get the error...
      ReferenceError: Can't find variable: jQuery ...</p>
  
  <p>However, the source for jQuery is on the page and should have been loaded.</p>
  
  <p>The code I'm using to log in is this...</p>
  
  <pre><code>  visit "https://developer.amazon.com/rp/sales.html"
    fill_in('ap_email', with: user)
    fill_in('ap_password', with: password)
    click_on('signInSubmit-input')
  </code></pre>
  
  <p>Submit triggers a javascript call to validate input. This uses jQuery and when it does, the error is thrown.</p>
  
  <h2>What I Expected</h2>
  
  <p>I expected that when I visited the login page, that jquery would have been loaded with the other javascript on that page.</p>
  
  <p>I have no idea why jQuery would not be loaded at this point.  Phantomjs would have loaded the page and loaded the jQuery referenced on the page, no?</p>
  
  <h2>Things I've Tried</h2>
  
  <p><strong>Timing Issue?</strong>
   - Added sleep after the visit.</p>
  
  <p><strong>Configuration Issue?</strong></p>
  
  <ul>
  <li><p>My Current Configuration    </p>
  
  <pre><code>include Capybara::DSL
  Capybara.default_driver = :poltergeist
  Capybara.register_driver :poltergeist do |app|
      Capybara::Poltergeist::Driver.new(app, phantomjs: Phantomjs.path)
  end
  Capybara.ignore_hidden_elements = false
  </code></pre></li>
  <li><p>Attempting to Force jQuery to Load</p>
  
  <pre><code>Capybara::Poltergeist::Driver.new(app,
                                phantomjs: Phantomjs.path,
                                extensions: ["handlers/jquery.js"])
  </code></pre></li>
  </ul>
  
  <p>I've tried quite a few things in an attempt to get my head around what's going on but I'm coming up empty. </p>
  
  <p>Any thoughts on where I might look or what may be going on would be greatly appreciated.</p>