在我的应用程序中,我需要创建一个表单,然后激活该表单,只有在激活表单后,我才会得到新的表单动态'url',它有一个属性rel=“external”。由于url是在外部选项卡/链接中打开的,因此如何删除该属性并在Cypress限制内访问url。下面的代码不起作用,
注:
<div id="main">
<div id="mainid">
<p>Live Action:
<a href="https://sometestsite.com/form/et24yetwefff rel="external"></a>
</p>
</div>
</div>
cy.wait(2000)
Cypress.$('#main-inner > p > a').removeAttr("rel")
cy.get('p > a').last()
.should('have.attr', 'href')
.then((href) => {
console.log(href);
cy.visit(href)
cy.wait(2000)
........// test continues type values in text field and submit the form
})