I have any problem with Capybara and Stripe. I write some test to check entering card numbers. Sometimes I have a broken test.
When I use chromedriver and look at him - I see, that capybara entered the card numbers very fast. And sometimes it creates errors.
For example - I often use number 4242 4242 4242 4242 - test card from Visa. Sometimes Capybara entered 4242 as 2442, 2244 or 4224. Of course, the test had broken.
Can you help me? I don't know how to resolve this problem. Maybe, I missed something in the documentation?
Update. Yes of course.
stripe_iframe = all("iframe[name=__privateStripeFrame4]").last
Capybara.within_frame stripe_iframe do
fill_in "cardnumber", with: "4242424242424242"
fill_in "exp-date", with: "1222"
fill_in "cvc", with: "123"
fill_in "postal", with: postal if postal
end
click_button "Start your free trial"
I solved same issue by sending card number digits one by one.
card_number = '4242424242424242'
card_number.chars.each do |digit|
find_field('cardnumber').send_keys(digit)
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With