我在IOS设备和测试咖啡馆上使用typeText时遇到一些问题。相同的脚本适用于台式机浏览器,Android浏览器,但不适用于IOS。我曾尝试在Browserstack Automate上托管真实设备,并尝试将整洁的testcafe函数--qr-code放在我手中的设备上。行为相同。添加文本的代码没有任何错误。当以下元素应该可见时,我得到了错误。
我之前也尝试过使用WebDriver(用Java编码),但是在sendKeys()中遇到了相同的问题
我很确定IOS和Safari需要一些特殊的处理,但是我无法确定需要什么。
我的代码是这样的:
async payWithCreditCardSecure(cardNumber, expiryDate, cvc) {
await t
.click(this.creditCardRadioButton)
.switchToIframe(this.creditCardNumberIFrame)
.typeText(this.creditCardNumber, cardNumber, {paste: true, replace: true})
.switchToMainWindow()
.switchToIframe(this.creditCardExpiryDateIFrame)
.typeText(this.creditCardExpiryDate, expiryDate, {paste: true, replace: true})
.switchToMainWindow()
.switchToIframe(this.creditCardCVCIFrame)
.typeText(this.creditCardCVC, cvc, {paste: true, replace: true})
.switchToMainWindow()
.click(this.finishPurchaseCreditCard) **// BUTTON NEVER GETS ACTIVE SINCE NO TEXT IS ADDED**
.typeText(this.creditCardSecureUsername, creditCardCredentials.user) **//HERE IT FAILS**
.typeText(this.creditCardSecurePassword, creditCardCredentials.password)
.click(this.creditCardSecureSubmit)
}
元素看起来像这样:enter image description here
UI看起来像这样:enter image description here
提前感谢。
我已经在Safari中复制了所描述的行为。我在TestCafe存储库中创建了一个问题。请添加以下线程以通知进度:
The typeText action doesn't work in third-party iframe in Safari