小编Ran*_*an 的帖子

cypress - 单击 iframe 元素,几秒钟后 iframe 的主体发生变化

cy.getIframeBody().find('#some-button')我在使用#some-button 元素尚不可用时遇到问题,因为 iframe 仍在加载,但 body 元素不为空,因此触发了 .find() 。

这是获取 iframe 主体的自定义命令

Cypress.Commands.add('getIframeBody', ()=> {
    return cy.get('iframe.cy-external-link-container')
        .its('0.contentDocument.body')
        .should('not.empty')
        .then(cy.wrap)
});
Run Code Online (Sandbox Code Playgroud)

我怎样才能在不使用的情况下做到这一点cy.wait()

iframe cypress

6
推荐指数
1
解决办法
1966
查看次数

标签 统计

cypress ×1

iframe ×1