【发布时间】:2022-11-19 03:40:58
【问题描述】:
单击我的应用程序中的图像后,将打开一个具有不同域 URL 的新选项卡,但出现以下错误
代码 -
cy.window().then((win) => {
cy.spy(win, 'open').as('@redirect')
});
cy.get('webElement').click();
cy.get('@redirect').should('be.called')
Note:
1. webElement clicked is 'img' not anchor and it does not have any 'href' and 'target' attribute.
2. Same code is working fine when new tab url is of same domain.
【问题讨论】:
标签: cypress cypress-custom-commands