【问题标题】:How to click an element that's not visible in Cypress?如何单击赛普拉斯中不可见的元素?
【发布时间】:2021-05-07 19:23:56
【问题描述】:

我在 Cypress 中运行测试时遇到此错误:

Timed out retrying after 10050ms: cy.click() failed because this element is not visible:

我怎么才能点击它呢?它只是一个菜单项,我不需要它对我的测试可见。

【问题讨论】:

    标签: automation cypress


    【解决方案1】:

    您必须添加{force: true},它应该会发生点击:

    cy.get('locator').click({force: true})
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-07-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-12-17
      相关资源
      最近更新 更多