Test Stripe.js Elements with Capybara

To access and test Stripe.js Element objects with Capybara, try the following:

card_frame = page.evaluate_script("$(\"iframe[src*='fieldName']\").attr(\"name\")")
within_frame card_frame do
  find(".InputElement").set("value")
end

Where fieldName is the name of the Stripe.js Element, for example ‘cardNumber’, and the value is whatever you would like to set the field value to (e.g. 4242 4242 4242 4242)

Note, you may need to wait for the Stripe elements to load, depending on your implementation.

ABOUT THE AUTHOR

Anthony Leon

Author has no description.

NO COMMENTS

Leave a comment

Your email is never published or shared.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>