水豚无法填充Stripe Checkout.js字段 [英] Capybara cannot fill Stripe Checkout.js fields

查看:56
本文介绍了水豚无法填充Stripe Checkout.js字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很难在Capybara上测试Stripe的Checkout.js产品。问题是,Stripe具有一些棘手的客户端验证,使愚弄Capybara的javascript驱动程序,因此当我告诉Capybara填写字段时,像这样:

c $ c> fill_in card_number,其中: 4242424242424242

条带字段仅填充前三位数字,然后它会在这些数字后自动放置一个空格,这会严重破坏水豚。



我该如何解决?

解决方案

我没有确切知道,但是当我进入这些情况时,我考虑直接放入浏览器的javascript中,例如(在这种情况下,假设存在jquery)

  page.execute_script(%Q {$('input#itsId')。val('424242424242424242');})


I am having a difficult time testing Stripe's Checkout.js product with Capybara. The problem is Stripe has some tricky client side validation that fools Capybara's javascript driver, so when I tell Capybara to fill in a field, like this:

fill_in "card_number", with: "4242424242424242"

Stripe field only fills up oly the first three digits then it automatically puts a space after those digits, and that breaks Capybara badly.

How can I fix this?

解决方案

I don't know exactly but when i get into these situations i consider dropping directly into the browsers javascript, such as (in this case assuming jquery is present)

page.execute_script(%Q{ $('input#itsId').val('424242424242424242'); })

这篇关于水豚无法填充Stripe Checkout.js字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆