这是我的代码:
const getIframeDocument = () => {
return cy
.get('iframe[id="login-iframe"]')
.its('0.contentDocument').should('exist')
}
const getIframeBody = () => {
// get the document
return getIframeDocument()
// automatically retries until body is loaded
.its('body').should('not.be.undefined')
// wraps "body" DOM element to allow
// chaining more Cypress commands, like ".find(...)"
.then(cy.wrap)
}
const username = Cypress.env('username')
const password = Cypress.env('password')
context('Misc', () => {
beforeEach('test', () => {
cy.visit('.........GOUT=&loginChannel=PC')
})
it('test', () => {
getIframeBody().find('.domain-body-input-control-username').should('exist').type(usename)
getIframeBody().find('.domain-body-input-control-userpass').should('exist').type(password)
getIframeBody().find('.domain-body-submit-control-submit').should('exist').click()
cy.wait(5000)
cy.visit('https:/....sale/index.htm#/shop?_k=qf0gj0')
cy.get('.anticon-qrcode').should('exist')
})
})
赛普拉斯可以捕获其他XHR请求,但是赛普拉斯不会捕获最后的XHR请求“ commonSearch”。我不知道为什么?