https://cypress.io logo
Does any one know how to handle redirect, when lin...
# i-need-help
k
I have a button element that I interact with and it opens another page. That page link though is not exactly the same every time, since generated UUID is passed as one of the URL parameters. Is there a way to handle this?
Also, I need to continue testing on that newly opened tab.
e
You won't be able to test on the new tab. If the element contains the URL you could just query for that and then just
cy.visit
. If it's not within the same domain you'll have to use
cy.origin
as well. Another way may just be to remove the attribute to open in new tab to force it to open in the same page, as described here: https://javascript.plainenglish.io/how-to-handle-new-tabs-in-cypress-fe768d13f357
6 Views