【问题标题】:Get the matched URL in `route` function in Cypress在 Cypress 的 `route` 函数中获取匹配的 URL
【发布时间】:2019-09-02 12:02:02
【问题描述】:

route中我们可以指定regexminimatch字符串来捕获任何匹配的URL,我怎样才能完全得到匹配的URL?

【问题讨论】:

    标签: url routes cypress


    【解决方案1】:

    你可以像这样从 xhr 获取它:

        cy.route('/users/**').as('getPage');
        cy.wait("@getPage").then((xhr) => {
          url = xhr.url;
          console.log('Matched url: ' + url);
        });
    

    希望对你有帮助:)

    【讨论】:

      猜你喜欢
      • 2016-11-24
      • 1970-01-01
      • 2015-01-14
      • 1970-01-01
      • 2021-01-26
      • 2019-12-25
      • 2019-01-20
      • 2021-09-19
      • 1970-01-01
      相关资源
      最近更新 更多