Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save manzhikov/1dab455c594d85f56abb0782e0b954d2 to your computer and use it in GitHub Desktop.
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
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