我已经被困在这个问题上很多年了,不知道如何让 Cypress 12.8.1 与 Stripe 元素一起工作来输入信用卡详细信息并创建付款。
我已经在互联网上搜索过,但似乎没有一个解决方案有效。
任何帮助是极大的赞赏。
我努力了:
使用 xpath https://www.browserstack.com/guide/frames-and-iframes-in-cypress这对我来说不起作用。查看错误:https://github.com/cypress-io/cypress/issues/24764#issuecomment-1489438851

尝试过这个插件,但它不再起作用了。/sf/answers/4901746671/ https://github.com/dbalatero/cypress-plugin-stripe-elements
尝试过这个但出现以下错误。
const $body = $element.contents().find('body')
let stripe = cy.wrap($body)
stripe.find('input[name="number"]').click().type('4242424242424242')
stripe = cy.wrap($body)
stripe.find('input[name="expiry"]').click().type('4242')
stripe = cy.wrap($body)
stripe.find('input[name="cvc"]').click().type('424')
})
Run Code Online (Sandbox Code Playgroud)
我的代码位于 support/commands.ts
// ***********************************************
// This example namespace declaration will help
// with Intellisense and code completion in your
// IDE or Text Editor.
// ***********************************************
declare namespace Cypress {
interface Chainable<Subject = any> {
iframeLoaded($iframe: …Run Code Online (Sandbox Code Playgroud)