告诉 Capybara 等待 iframe 加载(准备就绪)
有没有一种优雅的方法来做到这一点?目前我只使用自定义步骤 “等待 10 秒”可以绝对确定,有足够的时间让 iframe 做好准备。我不希望此功能因小网络问题或 CPU 峰值而在功能不足的 CI 虚拟机上失败。但这意味着功能套件会浪费大量时间,而且如您所知,如果测试套件需要很长时间,人们通常不会费心在 CI 服务器之外运行它。
Is there an elegant way to do this? At the moment i just use a custom step
"And wait 10 seconds" to be absolutely sure, there is enough time for the iframe to get ready. I don't want this feature to fail on my underpowered CI VM because of a small network issue or cpu spikes. But this means that the feature suite wastes a lot of time, and as you know, if the test suite takes a long time, one often doesn't bother to run it outside the CI server.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您知道 iframe 中将包含什么内容,您可以执行以下操作:
wait_until
方法将持续等待 10 秒,或者直到条件page.should
返回 true。If you know what's going to be in your iframe you could do:
The
wait_until
method will keep waiting for 10 seconds or until the conditionpage.should
returns true.