web页面上的导航功能,上一页,下一页,重新加载页面,直接访问页面。

cy.go()

使用浏览器的缓存功能,访问上一页,下一页

cy.location('pathname').should('include', 'navigation')

cy.go('back')
cy.location('pathname').should('not.include', 'navigation')

cy.go('forward')
cy.location('pathname').should('include', 'navigation')

// clicking back
cy.go(-1)
cy.location('pathname').should('not.include', 'navigation')

// clicking forward
cy.go(1)
cy.location('pathname').should('include', 'navigation')

cy.reload()

不使用检测,重新加载页面

cy.reload()

// reload the page without using the cache
cy.reload(true)

cy.visit()

直接通过 url 地址访问页面

cy.visit('https://example.cypress.io/commands/navigation', {
  timeout: 50000, // increase total time for the visit to resolve
  onBeforeLoad: function(contentWindow){
    // contentWindow is the remote page's window object
  },
  onLoad: function(contentWindow){
    // contentWindow is the remote page's window object
  }
})

相关文章:

  • 2021-11-13
  • 2021-09-08
  • 2021-12-01
  • 2021-05-07
  • 2021-07-14
  • 2022-02-02
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-29
  • 2022-12-23
  • 2021-10-31
  • 2021-11-03
  • 2021-08-13
  • 2021-12-03
  • 2022-02-08
相关资源
相似解决方案