Cypress系列(32)- url() 命令详解
2021-02-04 05:16
阅读:766
标签:enc img html alt options Plan http 文章 ref
如果想从头学起Cypress,可以看下面的系列文章哦
https://www.cnblogs.com/poloyy/category/1768839.html
作用
- 获取页面当前的 url
- 等价于 cy.location(‘href‘)
语法格式
cy.url()
cy.url(options)
options:只有 timeout 和 log,不再展开讲了
正确写法
cy.url()
实际栗子
测试文件代码
测试结果
url() 命令在 console 会输出啥
location(href) 命令在 console 会输出啥
结论
- 可以看到 cy.url() 和 cy.location(‘href‘) 是等价效果的
- 其实还有更多等价的写法,看下面
三种等价的断言方式
测试文件代码
测试结果
结尾
我的博客即将同步至腾讯云+社区,邀请大家一同入驻:https://cloud.tencent.com/developer/support-plan?invite_code=12vd92hxgwgj1
Cypress系列(32)- url() 命令详解
标签:enc img html alt options Plan http 文章 ref
原文地址:https://www.cnblogs.com/poloyy/p/13149710.html
上一篇:JS之闭包的应用
文章来自:搜素材网的编程语言模块,转载请注明文章出处。
文章标题:Cypress系列(32)- url() 命令详解
文章链接:http://soscw.com/index.php/essay/50751.html
文章标题:Cypress系列(32)- url() 命令详解
文章链接:http://soscw.com/index.php/essay/50751.html
评论
亲,登录后才可以留言!