Forked from iloveitaly/capybara_fill_stripe_elements.rb
Created
March 4, 2025 04:12
-
-
Save theprogramsam/51e9ce4b65f66d6b2f1bf55369f70dee to your computer and use it in GitHub Desktop.
Fill in a Stripe Elements (https://stripe.com/docs/elements) credit card field using capybara
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fill_stripe_elements(card) | |
using_wait_time(15) { within_frame('stripeField_card_element0') do | |
card.to_s.chars.each do |piece| | |
find_field('cardnumber').send_keys(piece) | |
end | |
find_field('exp-date').send_keys("0122") | |
find_field('cvc').send_keys '123' | |
find_field('postal').send_keys '19335' | |
end } | |
end | |
fill_stripe_elements(4242424242424242) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment