Cypress - Get Attribute value and store in Variable
In Cypress, you can retrieve an attribute value of an element using the .invoke() method. This is helpful when you need to store an attribute value for further use in your test. For instance, you might want to grab the value of a href, id, or src attribute from an element and then perform assertions