如何减慢水豚的速度?

How to slow down Capybara?

我对 Capybara 和 Stripe 有任何疑问。 我写了一些测试来检查输入的卡号。有时我的测试失败了。

当我用chromedriver 看他的时候- 我知道,水豚输入卡号的速度非常快。有时它会产生错误。

例如 - 我经常使用号码 4242 4242 4242 4242 - Visa 的测试卡。有时水豚输入4242为2442、2244或4224。当然,测试失败了。

你能帮帮我吗?我不知道如何解决这个问题。也许,我在文档中遗漏了什么?

更新。 当然可以。

stripe_iframe = all("iframe[name=__privateStripeFrame4]").last
Capybara.within_frame stripe_iframe do
  fill_in "cardnumber", with: "4242424242424242"
  fill_in "exp-date", with: "1222"
  fill_in "cvc", with: "123"
  fill_in "postal", with: postal if postal
end
click_button "Start your free trial"

我通过一位一位地发送卡号数字解决了同样的问题。

card_number = '4242424242424242'
card_number.chars.each do |digit|
  find_field('cardnumber').send_keys(digit)
end