Reputation: 43
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 ?
Upvotes: 4
Views: 3114
Reputation: 2757
This should work. Swap out 0 for whatever index you need.
cy.url().then(url => {
cy.log(url.split('/')[0])
});
Upvotes: 6