我有一个提案提交页面。填写详细信息后,我们必须稍后继续支付功能点击提交按钮后,我们导航到最后一页的 URL,我必须处理该 URL 或页面并下载一个文件。但是在自动化该脚本时我看不到该 URL 页面。我必须通过自动化下载该文件。
我试过这个
cy.get(this.finalSubmit).click()
//After clicking on the above button change the URL to the final page
cy.contains('Download Policy').then(($btn) => {
if ($btn.is(":enabled")) {
cy.wait(5000);
cy.log('button is enabled')
cy.wrap($btn).click() //Button is enabled
} else {
cy.log('Button is disabled');
}
})
我得到的错误是找不到下载策略元素
我期待我会自动下载该政策
“下载政策”按钮可能需要更长的时间才能在页面上显示。您可以使用 cy.wait() 或 cy.get().should() 等待元素可见,然后再尝试与之交互。
cy.get('selector-for-download-policy-button', { timeout: 10000 }).should('be.visible');