我想在Cypress中获取/标识隐藏的iframe元素,并在其中编写一些内容,比如文本。
<div class="tox-edit-area">
<iframe id="tiny-react_36495184831607144646798_ifr" frameborder="0"
allowtransparency="true" title="Rich Text Area. Press ALT-0 for
help." class="tox-edit-area__iframe" __idm_frm__="1483"
__idm_id__="362838018">
</iframe>
</div>
发布于 2020-12-05 14:19:15
1.转到cypress/support/command.js并编写:
Cypress.Commands.add('getIframe', (iframe) => {
return cy.get(iframe)
.its('0.contentDocument.body')
.should('be.visible')
.then(cy.wrap);
})2.在测试中写:
cy.getIframe('.tox-edit-area__iframe').clear().type('Demo Text')https://stackoverflow.com/questions/65136585
复制相似问题