I'm trying to test in my Rails app the Stripe checkout popup (http://www.stripe.com/checkout).
I was using Capybara + selenium-driver and everything worked well. When the page is loaded, the checkout.js adds an iframe, and I was able to access it
within_frame('stripe_checkout_app') do
do something
end
Now, switching to Poltergeist, I get this error:
Failure/Error: within_frame('stripe_checkout_app') do Capybara::Poltergeist::FrameNotFound: The frame 'stripe_checkout_app' was not found.
and if I inspect the page, there's not iframe. So I think that this script
<script type="text/javascript" src="https://checkout.stripe.com/checkout.js"></script>
is not loaded when I run the test with Poltergeist.
Update
I tried to run the test with Capybara-webkit, with same result.
Failure/Error: Capybara.within_frame('stripe_checkout_app') do
Capybara::Webkit::InvalidResponseError:
Unable to locate frame.
I also tried to wait for half a minute! with
sleep 30
These are my webmock settings:
RSpec.configure { |config|
WebMock.disable_net_connect!(allow_localhost: true)
}
Update 2:
'stripe_checkout_app' is the name of the iframe.
<iframe frameborder="0" allowtransparency="true" src="https://checkout.stripe.com/v3" name="stripe_checkout_app" class="stripe_checkout_app" style="z-index: 9999; display: none; background-color: transparent; border: 0px none transparent; overflow-x: hidden; overflow-y: auto; visibility: visible; margin: 0px; padding: 0px; -webkit-tap-highlight-color: transparent; position: fixed; left: 0px; top: 0px; width: 100%; height: 100%;"></iframe>
undefined method 'window_handles' for #<Capybara::Poltergeist::Driver:0x007fa09adde108>
- any ideas? Thanks! – Dramamine