【发布时间】:2021-09-09 00:56:09
【问题描述】:
为什么 cypress 在 for 循环中只循环一次?
测试代码是这样的:
cy.get('body').contains('Automation').each(($el, index) => {
cy.get('body').contains('Automation').parents()
.eq(1)
.find('mfc-dropdown > div > mfc-button > button', { timeout: 6000 })
.first()
.click({ force: true });
cy.get(this.DELETE_FILE_BUTTON).click();
cy.get('.mfc-dialog-container')
.find(this.CONFIRM_DELETE)
.click({ force: true });
});
【问题讨论】:
-
你需要正确格式化你的代码
-
您的网页中有多少带有
Automation文字的元素?
标签: typescript for-loop automation cypress