cypress - 使用 Cypress-promise 对我来说,异步等待在循环内部不起作用
问题描述
我收到错误您的回调函数返回了一个从未解决的承诺,我的代码和我是 cypress 3.4.1 版本
```cy.xpath(LOGO).then(async $ele => {
for (const i in $ele) {
if ($ele.eq(i).text() === 'USA') {
$ele.eq(i).click();
cy.wait(5000);
}
const count = await cy.get(COUNT).invoke('text').promisify();
if(count>0) break;
}`enter code here`
});```
解决方案
推荐阅读
- regex - 正则表达式 RE2 匹配所有电子邮件,但一个特定的,我不能使用“?!”
- visual-studio - 我应该将 Visual Studio 调试器附加到哪个进程来调试 Kestrel 应用程序?
- javascript - 显示 API 结果
- flutter - 应用启动,只有白屏,奇怪的流错误信息
- jquery - “System.Web.HttpServerUtility”不包含“JavaScriptStringEncode”的定义
- javascript - 您可以使用 jQuery 处理程序作为 .on() 的选择器吗?
- c# - WPF标签背景png图片透明
- php - 如何在sql数据库中存储包含用户国家的html表单
- c# - 无法从脚手架创建新帐户
- ruby-on-rails - 未选择的值的排列