首页 > 其他 > 详细

Cypress学习10-Navigation 导航功能(go,reload,visit)

时间:2020-05-12 17:26:09      阅读:44      评论:0      收藏:0      [点我收藏+]

前言

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
  }
})

Cypress学习10-Navigation 导航功能(go,reload,visit)

原文:https://www.cnblogs.com/yoyoketang/p/12877370.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!