title: Capybara:Webkit unable to find iframe or its content
body: <p>I allow users to share photos with other individuals.  When the user is viewing a photo and its description, they can click on "share" and a new page loads.  On this page the fill in an email address (and optional comments - not tested here) and click "Share Photo".  The systems sends an email to the recipient with a link contained and the subject line includes the name of the photo.  The page with the Share form also displays a list of individuals the photo has already been shared with. </p>
  
  <p>The full page load is a source of complaints from users.  They want a modal window to quickly load and minimize navigation.  I agree.</p>
  
  <p>I use <a href="http://www.shadowbox-js.com/" rel="noreferrer">shadowbox.js</a> to load the Share page into an iframe in a modal window.  It works well and allows a nice fallback to the old page if needed.</p>
  
  <p>But - I just can't get my tests to pass.  In particular, Capybara:Webkit just can't find the iframe.  </p>
  
  <p>The environment is:
    Rail 3.0.9
    capybara 0.4.1.2
    capybara-webkit 0.5.0
    cucumber 1.0.2</p>
  
  <p>The Cucumber story:</p>
  
  <pre><code>Feature: Share photo
  
  @javascript
  Scenario: User shares photo
    When I follow "Share"
    Then I should see "Share Old Man Photo" inside "#sb-player"
    And I should see information about who I've shared this photo with
    When I fill in "Share with" with "joe@example.com"
    And I press "Share Photo"
    Then "joe@example.com" should receive an email with subject "Old Man photo has been shared with you"
  </code></pre>
  
  <p>My step:</p>
  
  <pre><code>Then %r{^I should see "([^"]*)" inside ([^"].*)$} do |expected_text, named_element|
    selector = element_for(named_element)
    within_frame selector do
      page.should have_content(expected_text)
    end
  end
  </code></pre>
  
  <p>The Fail Message:</p>
  
  <pre><code>(::) failed steps (::)
  
  Unable to locate frame.  (Capybara::Driver::Webkit::WebkitError)
  ./features/step_definitions/sharing_steps.rb:94:in `/^I should see "([^"]*)" inside "([^"]*)"$/'
  features/user_shares_photo.feature:21:in `Then I should see "Share Old Man Photo" inside "#sb-player"'
  
  Failing Scenarios:
  cucumber features/user_shares_photo.feature:19 
  </code></pre>
  
  <p>I've tried every combination of element ids.  I just can't get Capybara:Webkit to recognize the iframe.  </p>
  
  <p>Any ideas or solutions?  I can't deliver with failing test and am considering pitching the whole iframe approach - but I'd like to find a solution.</p>
  
  <p>Thanks</p>