cypress - 单击由于 md-backdrop 类而隐藏的元素
问题描述
无法点击“ stage1 ”。
CypressError: Timed out retrying: cy.click() failed 因为这个元素:
<img class="add-achievement" src="images/gamification/add-entry-icon.e4f22ffd.png" alt="add stage achievement" ng-click="addStage(achievement.stage)" role="button" tabindex="0">
被另一个元素覆盖:
<md-backdrop class="md-select-backdrop md-click-catcher ng-scope" style="position: fixed;"> </md-backdrop>
修复此问题,或使用 {force: true} 禁用错误检查。
代码:
cy.get('#stage').click({force: true})
cy.get('#select_container_218 > md-select-menu > md-content')
.invoke('show')
.should('not.be.visible')
cy.contains('stage1')
.invoke('show')
.click({force: true})
解决方案
推荐阅读
- search - 如何使用 Ansible 模块替换或内联 shell 命令与 SED
- javascript - 如何统一访问平台角色 2d 的最大速度?
- flutter - 单击凸起按钮时如何在吐司上显示消息?
- glsl - webgl:绘制许多圆圈的最快方法
- jquery - 突出显示具有不同行跨度的备用表行
- angular - Angular: angular-resizable-element library 验证问题
- c# - Google.Cloud.Datastore.V1.DatastoreDb 线程安全吗?
- jquery - 将文本区域值写入目录中的文件:Ajax POST
- sql - 如何在 sqlite 查询中使用最大字符限制返回的行
- scala - 使用 Spark Scala Dataframe 中的现有整数列创建具有整数范围的新列