vendredi 1 février 2019

Catch URL after click with Cypress

I would like to know how to capture and read the URL after a click on a link.

On the click event our javascript does some string manipulation of the actual <a href> and then a window.location.href = newURL, so the original href is not necessarily the location you get to after the click.

Here is how I started:

describe("Twitter", function() {

  it("Should assert that via value is set correctly in JS", function() {

    cy.server();
    cy.visit(Cypress.config("appUrl") + "/probes/sha/sha-via.html");
    cy.get("#v_test ul.share li a")
      .click();

  });

});

Aucun commentaire:

Enregistrer un commentaire