I am unable to parse CSRF token from html in Cypress. I am following this link : Logging in using CSRF Token in Cypress
Trying to follow strategy #1 in the above link but I keep getting token as undefined.
This is how my html looks like:
This is how my code looks like:
cy.request({
url: returnUrlFromLoginAPI,
followRedirect: false
})
.its('body')
.then((body) => {
const $html = Cypress.$(body)
const requestVerificationToken = $html.find("input[name=__RequestVerificationToken]").val()
console.log(requestVerificationToken)
})
})