title: Rails Phantomjs, poltergeist, and Capybara not playing well together
body: <p>Working in a rails 3.1.2 project (mac OS X), I have PhantomJS properly installed (I can run code like the following and it works <em>perfectly</em>, accurately grabbing the title of the page and saving an accurate screenshot)</p>
  
  <p><strong>try_phantom.coffee</strong></p>
  
  <pre><code>page = require('webpage').create()
  page.open 'http://localhost:5000/parties/onetestparty', (status) -&gt;
      title = page.evaluate -&gt; document.title
      console.log "Title: #{title}"
      page.render './log/javascript_screenshot.png'
      phantom.exit()
  </code></pre>
  
  <p>However, when I attempt to use capybara/poltergeist in rspec as follows:</p>
  
  <p><strong>spec_helper.rb</strong></p>
  
  <pre><code>require 'capybara/poltergeist'
  Capybara.javascript_driver = :poltergeist
  </code></pre>
  
  <p>and then using a spec with a call requiring javascript:</p>
  
  <p><strong>parties_spec.rb</strong></p>
  
  <pre><code>        it "should allow a simple screenshot", js: true do
              visit "/"
              page.driver.render('./log/screen_Home.png', :full =&gt; true)
          end
  </code></pre>
  
  <p>It doesn't appear that my javascript is being rendered, and also the screenshot is <strong>always</strong> blank!</p>
  
  <p>I've tried the debugger, but that seems to also bring up a blank HTML page (just html with empty head and body tags)</p>
  
  <p>I'm pretty sure the problem is either the interface between capybara and poltergeist or (more likely) poltergeist and phantomjs.  Here are the versions of the relevant gems:</p>
  
  <blockquote>
    <p>capybara 1.1.3<br>
    capybara-webkit 0.13.0<br>
    poltergeist 1.0.2<br>
    phantomjs is 1.7.0</p>
  </blockquote>
  
  <p>Not sure how to troubleshoot further... Any help would be appreciated.</p>