这些是条纹元素:https://stripe.com/docs/stripe-js/elements/quickstart。
我想使用Splinter对其进行测试,但是在保留字符顺序的同时无法填写输入。
答案 0 :(得分:0)
def fill_in_stripe_input(browser, iframe_name, input_name, value):
# every Stripe Element is in a separate iframe
with browser.get_iframe(iframe_name) as iframe:
# get the internal Selenium element.
selenium_input = iframe.find_by_css('input[name=' + input_name + ']').first._element
# just send_keys('424242...') doesn't work, because order of characters may get mixed up
for character in value:
selenium_input.send_keys(character)
from splinter import Browser
browser = Browser('chrome', executable_path='/usr/local/bin/chromedriver')
fill_in_stripe_input(browser, iframe_name='__privateStripeFrame3', input_name='cardnumber', value='4242424242424242')
fill_in_stripe_input(browser, iframe_name='__privateStripeFrame4', input_name='exp-date', value='0320')
fill_in_stripe_input(browser, iframe_name='__privateStripeFrame5', input_name='cvc', value='999')