Compare Element Attribute Value

Описание к видео Compare Element Attribute Value

We can check that both elements either have the same attribute or do not have it.

cy.get('#member')
.invoke('attr', 'active')
.then(Boolean)
.then(cy.log)
.then(function (isActive) {
if (isActive) {
cy.get('#info').should('have.attr', 'active')
} else {
cy.get('#info').should('not.have.attr', 'active')
}
})
Find the full recipe and many more at https://glebbahmutov.com/cypress-exam...

Комментарии

Информация по комментариям в разработке