url - 在 Cypress 的 `route` 函数中获取匹配的 URL
问题描述
在route
我们可以指定regex
orminimatch
字符串来捕获任何匹配的 URL 时,我怎样才能完全获取匹配的 URL?
解决方案
您可以像这样从 xhr 获取它:
cy.route('/users/**').as('getPage');
cy.wait("@getPage").then((xhr) => {
url = xhr.url;
console.log('Matched url: ' + url);
});
希望能帮助到你 :)
推荐阅读
- image - 如何将每个 RGB 像素组合成一个超复数?
- ios - React Native - Xcode Simulator 上的 .app 文件要求提供 Bundle URL
- pdf - ghostscript:丢失的pdf原始嵌入字体
- office-js - 示例 - Microsoft 关于通过 Microsoft Commercial Marketplace 将您的 Office 365 加载项货币化
- python - 如何使用 DBSCAN 找到集群成员之间的最大/最小距离?
- session-storage - 如何从会话存储中获取某些值?可能吗?
- matplotlib - X, Y 中的纬度经度图
- google-cloud-dataflow - Dataflow/Apache Beam:如何从@FinishBundle 访问状态?
- entity-framework-6 - 实体框架代码优先迁移:使用 down() 方法恢复迁移不起作用
- c++ - GCC 警告形成偏移 [X1, X2] 超出范围 [0, X3]