yewido
0
Q:

cypress have attribute

cy.get('selector')
	.should('have.attr', 'aria-checked', 'true')
2
cy
  .get('nav')                          // yields <nav>
  .should('be.visible')                // yields <nav>
  .should('have.css', 'font-family')   // yields 'sans-serif'
  .and('match', /serif/)               // yields 'sans-serif'
1
cy.get('input').invoke('attr', 'placeholder').should('contain', 'username')
0
// have.attr comes from chai-jquery
cy.get('#header a').should('have.attr', 'href', '/users')
0

New to Communities?

Join the community