Hazem Alabiad
Hazem Alabiad

Reputation: 1052

Get the matched URL in `route` function in Cypress

In route we can specify the regex or minimatch string to capture any matching URLs', how can I get the matched URL completely?

Upvotes: 0

Views: 236

Answers (1)

gianegf
gianegf

Reputation: 18

You can get it from xhr like this:

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

Hope it helps :)

Upvotes: 1

Related Questions