Forked from iloveitaly/capybara_fill_stripe_elements.rb
Last active
August 26, 2019 21:55
-
-
Save manzhikov/1dab455c594d85f56abb0782e0b954d2 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 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: '4242424242424242', expiry: '1234', cvc: '123', postal: '12345') | |
using_wait_time(10) { | |
frame = find('#card-element > div > iframe') | |
within_frame(frame) do | |
card.to_s.chars.each do |piece| | |
find_field('cardnumber').send_keys(piece) | |
end | |
find_field('exp-date').send_keys expiry | |
find_field('cvc').send_keys cvc | |
find_field('postal').send_keys postal | |
end } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment