Im generating ids and then using id to cy.visit them , I wanna assert the generated id using cy.url().split('/') but I can not , Split works only for strings and cy.url() returns Chainable<string> , any other ways to do that ?
This should work. Swap out 0 for whatever index you need.
cy.url().then(url => {
cy.log(url.split('/')[0])
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With