我试着用下面的代码定位输入域,但一直收到未定义的错误.在我看来,这是一个框架集相互嵌套的传统网站,这使得使用Cypress在用户名字段中输入或键入变得更加复杂.
import 'cypress-iframe'
describe('Suite Name', () => {
Cypress.on('uncaught:exception', (err, runnable) => {
// returning false here prevents Cypress from
// failing the test
return false
})
it.only('FrameSetExample', () => {
cy.visit("https://epay.dallascityhall.com/bdisu/public/frameset_top_html.jsp")
cy.get("html > frameset > frame:nth-child(2)").then(($ele) => {
var ifele = $ele.contents().find("#logonuidfield")
cy.wrap(ifele).type("sample username")
})
})
})
当我try 使用下面的方法"Frame Load"时,它会打开网页,并成功检测到框架,所以要try 其他什么才能让它正常工作.
it.only('FrameSetExample', () => {
cy.visit("https://epay.dallascityhall.com/bdisu/public/frameset_top_html.jsp")
cy.frameLoaded("html > frameset > frame:nth-child(2)")
})